Skip to content

Fix F403 wildcart import used in astroid/__init__.py #1271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 30 additions & 1 deletion astroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,36 @@
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

Expand Down
2 changes: 2 additions & 0 deletions astroid/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
"NoDefault",
"NotFoundError",
"OperationError",
"ParentMissingError",
"ResolveError",
"StatementMissing",
"SuperArgumentTypeError",
"SuperError",
"TooManyLevelsError",
Expand Down
2 changes: 0 additions & 2 deletions astroid/nodes/scoped_nodes/scoped_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,6 @@ def fully_defined(self):
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:
...
Expand Down
2 changes: 2 additions & 0 deletions astroid/rebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@ def visit_attribute(
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,
Expand Down Expand Up @@ -2018,6 +2019,7 @@ def visit_name(
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,
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions tests/unittest_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ def func2(a={}):
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)
Expand Down
1 change: 1 addition & 0 deletions tests/unittest_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def test_builtin_lookup(self) -> None:
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:
Expand Down
1 change: 1 addition & 0 deletions tests/unittest_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ def test_as_string(self) -> None:
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)
Expand Down
2 changes: 1 addition & 1 deletion tests/unittest_scoped_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_file_stream_api(self) -> None:
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:
Expand Down