mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Push type check into helper
This commit is contained in:
@@ -390,6 +390,8 @@ def _infer_type_vars(annotation_value, value_set, is_class_value=False):
|
|||||||
`annotated_argument_class`: represents the annotated class of the
|
`annotated_argument_class`: represents the annotated class of the
|
||||||
argument being passed to the object annotated by `annotation_value`.
|
argument being passed to the object annotated by `annotation_value`.
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(annotated_argument_class, DefineGenericBase):
|
||||||
|
return
|
||||||
|
|
||||||
annotation_generics = annotation_value.get_generics()
|
annotation_generics = annotation_value.get_generics()
|
||||||
actual_generics = annotated_argument_class.get_generics()
|
actual_generics = annotated_argument_class.get_generics()
|
||||||
@@ -472,9 +474,6 @@ def _infer_type_vars(annotation_value, value_set, is_class_value=False):
|
|||||||
if not isinstance(py_class, GenericClass):
|
if not isinstance(py_class, GenericClass):
|
||||||
py_class = element
|
py_class = element
|
||||||
|
|
||||||
if not isinstance(py_class, DefineGenericBase):
|
|
||||||
continue
|
|
||||||
|
|
||||||
merge_pairwise_generics(annotation_value, py_class)
|
merge_pairwise_generics(annotation_value, py_class)
|
||||||
|
|
||||||
elif isinstance(annotation_value, GenericClass):
|
elif isinstance(annotation_value, GenericClass):
|
||||||
@@ -507,11 +506,7 @@ def _infer_type_vars(annotation_value, value_set, is_class_value=False):
|
|||||||
for parent_class in py_class.py__mro__():
|
for parent_class in py_class.py__mro__():
|
||||||
class_name = parent_class.py__name__()
|
class_name = parent_class.py__name__()
|
||||||
if annotation_name == class_name:
|
if annotation_name == class_name:
|
||||||
if not isinstance(parent_class, DefineGenericBase):
|
|
||||||
continue
|
|
||||||
|
|
||||||
merge_pairwise_generics(annotation_value, parent_class)
|
merge_pairwise_generics(annotation_value, parent_class)
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
return type_var_dict
|
return type_var_dict
|
||||||
|
|||||||
Reference in New Issue
Block a user