Skip to content
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

Merged
merged 2 commits into from
Sep 27, 2017

Conversation

lsetiawan
Copy link
Member

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.

* 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.
Copy link
Member

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.

Copy link
Member Author

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...

Copy link
Member

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!

Person Last Name
orgcode: str, default None
Organization Code

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

* Pass an OrganizationCode - returns a Affiliation object
Retrieve a list of ODM2 Affiliation objects.

Parameters
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay!

Copy link
Member

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?

>>> read.getAffiliations(personfirst='Anthony',
... personlast='Aufdenkampe')
>>> read.getAffiliations(orgcode='LimnoTech')

Copy link
Member

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.
Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

@emiliom emiliom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@emiliom
Copy link
Member

emiliom commented Sep 27, 2017

I'm merging ...

@emiliom emiliom merged commit 7eb9914 into ODM2:master Sep 27, 2017
@lsetiawan lsetiawan deleted the gaff_doc branch September 29, 2017 15:24
@lsetiawan lsetiawan mentioned this pull request Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants