1
0
forked from VimPlug/jedi

Rename AnnotatedClass to GenericClass

This commit is contained in:
Dave Halter
2019-05-27 21:21:42 +02:00
parent d2355ea53b
commit 1002acf907
5 changed files with 17 additions and 17 deletions
+3 -3
View File
@@ -333,7 +333,7 @@ class FunctionExecutionContext(TreeContext):
evaluator = self.evaluator
is_coroutine = self.tree_node.parent.type in ('async_stmt', 'async_funcdef')
is_generator = bool(get_yield_exprs(evaluator, self.tree_node))
from jedi.evaluate.gradual.typing import AnnotatedSubClass
from jedi.evaluate.gradual.typing import GenericClass
if is_coroutine:
if is_generator:
@@ -347,7 +347,7 @@ class FunctionExecutionContext(TreeContext):
generics = (yield_contexts.py__class__(), NO_CONTEXTS)
return ContextSet(
# In Python 3.6 AsyncGenerator is still a class.
AnnotatedSubClass(c, generics)
GenericClass(c, generics)
for c in async_generator_classes
).execute_annotation()
else:
@@ -358,7 +358,7 @@ class FunctionExecutionContext(TreeContext):
# Only the first generic is relevant.
generics = (return_contexts.py__class__(), NO_CONTEXTS, NO_CONTEXTS)
return ContextSet(
AnnotatedSubClass(c, generics) for c in async_classes
GenericClass(c, generics) for c in async_classes
).execute_annotation()
else:
if is_generator:
+2 -2
View File
@@ -208,10 +208,10 @@ class Sequence(BuiltinOverwrite, IterableMixin):
@memoize_method
def get_object(self):
from jedi.evaluate.gradual.typing import AnnotatedSubClass
from jedi.evaluate.gradual.typing import GenericClass
klass = compiled.builtin_from_name(self.evaluator, self.array_type)
# TODO is this execute annotation wrong? it returns a context set?!
return AnnotatedSubClass(klass, self._get_generics()).execute_annotation()
return GenericClass(klass, self._get_generics()).execute_annotation()
def py__bool__(self):
return None # We don't know the length, because of appends.
+4 -4
View File
@@ -243,11 +243,11 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, FunctionAndClassBa
)]
def py__getitem__(self, index_context_set, contextualized_node):
from jedi.evaluate.gradual.typing import AnnotatedClass
from jedi.evaluate.gradual.typing import LazyGenericClass
if not index_context_set:
return ContextSet([self])
return ContextSet(
AnnotatedClass(
LazyGenericClass(
self,
index_context,
context_of_index=contextualized_node.context,
@@ -256,7 +256,7 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, FunctionAndClassBa
)
def define_generics(self, type_var_dict):
from jedi.evaluate.gradual.typing import AnnotatedSubClass
from jedi.evaluate.gradual.typing import GenericClass
def remap_type_vars():
"""
@@ -272,7 +272,7 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, FunctionAndClassBa
yield type_var_dict.get(type_var.py__name__(), NO_CONTEXTS)
if type_var_dict:
return AnnotatedSubClass(
return GenericClass(
self,
generics=tuple(remap_type_vars())
)