mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
By having get_annotated_class_object for Tuple/Callable, some details are not necessary anymore
This commit is contained in:
@@ -350,7 +350,7 @@ def merge_pairwise_generics(annotation_value, annotated_argument_class):
|
|||||||
|
|
||||||
type_var_dict = {}
|
type_var_dict = {}
|
||||||
|
|
||||||
if not isinstance(annotated_argument_class, (DefineGenericBase, BaseTypingInstance)):
|
if not isinstance(annotated_argument_class, (DefineGenericBase)):
|
||||||
return type_var_dict
|
return type_var_dict
|
||||||
|
|
||||||
annotation_generics = annotation_value.get_generics()
|
annotation_generics = annotation_value.get_generics()
|
||||||
|
|||||||
@@ -389,6 +389,9 @@ class BaseTypingInstance(LazyValueWrapper):
|
|||||||
def py__class__(self):
|
def py__class__(self):
|
||||||
return self._class_value
|
return self._class_value
|
||||||
|
|
||||||
|
def get_annotated_class_object(self):
|
||||||
|
return self._class_value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return ValueName(self, self._tree_name)
|
return ValueName(self, self._tree_name)
|
||||||
@@ -400,3 +403,6 @@ class BaseTypingInstance(LazyValueWrapper):
|
|||||||
def _get_wrapped_value(self):
|
def _get_wrapped_value(self):
|
||||||
object_, = builtin_from_name(self.inference_state, u'object').execute_annotation()
|
object_, = builtin_from_name(self.inference_state, u'object').execute_annotation()
|
||||||
return object_
|
return object_
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '<%s: %s>' % (self.__class__.__name__, self._generics_manager)
|
||||||
|
|||||||
@@ -316,7 +316,6 @@ class Tuple(BaseTypingInstance):
|
|||||||
def infer_type_vars(self, value_set):
|
def infer_type_vars(self, value_set):
|
||||||
# Circular
|
# Circular
|
||||||
from jedi.inference.gradual.annotation import merge_pairwise_generics, merge_type_var_dicts
|
from jedi.inference.gradual.annotation import merge_pairwise_generics, merge_type_var_dicts
|
||||||
from jedi.inference.gradual.base import GenericClass
|
|
||||||
|
|
||||||
value_set = value_set.filter(
|
value_set = value_set.filter(
|
||||||
lambda x: x.py__name__().lower() == 'tuple',
|
lambda x: x.py__name__().lower() == 'tuple',
|
||||||
@@ -345,11 +344,8 @@ class Tuple(BaseTypingInstance):
|
|||||||
# above is not 100% correct, so just catch the remaining
|
# above is not 100% correct, so just catch the remaining
|
||||||
# cases here.
|
# cases here.
|
||||||
continue
|
continue
|
||||||
else:
|
|
||||||
py_class = method()
|
|
||||||
if not isinstance(py_class, GenericClass):
|
|
||||||
py_class = element
|
|
||||||
|
|
||||||
|
py_class = method()
|
||||||
merge_type_var_dicts(
|
merge_type_var_dicts(
|
||||||
type_var_dict,
|
type_var_dict,
|
||||||
merge_pairwise_generics(self, py_class),
|
merge_pairwise_generics(self, py_class),
|
||||||
|
|||||||
Reference in New Issue
Block a user