Skip to content

Commit

Permalink
Merge pull request #105 from lsetiawan/gres_doc
Browse files Browse the repository at this point in the history
Improve getResults docstring to follow google documentation
  • Loading branch information
ocefpaf authored Sep 29, 2017
2 parents d98bd5d + 629a352 commit 87512d6
Showing 1 changed file with 37 additions and 19 deletions.
56 changes: 37 additions & 19 deletions odm2api/ODM2/services/readService.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,19 +549,19 @@ def getAffiliations(self, ids=None, personfirst=None, personlast=None, orgcode=N
all Affiliation objects in the database will be returned.
Args:
ids (:obj:`list`, optional): List of AffiliationIDs. Defaults to None.
personfirst (:obj:`str`, optional): Person First Name. Defaults to None.
personlast (:obj:`str`, optional): Person Last Name. Defaults to None.
orgcode (:obj:`str`, optional): Organization Code. Defaults to None.
ids (list, optional): List of AffiliationIDs.
personfirst (str, optional): Person First Name.
personlast (str, optional): Person Last Name.
orgcode (str, optional): Organization Code.
Returns:
list: List of Affiliation objects
Examples:
>>> read.getAffiliations(ids=[39,40])
>>> read.getAffiliations(personfirst='John',
>>> ReadODM2.getAffiliations(ids=[39,40])
>>> ReadODM2.getAffiliations(personfirst='John',
... personlast='Smith')
>>> read.getAffiliations(orgcode='Acme')
>>> ReadODM2.getAffiliations(orgcode='Acme')
"""
q = self._session.query(Affiliations)
Expand All @@ -588,18 +588,36 @@ def getResults(self, ids=None, type=None, uuids=None, actionid=None, simulationi
variableid=None, siteid=None):

# TODO what if user sends in both type and actionid vs just actionid
"""
getResults(self, ids=None, type=None, uuids=None, actionid=None, simulationid=None, sfid=None,
variableid=None, siteid=None)
* Pass nothing - returns a list of all Results objects
* Pass a list of ResultID - returns a single Results object
* Pass a ResultType - returns a list of Result objects of that type. must be from ResultTypeCV
* Pass a list of UUIDs -
* Pass an ActionID - returns a single Results object
* Pass a Sampling Feature ID- returns a list of objects with that Sampling Feature ID
* Pass a Variable ID - returns a list of results with that Variable ID
* Pass a Simulation ID - return a list of results that were generated by that simulation
* Pass a Site ID - return a list of results from that site location, through the related features table.
"""Retrieve a list of Result objects.
If no arguments are passed to the function, or their values are None,
all Result objects in the database will be returned.
Args:
ids (list, optional): List of ResultIDs.
type (str, optional): Type of Result from
`controlled vocabulary name <http://vocabulary.odm2.org/resulttype/>`_.
uuids (list, optional): List of UUIDs string.
actionid (int, optional): ActionID.
simulationid (int, optional): SimulationID.
sfid (int, optional): SamplingFeatureID.
variableid (int, optional): VariableID.
siteid (int, optional): SiteID.
Returns:
list: List of Result objects
Examples:
>>> ReadODM2.getResults(ids=[39,40])
>>> ReadODM2.getResults(type='Time series coverage')
>>> ReadODM2.getResults(sfid=65)
>>> ReadODM2.getResults(uuids=['a6f114f1-5416-4606-ae10-23be32dbc202',
... '5396fdf3-ceb3-46b6-aaf9-454a37278bb4'])
>>> ReadODM2.getResults(simulationid=50)
>>> ReadODM2.getResults(siteid=6)
>>> ReadODM2.getResults(variableid=7)
>>> ReadODM2.getResults(actionid=20)
"""

query = self._session.query(Results)
Expand Down

0 comments on commit 87512d6

Please sign in to comment.