diff options
| author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-12-20 12:08:52 +0100 |
|---|---|---|
| committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-12-20 12:08:52 +0100 |
| commit | 6aca4e0d891d7a13d9712d9f1f8b0006ae1a87d8 (patch) | |
| tree | 8aaf5a9d10a771ac277b93d0006321d97623821e /checkers | |
| parent | 36f2b53088fbb3c02708a6495ba97a85d99469cb (diff) | |
| download | pylint-6aca4e0d891d7a13d9712d9f1f8b0006ae1a87d8.tar.gz | |
[py3] various fixes for python3
Diffstat (limited to 'checkers')
| -rw-r--r-- | checkers/base.py | 8 | ||||
| -rw-r--r-- | checkers/format.py | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/checkers/base.py b/checkers/base.py index de40c4c..61ec528 100644 --- a/checkers/base.py +++ b/checkers/base.py @@ -84,7 +84,10 @@ def _loop_exits_early(loop): return True return False - +if sys.version_info < (3, 0): + PROPERTY_CLASSES = set(('__builtin__.property', 'abc.abstractproperty')) +else: + PROPERTY_CLASSES = set(('builtins.property', 'abc.abstractproperty')) def _determine_function_name_type(node): """Determine the name type whose regex the a function's name should match. @@ -105,8 +108,7 @@ def _determine_function_name_type(node): (isinstance(decorator, astroid.Getattr) and decorator.attrname == 'abstractproperty')): infered = safe_infer(decorator) - if (infered and - infered.qname() in ('__builtin__.property', 'abc.abstractproperty')): + if infered and infered.qname() in PROPERTY_CLASSES: return 'attr' # If the function is decorated using the prop_method.{setter,getter} # form, treat it like an attribute as well. diff --git a/checkers/format.py b/checkers/format.py index f307f33..45a7477 100644 --- a/checkers/format.py +++ b/checkers/format.py @@ -36,7 +36,9 @@ from pylint.checkers.utils import check_messages from pylint.utils import WarningScope, OPTION_RGX _KEYWORD_TOKENS = ['assert', 'del', 'elif', 'except', 'for', 'if', 'in', 'not', - 'print', 'raise', 'return', 'while', 'yield'] + 'raise', 'return', 'while', 'yield'] +if sys.version_info < (3, 0): + _KEYWORD_TOKENS.append('print') _SPACED_OPERATORS = ['==', '<', '>', '!=', '<>', '<=', '>=', '+=', '-=', '*=', '**=', '/=', '//=', '&=', '|=', '^=', |
