summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2023-04-30 17:16:00 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2023-04-30 22:27:15 +0200
commit20af688144096e2079623afdf33ed0156779a846 (patch)
treeaef244cb72aed172faec15e465501d08a5396290
parente970218f6f591264f2b0512f46609c78e257e0b7 (diff)
downloadastroid-git-20af688144096e2079623afdf33ed0156779a846.tar.gz
Fix some typing issues
-rw-r--r--astroid/helpers.py6
-rw-r--r--astroid/inference.py4
-rw-r--r--astroid/nodes/node_classes.py2
-rw-r--r--astroid/transforms.py2
4 files changed, 7 insertions, 7 deletions
diff --git a/astroid/helpers.py b/astroid/helpers.py
index 15eac27a..63275813 100644
--- a/astroid/helpers.py
+++ b/astroid/helpers.py
@@ -18,7 +18,7 @@ from astroid.exceptions import (
_NonDeducibleTypeHierarchy,
)
from astroid.nodes import scoped_nodes
-from astroid.typing import InferenceResult, SuccessfulInferenceResult
+from astroid.typing import InferenceResult
def _build_proxy_class(cls_name: str, builtins: nodes.Module) -> nodes.ClassDef:
@@ -43,7 +43,7 @@ def _function_type(
def _object_type(
- node: SuccessfulInferenceResult, context: InferenceContext | None = None
+ node: InferenceResult, context: InferenceContext | None = None
) -> Generator[InferenceResult | None, None, None]:
astroid_manager = manager.AstroidManager()
builtins = astroid_manager.builtins_module
@@ -75,7 +75,7 @@ def _object_type(
def object_type(
- node: SuccessfulInferenceResult, context: InferenceContext | None = None
+ node: InferenceResult, context: InferenceContext | None = None
) -> InferenceResult | None:
"""Obtain the type of the given node.
diff --git a/astroid/inference.py b/astroid/inference.py
index e18ac69f..4dadc116 100644
--- a/astroid/inference.py
+++ b/astroid/inference.py
@@ -1009,7 +1009,7 @@ UNINFERABLE_OPS = {
}
-def _to_literal(node: nodes.NodeNG) -> Any:
+def _to_literal(node: SuccessfulInferenceResult) -> Any:
# Can raise SyntaxError or ValueError from ast.literal_eval
# Can raise AttributeError from node.as_string() as not all nodes have a visitor
# Is this the stupidest idea or the simplest idea?
@@ -1017,7 +1017,7 @@ def _to_literal(node: nodes.NodeNG) -> Any:
def _do_compare(
- left_iter: Iterable[nodes.NodeNG], op: str, right_iter: Iterable[nodes.NodeNG]
+ left_iter: Iterable[InferenceResult], op: str, right_iter: Iterable[InferenceResult]
) -> bool | util.UninferableBase:
"""
If all possible combinations are either True or False, return that:
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py
index 2c28c7bc..db0c50d6 100644
--- a/astroid/nodes/node_classes.py
+++ b/astroid/nodes/node_classes.py
@@ -286,7 +286,7 @@ class BaseContainer(_base_nodes.ParentAssignNode, Instance, metaclass=abc.ABCMet
:param end_col_offset: The end column this node appears on in the
source code. Note: This is after the last symbol.
"""
- self.elts: list[NodeNG] = []
+ self.elts: list[SuccessfulInferenceResult] = []
"""The elements in the node."""
super().__init__(
diff --git a/astroid/transforms.py b/astroid/transforms.py
index 44899b6e..840c1b11 100644
--- a/astroid/transforms.py
+++ b/astroid/transforms.py
@@ -145,7 +145,7 @@ class TransformVisitor:
"""Unregister the given transform."""
self.transforms[node_class].remove((transform, predicate)) # type: ignore[index, arg-type]
- def visit(self, module: nodes.Module) -> SuccessfulInferenceResult:
+ def visit(self, module: nodes.NodeNG) -> SuccessfulInferenceResult:
"""Walk the given astroid *tree* and transform each encountered node.
Only the nodes which have transforms registered will actually