summaryrefslogtreecommitdiff
path: root/checkers/classes.py
diff options
context:
space:
mode:
authorcpopa <devnull@localhost>2013-09-02 18:35:59 +0300
committercpopa <devnull@localhost>2013-09-02 18:35:59 +0300
commit7a2e295ed49e8d41480c1c125554d19d18d6bdaf (patch)
tree4168e48e1081b8cc10df6e574a7e75b72683bf6d /checkers/classes.py
parent85cf8667b5907ab35097d9b3b67085e186dfe584 (diff)
downloadpylint-7a2e295ed49e8d41480c1c125554d19d18d6bdaf.tar.gz
Use NEXT_METHOD globally.
Diffstat (limited to 'checkers/classes.py')
-rw-r--r--checkers/classes.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/checkers/classes.py b/checkers/classes.py
index 5770679..b03b715 100644
--- a/checkers/classes.py
+++ b/checkers/classes.py
@@ -26,7 +26,10 @@ from pylint.checkers import BaseChecker
from pylint.checkers.utils import (PYMETHODS, overrides_a_method,
check_messages, is_attr_private, is_attr_protected, node_frame_class)
-_PY3K = sys.version_info >= (3, 0)
+if sys.version_info >= (3, 0):
+ NEXT_METHOD = '__next__'
+else:
+ NEXT_METHOD = 'next'
def class_is_abstract(node):
"""return true if the given class node should be considered as an abstract
@@ -329,17 +332,13 @@ a metaclass class method.'}
except astroid.InferenceError:
return
- if _PY3K:
- next = '__next__'
- else:
- next = 'next'
for infered_node in infered:
if (infered_node is YES
or isinstance(infered_node, Generator)):
continue
if isinstance(infered_node, astroid.Instance):
try:
- infered_node.local_attr(next)
+ infered_node.local_attr(NEXT_METHOD)
except astroid.NotFoundError:
self.add_message('non-iterator-returned',
node=node)