1
0
forked from VimPlug/jedi

Extract common get_generics() calls

These no longer need to be guarded by the conditions now that we
know these types are generic anyway.
This commit is contained in:
Peter Law
2020-03-22 15:47:46 +00:00
parent ea33db388b
commit 3c90a84f68
2 changed files with 10 additions and 10 deletions
+4 -3
View File
@@ -207,11 +207,12 @@ class GenericClass(ClassMixin, DefineGenericBase):
annotation_name = self.py__name__()
type_var_dict = {}
if annotation_name == 'Iterable' and not is_class_value:
given = self.get_generics()
if given:
return given[0].infer_type_vars(
annotation_generics = self.get_generics()
if annotation_generics:
return annotation_generics[0].infer_type_vars(
value_set.merge_types_of_iterate(),
)
else:
# Note: we need to handle the MRO _in order_, so we need to extract
# the elements from the set first, then handle them, even if we put