|
18 | 18 | from typing import TYPE_CHECKING, Any, Literal, TypeAlias
|
19 | 19 |
|
20 | 20 | import astroid
|
| 21 | +import astroid.context |
21 | 22 | import astroid.exceptions
|
22 | 23 | import astroid.helpers
|
23 |
| -from astroid import arguments, bases, nodes, util |
| 24 | +import astroid.interpreter |
| 25 | +import astroid.modutils |
| 26 | +from astroid import arguments, bases, nodes, objects, util |
24 | 27 | from astroid.nodes import _base_nodes
|
25 | 28 | from astroid.typing import InferenceResult, SuccessfulInferenceResult
|
26 | 29 |
|
@@ -476,7 +479,7 @@ def _emit_no_member(
|
476 | 479 | # at some point during the runtime of the program.
|
477 | 480 | if utils.is_attribute_typed_annotation(owner, node.attrname):
|
478 | 481 | return False
|
479 |
| - if isinstance(owner, astroid.objects.Super): |
| 482 | + if isinstance(owner, objects.Super): |
480 | 483 | # Verify if we are dealing with an invalid Super object.
|
481 | 484 | # If it is invalid, then there's no point in checking that
|
482 | 485 | # it has the required attribute. Also, don't fail if the
|
@@ -605,9 +608,9 @@ def _determine_callable(
|
605 | 608 | callable_obj: nodes.NodeNG,
|
606 | 609 | ) -> tuple[CallableObjects, int, str]:
|
607 | 610 | # TODO: The typing of the second return variable is actually Literal[0,1]
|
608 |
| - # We need typing on astroid.NodeNG.implicit_parameters for this |
| 611 | + # We need typing on nodes.NodeNG.implicit_parameters for this |
609 | 612 | # TODO: The typing of the third return variable can be narrowed to a Literal
|
610 |
| - # We need typing on astroid.NodeNG.type for this |
| 613 | + # We need typing on nodes.NodeNG.type for this |
611 | 614 |
|
612 | 615 | # Ordering is important, since BoundMethod is a subclass of UnboundMethod,
|
613 | 616 | # and Function inherits Lambda.
|
@@ -1478,7 +1481,7 @@ def visit_call(self, node: nodes.Call) -> None:
|
1478 | 1481 |
|
1479 | 1482 | # Build the set of keyword arguments, checking for duplicate keywords,
|
1480 | 1483 | # and count the positional arguments.
|
1481 |
| - call_site = astroid.arguments.CallSite.from_call(node) |
| 1484 | + call_site = arguments.CallSite.from_call(node) |
1482 | 1485 |
|
1483 | 1486 | # Warn about duplicated keyword arguments, such as `f=24, **{'f': 24}`
|
1484 | 1487 | for keyword in call_site.duplicated_keywords:
|
@@ -1853,7 +1856,7 @@ def _check_invalid_slice_index(self, node: nodes.Slice) -> None:
|
1853 | 1856 | nodes.List,
|
1854 | 1857 | nodes.Dict,
|
1855 | 1858 | nodes.Tuple,
|
1856 |
| - astroid.objects.FrozenSet, |
| 1859 | + objects.FrozenSet, |
1857 | 1860 | nodes.Set,
|
1858 | 1861 | )
|
1859 | 1862 | if not (
|
@@ -1883,15 +1886,15 @@ def visit_with(self, node: nodes.With) -> None:
|
1883 | 1886 | match inferred := safe_infer(ctx_mgr, context=context):
|
1884 | 1887 | case _ if not inferred:
|
1885 | 1888 | continue
|
1886 |
| - case astroid.bases.Generator(): |
| 1889 | + case bases.Generator(): |
1887 | 1890 | # Check if we are dealing with a function decorated
|
1888 | 1891 | # with contextlib.contextmanager.
|
1889 | 1892 | if decorated_with(
|
1890 | 1893 | inferred.parent, self.linter.config.contextmanager_decorators
|
1891 | 1894 | ):
|
1892 | 1895 | continue
|
1893 | 1896 | # Check if it's an AsyncGenerator decorated with asynccontextmanager
|
1894 |
| - if isinstance(inferred, astroid.bases.AsyncGenerator): |
| 1897 | + if isinstance(inferred, bases.AsyncGenerator): |
1895 | 1898 | async_decorators = ["contextlib.asynccontextmanager"]
|
1896 | 1899 | if decorated_with(inferred.parent, async_decorators):
|
1897 | 1900 | self.add_message(
|
|
0 commit comments