diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2019-10-11 12:17:10 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-10-11 12:19:51 +0200 |
commit | 73babe3d536ffc4da94e59c705eb6a8c3e5822ef (patch) | |
tree | f7bd58c91f6af50cf86caf296146bd239037e3ed | |
parent | 2982861826e5955e2e5597f1a3b125ddf9106fa4 (diff) | |
download | astroid-git-73babe3d536ffc4da94e59c705eb6a8c3e5822ef.tar.gz |
Fix lint warnings
-rw-r--r-- | astroid/bases.py | 1 | ||||
-rw-r--r-- | astroid/helpers.py | 1 | ||||
-rw-r--r-- | astroid/interpreter/objectmodel.py | 11 | ||||
-rw-r--r-- | astroid/manager.py | 7 | ||||
-rw-r--r-- | astroid/tests/unittest_builder.py | 15 |
5 files changed, 17 insertions, 18 deletions
diff --git a/astroid/bases.py b/astroid/bases.py index c1007449..d5b042a0 100644 --- a/astroid/bases.py +++ b/astroid/bases.py @@ -404,6 +404,7 @@ class BoundMethod(UnboundMethod): a subtype of ``type``, the name needs to be a string, the bases needs to be a tuple of classes """ + # pylint: disable=import-outside-toplevel; circular import from astroid import node_classes # Verify the metaclass diff --git a/astroid/helpers.py b/astroid/helpers.py index 942b0a02..749a2389 100644 --- a/astroid/helpers.py +++ b/astroid/helpers.py @@ -240,6 +240,7 @@ def object_len(node, context=None): or if multiple nodes are inferred :rtype int: Integer length of node """ + # pylint: disable=import-outside-toplevel; circular import from astroid.objects import FrozenSet inferred_node = safe_infer(node, context=context) diff --git a/astroid/interpreter/objectmodel.py b/astroid/interpreter/objectmodel.py index cc4a2ba4..5e488d9d 100644 --- a/astroid/interpreter/objectmodel.py +++ b/astroid/interpreter/objectmodel.py @@ -280,6 +280,7 @@ class FunctionModel(ObjectModel): @property def attr___get__(self): + # pylint: disable=import-outside-toplevel; circular import from astroid import bases func = self._instance @@ -425,6 +426,7 @@ class ClassModel(ObjectModel): target=self._instance, attribute="mro" ) + # pylint: disable=import-outside-toplevel; circular import from astroid import bases other_self = self @@ -449,6 +451,7 @@ class ClassModel(ObjectModel): @property def attr___class__(self): + # pylint: disable=import-outside-toplevel; circular import from astroid import helpers return helpers.object_type(self._instance) @@ -460,6 +463,7 @@ class ClassModel(ObjectModel): This looks only in the current module for retrieving the subclasses, thus it might miss a couple of them. """ + # pylint: disable=import-outside-toplevel; circular import from astroid import bases from astroid import scoped_nodes @@ -513,6 +517,7 @@ class SuperModel(ObjectModel): class UnboundMethodModel(ObjectModel): @property def attr___class__(self): + # pylint: disable=import-outside-toplevel; circular import from astroid import helpers return helpers.object_type(self._instance) @@ -701,10 +706,10 @@ class DictModel(ObjectModel): elems.append(elem) obj.postinit(elts=elems) + # pylint: disable=import-outside-toplevel; circular import from astroid import objects obj = objects.DictItems(obj) - return self._generic_dict_attribute(obj, "items") @property @@ -713,10 +718,10 @@ class DictModel(ObjectModel): obj = node_classes.List(parent=self._instance) obj.postinit(elts=keys) + # pylint: disable=import-outside-toplevel; circular import from astroid import objects obj = objects.DictKeys(obj) - return self._generic_dict_attribute(obj, "keys") @property @@ -726,8 +731,8 @@ class DictModel(ObjectModel): obj = node_classes.List(parent=self._instance) obj.postinit(values) + # pylint: disable=import-outside-toplevel; circular import from astroid import objects obj = objects.DictValues(obj) - return self._generic_dict_attribute(obj, "values") diff --git a/astroid/manager.py b/astroid/manager.py index cca7cc50..e5fd0d6b 100644 --- a/astroid/manager.py +++ b/astroid/manager.py @@ -89,6 +89,7 @@ class AstroidManager: ): return self.astroid_cache[modname] if source: + # pylint: disable=import-outside-toplevel; circular import from astroid.builder import AstroidBuilder return AstroidBuilder(self).file_build(filepath, modname) @@ -99,11 +100,13 @@ class AstroidManager: ) def _build_stub_module(self, modname): + # pylint: disable=import-outside-toplevel; circular import from astroid.builder import AstroidBuilder return AstroidBuilder(self).string_build("", modname) def _build_namespace_module(self, modname, path): + # pylint: disable=import-outside-toplevel; circular import from astroid.builder import build_namespace_package_module return build_namespace_package_module(modname, path) @@ -185,6 +188,8 @@ class AstroidManager: def zip_import_data(self, filepath): if zipimport is None: return None + + # pylint: disable=import-outside-toplevel; circular import from astroid.builder import AstroidBuilder builder = AstroidBuilder(self) @@ -237,6 +242,8 @@ class AstroidManager: return self.ast_from_file(filepath, modname) except AttributeError: pass + + # pylint: disable=import-outside-toplevel; circular import from astroid.builder import AstroidBuilder return AstroidBuilder(self).module_build(module, modname) diff --git a/astroid/tests/unittest_builder.py b/astroid/tests/unittest_builder.py index 66643889..54d40420 100644 --- a/astroid/tests/unittest_builder.py +++ b/astroid/tests/unittest_builder.py @@ -302,21 +302,6 @@ class BuilderTest(unittest.TestCase): self.assertTrue(time_ast) self.assertEqual(time_ast["time"].args.defaults, []) - if os.name == "java": - test_inspect_build1 = unittest.expectedFailure(test_inspect_build1) - - def test_inspect_build2(self): - """test astroid tree build from a living object""" - try: - from mx import DateTime - except ImportError: - self.skipTest("test skipped: mxDateTime is not available") - else: - dt_ast = self.builder.inspect_build(DateTime) - dt_ast.getattr("DateTime") - # this one is failing since DateTimeType.__module__ = 'builtins' ! - # dt_ast.getattr('DateTimeType') - def test_inspect_build3(self): self.builder.inspect_build(unittest) |