forked from VimPlug/jedi
Instances should not need get_generics
This commit is contained in:
@@ -12,7 +12,7 @@ from parso import ParserSyntaxError, parse
|
||||
from jedi._compatibility import force_unicode, Parameter
|
||||
from jedi.inference.cache import inference_state_method_cache
|
||||
from jedi.inference.base_value import ValueSet, NO_VALUES
|
||||
from jedi.inference.gradual.base import DefineGenericBase, GenericClass, BaseTypingInstance
|
||||
from jedi.inference.gradual.base import DefineGenericBase, GenericClass
|
||||
from jedi.inference.gradual.generics import TupleGenericManager
|
||||
from jedi.inference.gradual.type_var import TypeVar
|
||||
from jedi.inference.helpers import is_string
|
||||
@@ -350,7 +350,7 @@ def merge_pairwise_generics(annotation_value, annotated_argument_class):
|
||||
|
||||
type_var_dict = {}
|
||||
|
||||
if not isinstance(annotated_argument_class, (DefineGenericBase)):
|
||||
if not isinstance(annotated_argument_class, DefineGenericBase):
|
||||
return type_var_dict
|
||||
|
||||
annotation_generics = annotation_value.get_generics()
|
||||
|
||||
@@ -396,10 +396,6 @@ class BaseTypingInstance(LazyValueWrapper):
|
||||
def name(self):
|
||||
return ValueName(self, self._tree_name)
|
||||
|
||||
@inference_state_method_cache()
|
||||
def get_generics(self):
|
||||
return self._generics_manager.to_tuple()
|
||||
|
||||
def _get_wrapped_value(self):
|
||||
object_, = builtin_from_name(self.inference_state, u'object').execute_annotation()
|
||||
return object_
|
||||
|
||||
@@ -325,7 +325,7 @@ class Tuple(BaseTypingInstance):
|
||||
# The parameter annotation is of the form `Tuple[T, ...]`,
|
||||
# so we treat the incoming tuple like a iterable sequence
|
||||
# rather than a positional container of elements.
|
||||
return self.get_generics()[0].infer_type_vars(
|
||||
return self._class_value.get_generics()[0].infer_type_vars(
|
||||
value_set.merge_types_of_iterate(),
|
||||
)
|
||||
|
||||
@@ -348,7 +348,7 @@ class Tuple(BaseTypingInstance):
|
||||
py_class = method()
|
||||
merge_type_var_dicts(
|
||||
type_var_dict,
|
||||
merge_pairwise_generics(self, py_class),
|
||||
merge_pairwise_generics(self._class_value, py_class),
|
||||
)
|
||||
|
||||
return type_var_dict
|
||||
|
||||
Reference in New Issue
Block a user