@@ -171,8 +171,8 @@ def getAnnotations(self, annottype=None, codes=None, ids=None, **kwargs):
171171 # TODO What keywords do I use for type.
172172 a = Annotations
173173 if 'type' in kwargs :
174- warnings .warn (
175- "The parameter 'type' is deprecated. Please use the annottype parameter instead." )
174+ warnings .warn ('The parameter \' type \' is deprecated. Please use the annottype parameter instead.' ,
175+ DeprecationWarning , stacklevel = 2 )
176176 annottype = kwargs ['type' ]
177177 if annottype :
178178 if annottype == 'action' :
@@ -398,21 +398,25 @@ def getVariables(self, ids=None, codes=None, sitecode=None, results=False):
398398 return None
399399
400400 # Method
401- def getMethods (self , ids = None , codes = None , type = None ):
401+ def getMethods (self , ids = None , codes = None , medtype = None , ** kwargs ):
402402 """
403403 * Pass nothing - returns full list of method objects
404404 * Pass a list of MethodIDs - returns a single method object for each given id
405405 * Pass a list of MethodCode - returns a single method object for each given code
406406 * Pass a MethodType - returns a list of method objects of the given MethodType
407407
408408 """
409+ if 'type' in kwargs :
410+ warnings .warn ('The parameter \' type\' is deprecated. Please use the medtype parameter instead.' ,
411+ DeprecationWarning , stacklevel = 2 )
412+ medtype = kwargs ['type' ]
409413 q = self ._session .query (Methods )
410414 if ids :
411415 q = q .filter (Methods .MethodID .in_ (ids ))
412416 if codes :
413417 q = q .filter (Methods .MethodCode .in_ (codes ))
414- if type :
415- q = q .filter_by (MethodTypeCV = type )
418+ if medtype :
419+ q = q .filter_by (MethodTypeCV = medtype )
416420
417421 try :
418422 return q .all ()
@@ -455,7 +459,8 @@ def getProcessingLevels(self, ids=None, codes=None):
455459 return None
456460
457461 # Sampling Feature
458- def getSamplingFeatures (self , ids = None , codes = None , uuids = None , type = None , wkt = None , results = False ):
462+ def getSamplingFeatures (self , ids = None , codes = None , uuids = None ,
463+ sftype = None , wkt = None , results = False , ** kwargs ):
459464 """Retrieve a list of Sampling Feature objects.
460465
461466 If no arguments are passed to the function, or their values are None,
@@ -465,7 +470,7 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=N
465470 ids (list, optional): List of SamplingFeatureIDs.
466471 codes (list, optional): List of SamplingFeature Codes.
467472 uuids (list, optional): List of UUIDs string.
468- type (str, optional): Type of Sampling Feature from
473+ sftype (str, optional): Type of Sampling Feature from
469474 `controlled vocabulary name <http://vocabulary.odm2.org/samplingfeaturetype/>`_.
470475 wkt (str, optional): SamplingFeature Well Known Text.
471476 results (bool, optional): Whether or not you want to return only the
@@ -486,6 +491,10 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=N
486491 >>> READ.getSamplingFeatures(type='Site', results=True)
487492
488493 """
494+ if 'type' in kwargs :
495+ warnings .warn ('The parameter \' type\' is deprecated. Please use the sftype parameter instead.' ,
496+ DeprecationWarning , stacklevel = 2 )
497+ sftype = kwargs ['type' ]
489498 if results :
490499 try :
491500 fas = [x [0 ] for x in self ._session .query (distinct (Results .FeatureActionID )).all ()]
@@ -500,8 +509,8 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=N
500509
501510 q = self ._session .query (SamplingFeatures )
502511
503- if type :
504- q = q .filter_by (SamplingFeatureTypeCV = type )
512+ if sftype :
513+ q = q .filter_by (SamplingFeatureTypeCV = sftype )
505514 if ids :
506515 q = q .filter (SamplingFeatures .SamplingFeatureID .in_ (ids ))
507516 if codes :
@@ -548,7 +557,7 @@ def getRelatedSamplingFeatures(self, sfid=None, rfid=None, relationshiptype=None
548557
549558
550559 # Action
551- def getActions (self , ids = None , type = None , sfid = None ):
560+ def getActions (self , ids = None , acttype = None , sfid = None , ** kwargs ):
552561 """
553562 * Pass nothing - returns a list of all Actions
554563 * Pass a list of Action ids - returns a list of Action objects
@@ -557,12 +566,16 @@ def getActions(self, ids=None, type=None, sfid=None):
557566 associated with that Sampling feature ID, Found through featureAction table
558567
559568 """
569+ if 'type' in kwargs :
570+ warnings .warn ('The parameter \' type\' is deprecated. Please use the acttype parameter instead.' ,
571+ DeprecationWarning , stacklevel = 2 )
572+ acttype = kwargs ['type' ]
560573 a = Actions
561- if type == 'equipment' :
574+ if acttype == 'equipment' :
562575 a = EquipmentActions
563- elif type == 'calibration' :
576+ elif acttype == 'calibration' :
564577 a = CalibrationActions
565- elif type == 'maintenance' :
578+ elif acttype == 'maintenance' :
566579 a = MaintenanceActions
567580
568581 q = self ._session .query (a )
@@ -594,21 +607,25 @@ def getRelatedActions(self, actionid=None):
594607 return None
595608
596609 # Unit
597- def getUnits (self , ids = None , name = None , type = None ):
610+ def getUnits (self , ids = None , name = None , unittype = None , ** kwargs ):
598611 """
599612 * Pass nothing - returns a list of all units objects
600613 * Pass a list of UnitsID - returns a single units object for the given id
601614 * Pass UnitsName - returns a single units object
602615 * Pass a type- returns a list of all objects of the given type
603616
604617 """
618+ if 'type' in kwargs :
619+ warnings .warn ('The parameter \' type\' is deprecated. Please use the unittype parameter instead.' ,
620+ DeprecationWarning , stacklevel = 2 )
621+ unittype = kwargs ['type' ]
605622 q = self ._session .query (Units )
606623 if ids :
607624 q = q .filter (Units .UnitsID .in_ (ids ))
608625 if name :
609626 q = q .filter (Units .UnitsName .ilike (name ))
610- if type :
611- q = q .filter (Units .UnitsTypeCV .ilike (type ))
627+ if unittype :
628+ q = q .filter (Units .UnitsTypeCV .ilike (unittype ))
612629 try :
613630 return q .all ()
614631 except Exception as e :
@@ -738,8 +755,8 @@ def getResults(self, ids=None, restype = None, uuids=None, actionid=None, simula
738755 query = self ._session .query (Results )
739756
740757 if 'type' in kwargs :
741- warnings .warn (
742- "The parameter 'type' is deprecated. Please use the restype parameter instead." )
758+ warnings .warn ('The parameter \' type \' is deprecated. Please use the restype parameter instead.' ,
759+ DeprecationWarning , stacklevel = 2 )
743760 restype = kwargs ['type' ]
744761 if restype :
745762 query = query .filter_by (ResultTypeCV = restype )
@@ -757,7 +774,9 @@ def getResults(self, ids=None, restype = None, uuids=None, actionid=None, simula
757774 if actionid :
758775 query = query .join (FeatureActions ).filter_by (ActionID = actionid )
759776 if 'sfid' in kwargs :
760- warnings .warn ("The parameter 'sfid' is deprecated. Please use the sfids parameter and send in a list." )
777+ warnings .warn ('The parameter \' sfid\' is deprecated. '
778+ 'Please use the sfids parameter instead and send in a list.' ,
779+ DeprecationWarning , stacklevel = 2 )
761780 query = query .join (FeatureActions ).filter_by (SamplingFeatureID = kwargs ['sfid' ])
762781 if sfids or sfcodes or sfuuids :
763782 sf_list = self .getSamplingFeatures (ids = sfids , codes = sfcodes , uuids = sfuuids )
@@ -1024,7 +1043,7 @@ def getResultsDataQuality(self):
10241043
10251044 # TODO Equipment Schema Queries
10261045 # Equipment
1027- def getEquipment (self , codes = None , type = None , sfid = None , actionid = None ):
1046+ def getEquipment (self , codes = None , equiptype = None , sfid = None , actionid = None , ** kwargs ):
10281047 """
10291048 * Pass nothing - returns a list of all Equipment objects
10301049 * Pass a list of EquipmentCodes- return a list of all Equipment objects that match each of the codes
@@ -1033,6 +1052,10 @@ def getEquipment(self, codes=None, type=None, sfid=None, actionid=None):
10331052 * Pass an ActionID - returns a single Equipment object
10341053
10351054 """
1055+ if 'type' in kwargs :
1056+ warnings .warn ('The parameter \' type\' is deprecated. Please use the equiptype parameter instead.' ,
1057+ DeprecationWarning , stacklevel = 2 )
1058+ equiptype = kwargs ['type' ]
10361059 e = self ._session .query (Equipment )
10371060 if sfid :
10381061 e = e .join (EquipmentUsed ) \
@@ -1121,25 +1144,29 @@ def RelatedEquipment(self, code=None):
11211144 return r .all ()
11221145
11231146 # Extension Properties
1124- def getExtensionProperties (self , type = None ):
1147+ def getExtensionProperties (self , exptype = None , ** kwargs ):
11251148 """
11261149 * Pass nothing - return a list of all objects
11271150 * Pass type- return a list of all objects of the given type
11281151
11291152 """
11301153 # Todo what values to use for extensionproperties type
1154+ if 'type' in kwargs :
1155+ warnings .warn ('The parameter \' type\' is deprecated. Please use the exptype parameter instead.' ,
1156+ DeprecationWarning , stacklevel = 2 )
1157+ exptype = kwargs ['type' ]
11311158 e = ExtensionProperties
1132- if type == 'action' :
1159+ if exptype == 'action' :
11331160 e = ActionExtensionPropertyValues
1134- elif type == 'citation' :
1161+ elif exptype == 'citation' :
11351162 e = CitationExtensionPropertyValues
1136- elif type == 'method' :
1163+ elif exptype == 'method' :
11371164 e = MethodExtensionPropertyValues
1138- elif type == 'result' :
1165+ elif exptype == 'result' :
11391166 e = ResultExtensionPropertyValues
1140- elif type == 'samplingfeature' :
1167+ elif exptype == 'samplingfeature' :
11411168 e = SamplingFeatureExtensionPropertyValues
1142- elif type == 'variable' :
1169+ elif exptype == 'variable' :
11431170 e = VariableExtensionPropertyValues
11441171 try :
11451172 return self ._session .query (e ).all ()
@@ -1148,28 +1175,32 @@ def getExtensionProperties(self, type=None):
11481175 return None
11491176
11501177 # External Identifiers
1151- def getExternalIdentifiers (self , type = None ):
1178+ def getExternalIdentifiers (self , eitype = None , ** kwargs ):
11521179 """
11531180 * Pass nothing - return a list of all objects
11541181 * Pass type- return a list of all objects of the given type
11551182
11561183 """
1184+ if 'type' in kwargs :
1185+ warnings .warn ('The parameter \' type\' is deprecated. Please use the eitype parameter instead.' ,
1186+ DeprecationWarning , stacklevel = 2 )
1187+ eitype = kwargs ['type' ]
11571188 e = ExternalIdentifierSystems
1158- if type .lowercase == 'citation' :
1189+ if eitype .lowercase == 'citation' :
11591190 e = CitationExternalIdentifiers
1160- elif type == 'method' :
1191+ elif eitype == 'method' :
11611192 e = MethodExternalIdentifiers
1162- elif type == 'person' :
1193+ elif eitype == 'person' :
11631194 e = PersonExternalIdentifiers
1164- elif type == 'referencematerial' :
1195+ elif eitype == 'referencematerial' :
11651196 e = ReferenceMaterialExternalIdentifiers
1166- elif type == 'samplingfeature' :
1197+ elif eitype == 'samplingfeature' :
11671198 e = SamplingFeatureExternalIdentifiers
1168- elif type == 'spatialreference' :
1199+ elif eitype == 'spatialreference' :
11691200 e = SpatialReferenceExternalIdentifiers
1170- elif type == 'taxonomicclassifier' :
1201+ elif eitype == 'taxonomicclassifier' :
11711202 e = TaxonomicClassifierExternalIdentifiers
1172- elif type == 'variable' :
1203+ elif eitype == 'variable' :
11731204 e = VariableExternalIdentifiers
11741205 try :
11751206 return self ._session .query (e ).all ()
@@ -1394,16 +1425,20 @@ def getModels(self, codes=None):
13941425 print ('Error running Query: {}' .format (e ))
13951426 return None
13961427
1397- def getRelatedModels (self , id = None , code = None ):
1428+ def getRelatedModels (self , modid = None , code = None , ** kwargs ):
13981429 """
13991430 getRelatedModels(self, id=None, code=None)
14001431 * Pass a ModelID - get a list of converter objects related to the converter having ModelID
14011432 * Pass a ModelCode - get a list of converter objects related to the converter having ModeCode
14021433
14031434 """
1435+ if 'id' in kwargs :
1436+ warnings .warn ('The parameter \' id\' is deprecated. Please use the modid parameter instead.' ,
1437+ DeprecationWarning , stacklevel = 2 )
1438+ modid = kwargs ['type' ]
14041439 m = self ._session .query (Models ).select_from (RelatedModels ).join (RelatedModels .ModelObj )
1405- if id :
1406- m = m .filter (RelatedModels .ModelID == id )
1440+ if modid :
1441+ m = m .filter (RelatedModels .ModelID == modid )
14071442 if code :
14081443 m = m .filter (Models .ModelCode == code )
14091444
0 commit comments