TypedDictBase -> TypedDictClass

This commit is contained in:
Dave Halter
2020-05-10 03:17:07 +02:00
parent d0270b5e59
commit e9a0c01af8
2 changed files with 4 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ class TypingModuleName(NameWrapper):
elif name == 'TypedDict': elif name == 'TypedDict':
# TODO doesn't even exist in typeshed/typing.py, yet. But will be # TODO doesn't even exist in typeshed/typing.py, yet. But will be
# added soon. # added soon.
yield TypedDictBase.create_cached( yield TypedDictClass.create_cached(
inference_state, self.parent_context, self.tree_name) inference_state, self.parent_context, self.tree_name)
elif name in ('no_type_check', 'no_type_check_decorator'): elif name in ('no_type_check', 'no_type_check_decorator'):
# This is not necessary, as long as we are not doing type checking. # This is not necessary, as long as we are not doing type checking.
@@ -416,7 +416,7 @@ class CastFunction(BaseTypingValue):
return type_value_set.execute_annotation() return type_value_set.execute_annotation()
class TypedDictBase(BaseTypingValue): class TypedDictClass(BaseTypingValue):
""" """
This class has no responsibilities and is just here to make sure that typed This class has no responsibilities and is just here to make sure that typed
dicts can be identified. dicts can be identified.

View File

@@ -241,7 +241,7 @@ class ClassMixin(object):
def is_typeddict(self): def is_typeddict(self):
# TODO Do a proper mro resolution. Currently we are just listing # TODO Do a proper mro resolution. Currently we are just listing
# classes. However, it's a complicated algorithm. # classes. However, it's a complicated algorithm.
from jedi.inference.gradual.typing import TypedDictBase from jedi.inference.gradual.typing import TypedDictClass
for lazy_cls in self.py__bases__(): for lazy_cls in self.py__bases__():
if not isinstance(lazy_cls, LazyTreeValue): if not isinstance(lazy_cls, LazyTreeValue):
return False return False
@@ -253,7 +253,7 @@ class ClassMixin(object):
return False return False
for cls in lazy_cls.infer(): for cls in lazy_cls.infer():
if isinstance(cls, TypedDictBase): if isinstance(cls, TypedDictClass):
return True return True
try: try:
method = cls.is_typeddict method = cls.is_typeddict