forked from VimPlug/jedi
get_filters should always have the default search_global=False
This commit is contained in:
@@ -7,7 +7,7 @@ from jedi.evaluate.helpers import execute_evaluated
|
|||||||
|
|
||||||
def builtin_from_name(evaluator, string):
|
def builtin_from_name(evaluator, string):
|
||||||
builtins = evaluator.builtins_module
|
builtins = evaluator.builtins_module
|
||||||
filter_ = next(builtins.get_filters(search_global=False))
|
filter_ = next(builtins.get_filters())
|
||||||
name, = filter_.get(string)
|
name, = filter_.get(string)
|
||||||
context, = name.infer()
|
context, = name.infer()
|
||||||
return context
|
return context
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class LambdaName(AbstractNameDefinition):
|
|||||||
class AbstractFunction(TreeContext):
|
class AbstractFunction(TreeContext):
|
||||||
api_type = u'function'
|
api_type = u'function'
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None, origin_scope=None):
|
def get_filters(self, search_global=False, until_position=None, origin_scope=None):
|
||||||
if search_global:
|
if search_global:
|
||||||
yield ParserTreeFilter(
|
yield ParserTreeFilter(
|
||||||
self.evaluator,
|
self.evaluator,
|
||||||
@@ -263,7 +263,7 @@ class FunctionExecutionContext(TreeContext):
|
|||||||
for result in self._get_yield_lazy_context(yield_in_same_for_stmt):
|
for result in self._get_yield_lazy_context(yield_in_same_for_stmt):
|
||||||
yield result
|
yield result
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None, origin_scope=None):
|
def get_filters(self, search_global=False, until_position=None, origin_scope=None):
|
||||||
yield self.function_execution_filter(self.evaluator, self,
|
yield self.function_execution_filter(self.evaluator, self,
|
||||||
until_position=until_position,
|
until_position=until_position,
|
||||||
origin_scope=origin_scope)
|
origin_scope=origin_scope)
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class CompForContext(TreeContext):
|
|||||||
def get_node(self):
|
def get_node(self):
|
||||||
return self.tree_node
|
return self.tree_node
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None, origin_scope=None):
|
def get_filters(self, search_global=False, until_position=None, origin_scope=None):
|
||||||
yield ParserTreeFilter(self.evaluator, self)
|
yield ParserTreeFilter(self.evaluator, self)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,8 @@ class ClassContext(use_metaclass(CachedMetaClass, TreeContext)):
|
|||||||
def py__class__(self):
|
def py__class__(self):
|
||||||
return compiled.builtin_from_name(self.evaluator, u'type')
|
return compiled.builtin_from_name(self.evaluator, u'type')
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None, origin_scope=None, is_instance=False):
|
def get_filters(self, search_global=False, until_position=None,
|
||||||
|
origin_scope=None, is_instance=False):
|
||||||
if search_global:
|
if search_global:
|
||||||
yield ParserTreeFilter(
|
yield ParserTreeFilter(
|
||||||
self.evaluator,
|
self.evaluator,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class ModuleContext(TreeContext):
|
|||||||
self._string_names = string_names
|
self._string_names = string_names
|
||||||
self.code_lines = code_lines
|
self.code_lines = code_lines
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None, origin_scope=None):
|
def get_filters(self, search_global=False, until_position=None, origin_scope=None):
|
||||||
yield MergedFilter(
|
yield MergedFilter(
|
||||||
ParserTreeFilter(
|
ParserTreeFilter(
|
||||||
self.evaluator,
|
self.evaluator,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ImplicitNamespaceContext(Context):
|
|||||||
self._fullname = fullname
|
self._fullname = fullname
|
||||||
self.paths = paths
|
self.paths = paths
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None, origin_scope=None):
|
def get_filters(self, search_global=False, until_position=None, origin_scope=None):
|
||||||
yield DictFilter(self._sub_modules_dict())
|
yield DictFilter(self._sub_modules_dict())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ class _AbstractAnnotatedClass(ClassContext):
|
|||||||
def get_type_var_filter(self):
|
def get_type_var_filter(self):
|
||||||
return TypeVarFilter(self.get_given_types(), self.find_annotation_variables())
|
return TypeVarFilter(self.get_given_types(), self.find_annotation_variables())
|
||||||
|
|
||||||
def get_filters(self, search_global, *args, **kwargs):
|
def get_filters(self, search_global=False, *args, **kwargs):
|
||||||
for f in super(_AbstractAnnotatedClass, self).get_filters(search_global, *args, **kwargs):
|
for f in super(_AbstractAnnotatedClass, self).get_filters(search_global, *args, **kwargs):
|
||||||
yield f
|
yield f
|
||||||
|
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ class AbstractObjectOverwrite(use_metaclass(_OverwriteMeta, object)):
|
|||||||
def get_object(self):
|
def get_object(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_filters(self, search_global, *args, **kwargs):
|
def get_filters(self, search_global=False, *args, **kwargs):
|
||||||
yield SpecialMethodFilter(self, self.overwritten_methods, self.get_object())
|
yield SpecialMethodFilter(self, self.overwritten_methods, self.get_object())
|
||||||
|
|
||||||
for filter in self.get_object().get_filters(search_global):
|
for filter in self.get_object().get_filters(search_global):
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ class _MixedStubContextMixin(object):
|
|||||||
|
|
||||||
|
|
||||||
class _StubContextFilterMixin(_MixedStubContextMixin):
|
class _StubContextFilterMixin(_MixedStubContextMixin):
|
||||||
def get_filters(self, search_global, until_position=None,
|
def get_filters(self, search_global=False, until_position=None,
|
||||||
origin_scope=None, **kwargs):
|
origin_scope=None, **kwargs):
|
||||||
filters = super(_StubContextFilterMixin, self).get_filters(
|
filters = super(_StubContextFilterMixin, self).get_filters(
|
||||||
search_global, until_position, origin_scope, **kwargs
|
search_global, until_position, origin_scope, **kwargs
|
||||||
@@ -384,7 +384,7 @@ class StubOnlyModuleContext(ModuleContext):
|
|||||||
for context in self.non_stub_context_set:
|
for context in self.non_stub_context_set:
|
||||||
yield next(context.get_filters(search_global=False))
|
yield next(context.get_filters(search_global=False))
|
||||||
|
|
||||||
def get_filters(self, search_global, until_position=None,
|
def get_filters(self, search_global=False, until_position=None,
|
||||||
origin_scope=None, **kwargs):
|
origin_scope=None, **kwargs):
|
||||||
filters = super(StubOnlyModuleContext, self).get_filters(
|
filters = super(StubOnlyModuleContext, self).get_filters(
|
||||||
search_global, until_position, origin_scope, **kwargs
|
search_global, until_position, origin_scope, **kwargs
|
||||||
|
|||||||
Reference in New Issue
Block a user