summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-03-03 12:45:18 +0100
committerGitHub <noreply@github.com>2022-03-03 12:45:18 +0100
commit58706b5494efab4a3f04336c0a04ef8ad613335f (patch)
tree21e8327ed876b09efd6b58904de6ea48a787e013
parent3b8db0072402a10a3da1febf83262b3f89eda23c (diff)
downloadastroid-git-58706b5494efab4a3f04336c0a04ef8ad613335f.tar.gz
Fix F403 wildcart import used in astroid/__init__.py (#1271)
* Fix F403 wildcart import used in astroid/__init__.py And apply flake8 on setup.py and astroid/__init__.py Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--astroid/__init__.py31
-rw-r--r--astroid/exceptions.py2
-rw-r--r--astroid/nodes/scoped_nodes/scoped_nodes.py2
-rw-r--r--astroid/rebuilder.py2
-rw-r--r--pylintrc2
-rw-r--r--tests/unittest_builder.py1
-rw-r--r--tests/unittest_lookup.py1
-rw-r--r--tests/unittest_nodes.py1
-rw-r--r--tests/unittest_scoped_nodes.py2
10 files changed, 40 insertions, 6 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b7d92715..9d33a86e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -47,7 +47,7 @@ repos:
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear, flake8-typing-imports==1.12.0]
- exclude: tests/testdata|doc/conf.py|astroid/__init__.py
+ exclude: tests/testdata|doc/conf.py
- repo: local
hooks:
- id: pylint
diff --git a/astroid/__init__.py b/astroid/__init__.py
index e068cead..faa6e110 100644
--- a/astroid/__init__.py
+++ b/astroid/__init__.py
@@ -64,7 +64,36 @@ from astroid.bases import BaseInstance, BoundMethod, Instance, UnboundMethod
from astroid.brain.helpers import register_module_extender
from astroid.builder import extract_node, parse
from astroid.const import PY310_PLUS, Context, Del, Load, Store
-from astroid.exceptions import *
+from astroid.exceptions import (
+ AstroidBuildingError,
+ AstroidBuildingException,
+ AstroidError,
+ AstroidImportError,
+ AstroidIndexError,
+ AstroidSyntaxError,
+ AstroidTypeError,
+ AstroidValueError,
+ AttributeInferenceError,
+ BinaryOperationError,
+ DuplicateBasesError,
+ InconsistentMroError,
+ InferenceError,
+ InferenceOverwriteError,
+ MroError,
+ NameInferenceError,
+ NoDefault,
+ NotFoundError,
+ OperationError,
+ ParentMissingError,
+ ResolveError,
+ StatementMissing,
+ SuperArgumentTypeError,
+ SuperError,
+ TooManyLevelsError,
+ UnaryOperationError,
+ UnresolvableName,
+ UseInferenceDefault,
+)
from astroid.inference_tip import _inference_tip_cached, inference_tip
from astroid.objects import ExceptionInstance
diff --git a/astroid/exceptions.py b/astroid/exceptions.py
index b8838023..9aaaaa53 100644
--- a/astroid/exceptions.py
+++ b/astroid/exceptions.py
@@ -42,7 +42,9 @@ __all__ = (
"NoDefault",
"NotFoundError",
"OperationError",
+ "ParentMissingError",
"ResolveError",
+ "StatementMissing",
"SuperArgumentTypeError",
"SuperError",
"TooManyLevelsError",
diff --git a/astroid/nodes/scoped_nodes/scoped_nodes.py b/astroid/nodes/scoped_nodes/scoped_nodes.py
index cdaf8c39..2ef20eb0 100644
--- a/astroid/nodes/scoped_nodes/scoped_nodes.py
+++ b/astroid/nodes/scoped_nodes/scoped_nodes.py
@@ -636,8 +636,6 @@ class Module(LocalsDictNodeNG):
def statement(self, *, future: Literal[None] = ...) -> "Module":
...
- # pylint: disable-next=arguments-differ
- # https://github.com/PyCQA/pylint/issues/5264
@overload
def statement(self, *, future: Literal[True]) -> NoReturn:
...
diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py
index 141494ea..52cd8f7f 100644
--- a/astroid/rebuilder.py
+++ b/astroid/rebuilder.py
@@ -1750,6 +1750,7 @@ class TreeRebuilder:
newnode = nodes.DelAttr(node.attr, node.lineno, node.col_offset, parent)
elif context == Context.Store:
if sys.version_info >= (3, 8):
+ # pylint: disable=redefined-variable-type
newnode = nodes.AssignAttr(
attrname=node.attr,
lineno=node.lineno,
@@ -2018,6 +2019,7 @@ class TreeRebuilder:
newnode = nodes.DelName(node.id, node.lineno, node.col_offset, parent)
elif context == Context.Store:
if sys.version_info >= (3, 8):
+ # pylint: disable=redefined-variable-type
newnode = nodes.AssignName(
name=node.id,
lineno=node.lineno,
diff --git a/pylintrc b/pylintrc
index 2ca5a62d..6f9dc1f3 100644
--- a/pylintrc
+++ b/pylintrc
@@ -310,7 +310,7 @@ mixin-class-rgx=.*Mix[Ii]n
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed. Python regular
# expressions are accepted.
-generated-members=REQUEST,acl_users,aq_parent
+generated-members=REQUEST,acl_users,aq_parent,argparse.Namespace
[VARIABLES]
diff --git a/tests/unittest_builder.py b/tests/unittest_builder.py
index 205f2055..9a3e636e 100644
--- a/tests/unittest_builder.py
+++ b/tests/unittest_builder.py
@@ -715,6 +715,7 @@ class BuilderTest(unittest.TestCase):
a.custom_attr = 0
"""
builder.parse(code)
+ # pylint: disable=no-member
nonetype = nodes.const_factory(None)
self.assertNotIn("custom_attr", nonetype.locals)
self.assertNotIn("custom_attr", nonetype.instance_attrs)
diff --git a/tests/unittest_lookup.py b/tests/unittest_lookup.py
index 1555603b..19d87432 100644
--- a/tests/unittest_lookup.py
+++ b/tests/unittest_lookup.py
@@ -394,6 +394,7 @@ class LookupTest(resources.SysPathSetup, unittest.TestCase):
self.assertEqual(len(intstmts), 1)
self.assertIsInstance(intstmts[0], nodes.ClassDef)
self.assertEqual(intstmts[0].name, "int")
+ # pylint: disable=no-member
self.assertIs(intstmts[0], nodes.const_factory(1)._proxied)
def test_decorator_arguments_lookup(self) -> None:
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py
index a7735c5c..f07fd857 100644
--- a/tests/unittest_nodes.py
+++ b/tests/unittest_nodes.py
@@ -633,6 +633,7 @@ class CmpNodeTest(unittest.TestCase):
class ConstNodeTest(unittest.TestCase):
def _test(self, value: Any) -> None:
node = nodes.const_factory(value)
+ # pylint: disable=no-member
self.assertIsInstance(node._proxied, nodes.ClassDef)
self.assertEqual(node._proxied.name, value.__class__.__name__)
self.assertIs(node.value, value)
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py
index 6a95385c..25118662 100644
--- a/tests/unittest_scoped_nodes.py
+++ b/tests/unittest_scoped_nodes.py
@@ -283,7 +283,7 @@ class ModuleNodeTest(ModuleLoader, unittest.TestCase):
path = resources.find("data/all.py")
file_build = builder.AstroidBuilder().file_build(path, "all")
with self.assertRaises(AttributeError):
- # pylint: disable=pointless-statement
+ # pylint: disable=pointless-statement, no-member
file_build.file_stream
def test_stream_api(self) -> None: