From cb96c1029c12469f254d53a01fb0fa2053b5314d Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Wed, 25 Nov 2015 19:56:43 +0200 Subject: Fix some docstrings and the Python 3 tests --- pylint/checkers/imports.py | 8 +++++--- pylint/test/functional/abstract_class_instantiated_py34.py | 4 ++-- pylint/test/functional/class_members_py30.py | 2 +- pylint/test/functional/undefined_variable_py30.py | 2 +- pylint/test/input/func_unused_import_py30.py | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index bc8efa1..e77522b 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -182,7 +182,7 @@ MSGS = { 'detected.'), 'C0411': ('%s comes before %s', 'wrong-import-order', - 'Used when PEP8 import order is not observed (standard imports ' + 'Used when PEP8 import order is not respected (standard imports ' 'first, then third-party libraries, then local imports)'), 'C0412': ('Imports from package %s are not grouped', 'ungrouped-imports', @@ -334,9 +334,10 @@ given file (report RP0402 must not be disabled)'} @check_messages('wrong-import-order', 'ungrouped-imports') def leave_module(self, node): - # check imports are grouped by category (standard, 3rd party, local) + # Check imports are grouped by category (standard, 3rd party, local) std_imports, ext_imports, loc_imports = self._check_imports_order(node) - # check imports are grouped by package within a given category + + # Check imports are grouped by package within a given category met = set() curr_package = None for imp in std_imports + ext_imports + loc_imports: @@ -345,6 +346,7 @@ given file (report RP0402 must not be disabled)'} self.add_message('ungrouped-imports', node=imp[0], args=package) curr_package = package met.add(package) + self._imports_stack = [] self._first_non_import_node = None diff --git a/pylint/test/functional/abstract_class_instantiated_py34.py b/pylint/test/functional/abstract_class_instantiated_py34.py index 4dadef4..e24ad28 100644 --- a/pylint/test/functional/abstract_class_instantiated_py34.py +++ b/pylint/test/functional/abstract_class_instantiated_py34.py @@ -5,10 +5,10 @@ defines abstract methods. # pylint: disable=too-few-public-methods, missing-docstring, no-init -__revision__ = 0 - import abc + + class BadClass(abc.ABC): @abc.abstractmethod def test(self): diff --git a/pylint/test/functional/class_members_py30.py b/pylint/test/functional/class_members_py30.py index 8c27703..ee33988 100644 --- a/pylint/test/functional/class_members_py30.py +++ b/pylint/test/functional/class_members_py30.py @@ -1,5 +1,5 @@ """ Various tests for class members access. """ -# pylint: disable=R0903,import-error,no-init,missing-docstring +# pylint: disable=R0903,import-error,no-init,missing-docstring, wrong-import-position,wrong-import-order from missing import Missing class MyClass(object): """class docstring""" diff --git a/pylint/test/functional/undefined_variable_py30.py b/pylint/test/functional/undefined_variable_py30.py index 712a096..3695cf1 100644 --- a/pylint/test/functional/undefined_variable_py30.py +++ b/pylint/test/functional/undefined_variable_py30.py @@ -1,7 +1,7 @@ """Test warnings about access to undefined variables for various Python 3 constructs. """ # pylint: disable=too-few-public-methods, no-init, no-self-use - +# pylint: disable=wrong-import-position class Undefined: """ test various annotation problems. """ diff --git a/pylint/test/input/func_unused_import_py30.py b/pylint/test/input/func_unused_import_py30.py index d7a38c5..0ea2c9b 100644 --- a/pylint/test/input/func_unused_import_py30.py +++ b/pylint/test/input/func_unused_import_py30.py @@ -1,6 +1,6 @@ """check unused import for metaclasses """ -# pylint: disable=too-few-public-methods +# pylint: disable=too-few-public-methods,wrong-import-position,ungrouped-imports __revision__ = 1 import abc import sys -- cgit v1.2.1