summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-11-25 11:26:52 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2015-11-25 11:26:52 +0200
commit5b7deb7654ea35b1384f8a9398c18fb7466133c6 (patch)
tree2042cac8222980914dfd5f6f6625ba4de27d0a4e
parent886c03cf2ac8758519dfd50c12b486d76d231d0d (diff)
downloadpylint-5b7deb7654ea35b1384f8a9398c18fb7466133c6.tar.gz
Fix instances of unneeded-not in pylint's codebase.
-rw-r--r--pylint/checkers/classes.py2
-rw-r--r--pylint/checkers/imports.py2
-rw-r--r--pylint/checkers/utils.py2
-rw-r--r--pylint/checkers/variables.py2
-rw-r--r--pylint/graph.py2
-rw-r--r--pylint/gui.py2
-rw-r--r--pylint/pyreverse/inspector.py2
-rw-r--r--pylint/utils.py3
8 files changed, 8 insertions, 9 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py
index 6763f74..e79cf97 100644
--- a/pylint/checkers/classes.py
+++ b/pylint/checkers/classes.py
@@ -570,7 +570,7 @@ a metaclass class method.'}
return
class_node = node.parent.frame()
if (self._meth_could_be_func and node.type == 'method'
- and not node.name in PYMETHODS
+ and node.name not in PYMETHODS
and not (node.is_abstract() or
overrides_a_method(class_node, node.name) or
decorated_with_property(node) or
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py
index 0be2b2c..59c6ed0 100644
--- a/pylint/checkers/imports.py
+++ b/pylint/checkers/imports.py
@@ -372,7 +372,7 @@ given file (report RP0402 must not be disabled)'}
# handle dependencies
importedmodnames = self.stats['dependencies'].setdefault(
importedmodname, set())
- if not context_name in importedmodnames:
+ if context_name not in importedmodnames:
importedmodnames.add(context_name)
# update import graph
mgraph = self.import_graph[context_name]
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index b85c237..cfb20d7 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -382,7 +382,7 @@ def is_attr_protected(attrname):
"""return True if attribute name is protected (start with _ and some other
details), False otherwise.
"""
- return attrname[0] == '_' and not attrname == '_' and not (
+ return attrname[0] == '_' and attrname != '_' and not (
attrname.startswith('__') and attrname.endswith('__'))
def node_frame_class(node):
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index f0f0fa0..cde66eb 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -729,7 +729,7 @@ builtins. Remember that you should avoid to define new builtins when possible.'
assign = astmts[0].assign_type()
if (isinstance(assign, (astroid.For, astroid.Comprehension,
astroid.GeneratorExp))
- and not assign.statement() is node.statement()):
+ and assign.statement() is not node.statement()):
self.add_message('undefined-loop-variable', args=name, node=node)
@check_messages('redefine-in-handler')
diff --git a/pylint/graph.py b/pylint/graph.py
index 76d254c..17ff75d 100644
--- a/pylint/graph.py
+++ b/pylint/graph.py
@@ -164,7 +164,7 @@ def _get_cycles(graph_dict, path, visited, result, vertice):
index = cycle.index(start_from)
cycle = cycle[index:] + cycle[0:index]
# append it to result if not already in
- if not cycle in result:
+ if cycle not in result:
result.append(cycle)
return
path.append(vertice)
diff --git a/pylint/gui.py b/pylint/gui.py
index 8327e0e..bd332e9 100644
--- a/pylint/gui.py
+++ b/pylint/gui.py
@@ -455,7 +455,7 @@ class LintGui(object):
try:
view_history = open(HOME+HISTORY, 'r')
for hist in view_history.readlines():
- if not hist in self.filenames:
+ if hist not in self.filenames:
self.filenames.append(hist)
self.showhistory.insert(END, hist.split('\n')[0])
view_history.close()
diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py
index b9712a7..4fd86b8 100644
--- a/pylint/pyreverse/inspector.py
+++ b/pylint/pyreverse/inspector.py
@@ -57,7 +57,7 @@ def interfaces(node, herited=True, handler_func=_iface_hdlr):
implements = bases.Instance(node).getattr('__implements__')[0]
except exceptions.NotFoundError:
return
- if not herited and not implements.frame() is node:
+ if not herited and implements.frame() is not node:
return
found = set()
missing = False
diff --git a/pylint/utils.py b/pylint/utils.py
index 9cf4405..74903de 100644
--- a/pylint/utils.py
+++ b/pylint/utils.py
@@ -568,8 +568,7 @@ class FileState(object):
for msgid, lines in six.iteritems(msg_state):
for lineno, state in list(lines.items()):
original_lineno = lineno
- # pylint: disable=superfluous-parens
- if not (first <= lineno <= last):
+ if first > lineno or last < lineno:
continue
# Set state for all lines for this block, if the
# warning is applied to nodes.