Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coding standards improvements #170

Merged
merged 3 commits into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions odm2api/services/readService.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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']

Expand Down Expand Up @@ -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']

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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'])
Expand Down Expand Up @@ -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']

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_odm2/test_readservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down