diff options
| author | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-03-12 10:48:00 +0100 |
|---|---|---|
| committer | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-03-12 12:02:55 +0100 |
| commit | a38806022d90c3d1d8c4b31af2cab8463c0bc4fc (patch) | |
| tree | 9b9a990797f71e34d3247d6b666646658dd540f2 | |
| parent | 7557b396327c775a423b74788fa4685138b1b324 (diff) | |
| download | astroid-git-a38806022d90c3d1d8c4b31af2cab8463c0bc4fc.tar.gz | |
Move ``InferFn`` to ``typing.py``
| -rw-r--r-- | astroid/inference_tip.py | 2 | ||||
| -rw-r--r-- | astroid/nodes/node_ng.py | 3 | ||||
| -rw-r--r-- | astroid/typing.py | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/astroid/inference_tip.py b/astroid/inference_tip.py index 0c12dd11..f74ff235 100644 --- a/astroid/inference_tip.py +++ b/astroid/inference_tip.py @@ -11,8 +11,8 @@ import wrapt from astroid import bases, util from astroid.exceptions import InferenceOverwriteError, UseInferenceDefault from astroid.nodes import NodeNG +from astroid.typing import InferFn -InferFn = typing.Callable[..., typing.Any] InferOptions = typing.Union[ NodeNG, bases.Instance, bases.UnboundMethod, typing.Type[util.Uninferable] ] diff --git a/astroid/nodes/node_ng.py b/astroid/nodes/node_ng.py index 1972a075..fcbe6100 100644 --- a/astroid/nodes/node_ng.py +++ b/astroid/nodes/node_ng.py @@ -33,6 +33,7 @@ from astroid.manager import AstroidManager from astroid.nodes.as_string import AsStringVisitor from astroid.nodes.const import OP_PRECEDENCE from astroid.nodes.utils import Position +from astroid.typing import InferFn if TYPE_CHECKING: from astroid import nodes @@ -88,7 +89,7 @@ class NodeNG: _other_other_fields: ClassVar[typing.Tuple[str, ...]] = () """Attributes that contain AST-dependent fields.""" # instance specific inference function infer(node, context) - _explicit_inference = None + _explicit_inference: Optional[InferFn] = None def __init__( self, diff --git a/astroid/typing.py b/astroid/typing.py index 0944a0eb..32d01dde 100644 --- a/astroid/typing.py +++ b/astroid/typing.py @@ -3,7 +3,7 @@ # Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt import sys -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any, Callable if TYPE_CHECKING: from astroid import nodes @@ -22,3 +22,6 @@ class InferenceErrorInfo(TypedDict): node: "nodes.NodeNG" context: "InferenceContext | None" + + +InferFn = Callable[..., Any] |
