@@ -158,8 +158,8 @@ def getAnnotations(self, annottype=None, codes=None, ids=None, **kwargs):
158158 # TODO What keywords do I use for type.
159159 a = Annotations
160160 if 'type' in kwargs :
161- warnings .warn (
162- "The parameter 'type' is deprecated. Please use the annottype parameter instead." )
161+ warnings .warn ('The parameter \' type \' is deprecated. Please use the annottype parameter instead.' ,
162+ DeprecationWarning , stacklevel = 2 )
163163 annottype = kwargs ['type' ]
164164 if annottype :
165165 if annottype == 'action' :
@@ -385,21 +385,25 @@ def getVariables(self, ids=None, codes=None, sitecode=None, results=False):
385385 return None
386386
387387 # Method
388- def getMethods (self , ids = None , codes = None , type = None ):
388+ def getMethods (self , ids = None , codes = None , medtype = None , ** kwargs ):
389389 """
390390 * Pass nothing - returns full list of method objects
391391 * Pass a list of MethodIDs - returns a single method object for each given id
392392 * Pass a list of MethodCode - returns a single method object for each given code
393393 * Pass a MethodType - returns a list of method objects of the given MethodType
394394
395395 """
396+ if 'type' in kwargs :
397+ warnings .warn ('The parameter \' type\' is deprecated. Please use the medtype parameter instead.' ,
398+ DeprecationWarning , stacklevel = 2 )
399+ medtype = kwargs ['type' ]
396400 q = self ._session .query (Methods )
397401 if ids :
398402 q = q .filter (Methods .MethodID .in_ (ids ))
399403 if codes :
400404 q = q .filter (Methods .MethodCode .in_ (codes ))
401- if type :
402- q = q .filter_by (MethodTypeCV = type )
405+ if medtype :
406+ q = q .filter_by (MethodTypeCV = medtype )
403407
404408 try :
405409 return q .all ()
@@ -442,7 +446,8 @@ def getProcessingLevels(self, ids=None, codes=None):
442446 return None
443447
444448 # Sampling Feature
445- def getSamplingFeatures (self , ids = None , codes = None , uuids = None , type = None , wkt = None , results = False ):
449+ def getSamplingFeatures (self , ids = None , codes = None , uuids = None ,
450+ sftype = None , wkt = None , results = False , ** kwargs ):
446451 """Retrieve a list of Sampling Feature objects.
447452
448453 If no arguments are passed to the function, or their values are None,
@@ -452,7 +457,7 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=N
452457 ids (list, optional): List of SamplingFeatureIDs.
453458 codes (list, optional): List of SamplingFeature Codes.
454459 uuids (list, optional): List of UUIDs string.
455- type (str, optional): Type of Sampling Feature from
460+ sftype (str, optional): Type of Sampling Feature from
456461 `controlled vocabulary name <http://vocabulary.odm2.org/samplingfeaturetype/>`_.
457462 wkt (str, optional): SamplingFeature Well Known Text.
458463 results (bool, optional): Whether or not you want to return only the
@@ -473,6 +478,10 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=N
473478 >>> READ.getSamplingFeatures(type='Site', results=True)
474479
475480 """
481+ if 'type' in kwargs :
482+ warnings .warn ('The parameter \' type\' is deprecated. Please use the sftype parameter instead.' ,
483+ DeprecationWarning , stacklevel = 2 )
484+ sftype = kwargs ['type' ]
476485 if results :
477486 try :
478487 fas = [x [0 ] for x in self ._session .query (distinct (Results .FeatureActionID )).all ()]
@@ -487,8 +496,8 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, type=None, wkt=N
487496
488497 q = self ._session .query (SamplingFeatures )
489498
490- if type :
491- q = q .filter_by (SamplingFeatureTypeCV = type )
499+ if sftype :
500+ q = q .filter_by (SamplingFeatureTypeCV = sftype )
492501 if ids :
493502 q = q .filter (SamplingFeatures .SamplingFeatureID .in_ (ids ))
494503 if codes :
@@ -535,7 +544,7 @@ def getRelatedSamplingFeatures(self, sfid=None, rfid=None, relationshiptype=None
535544
536545
537546 # Action
538- def getActions (self , ids = None , type = None , sfid = None ):
547+ def getActions (self , ids = None , acttype = None , sfid = None , ** kwargs ):
539548 """
540549 * Pass nothing - returns a list of all Actions
541550 * Pass a list of Action ids - returns a list of Action objects
@@ -544,12 +553,16 @@ def getActions(self, ids=None, type=None, sfid=None):
544553 associated with that Sampling feature ID, Found through featureAction table
545554
546555 """
556+ if 'type' in kwargs :
557+ warnings .warn ('The parameter \' type\' is deprecated. Please use the acttype parameter instead.' ,
558+ DeprecationWarning , stacklevel = 2 )
559+ acttype = kwargs ['type' ]
547560 a = Actions
548- if type == 'equipment' :
561+ if acttype == 'equipment' :
549562 a = EquipmentActions
550- elif type == 'calibration' :
563+ elif acttype == 'calibration' :
551564 a = CalibrationActions
552- elif type == 'maintenance' :
565+ elif acttype == 'maintenance' :
553566 a = MaintenanceActions
554567
555568 q = self ._session .query (a )
@@ -581,21 +594,25 @@ def getRelatedActions(self, actionid=None):
581594 return None
582595
583596 # Unit
584- def getUnits (self , ids = None , name = None , type = None ):
597+ def getUnits (self , ids = None , name = None , unittype = None , ** kwargs ):
585598 """
586599 * Pass nothing - returns a list of all units objects
587600 * Pass a list of UnitsID - returns a single units object for the given id
588601 * Pass UnitsName - returns a single units object
589602 * Pass a type- returns a list of all objects of the given type
590603
591604 """
605+ if 'type' in kwargs :
606+ warnings .warn ('The parameter \' type\' is deprecated. Please use the unittype parameter instead.' ,
607+ DeprecationWarning , stacklevel = 2 )
608+ unittype = kwargs ['type' ]
592609 q = self ._session .query (Units )
593610 if ids :
594611 q = q .filter (Units .UnitsID .in_ (ids ))
595612 if name :
596613 q = q .filter (Units .UnitsName .ilike (name ))
597- if type :
598- q = q .filter (Units .UnitsTypeCV .ilike (type ))
614+ if unittype :
615+ q = q .filter (Units .UnitsTypeCV .ilike (unittype ))
599616 try :
600617 return q .all ()
601618 except Exception as e :
@@ -725,8 +742,8 @@ def getResults(self, ids=None, restype = None, uuids=None, actionid=None, simula
725742 query = self ._session .query (Results )
726743
727744 if 'type' in kwargs :
728- warnings .warn (
729- "The parameter 'type' is deprecated. Please use the restype parameter instead." )
745+ warnings .warn ('The parameter \' type \' is deprecated. Please use the restype parameter instead.' ,
746+ DeprecationWarning , stacklevel = 2 )
730747 restype = kwargs ['type' ]
731748 if restype :
732749 query = query .filter_by (ResultTypeCV = restype )
@@ -744,7 +761,9 @@ def getResults(self, ids=None, restype = None, uuids=None, actionid=None, simula
744761 if actionid :
745762 query = query .join (FeatureActions ).filter_by (ActionID = actionid )
746763 if 'sfid' in kwargs :
747- warnings .warn ("The parameter 'sfid' is deprecated. Please use the sfids parameter and send in a list." )
764+ warnings .warn ('The parameter \' sfid\' is deprecated. '
765+ 'Please use the sfids parameter instead and send in a list.' ,
766+ DeprecationWarning , stacklevel = 2 )
748767 query = query .join (FeatureActions ).filter_by (SamplingFeatureID = kwargs ['sfid' ])
749768 if sfids or sfcodes or sfuuids :
750769 sf_list = self .getSamplingFeatures (ids = sfids , codes = sfcodes , uuids = sfuuids )
@@ -1011,7 +1030,7 @@ def getResultsDataQuality(self):
10111030
10121031 # TODO Equipment Schema Queries
10131032 # Equipment
1014- def getEquipment (self , codes = None , type = None , sfid = None , actionid = None ):
1033+ def getEquipment (self , codes = None , equiptype = None , sfid = None , actionid = None , ** kwargs ):
10151034 """
10161035 * Pass nothing - returns a list of all Equipment objects
10171036 * Pass a list of EquipmentCodes- return a list of all Equipment objects that match each of the codes
@@ -1020,6 +1039,10 @@ def getEquipment(self, codes=None, type=None, sfid=None, actionid=None):
10201039 * Pass an ActionID - returns a single Equipment object
10211040
10221041 """
1042+ if 'type' in kwargs :
1043+ warnings .warn ('The parameter \' type\' is deprecated. Please use the equiptype parameter instead.' ,
1044+ DeprecationWarning , stacklevel = 2 )
1045+ equiptype = kwargs ['type' ]
10231046 e = self ._session .query (Equipment )
10241047 if sfid :
10251048 e = e .join (EquipmentUsed ) \
@@ -1108,25 +1131,29 @@ def RelatedEquipment(self, code=None):
11081131 return r .all ()
11091132
11101133 # Extension Properties
1111- def getExtensionProperties (self , type = None ):
1134+ def getExtensionProperties (self , exptype = None , ** kwargs ):
11121135 """
11131136 * Pass nothing - return a list of all objects
11141137 * Pass type- return a list of all objects of the given type
11151138
11161139 """
11171140 # Todo what values to use for extensionproperties type
1141+ if 'type' in kwargs :
1142+ warnings .warn ('The parameter \' type\' is deprecated. Please use the exptype parameter instead.' ,
1143+ DeprecationWarning , stacklevel = 2 )
1144+ exptype = kwargs ['type' ]
11181145 e = ExtensionProperties
1119- if type == 'action' :
1146+ if exptype == 'action' :
11201147 e = ActionExtensionPropertyValues
1121- elif type == 'citation' :
1148+ elif exptype == 'citation' :
11221149 e = CitationExtensionPropertyValues
1123- elif type == 'method' :
1150+ elif exptype == 'method' :
11241151 e = MethodExtensionPropertyValues
1125- elif type == 'result' :
1152+ elif exptype == 'result' :
11261153 e = ResultExtensionPropertyValues
1127- elif type == 'samplingfeature' :
1154+ elif exptype == 'samplingfeature' :
11281155 e = SamplingFeatureExtensionPropertyValues
1129- elif type == 'variable' :
1156+ elif exptype == 'variable' :
11301157 e = VariableExtensionPropertyValues
11311158 try :
11321159 return self ._session .query (e ).all ()
@@ -1135,28 +1162,32 @@ def getExtensionProperties(self, type=None):
11351162 return None
11361163
11371164 # External Identifiers
1138- def getExternalIdentifiers (self , type = None ):
1165+ def getExternalIdentifiers (self , eitype = None , ** kwargs ):
11391166 """
11401167 * Pass nothing - return a list of all objects
11411168 * Pass type- return a list of all objects of the given type
11421169
11431170 """
1171+ if 'type' in kwargs :
1172+ warnings .warn ('The parameter \' type\' is deprecated. Please use the eitype parameter instead.' ,
1173+ DeprecationWarning , stacklevel = 2 )
1174+ eitype = kwargs ['type' ]
11441175 e = ExternalIdentifierSystems
1145- if type .lowercase == 'citation' :
1176+ if eitype .lowercase == 'citation' :
11461177 e = CitationExternalIdentifiers
1147- elif type == 'method' :
1178+ elif eitype == 'method' :
11481179 e = MethodExternalIdentifiers
1149- elif type == 'person' :
1180+ elif eitype == 'person' :
11501181 e = PersonExternalIdentifiers
1151- elif type == 'referencematerial' :
1182+ elif eitype == 'referencematerial' :
11521183 e = ReferenceMaterialExternalIdentifiers
1153- elif type == 'samplingfeature' :
1184+ elif eitype == 'samplingfeature' :
11541185 e = SamplingFeatureExternalIdentifiers
1155- elif type == 'spatialreference' :
1186+ elif eitype == 'spatialreference' :
11561187 e = SpatialReferenceExternalIdentifiers
1157- elif type == 'taxonomicclassifier' :
1188+ elif eitype == 'taxonomicclassifier' :
11581189 e = TaxonomicClassifierExternalIdentifiers
1159- elif type == 'variable' :
1190+ elif eitype == 'variable' :
11601191 e = VariableExternalIdentifiers
11611192 try :
11621193 return self ._session .query (e ).all ()
@@ -1372,16 +1403,20 @@ def getModels(self, codes=None):
13721403 print ('Error running Query: {}' .format (e ))
13731404 return None
13741405
1375- def getRelatedModels (self , id = None , code = None ):
1406+ def getRelatedModels (self , modid = None , code = None , ** kwargs ):
13761407 """
13771408 getRelatedModels(self, id=None, code=None)
13781409 * Pass a ModelID - get a list of converter objects related to the converter having ModelID
13791410 * Pass a ModelCode - get a list of converter objects related to the converter having ModeCode
13801411
13811412 """
1413+ if 'id' in kwargs :
1414+ warnings .warn ('The parameter \' id\' is deprecated. Please use the modid parameter instead.' ,
1415+ DeprecationWarning , stacklevel = 2 )
1416+ modid = kwargs ['type' ]
13821417 m = self ._session .query (Models ).select_from (RelatedModels ).join (RelatedModels .ModelObj )
1383- if id :
1384- m = m .filter (RelatedModels .ModelID == id )
1418+ if modid :
1419+ m = m .filter (RelatedModels .ModelID == modid )
13851420 if code :
13861421 m = m .filter (Models .ModelCode == code )
13871422
0 commit comments