summaryrefslogtreecommitdiff
path: root/astroid/bases.py
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-06-23 09:09:05 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-06-23 22:12:47 +0200
commit39305fde76d904a1447013a8a9cd4cd3734ae785 (patch)
tree82f326181402d46e55ae4d0c4f03ed2f7aa9469f /astroid/bases.py
parent5f01da9e9f31e7a8a1edb604277c1f5bfa295282 (diff)
downloadastroid-git-39305fde76d904a1447013a8a9cd4cd3734ae785.tar.gz
Fix typing of ``_infer`` to allow a return value in the ``Generator``
Diffstat (limited to 'astroid/bases.py')
-rw-r--r--astroid/bases.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/astroid/bases.py b/astroid/bases.py
index bfa60413..909ead4d 100644
--- a/astroid/bases.py
+++ b/astroid/bases.py
@@ -10,7 +10,7 @@ from __future__ import annotations
import collections
import collections.abc
from collections.abc import Sequence
-from typing import TYPE_CHECKING, Any, TypeVar
+from typing import TYPE_CHECKING, Any
from astroid import decorators
from astroid.const import PY310_PLUS
@@ -26,7 +26,7 @@ from astroid.exceptions import (
InferenceError,
NameInferenceError,
)
-from astroid.typing import InferenceResult
+from astroid.typing import InferenceErrorInfo, InferenceResult
from astroid.util import Uninferable, lazy_descriptor, lazy_import
objectmodel = lazy_import("interpreter.objectmodel")
@@ -36,7 +36,6 @@ manager = lazy_import("manager")
if TYPE_CHECKING:
from astroid import nodes
-_ProxyT = TypeVar("_ProxyT", bound="Proxy")
# TODO: check if needs special treatment
BOOL_SPECIAL_METHOD = "__bool__"
@@ -119,9 +118,9 @@ class Proxy:
return self.__dict__[name]
return getattr(self._proxied, name)
- def infer(
- self: _ProxyT, context: InferenceContext | None = None, **kwargs: Any
- ) -> collections.abc.Generator[_ProxyT, None, None]:
+ def infer( # type: ignore[return]
+ self, context: InferenceContext | None = None, **kwargs: Any
+ ) -> collections.abc.Generator[InferenceResult, None, InferenceErrorInfo | None]:
yield self