summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-05-16 18:25:57 +0300
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-05-16 18:25:57 +0300
commit90dec971edee9de4789766d77f1081cc2ca206f9 (patch)
treec471f9b5a2b2aeab56040e7f572bff6f1a7cfa37
parentf05bf5bbe79666e3fbc1ed7218360f789a1bad06 (diff)
downloadpylint-90dec971edee9de4789766d77f1081cc2ca206f9.tar.gz
Fix some pylint warnings over pylint's codebase.
-rw-r--r--pylint/checkers/classes.py6
-rw-r--r--pylint/checkers/python3.py4
-rwxr-xr-xpylint/epylint.py8
-rw-r--r--pylint/lint.py24
-rw-r--r--pylint/testutils.py16
-rw-r--r--pylintrc4
6 files changed, 32 insertions, 30 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py
index 253e04f..7307a74 100644
--- a/pylint/checkers/classes.py
+++ b/pylint/checkers/classes.py
@@ -975,9 +975,9 @@ def node_method(node, method_name):
"""get astroid for <method_name> on the given class node, ensuring it
is a Function node
"""
- for n in node.local_attr(method_name):
- if isinstance(n, astroid.Function):
- return n
+ for node_attr in node.local_attr(method_name):
+ if isinstance(node_attr, astroid.Function):
+ return node_attr
raise astroid.NotFoundError(method_name)
def register(linter):
diff --git a/pylint/checkers/python3.py b/pylint/checkers/python3.py
index ccffce7..95aa3a7 100644
--- a/pylint/checkers/python3.py
+++ b/pylint/checkers/python3.py
@@ -50,7 +50,7 @@ def _check_dict_node(node):
def _is_builtin(node):
return getattr(node, 'name', None) in ('__builtin__', 'builtins')
-_accepts_iterator = {'iter', 'list', 'tuple', 'sorted', 'set', 'sum', 'any',
+_ACCEPTS_ITERATOR = {'iter', 'list', 'tuple', 'sorted', 'set', 'sum', 'any',
'all', 'enumerate', 'dict'}
def _in_iterating_context(node):
@@ -74,7 +74,7 @@ def _in_iterating_context(node):
elif isinstance(parent, astroid.CallFunc):
if isinstance(parent.func, astroid.Name):
parent_scope = parent.func.lookup(parent.func.name)[0]
- if _is_builtin(parent_scope) and parent.func.name in _accepts_iterator:
+ if _is_builtin(parent_scope) and parent.func.name in _ACCEPTS_ITERATOR:
return True
elif isinstance(parent.func, astroid.Getattr):
if parent.func.attrname == 'join':
diff --git a/pylint/epylint.py b/pylint/epylint.py
index 3d73ecd..12cd6de 100755
--- a/pylint/epylint.py
+++ b/pylint/epylint.py
@@ -154,12 +154,12 @@ def py_run(command_options='', return_std=False, stdout=None, stderr=None,
else:
stderr = sys.stderr
# Call pylint in a subprocess
- p = Popen(command_line, shell=True, stdout=stdout, stderr=stderr,
- env=_get_env(), universal_newlines=True)
- p.wait()
+ process = Popen(command_line, shell=True, stdout=stdout, stderr=stderr,
+ env=_get_env(), universal_newlines=True)
+ process.wait()
# Return standard output and error
if return_std:
- return (p.stdout, p.stderr)
+ return (process.stdout, process.stderr)
def Run():
diff --git a/pylint/lint.py b/pylint/lint.py
index 19aa838..11b7b38 100644
--- a/pylint/lint.py
+++ b/pylint/lint.py
@@ -205,9 +205,10 @@ MSGS = {
if multiprocessing is not None:
- class ChildLinter(multiprocessing.Process): # pylint: disable=no-member
+ class ChildLinter(multiprocessing.Process):
def run(self):
- tasks_queue, results_queue, self._config = self._args # pylint: disable=no-member
+ # pylint: disable=no-member, unbalanced-tuple-unpacking
+ tasks_queue, results_queue, self._config = self._args
self._config["jobs"] = 1 # Child does not parallelize any further.
self._python3_porting_mode = self._config.pop(
@@ -762,15 +763,16 @@ class PyLinter(configuration.OptionsManagerMixIn,
child_config['python3_porting_mode'] = self._python3_porting_mode
child_config['plugins'] = self._dynamic_plugins
- childs = []
- manager = multiprocessing.Manager() # pylint: disable=no-member
- tasks_queue = manager.Queue() # pylint: disable=no-member
- results_queue = manager.Queue() # pylint: disable=no-member
+ children = []
+ manager = multiprocessing.Manager()
+ tasks_queue = manager.Queue()
+ results_queue = manager.Queue()
for _ in range(self.config.jobs):
- cl = ChildLinter(args=(tasks_queue, results_queue, child_config))
- cl.start() # pylint: disable=no-member
- childs.append(cl)
+ child_linter = ChildLinter(args=(tasks_queue, results_queue,
+ child_config))
+ child_linter.start()
+ children.append(child_linter)
# Send files to child linters.
expanded_files = self.expand_files(files_or_modules)
@@ -794,8 +796,8 @@ class PyLinter(configuration.OptionsManagerMixIn,
# Stop child linters and wait for their completion.
for _ in range(self.config.jobs):
tasks_queue.put('STOP')
- for cl in childs:
- cl.join()
+ for child in children:
+ child.join()
if failed:
print("Error occured, stopping the linter.", file=sys.stderr)
diff --git a/pylint/testutils.py b/pylint/testutils.py
index 7a4bddc..c7d8e1d 100644
--- a/pylint/testutils.py
+++ b/pylint/testutils.py
@@ -170,9 +170,9 @@ class UnittestLinter(object):
def set_config(**kwargs):
"""Decorator for setting config values on a checker."""
- def _Wrapper(fun):
+ def _wrapper(fun):
@functools.wraps(fun)
- def _Forward(self):
+ def _forward(self):
for key, value in six.iteritems(kwargs):
setattr(self.checker.config, key, value)
if isinstance(self, CheckerTestCase):
@@ -180,8 +180,8 @@ def set_config(**kwargs):
self.checker.open()
fun(self)
- return _Forward
- return _Wrapper
+ return _forward
+ return _wrapper
class CheckerTestCase(unittest.TestCase):
@@ -391,17 +391,17 @@ def create_tempfile(content=None):
# Can't use tempfile.NamedTemporaryFile here
# because on Windows the file must be closed before writing to it,
# see http://bugs.python.org/issue14243
- fd, tmp = tempfile.mkstemp()
+ file_handle, tmp = tempfile.mkstemp()
if content:
if sys.version_info >= (3, 0):
# erff
- os.write(fd, bytes(content, 'ascii'))
+ os.write(file_handle, bytes(content, 'ascii'))
else:
- os.write(fd, content)
+ os.write(file_handle, content)
try:
yield tmp
finally:
- os.close(fd)
+ os.close(file_handle)
os.remove(tmp)
@contextlib.contextmanager
diff --git a/pylintrc b/pylintrc
index ed25094..1f2c1b0 100644
--- a/pylintrc
+++ b/pylintrc
@@ -67,7 +67,7 @@ disable=invalid-name,protected-access,fixme,too-many-branches,
too-many-return-statements,too-few-public-methods,
import-error,too-many-lines,too-many-instance-attributes,
too-many-public-methods,duplicate-code,broad-except,
- unbalanced-tuple-unpacking,redefined-builtin,anomalous-backslash-in-string,
+ redefined-builtin,anomalous-backslash-in-string,
missing-docstring,no-member
@@ -280,7 +280,7 @@ ignored-modules=
# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set).
-ignored-classes=SQLObject
+ignored-classes=SQLObject, Values
# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.