forked from VimPlug/jedi
NO_CONTEXTS -> NO_VALUES
This commit is contained in:
@@ -12,7 +12,7 @@ from jedi.inference.signature import TreeSignature
|
||||
from jedi.inference.arguments import AnonymousArguments
|
||||
from jedi.inference.filters import ParserTreeFilter, FunctionExecutionFilter
|
||||
from jedi.inference.names import ContextName, AbstractNameDefinition, ParamName
|
||||
from jedi.inference.base_value import ContextualizedNode, NO_CONTEXTS, \
|
||||
from jedi.inference.base_value import ContextualizedNode, NO_VALUES, \
|
||||
ContextSet, TreeContext, ContextWrapper
|
||||
from jedi.inference.lazy_value import LazyKnownContexts, LazyKnownContext, \
|
||||
LazyTreeContext
|
||||
@@ -180,7 +180,7 @@ class FunctionExecutionContext(TreeContext):
|
||||
self.function_value = function_value
|
||||
self.var_args = var_args
|
||||
|
||||
@infer_state_method_cache(default=NO_CONTEXTS)
|
||||
@infer_state_method_cache(default=NO_VALUES)
|
||||
@recursion.execution_recursion_decorator()
|
||||
def get_return_values(self, check_yields=False):
|
||||
funcdef = self.tree_node
|
||||
@@ -188,7 +188,7 @@ class FunctionExecutionContext(TreeContext):
|
||||
return self.infer_node(funcdef.children[-1])
|
||||
|
||||
if check_yields:
|
||||
value_set = NO_CONTEXTS
|
||||
value_set = NO_VALUES
|
||||
returns = get_yield_exprs(self.infer_state, funcdef)
|
||||
else:
|
||||
returns = funcdef.iter_return_stmts()
|
||||
@@ -331,13 +331,13 @@ class FunctionExecutionContext(TreeContext):
|
||||
if is_coroutine:
|
||||
if is_generator:
|
||||
if infer_state.environment.version_info < (3, 6):
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
async_generator_classes = infer_state.typing_module \
|
||||
.py__getattribute__('AsyncGenerator')
|
||||
|
||||
yield_values = self.merge_yield_values(is_async=True)
|
||||
# The contravariant doesn't seem to be defined.
|
||||
generics = (yield_values.py__class__(), NO_CONTEXTS)
|
||||
generics = (yield_values.py__class__(), NO_VALUES)
|
||||
return ContextSet(
|
||||
# In Python 3.6 AsyncGenerator is still a class.
|
||||
GenericClass(c, generics)
|
||||
@@ -345,11 +345,11 @@ class FunctionExecutionContext(TreeContext):
|
||||
).execute_annotation()
|
||||
else:
|
||||
if infer_state.environment.version_info < (3, 5):
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
async_classes = infer_state.typing_module.py__getattribute__('Coroutine')
|
||||
return_values = self.get_return_values()
|
||||
# Only the first generic is relevant.
|
||||
generics = (return_values.py__class__(), NO_CONTEXTS, NO_CONTEXTS)
|
||||
generics = (return_values.py__class__(), NO_VALUES, NO_VALUES)
|
||||
return ContextSet(
|
||||
GenericClass(c, generics) for c in async_classes
|
||||
).execute_annotation()
|
||||
@@ -368,7 +368,7 @@ class OverloadedFunctionContext(FunctionMixin, ContextWrapper):
|
||||
def py__call__(self, arguments):
|
||||
debug.dbg("Execute overloaded function %s", self._wrapped_value, color='BLUE')
|
||||
function_executions = []
|
||||
value_set = NO_CONTEXTS
|
||||
value_set = NO_VALUES
|
||||
matched = False
|
||||
for f in self._overloaded_functions:
|
||||
function_execution = f.get_function_execution(arguments)
|
||||
@@ -382,7 +382,7 @@ class OverloadedFunctionContext(FunctionMixin, ContextWrapper):
|
||||
|
||||
if self.infer_state.is_analysis:
|
||||
# In this case we want precision.
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
return ContextSet.from_sets(fe.infer() for fe in function_executions)
|
||||
|
||||
def get_signature_functions(self):
|
||||
|
||||
@@ -7,7 +7,7 @@ from jedi.inference.compiled.value import CompiledObjectFilter
|
||||
from jedi.inference.helpers import values_from_qualified_names
|
||||
from jedi.inference.filters import AbstractFilter
|
||||
from jedi.inference.names import ContextName, TreeNameDefinition
|
||||
from jedi.inference.base_value import Context, NO_CONTEXTS, ContextSet, \
|
||||
from jedi.inference.base_value import Context, NO_VALUES, ContextSet, \
|
||||
iterator_to_value_set, ContextWrapper
|
||||
from jedi.inference.lazy_value import LazyKnownContext, LazyKnownContexts
|
||||
from jedi.inference.cache import infer_state_method_cache
|
||||
@@ -249,7 +249,7 @@ class CompiledInstance(AbstractInstanceContext):
|
||||
def get_first_non_keyword_argument_values(self):
|
||||
key, lazy_value = next(self._original_var_args.unpack(), ('', None))
|
||||
if key is not None:
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
|
||||
return lazy_value.infer()
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ from jedi.inference.utils import safe_property, to_list
|
||||
from jedi.inference.cache import infer_state_method_cache
|
||||
from jedi.inference.filters import ParserTreeFilter, LazyAttributeOverwrite, \
|
||||
publish_method
|
||||
from jedi.inference.base_value import ContextSet, Context, NO_CONTEXTS, \
|
||||
from jedi.inference.base_value import ContextSet, Context, NO_VALUES, \
|
||||
TreeContext, ContextualizedNode, iterate_values, HelperContextMixin, _sentinel
|
||||
from jedi.parser_utils import get_sync_comp_fors
|
||||
|
||||
@@ -381,7 +381,7 @@ class SequenceLiteralContext(Sequence):
|
||||
"""
|
||||
if self.array_type == u'dict':
|
||||
# Get keys.
|
||||
types = NO_CONTEXTS
|
||||
types = NO_VALUES
|
||||
for k, _ in self.get_tree_entries():
|
||||
types |= self._defining_value.infer_node(k)
|
||||
# We don't know which dict index comes first, therefore always
|
||||
@@ -652,12 +652,12 @@ def check_array_additions(value, sequence):
|
||||
""" Just a mapper function for the internal _check_array_additions """
|
||||
if sequence.array_type not in ('list', 'set'):
|
||||
# TODO also check for dict updates
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
|
||||
return _check_array_additions(value, sequence)
|
||||
|
||||
|
||||
@infer_state_method_cache(default=NO_CONTEXTS)
|
||||
@infer_state_method_cache(default=NO_VALUES)
|
||||
@debug.increase_indent
|
||||
def _check_array_additions(value, sequence):
|
||||
"""
|
||||
@@ -672,7 +672,7 @@ def _check_array_additions(value, sequence):
|
||||
module_value = value.get_root_value()
|
||||
if not settings.dynamic_array_additions or isinstance(module_value, compiled.CompiledObject):
|
||||
debug.dbg('Dynamic array search aborted.', color='MAGENTA')
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
|
||||
def find_additions(value, arglist, add_name):
|
||||
params = list(arguments.TreeArguments(value.infer_state, value, arglist).unpack())
|
||||
|
||||
@@ -47,7 +47,7 @@ from jedi.inference.filters import ParserTreeFilter
|
||||
from jedi.inference.names import TreeNameDefinition, ContextName
|
||||
from jedi.inference.arguments import unpack_arglist, ValuesArguments
|
||||
from jedi.inference.base_value import ContextSet, iterator_to_value_set, \
|
||||
NO_CONTEXTS
|
||||
NO_VALUES
|
||||
from jedi.inference.value.function import FunctionAndClassBase
|
||||
from jedi.plugins import plugin_manager
|
||||
|
||||
@@ -307,7 +307,7 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, FunctionAndClassBa
|
||||
a different type var name.
|
||||
"""
|
||||
for type_var in self.list_type_vars():
|
||||
yield type_var_dict.get(type_var.py__name__(), NO_CONTEXTS)
|
||||
yield type_var_dict.get(type_var.py__name__(), NO_VALUES)
|
||||
|
||||
if type_var_dict:
|
||||
return ContextSet([GenericClass(
|
||||
@@ -321,7 +321,7 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, FunctionAndClassBa
|
||||
debug.dbg('Unprocessed metaclass %s', metaclass)
|
||||
return []
|
||||
|
||||
@infer_state_method_cache(default=NO_CONTEXTS)
|
||||
@infer_state_method_cache(default=NO_VALUES)
|
||||
def get_metaclasses(self):
|
||||
args = self._get_bases_arguments()
|
||||
if args is not None:
|
||||
@@ -337,4 +337,4 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, FunctionAndClassBa
|
||||
values = value.get_metaclasses()
|
||||
if values:
|
||||
return values
|
||||
return NO_CONTEXTS
|
||||
return NO_VALUES
|
||||
|
||||
Reference in New Issue
Block a user