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/strings.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/strings.py')
-rw-r--r-- | pylint/checkers/strings.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pylint/checkers/strings.py b/pylint/checkers/strings.py index 5fb9a44..31f025d 100644 --- a/pylint/checkers/strings.py +++ b/pylint/checkers/strings.py @@ -24,7 +24,6 @@ import string import numbers import astroid -from astroid import helpers from pylint.interfaces import ITokenChecker, IAstroidChecker, IRawChecker from pylint.checkers import BaseChecker, BaseTokenChecker @@ -206,7 +205,7 @@ def get_args(callfunc): is the keyword arguments in a dict. """ if callfunc.keywords: - named = {arg.arg: helpers.safe_infer(arg.value) + named = {arg.arg: utils.safe_infer(arg.value) for arg in callfunc.keywords} else: named = {} @@ -333,12 +332,12 @@ class StringMethodsChecker(BaseChecker): @check_messages(*(MSGS.keys())) def visit_call(self, node): - func = helpers.safe_infer(node.func) + func = utils.safe_infer(node.func) if (isinstance(func, astroid.BoundMethod) and isinstance(func.bound, astroid.Instance) and func.bound.name in ('str', 'unicode', 'bytes')): if func.name in ('strip', 'lstrip', 'rstrip') and node.args: - arg = helpers.safe_infer(node.args[0]) + arg = utils.safe_infer(node.args[0]) if not isinstance(arg, astroid.Const): return if len(arg.value) != len(set(arg.value)): |