Introduce some stricter typing

This commit is contained in:
Dave Halter
2026-02-04 01:19:14 +01:00
parent c7481b3319
commit 30ef824abd
28 changed files with 171 additions and 67 deletions
+15 -1
View File
@@ -9,6 +9,7 @@ just one.
from functools import reduce
from operator import add
from itertools import zip_longest
from typing import TYPE_CHECKING, Any
from parso.python.tree import Name
@@ -21,12 +22,25 @@ from jedi.cache import memoize_method
sentinel = object()
if TYPE_CHECKING:
from jedi.inference import InferenceState
class HasNoContext(Exception):
pass
class HelperValueMixin:
parent_context: Any
inference_state: "InferenceState"
name: Any
get_filters: Any
is_stub: Any
py__getattribute__alternatives: Any
py__iter__: Any
py__mro__: Any
_as_context: Any
def get_root_context(self):
value = self
if value.parent_context is None:
@@ -499,7 +513,7 @@ class ValueSet:
return ValueSet.from_sets(_getitem(c, *args, **kwargs) for c in self._set)
def try_merge(self, function_name):
value_set = self.__class__([])
value_set = ValueSet([])
for c in self._set:
try:
method = getattr(c, function_name)