diff --git a/odm2api/services/readService.py b/odm2api/services/readService.py index e93a712..3a04043 100644 --- a/odm2api/services/readService.py +++ b/odm2api/services/readService.py @@ -185,7 +185,7 @@ def getAnnotations(self, annottype=None, codes=None, ids=None, **kwargs): a = Annotations self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the annottype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the annottype parameter instead.", DeprecationWarning, stacklevel=2) annottype = kwargs['type'] if annottype: @@ -238,7 +238,7 @@ def getCVs(self, cvtype, **kwargs): """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the cvtype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the cvtype parameter instead.", DeprecationWarning, stacklevel=2) cvtype = kwargs['type'] @@ -430,7 +430,7 @@ def getMethods(self, ids=None, codes=None, methodtype=None, **kwargs): """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the medtype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the medtype parameter instead.", DeprecationWarning, stacklevel=2) methodtype = kwargs['type'] @@ -517,7 +517,7 @@ def getSamplingFeatures(self, ids=None, codes=None, uuids=None, """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the sftype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the sftype parameter instead.", DeprecationWarning, stacklevel=2) sftype = kwargs['type'] if results: @@ -591,7 +591,7 @@ def getActions(self, ids=None, acttype=None, sfid=None, **kwargs): """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the acttype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the acttype parameter instead.", DeprecationWarning, stacklevel=2) acttype = kwargs['type'] a = Actions @@ -641,7 +641,7 @@ def getUnits(self, ids=None, name=None, unittype=None, **kwargs): """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the unittype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the unittype parameter instead.", DeprecationWarning, stacklevel=2) unittype = kwargs['type'] q = self._session.query(Units) @@ -779,7 +779,7 @@ def getResults(self, ids=None, restype=None, uuids=None, actionid=None, simulati query = self._session.query(Results) self._check_kwargs(['type', 'sfid'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the restype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the restype parameter instead.", DeprecationWarning, stacklevel=2) restype = kwargs['type'] if restype: @@ -798,8 +798,8 @@ def getResults(self, ids=None, restype=None, uuids=None, actionid=None, simulati if actionid: query = query.join(FeatureActions).filter_by(ActionID=actionid) if 'sfid' in kwargs: - warnings.warn('The parameter \'sfid\' is deprecated. ' - 'Please use the sfids parameter instead and send in a list.', + warnings.warn("The parameter 'sfid' is deprecated. " + + "Please use the sfids parameter instead and send in a list.", # noqa DeprecationWarning, stacklevel=2) if kwargs['sfid']: query = query.join(FeatureActions).filter_by(SamplingFeatureID=kwargs['sfid']) @@ -1087,7 +1087,7 @@ def getEquipment(self, codes=None, equiptype=None, sfid=None, actionid=None, **k """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the equiptype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the equiptype parameter instead.", DeprecationWarning, stacklevel=2) equiptype = kwargs['type'] @@ -1191,7 +1191,7 @@ def getExtensionProperties(self, exptype=None, **kwargs): # Todo what values to use for extensionproperties type self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the exptype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the exptype parameter instead.", DeprecationWarning, stacklevel=2) exptype = kwargs['type'] e = ExtensionProperties @@ -1222,7 +1222,7 @@ def getExternalIdentifiers(self, eitype=None, **kwargs): """ self._check_kwargs(['type'], kwargs) if 'type' in kwargs: - warnings.warn('The parameter \'type\' is deprecated. Please use the eitype parameter instead.', + warnings.warn("The parameter 'type' is deprecated. Please use the eitype parameter instead.", DeprecationWarning, stacklevel=2) eitype = kwargs['type'] e = ExternalIdentifierSystems @@ -1415,9 +1415,9 @@ def getResultValues(self, resultids, starttime=None, endtime=None, lowercols=Tru df.columns = [self._get_columns(ResultValues)[c] for c in df.columns] else: warnings.warn( - 'In a near-future release, ' - 'the parameter \'lowercols\' default will be changed to False, ' - 'and later the parameter may be removed.', + "In a near-future release, " + # noqa + "the parameter 'lowercols' default will be changed to False, " + + "and later the parameter may be removed.", # noqa DeprecationWarning, stacklevel=2) return df except Exception as e: @@ -1487,7 +1487,7 @@ def getRelatedModels(self, modid=None, code=None, **kwargs): """ self._check_kwargs(['id'], kwargs) if 'id' in kwargs: - warnings.warn('The parameter \'id\' is deprecated. Please use the modid parameter instead.', + warnings.warn("The parameter 'id' is deprecated. Please use the modid parameter instead.", DeprecationWarning, stacklevel=2) modid = kwargs['id'] m = self._session.query(Models).select_from(RelatedModels).join(RelatedModels.ModelObj) diff --git a/tests/test_odm2/test_readservice.py b/tests/test_odm2/test_readservice.py index 3e7189f..814531c 100644 --- a/tests/test_odm2/test_readservice.py +++ b/tests/test_odm2/test_readservice.py @@ -3,8 +3,8 @@ from os.path import abspath, dirname, join from odm2api import models -from odm2api.services.readService import ReadODM2 from odm2api.ODMconnection import dbconnection +from odm2api.services.readService import ReadODM2 import pytest