diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-19 17:46:42 +0200 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-19 17:46:42 +0200 |
| commit | da0276ffb914ee2f9f34a4ae5f492c3dddbb17d6 (patch) | |
| tree | 4845376f05ccc0640c31411eaa937ce93dcff7f4 | |
| parent | f0778c57516a89fc1e82d7e32ad533275e55e44d (diff) | |
| download | astroid-git-da0276ffb914ee2f9f34a4ae5f492c3dddbb17d6.tar.gz | |
Fix pylint errors.
--HG--
branch : 1.4.0
| -rw-r--r-- | astroid/as_string.py | 2 | ||||
| -rw-r--r-- | astroid/nodes.py | 2 | ||||
| -rw-r--r-- | astroid/objects.py | 2 | ||||
| -rw-r--r-- | astroid/rebuilder.py | 5 | ||||
| -rw-r--r-- | astroid/scoped_nodes.py | 4 | ||||
| -rw-r--r-- | astroid/tests/unittest_brain.py | 2 | ||||
| -rw-r--r-- | astroid/tests/unittest_inference.py | 18 | ||||
| -rw-r--r-- | astroid/tests/unittest_nodes.py | 7 | ||||
| -rw-r--r-- | astroid/tests/unittest_python3.py | 3 |
9 files changed, 17 insertions, 28 deletions
diff --git a/astroid/as_string.py b/astroid/as_string.py index 704d6f1d..d872d47e 100644 --- a/astroid/as_string.py +++ b/astroid/as_string.py @@ -522,7 +522,7 @@ class AsStringVisitor3k(AsStringVisitor): def visit_await(self, node): return 'await %s' % node.value.accept(self) - + def visit_asyncwith(self, node): return 'async %s' % self.visit_with(node) diff --git a/astroid/nodes.py b/astroid/nodes.py index a6b3c399..2fd6cb65 100644 --- a/astroid/nodes.py +++ b/astroid/nodes.py @@ -70,7 +70,7 @@ ALL_NODE_CLASSES = ( Decorators, DelAttr, DelName, Delete, Dict, DictComp, DictUnpack, Expr, Ellipsis, EmptyNode, ExceptHandler, Exec, ExtSlice, - For, ImportFrom, FunctionDef, + For, ImportFrom, FunctionDef, Attribute, GeneratorExp, Global, If, IfExp, Import, Index, Keyword, diff --git a/astroid/objects.py b/astroid/objects.py index 70e0d825..089f43fe 100644 --- a/astroid/objects.py +++ b/astroid/objects.py @@ -31,7 +31,7 @@ import six from astroid import MANAGER from astroid.bases import ( BUILTINS, NodeNG, Instance, _infer_stmts, - BoundMethod, UnboundMethod, + BoundMethod, ) from astroid.decorators import cachedproperty from astroid.exceptions import ( diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py index b89a17d1..d0db01cd 100644 --- a/astroid/rebuilder.py +++ b/astroid/rebuilder.py @@ -22,9 +22,8 @@ order to get a single Astroid representation import sys import _ast from _ast import ( - Expr, Str, # binary operators - Add, BinOp, Div, FloorDiv, Mod, Mult, Pow, Sub, BitAnd, BitOr, BitXor, + Add, Div, FloorDiv, Mod, Mult, Pow, Sub, BitAnd, BitOr, BitXor, LShift, RShift, # logical operators And, Or, @@ -342,7 +341,7 @@ class TreeRebuilder(object): keywords.append(new_kwargs) else: keywords = [new_kwargs] - + newnode.args = args newnode.keywords = keywords return newnode diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py index f03c7625..d2daba50 100644 --- a/astroid/scoped_nodes.py +++ b/astroid/scoped_nodes.py @@ -22,12 +22,8 @@ new local scope in the language definition : Module, ClassDef, FunctionDef (and Lambda, GeneratorExp, DictComp and SetComp to some extent). """ -from __future__ import print_function -import inspect - import io import itertools -import sys import warnings import six diff --git a/astroid/tests/unittest_brain.py b/astroid/tests/unittest_brain.py index 21bd359f..3520b49e 100644 --- a/astroid/tests/unittest_brain.py +++ b/astroid/tests/unittest_brain.py @@ -435,7 +435,7 @@ class EnumBrainTest(unittest.TestCase): inferred_cls = next(cls.infer()) self.assertIsInstance(inferred_cls, nodes.ClassDef) inferred_instance = next(instance.infer()) - self.assertIsInstance(inferred_instance, bases.Instance) + self.assertIsInstance(inferred_instance, bases.Instance) @unittest.skipUnless(HAS_DATEUTIL, "This test requires the dateutil library.") diff --git a/astroid/tests/unittest_inference.py b/astroid/tests/unittest_inference.py index aa3a829b..1d3c623f 100644 --- a/astroid/tests/unittest_inference.py +++ b/astroid/tests/unittest_inference.py @@ -17,7 +17,6 @@ # with astroid. If not, see <http://www.gnu.org/licenses/>. """tests for the astroid inference capabilities """ -import os import sys from functools import partial import unittest @@ -31,7 +30,6 @@ from astroid.inference import infer_end as inference_infer_end from astroid.bases import Instance, BoundMethod, UnboundMethod,\ path_wrapper, BUILTINS from astroid import arguments -from astroid import context from astroid import objects from astroid import test_utils from astroid import util @@ -1811,7 +1809,7 @@ class ArgumentsTest(unittest.TestCase): ''') for node, expected_value in zip(ast_nodes, expected_values): inferred = next(node.infer()) - self.assertIsInstance(inferred, nodes.Tuple) + self.assertIsInstance(inferred, nodes.Tuple) self.assertEqual(self._get_tuple_value(inferred), expected_value) @test_utils.require_version('3.5') @@ -1828,7 +1826,7 @@ class ArgumentsTest(unittest.TestCase): ''') for node, expected_value in zip(ast_nodes, expected_values): inferred = next(node.infer()) - self.assertIsInstance(inferred, nodes.Tuple) + self.assertIsInstance(inferred, nodes.Tuple) self.assertEqual(self._get_tuple_value(inferred), expected_value) def test_defaults(self): @@ -1872,7 +1870,7 @@ class ArgumentsTest(unittest.TestCase): expected = [ [('a', 1), ('b', 2), ('c', 3)], [('a', 1)], - [('a', 'b')], + [('a', 'b')], ] ast_nodes = test_utils.extract_node(''' def test(**kwargs): @@ -1923,7 +1921,7 @@ class ArgumentsTest(unittest.TestCase): for ast_node, value in zip(ast_nodes, expected_values): inferred = next(ast_node.infer()) self.assertIsInstance(inferred, nodes.Const) - self.assertEqual(inferred.value, value) + self.assertEqual(inferred.value, value) def test_infer_call_result_invalid_dunder_call_on_instance(self): ast_nodes = test_utils.extract_node(''' @@ -1952,7 +1950,7 @@ class ArgumentsTest(unittest.TestCase): flow['app'] = AttributeDict() flow['app']['config'] = AttributeDict() flow['app']['config']['doffing'] = AttributeDict() #@ - ''') + ''') self.assertIsNone(util.safe_infer(ast_node.targets[0])) def test_classmethod_inferred_by_context(self): @@ -2032,7 +2030,7 @@ class ArgumentsTest(unittest.TestCase): def test(*args): return args test(*unknown) #@ ''') - for node in ast_nodes: + for node in ast_nodes: inferred = next(node.infer()) self.assertEqual(inferred, util.YES) @@ -2105,9 +2103,7 @@ class CallSiteTest(unittest.TestCase): values = [ "f()", "f(*(1, ))", "f(1, 2, *(2, 3))", ] - self._test_call_site_valid_arguments(values, invalid=False) - - + self._test_call_site_valid_arguments(values, invalid=False) def test_duplicated_keyword_arguments(self): ast_node = test_utils.extract_node('f(f=24, **{"f": 25})') diff --git a/astroid/tests/unittest_nodes.py b/astroid/tests/unittest_nodes.py index 43a572ce..70f6d9c9 100644 --- a/astroid/tests/unittest_nodes.py +++ b/astroid/tests/unittest_nodes.py @@ -649,7 +649,7 @@ class AliasesTest(unittest.TestCase): self.assertIsInstance(module.body[5].value, nodes.Attribute) self.assertEqual(module.body[6].value.elt.value, 2) self.assertIsInstance(module.body[6].value, nodes.GeneratorExp) - + @unittest.skipIf(six.PY3, "Python 3 doesn't have Repr nodes.") def test_repr(self): def test_backquote(node): @@ -678,7 +678,7 @@ class DeprecationWarningsTest(unittest.TestCase): parent_assign_type_mixin = module.body[2] warnings.simplefilter('always') - + with warnings.catch_warnings(record=True) as w: filter_stmts_mixin.ass_type() self.assertIsInstance(w[0].message, PendingDeprecationWarning) @@ -704,7 +704,7 @@ class DeprecationWarningsTest(unittest.TestCase): @test_utils.require_version('3.5') class Python35AsyncTest(unittest.TestCase): - + def test_async_await_keywords(self): async_def, async_for, async_with, await_node = test_utils.extract_node(''' async def func(): #@ @@ -745,7 +745,6 @@ class Python35AsyncTest(unittest.TestCase): await 42 ''') self._test_await_async_as_string(code) - if __name__ == '__main__': diff --git a/astroid/tests/unittest_python3.py b/astroid/tests/unittest_python3.py index ec875993..87010571 100644 --- a/astroid/tests/unittest_python3.py +++ b/astroid/tests/unittest_python3.py @@ -233,7 +233,7 @@ class Python3TC(unittest.TestCase): self.assertEqual(node.as_string(), code) keys = [key for (key, _) in node.items] self.assertIsInstance(keys[0], nodes.Const) - self.assertIsInstance(keys[1], nodes.DictUnpack) + self.assertIsInstance(keys[1], nodes.DictUnpack) @require_version('3.5') def test_nested_unpacking_in_dicts(self): @@ -248,7 +248,6 @@ class Python3TC(unittest.TestCase): value = node.getitem(key) self.assertIsInstance(value, nodes.Const) self.assertEqual(value.value, expected) - if __name__ == '__main__': |
