mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Remove dict merging where it doesn't do anything
These cases are all at the end of a single-path branch that ends up "merging" against an empty mapping which is then returned unchanged.
This commit is contained in:
@@ -209,11 +209,8 @@ class GenericClass(ClassMixin, DefineGenericBase):
|
|||||||
if annotation_name == 'Iterable' and not is_class_value:
|
if annotation_name == 'Iterable' and not is_class_value:
|
||||||
given = self.get_generics()
|
given = self.get_generics()
|
||||||
if given:
|
if given:
|
||||||
merge_type_var_dicts(
|
return given[0].infer_type_vars(
|
||||||
type_var_dict,
|
value_set.merge_types_of_iterate(),
|
||||||
given[0].infer_type_vars(
|
|
||||||
value_set.merge_types_of_iterate(),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Note: we need to handle the MRO _in order_, so we need to extract
|
# Note: we need to handle the MRO _in order_, so we need to extract
|
||||||
|
|||||||
@@ -200,22 +200,16 @@ class TypingClassValueWithIndex(_TypingClassMixin, TypingValueWithIndex):
|
|||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
merge_type_var_dicts(
|
return given[0].infer_type_vars(
|
||||||
type_var_dict,
|
value_set,
|
||||||
given[0].infer_type_vars(
|
is_class_value=True,
|
||||||
value_set,
|
|
||||||
is_class_value=True,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
elif annotation_name == 'Callable':
|
elif annotation_name == 'Callable':
|
||||||
given = self.get_generics()
|
given = self.get_generics()
|
||||||
if len(given) == 2:
|
if len(given) == 2:
|
||||||
merge_type_var_dicts(
|
return given[1].infer_type_vars(
|
||||||
type_var_dict,
|
value_set.execute_annotation(),
|
||||||
given[1].infer_type_vars(
|
|
||||||
value_set.execute_annotation(),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
elif annotation_name == 'Tuple':
|
elif annotation_name == 'Tuple':
|
||||||
@@ -226,11 +220,8 @@ class TypingClassValueWithIndex(_TypingClassMixin, TypingValueWithIndex):
|
|||||||
# The parameter annotation is of the form `Tuple[T, ...]`,
|
# The parameter annotation is of the form `Tuple[T, ...]`,
|
||||||
# so we treat the incoming tuple like a iterable sequence
|
# so we treat the incoming tuple like a iterable sequence
|
||||||
# rather than a positional container of elements.
|
# rather than a positional container of elements.
|
||||||
merge_type_var_dicts(
|
return annotation_generics[0].infer_type_vars(
|
||||||
type_var_dict,
|
value_set.merge_types_of_iterate(),
|
||||||
annotation_generics[0].infer_type_vars(
|
|
||||||
value_set.merge_types_of_iterate(),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user