-
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
Conversation
odm2api/ODM2/services/readService.py
Outdated
* 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. |
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!
odm2api/ODM2/services/readService.py
Outdated
Person Last Name | ||
orgcode: str, default None | ||
Organization Code | ||
|
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Should I say:
Retrieve a list of ODM2 Affiliation objects.
Note: If no arguments are passed to the function,
ALL ODM2 Affiliation objects within the database will be queried.
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.
Retrieve a list of Affiliation objects.
If no arguments are passed to the function, or their values are None,
all Affiliation objects in the database will be returned.
odm2api/ODM2/services/readService.py
Outdated
* 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 comment
The reason will be displayed to describe this comment to others. Learn more.
We may need the numpydoc
extension for this. I don't have a strong preference but lately I've stop using numpy-style and adopted the simpler http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
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.
Ah okay!
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.
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?
odm2api/ODM2/services/readService.py
Outdated
>>> read.getAffiliations(personfirst='Anthony', | ||
... personlast='Aufdenkampe') | ||
>>> read.getAffiliations(orgcode='LimnoTech') | ||
|
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.
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'
all Affiliation objects in the database will be returned. | ||
|
||
Args: | ||
ids (:obj:`list`, optional): List of AffiliationIDs. Defaults to None. |
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.
@ocefpaf Is the :obj:
necessary?
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.
It will link to the standard lib docs on that object. Hover over/clock the bool
here and you'll see that in action. But no, we don't really need that.
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.
Looks good.
I'm merging ... |
Overview
This PR improves the docstring for
getAffiliations
to follow the numpy/scipy documentation standard. If you have suggestions of better wordings, please let me know. This relates to #97.