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
+9
View File
@@ -2,6 +2,7 @@
This module is about generics, like the `int` in `List[int]`. It's not about
the Generic class.
"""
from abc import abstractmethod
from jedi import debug
from jedi.cache import memoize_method
@@ -24,6 +25,14 @@ def _resolve_forward_references(context, value_set):
class _AbstractGenericManager:
@abstractmethod
def __getitem__(self, index):
raise NotImplementedError
@abstractmethod
def to_tuple(self):
raise NotImplementedError
def get_index_and_execute(self, index):
try:
return self[index].execute_annotation()
+3
View File
@@ -6,6 +6,7 @@ values.
This file deals with all the typing.py cases.
"""
import itertools
from typing import Any
from jedi import debug
from jedi.inference.compiled import builtin_from_name, create_simple_object
@@ -186,6 +187,8 @@ class ProxyTypingValue(BaseTypingValue):
class _TypingClassMixin(ClassMixin):
_tree_name: Any
def py__bases__(self):
return [LazyKnownValues(
self.inference_state.builtins_module.py__getattribute__('object')