From bbfbd5fff9bc762076f940ea2c42cbc2a8d95f99 Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Wed, 27 Sep 2017 15:33:24 -0700 Subject: [PATCH 1/2] Improve getAffiliation docstring to follow numpy/scipy documentation --- odm2api/ODM2/services/readService.py | 30 ++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index 4cffa89..5b89704 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -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 + ---------- + 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 + + Returns + ------- + List of Affiliation objects + + Examples + -------- + >>> read.getAffiliations(ids=[39,40]) + >>> read.getAffiliations(personfirst='Anthony', + ... personlast='Aufdenkampe') + >>> read.getAffiliations(orgcode='LimnoTech') + """ q = self._session.query(Affiliations) From b81521d3b24af3c95353e9402522ccd3bdfab9ff Mon Sep 17 00:00:00 2001 From: lsetiawan Date: Wed, 27 Sep 2017 16:25:32 -0700 Subject: [PATCH 2/2] Use google doc style and resolve comments --- odm2api/ODM2/services/readService.py | 43 ++++++++++++---------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/odm2api/ODM2/services/readService.py b/odm2api/ODM2/services/readService.py index 5b89704..fd95953 100644 --- a/odm2api/ODM2/services/readService.py +++ b/odm2api/ODM2/services/readService.py @@ -543,30 +543,25 @@ def getPeople(self, ids=None, firstname=None, lastname=None): return None def getAffiliations(self, ids=None, personfirst=None, personlast=None, orgcode=None): - """ - Retrieve a list of ODM2 Affiliation objects. - - Parameters - ---------- - 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 - - Returns - ------- - List of Affiliation objects - - Examples - -------- - >>> read.getAffiliations(ids=[39,40]) - >>> read.getAffiliations(personfirst='Anthony', - ... personlast='Aufdenkampe') - >>> read.getAffiliations(orgcode='LimnoTech') + """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. + + 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. + + Returns: + list: List of Affiliation objects + + Examples: + >>> read.getAffiliations(ids=[39,40]) + >>> read.getAffiliations(personfirst='John', + ... personlast='Smith') + >>> read.getAffiliations(orgcode='Acme') """ q = self._session.query(Affiliations)