Remove remap_type_vars, which was never used

This commit is contained in:
Dave Halter
2019-05-19 16:15:52 +02:00
parent 7ec76bc0b5
commit ea490b9a2b
2 changed files with 9 additions and 20 deletions

View File

@@ -256,6 +256,15 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, TreeContext)):
from jedi.evaluate.gradual.typing import AnnotatedSubClass
def remap_type_vars():
"""
The TypeVars in the resulting classes have sometimes different names
and we need to check for that, e.g. a signature can be:
def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...
However, the iterator is defined as Iterator[_T_co], which means it has
a different type var name.
"""
for type_var in self.list_type_vars():
yield type_var_dict.get(type_var.py__name__(), NO_CONTEXTS)

View File

@@ -203,26 +203,6 @@ def infer_return_types(function_execution_context):
type_var_dict = infer_type_vars_for_execution(function_execution_context, all_annotations)
def remap_type_vars(context, type_var_dict):
"""
The TypeVars in the resulting classes have sometimes different names
and we need to check for that, e.g. a signature can be:
def iter(iterable: Iterable[_T]) -> Iterator[_T]: ...
However, the iterator is defined as Iterator[_T_co], which means it has
a different type var name.
"""
try:
func = context.list_type_vars
except AttributeError:
return type_var_dict
else:
return {
to.py__name__(): type_var_dict.get(from_.py__name__(), NO_CONTEXTS)
for from_, to in zip(unknown_type_vars, func())
}
return ContextSet(
ann.define_generics(type_var_dict)
if isinstance(ann, AbstractAnnotatedClass) else ann