Skip to content

Commit c4b59dd

Browse files
DanielNoordcdce8p
andauthored
Add partial typing to NodeNG.infer (#1580)
Co-authored-by: Marc Mueller <[email protected]>
1 parent e57ac42 commit c4b59dd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

astroid/nodes/node_ng.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,22 @@
77
import pprint
88
import sys
99
import warnings
10-
from collections.abc import Iterator
10+
from collections.abc import Generator, Iterator
1111
from functools import singledispatch as _singledispatch
12-
from typing import TYPE_CHECKING, ClassVar, Tuple, Type, TypeVar, Union, cast, overload
12+
from typing import (
13+
TYPE_CHECKING,
14+
Any,
15+
ClassVar,
16+
Tuple,
17+
Type,
18+
TypeVar,
19+
Union,
20+
cast,
21+
overload,
22+
)
1323

14-
from astroid import decorators, util
24+
from astroid import bases, decorators, util
25+
from astroid.context import InferenceContext
1526
from astroid.exceptions import (
1627
AstroidError,
1728
InferenceError,
@@ -124,7 +135,9 @@ def __init__(
124135
E.g. ClassDef, FunctionDef.
125136
"""
126137

127-
def infer(self, context=None, **kwargs):
138+
def infer(
139+
self, context: InferenceContext | None = None, **kwargs: Any
140+
) -> Generator[nodes.NodeNG | type[util.Uninferable] | bases.Instance, None, None]:
128141
"""Get a generator of the inferred values.
129142
130143
This is the main entry point to the inference system.

0 commit comments

Comments
 (0)