Skip to content

Commit 5ad4243

Browse files
committed
Change all keywords referencing OT 'property' to 'property_name' and 'value' to 'property_value'
1 parent e046bee commit 5ad4243

File tree

1 file changed

+33
-32
lines changed

1 file changed

+33
-32
lines changed

pyopentree/opentreeservice.py

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,8 @@ def taxonomy_taxon(self, ott_id, include_lineage=False):
734734

735735
def studies_find_studies(
736736
self,
737-
study_property=None,
738-
value=None,
737+
property_name=None,
738+
property_value=None,
739739
exact=False,
740740
verbose=False):
741741
"""
@@ -751,11 +751,12 @@ def studies_find_studies(
751751
752752
Parameters
753753
----------
754-
study_property : string
755-
The property to be searched on. A list of searchable properties is
756-
available from the `studies_properties` function. To find all studies,
757-
omit both the property and the value from your query.
758-
value : string
754+
property_name : string
755+
The *study* property to be searched on. A list of searchable
756+
properties is available from `studies_properties()["study_properties"]`.
757+
To find all studies, omit both the property and the value from your
758+
query.
759+
property_value : string
759760
The value to be searched. This must be passed as a string, but will be
760761
converted to the datatype corresponding to the specified searchable
761762
value. To find all studies, omit both the property and the value from
@@ -776,23 +777,23 @@ def studies_find_studies(
776777
"matched_studies"
777778
"""
778779
payload = {"exact" : exact}
779-
if study_property is None or value is None:
780-
if study_property is not None:
781-
raise ValueError("If 'study_property' is specified, 'value' must be specified as well")
782-
if value is not None:
783-
raise ValueError("If 'value' is specified, 'study_property' must be specified as well")
780+
if property_name is None or property_value is None:
781+
if property_name is not None:
782+
raise ValueError("If 'property_name' is specified, 'property_value' must be specified as well")
783+
if property_value is not None:
784+
raise ValueError("If 'property_value' is specified, 'property_name' must be specified as well")
784785
else:
785-
payload["property"] = study_property
786-
payload["value"] = value
786+
payload["property"] = property_name
787+
payload["value"] = property_value
787788
result = self.request(
788789
'/studies/find_studies',
789790
payload=payload)
790791
return result
791792

792793
def studies_find_trees(
793794
self,
794-
tree_property,
795-
value,
795+
property_name,
796+
property_value,
796797
exact=False,
797798
verbose=False):
798799
"""
@@ -807,10 +808,10 @@ def studies_find_trees(
807808
808809
Parameters
809810
----------
810-
tree_property : string
811-
The property to be searched on. A list of searchable properties is
812-
available from the `studies_properties` function.
813-
value : string
811+
property_name : string
812+
The *tree* property to be searched on. A list of searchable
813+
properties is available from `studies_properties()["tree_properties"]`.
814+
property_value : string
814815
The value to be searched. This must be passed as a string, but will be
815816
converted to the datatype corresponding to the specified searchable
816817
value.
@@ -831,8 +832,8 @@ def studies_find_trees(
831832
"""
832833
payload = {
833834
"exact" : exact,
834-
"property": tree_property,
835-
"value": value, }
835+
"property": property_name,
836+
"value": property_value, }
836837
result = self.request(
837838
'/studies/find_trees',
838839
payload=payload)
@@ -1105,33 +1106,33 @@ def taxonomy_taxon(ott_id, include_lineage=False):
11051106
)
11061107

11071108
def studies_find_studies(
1108-
study_property=None,
1109-
value=None,
1109+
property_name=None,
1110+
property_value=None,
11101111
exact=False,
11111112
verbose=False,
11121113
):
11131114
"""
11141115
Forwards to :meth:`OpenTreeService.studies_find_studies()` of the global :class:`OpenTreeService` instance.
11151116
"""
11161117
return GLOBAL_OPEN_TREE_SERVICE.studies_find_studies(
1117-
study_property=study_property,
1118-
value=value,
1118+
property_name=property_name,
1119+
property_value=property_value,
11191120
exact=exact,
11201121
verbose=verbose,
11211122
)
11221123

11231124
def studies_find_trees(
1124-
study_property,
1125-
value,
1125+
property_name,
1126+
property_value,
11261127
exact=False,
11271128
verbose=False,
11281129
):
11291130
"""
11301131
Forwards to :meth:`OpenTreeService.studies_find_trees()` of the global :class:`OpenTreeService` instance.
11311132
"""
11321133
return GLOBAL_OPEN_TREE_SERVICE.studies_find_trees(
1133-
study_property=study_property,
1134-
value=value,
1134+
property_name=property_name,
1135+
property_value=property_value,
11351136
exact=exact,
11361137
verbose=verbose,
11371138
)
@@ -1293,12 +1294,12 @@ def human_readable_output_inspection(function_name, function_output):
12931294
# curl -X POST http://devapi.opentreeoflife.org/v2/studies/find_studies -H "content-type:application/json" -d '{"property":"ot:studyId","value":"pg_719","verbose":true}'
12941295
human_readable_output_inspection(
12951296
function_name='studies_find_studies',
1296-
function_output=studies_find_studies(study_property="ot:studyId", value="pg_719", verbose=True))
1297+
function_output=studies_find_studies(property_name="ot:studyId", property_value="pg_719", verbose=True))
12971298

12981299
# curl -X POST http://devapi.opentreeoflife.org/v2/studies/find_trees -H "content-type:application/json" -d '{"property":"ot:ottTaxonName","value":"Garcinia"}'
12991300
human_readable_output_inspection(
13001301
function_name='studies_find_trees',
1301-
function_output=studies_find_trees(study_property="ot:ottTaxonName", value="Garcinia"))
1302+
function_output=studies_find_trees(property_name="ot:ottTaxonName", property_value="Garcinia"))
13021303

13031304
# curl -X POST http://devapi.opentreeoflife.org/v2/studies/properties
13041305
human_readable_output_inspection(

0 commit comments

Comments
 (0)