Skip to content

Commit

Permalink
Various fixes and work-arounds for issues detected by new version of
Browse files Browse the repository at this point in the history
pylint.
  • Loading branch information
Kami committed May 3, 2018
1 parent 46ce4ec commit 13b52e7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pylint_plugins/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

from astroid import MANAGER
from astroid import nodes
from astroid import scoped_nodes

# A list of class names for which we want to skip the checks
Expand All @@ -33,6 +34,11 @@ def transform(cls):
if cls.name in CLASS_NAME_BLACKLIST:
return

if cls.name == 'StormFoundationDB':
# _fields get added automagically by mongoengine
if '_fields' not in cls.locals:
cls.locals['_fields'] = [nodes.Dict()]

if cls.name.endswith('DB'):
# mongoengine explicitly declared "id" field on each class so we teach pylint about that
property_name = 'id'
Expand Down
2 changes: 2 additions & 0 deletions st2common/st2common/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ def match(self, req):
except KeyError:
path_vars = match

path_vars = list(path_vars)

path = path_vars.pop('_api_path')
method = path_vars.pop('_api_method')
endpoint = self.spec['paths'][path][method]
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/util/monkey_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def use_select_poll_workaround():

if sys.version_info >= (3, 6, 5):
# If we also don't patch selectors.select, it will fail with Python >= 3.6.5
import selectors
import selectors # pylint: disable=import-error

sys.modules['selectors'] = selectors
selectors.select = sys.modules['select']
Expand Down
4 changes: 2 additions & 2 deletions st2common/st2common/util/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def kill_process(process):

try:
if six.PY3:
status = subprocess.call(kill_command, timeout=100)
status = subprocess.call(kill_command, timeout=100) # pylint: disable=not-callable
else:
status = subprocess.call(kill_command)
status = subprocess.call(kill_command) # pylint: disable=not-callable
except Exception:
LOG.exception('Unable to pkill process.')

Expand Down

0 comments on commit 13b52e7

Please sign in to comment.