forked from VimPlug/jedi
Use CompiledValue for simple values
This commit is contained in:
@@ -341,16 +341,6 @@ def signature_matches(function_context, arguments):
|
||||
return True
|
||||
|
||||
|
||||
def has_same_class(context_set1, context_set2):
|
||||
for c1 in context_set1:
|
||||
for c2 in context_set2:
|
||||
if c1.name.string_name == c2.name.string_name:
|
||||
# TODO This is wrong, it doesn't account for a lot of things.
|
||||
return True
|
||||
|
||||
return bool(context_set1 & context_set2)
|
||||
|
||||
|
||||
def _find_overload_functions(context, tree_node):
|
||||
def _is_overload_decorated(funcdef):
|
||||
if funcdef.parent.type == 'decorated':
|
||||
|
||||
@@ -3,6 +3,7 @@ We need to somehow work with the typing objects. Since the typing objects are
|
||||
pretty bare we need to add all the Jedi customizations to make them work as
|
||||
contexts.
|
||||
"""
|
||||
from jedi._compatibility import unicode
|
||||
from jedi import debug
|
||||
from jedi.evaluate.cache import evaluator_method_cache
|
||||
from jedi.evaluate.compiled import builtin_from_name, CompiledObject
|
||||
@@ -359,9 +360,15 @@ class TypeVarClass(_BaseTypingContext):
|
||||
debug.warning('Found multiple contexts for a type variable: %s', context_set)
|
||||
|
||||
name_context = next(iter(context_set))
|
||||
if isinstance(name_context, CompiledObject):
|
||||
return name_context.get_safe_value(default=None)
|
||||
return None
|
||||
try:
|
||||
method = name_context.get_safe_value
|
||||
except AttributeError:
|
||||
return None
|
||||
else:
|
||||
safe_value = method(default=None)
|
||||
if isinstance(safe_value, (str, unicode)):
|
||||
return safe_value
|
||||
return None
|
||||
|
||||
|
||||
class TypeVar(_BaseTypingContext):
|
||||
|
||||
Reference in New Issue
Block a user