diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-20 12:52:19 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-20 12:52:19 +0200 |
commit | fb6b47b10084423e6c43a30538cb8eca39ce7408 (patch) | |
tree | ba07148af593966260188a6b09fddcd4379a95f6 /pylint/checkers/classes.py | |
parent | f137fdb1f38054fc5a1a967dbe6ff37a12ab9adb (diff) | |
download | pylint-fb6b47b10084423e6c43a30538cb8eca39ce7408.tar.gz |
Import has_known_bases and safe_infer back into pylint from astroid, until the latter stabilizes its API.
Currently astroid goes into a total revamp, having a couple of development branches with partially
incompatible APIs, which means that pylint can't rely on the exact location of has_known_bases
and safe_infer until astroid reaches a new major release. With this in mind, these two
functions are backported in pylint again.
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 5e941c5..2dc45e1 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -25,7 +25,6 @@ from astroid.bases import Generator, BUILTINS from astroid.exceptions import InconsistentMroError, DuplicateBasesError from astroid import objects from astroid.scoped_nodes import function_to_method -from astroid import helpers from pylint.interfaces import IAstroidChecker from pylint.checkers import BaseChecker @@ -34,7 +33,8 @@ from pylint.checkers.utils import ( overrides_a_method, check_messages, is_attr_private, is_attr_protected, node_frame_class, is_builtin_object, decorated_with_property, unimplemented_abstract_methods, - decorated_with, class_is_abstract) + decorated_with, class_is_abstract, + safe_infer, has_known_bases) from pylint.utils import deprecated_option, get_global_option import six @@ -353,7 +353,7 @@ a metaclass class method.'} self._accessed.append(defaultdict(list)) self._check_bases_classes(node) # if not an exception or a metaclass - if node.type == 'class' and helpers.has_known_bases(node): + if node.type == 'class' and has_known_bases(node): try: node.local_attr('__init__') except astroid.NotFoundError: @@ -382,7 +382,7 @@ a metaclass class method.'} a class or a type. """ for base in node.bases: - ancestor = helpers.safe_infer(base) + ancestor = safe_infer(base) if ancestor in (astroid.YES, None): continue if (isinstance(ancestor, astroid.Instance) and @@ -602,7 +602,7 @@ a metaclass class method.'} """ Check that the given assattr node is defined in the class slots. """ - infered = helpers.safe_infer(node.expr) + infered = safe_infer(node.expr) if infered and isinstance(infered, astroid.Instance): klass = infered._proxied if '__slots__' not in klass.locals or not klass.newstyle: |