mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Fix some small issues
This commit is contained in:
@@ -18,6 +18,8 @@ from jedi.evaluate.cache import evaluator_as_method_param_cache
|
||||
|
||||
|
||||
class HelperContextMixin:
|
||||
tree_node = None
|
||||
|
||||
@classmethod
|
||||
@evaluator_as_method_param_cache()
|
||||
def create_cached(cls, *args, **kwargs):
|
||||
@@ -63,9 +65,7 @@ class Context(HelperContextMixin, BaseContext):
|
||||
"""
|
||||
Should be defined, otherwise the API returns empty types.
|
||||
"""
|
||||
|
||||
predefined_names = {}
|
||||
tree_node = None
|
||||
"""
|
||||
To be defined by subclasses.
|
||||
"""
|
||||
|
||||
@@ -6,7 +6,8 @@ contexts.
|
||||
from jedi import debug
|
||||
from jedi.evaluate.cache import evaluator_method_cache
|
||||
from jedi.evaluate.compiled import builtin_from_name, CompiledObject
|
||||
from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS, Context, iterator_to_context_set
|
||||
from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS, Context, \
|
||||
iterator_to_context_set, HelperContextMixin
|
||||
from jedi.evaluate.lazy_context import LazyKnownContexts, LazyKnownContext
|
||||
from jedi.evaluate.context.iterable import SequenceLiteralContext
|
||||
from jedi.evaluate.arguments import repack_with_argument_clinic, unpack_arglist
|
||||
@@ -62,7 +63,7 @@ class _BaseTypingContext(Context):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return ContextName(self, self.tree_name)
|
||||
return ContextName(self, self._tree_name)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%s)' % (self.__class__.__name__, self._tree_name.value)
|
||||
@@ -225,7 +226,7 @@ def _iter_over_arguments(maybe_tuple_context, defining_context):
|
||||
yield ContextSet.from_iterable(resolve_forward_references(context_set))
|
||||
|
||||
|
||||
class TypeAlias(object):
|
||||
class TypeAlias(HelperContextMixin):
|
||||
def __init__(self, evaluator, parent_context, origin_tree_name, actual):
|
||||
self.evaluator = evaluator
|
||||
self.parent_context = parent_context
|
||||
|
||||
@@ -452,8 +452,6 @@ def find_annotation_variables(context, node):
|
||||
for subscript_node in _unpack_subscriptlist(trailer.children[1]):
|
||||
type_var_set = context.eval_node(subscript_node)
|
||||
for type_var in type_var_set:
|
||||
from jedi.evaluate.context.typing import TypeVar
|
||||
|
||||
if isinstance(type_var, TypeVar) and type_var not in found:
|
||||
found.append(type_var)
|
||||
return found
|
||||
|
||||
Reference in New Issue
Block a user