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

mgr/dashboard: Clean up Pylint warnings #21694

Merged
merged 1 commit into from May 3, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/pybind/mgr/dashboard/.pylintrc
Expand Up @@ -54,24 +54,13 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
disable=import-star-module-level,
raw-checker-failed,
bad-inline-option,
locally-disabled,
locally-enabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
apply-builtin,
basestring-builtin,
buffer-builtin,
Expand All @@ -96,7 +85,6 @@ disable=print-statement,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
Expand All @@ -119,10 +107,6 @@ disable=print-statement,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
Expand All @@ -132,7 +116,6 @@ disable=print-statement,
no-self-use,
too-few-public-methods,
no-member,
fixme,
too-many-arguments,
too-many-locals

Expand Down
3 changes: 1 addition & 2 deletions src/pybind/mgr/dashboard/controllers/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# pylint: disable=W0212
# pylint: disable=protected-access
from __future__ import absolute_import

import collections
Expand Down Expand Up @@ -526,7 +526,6 @@ def _function_args(func):
else:
return inspect.getargspec(func).args[1:] # pylint: disable=deprecated-method

# pylint: disable=W1505
@staticmethod
def _takes_json(func):
def inner(*args, **kwargs):
Expand Down
2 changes: 0 additions & 2 deletions src/pybind/mgr/dashboard/controllers/cephfs.py
Expand Up @@ -284,8 +284,6 @@ def __init__(self, module_inst, fscid):
self._module = module_inst
self.fscid = fscid

# pylint: disable=unused-variable
@ViewCache()
def get(self):
# TODO handle nonzero returns, e.g. when rank isn't active
return CephService.send_command('mds', 'session ls', srv_spec='{0}:0'.format(self.fscid))
1 change: 0 additions & 1 deletion src/pybind/mgr/dashboard/controllers/dashboard.py
Expand Up @@ -38,7 +38,6 @@ def load_buffer(self, buf, channel_name):
for l in lines:
buf.appendleft(l)

# pylint: disable=R0914
@cherrypy.expose
@cherrypy.tools.json_out()
def health(self):
Expand Down
1 change: 0 additions & 1 deletion src/pybind/mgr/dashboard/controllers/rbd.py
Expand Up @@ -255,7 +255,6 @@ def _rbd_list(self, pool_name=None):
return result

def list(self, pool_name=None):
# pylint: disable=unbalanced-tuple-unpacking
return self._rbd_list(pool_name)

def get(self, pool_name, image_name):
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/dashboard/controllers/rbd_mirroring.py
Expand Up @@ -56,7 +56,7 @@ def get_daemon_health(daemon):
'health_color': 'info',
'health': 'Unknown'
}
for _, pool_data in daemon['status'].items(): # TODO: simplify
for _, pool_data in daemon['status'].items():
if (health['health'] != 'error' and
[k for k, v in pool_data.get('callouts', {}).items()
if v['level'] == 'error']):
Expand Down
3 changes: 2 additions & 1 deletion src/pybind/mgr/dashboard/tests/helper.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# pylint: disable=W0212,too-many-arguments
# pylint: disable=too-many-arguments
from __future__ import absolute_import

import json
Expand Down Expand Up @@ -70,6 +70,7 @@ def _task_request(self, method, url, data, timeout):
task_name = res['name']
task_metadata = res['metadata']

# pylint: disable=protected-access
class Waiter(threading.Thread):
def __init__(self, task_name, task_metadata, tc):
super(Waiter, self).__init__()
Expand Down
3 changes: 1 addition & 2 deletions src/pybind/mgr/dashboard/tests/test_tools.py
Expand Up @@ -11,7 +11,6 @@
from ..tools import is_valid_ipv6_address, dict_contains_path


# pylint: disable=W0613
@ApiController('foo')
class FooResource(RESTController):
elems = []
Expand Down Expand Up @@ -49,7 +48,7 @@ def set(self, code, name=None, opt1=None, opt2=None):
return {'code': code, 'name': name, 'opt1': opt1, 'opt2': opt2}


# pylint: disable=C0102
# pylint: disable=blacklisted-name
class Root(object):
foo = FooResource()
fooargs = FooArgs()
Expand Down
5 changes: 3 additions & 2 deletions src/pybind/mgr/dashboard/tools.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
# pylint: disable=W0212
from __future__ import absolute_import

import collections
Expand Down Expand Up @@ -395,7 +394,7 @@ def run(self):
logger.debug("notification queue finished")


# pylint: disable=too-many-arguments
# pylint: disable=too-many-arguments, protected-access
class TaskManager(object):
FINISHED_TASK_SIZE = 10
FINISHED_TASK_TTL = 60.0
Expand Down Expand Up @@ -504,6 +503,7 @@ def list_serializable(cls, ns_glob=None):
} for t in fn_t]


# pylint: disable=protected-access
class TaskExecutor(object):
def __init__(self):
self.task = None
Expand All @@ -528,6 +528,7 @@ def finish(self, ret_value, exception):
self.task._complete(ret_value, exception)


# pylint: disable=protected-access
class ThreadedExecutor(TaskExecutor):
def __init__(self):
super(ThreadedExecutor, self).__init__()
Expand Down