Skip to content

Commit a388060

Browse files
committed
Move InferFn to typing.py
1 parent 7557b39 commit a388060

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

astroid/inference_tip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from astroid import bases, util
1212
from astroid.exceptions import InferenceOverwriteError, UseInferenceDefault
1313
from astroid.nodes import NodeNG
14+
from astroid.typing import InferFn
1415

15-
InferFn = typing.Callable[..., typing.Any]
1616
InferOptions = typing.Union[
1717
NodeNG, bases.Instance, bases.UnboundMethod, typing.Type[util.Uninferable]
1818
]

astroid/nodes/node_ng.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from astroid.nodes.as_string import AsStringVisitor
3434
from astroid.nodes.const import OP_PRECEDENCE
3535
from astroid.nodes.utils import Position
36+
from astroid.typing import InferFn
3637

3738
if TYPE_CHECKING:
3839
from astroid import nodes
@@ -88,7 +89,7 @@ class NodeNG:
8889
_other_other_fields: ClassVar[typing.Tuple[str, ...]] = ()
8990
"""Attributes that contain AST-dependent fields."""
9091
# instance specific inference function infer(node, context)
91-
_explicit_inference = None
92+
_explicit_inference: Optional[InferFn] = None
9293

9394
def __init__(
9495
self,

astroid/typing.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt
44

55
import sys
6-
from typing import TYPE_CHECKING
6+
from typing import TYPE_CHECKING, Any, Callable
77

88
if TYPE_CHECKING:
99
from astroid import nodes
@@ -22,3 +22,6 @@ class InferenceErrorInfo(TypedDict):
2222

2323
node: "nodes.NodeNG"
2424
context: "InferenceContext | None"
25+
26+
27+
InferFn = Callable[..., Any]

0 commit comments

Comments
 (0)