-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve getAffiliation docstring to follow numpy/scipy documentation #98
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -544,12 +544,30 @@ def getPeople(self, ids=None, firstname=None, lastname=None): | |
|
||
def getAffiliations(self, ids=None, personfirst=None, personlast=None, orgcode=None): | ||
""" | ||
getAffiliations(self, ids=None, personfirst=None, personlast=None, orgcode=None) | ||
* Pass nothing - returns a list of all Affiliation objects | ||
* Pass a list of AffiliationID - returns a single Affiliation object | ||
* Pass a First Name - returns a single Affiliation object | ||
* Pass a Last Name - returns a single Affiliation object | ||
* Pass an OrganizationCode - returns a Affiliation object | ||
Retrieve a list of ODM2 Affiliation objects. | ||
|
||
Parameters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know much about the two styles, so I'll go with whatever @ocefpaf recommends! Can you tell us why you've made the change (pros and cons), offline? Say, on the email thread we started yesterday about documentation? |
||
---------- | ||
ids: list, default None | ||
List of AffiliationIDs | ||
personfirst: str, default None | ||
Person First Name | ||
personlast: str, default None | ||
Person Last Name | ||
orgcode: str, default None | ||
Organization Code | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like if you call the function with no arguments (or None for all / any of them), a list of ALL affiliations will be returned. Tweak the docstring to include that information. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I say:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
Returns | ||
------- | ||
List of Affiliation objects | ||
|
||
Examples | ||
-------- | ||
>>> read.getAffiliations(ids=[39,40]) | ||
>>> read.getAffiliations(personfirst='Anthony', | ||
... personlast='Aufdenkampe') | ||
>>> read.getAffiliations(orgcode='LimnoTech') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change the examples so they don't refer to Anthony's actual identity (first & last name and actual organization)! Use made up names and organization code, eg: John Smith, orgcode='Acme' |
||
""" | ||
q = self._session.query(Affiliations) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the behavior described in the old docstring, I'd change this to: "Retrieve an Affiliation object or a list of such objects." But please confirm whether a request that returns one object, returns a list with one element or the object proper. Adjust the above string as appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous docstring seems to be incorrect, the function always returns a list...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Glad you checked it!
I would just remove "ODM2" from the string. It's obvious that odm2api query methods all return ODM2 objects!