diff --git a/jedi/api/interpreter.py b/jedi/api/interpreter.py index cc13be4c..9375b8d9 100644 --- a/jedi/api/interpreter.py +++ b/jedi/api/interpreter.py @@ -44,10 +44,6 @@ class InterpreterNamespace(pt.Module): for key, value in self.namespace.items(): yield LazyName(self._evaluator, key, value) - def scope_names_generator(self, position=None): - raise NotImplementedError - yield self, list(self.get_defined_names()) - def __getattr__(self, name): return getattr(self.parser_module, name) diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index 2cd0bdad..33ce1ac3 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -154,9 +154,6 @@ class CompiledObject(Base): def names_dicts(self, search_global): yield self.names_dict - def scope_names_generator(self, position=None, add_class_vars=True): - yield self, self.get_defined_names() - @underscore_memoization def instance_names(self): names = [] diff --git a/jedi/evaluate/iterable.py b/jedi/evaluate/iterable.py index 8e767131..493bf3b3 100644 --- a/jedi/evaluate/iterable.py +++ b/jedi/evaluate/iterable.py @@ -59,9 +59,6 @@ class GeneratorMixin(object): else: yield name - def scope_names_generator(self, position=None): - yield self, self._get_defined_names() - @memoize_default() def names_dicts(self, search_global=False): # is always False dct = {} @@ -259,16 +256,6 @@ class Array(IterableWrapper): def iter_content(self): return self.values() - def scope_names_generator(self, position=None): - """ - It returns e.g. for a list: append, pop, ... - """ - # `array.type` is a string with the type, e.g. 'list'. - scope = self._evaluator.find_types(compiled.builtin, self.type)[0] - scope = self._evaluator.execute(scope)[0] # builtins only have one class - for _, names in scope.scope_names_generator(): - yield self, names - @memoize_default() def names_dicts(self, search_global=False): # Always False. # `array.type` is a string with the type, e.g. 'list'. diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index fe6c08fb..318f4661 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -251,17 +251,6 @@ class Instance(use_metaclass(CachedMetaClass, Executed)): for names_dict in self.base.names_dicts(search_global=False): yield LazyInstanceDict(self._evaluator, self, names_dict) - def scope_names_generator(self, position=None): - """ - An Instance has two scopes: The scope with self names and the class - scope. Instance variables have priority over the class scope. - """ - yield self, self.get_self_attributes() - - for scope, names in self.base.scope_names_generator(add_class_vars=False): - yield self, [get_instance_el(self._evaluator, self, var, True) - for var in names] - def get_index_types(self, evaluator, index_array): indexes = iterable.create_indexes_or_slices(self._evaluator, index_array) if any([isinstance(i, iterable.Slice) for i in indexes]): @@ -486,30 +475,6 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)): def params(self): return self.get_subscope_by_name('__init__').params - def scope_names_generator(self, position=None, add_class_vars=True): - def in_iterable(name, iterable): - """ checks if the name is in the variable 'iterable'. """ - for i in iterable: - # Only the last name is important, because these names have a - # maximal length of 2, with the first one being `self`. - if unicode(i.names[-1]) == unicode(name.names[-1]): - return True - return False - - all_names = [] - for cls in self.py__mro__(self._evaluator): - names = [] - if isinstance(cls, compiled.CompiledObject): - x = cls.instance_names() - else: - x = reversed(cls.base.get_defined_names()) - for n in x: - if not in_iterable(n, all_names): - names.append(n) - yield cls, names - if add_class_vars: - yield self, compiled.type_names - def names_dicts(self, search_global): if search_global: yield self.names_dict @@ -750,10 +715,6 @@ class FunctionExecution(Executed): """ return self._get_params() + pr.Scope.get_defined_names(self) - def scope_names_generator(self, position=None): - names = pr.filter_after_position(pr.Scope.get_defined_names(self), position) - yield self, self._get_params() + names - def _copy_list(self, lst): """ Copies a list attribute of a parser Function. Copying is very @@ -839,17 +800,6 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, pr.Module, Wrapper)): self._evaluator = evaluator self.base = self._module = module - def scope_names_generator(self, position=None): - yield self, pr.filter_after_position(self._module.get_defined_names(), position) - yield self, self._module_attributes() - for star_module in self.star_imports(): - yield self, star_module.get_defined_names() - if self.base.global_names: - yield self, self.base.global_names - sub_modules = self._sub_modules() - if sub_modules: - yield self, self._sub_modules() - def names_dicts(self, search_global): yield self.base.names_dict yield self._module_attributes_dict() diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index 4b925925..05e6ef78 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -755,9 +755,6 @@ class Class(ClassOrFunc): sub.get_call_signature(func_name=self.name), docstr) return docstr - def scope_names_generator(self, position=None): - yield self, filter_after_position(self.get_defined_names(), position) - def _create_params(function, lst): if not lst: @@ -830,9 +827,6 @@ class Function(ClassOrFunc): debug.warning("multiple names in param %s", n) return n - def scope_names_generator(self, position=None): - yield self, filter_after_position(self.get_defined_names(), position) - def get_call_signature(self, width=72, func_name=None): """ Generate call signature of this function. @@ -1269,9 +1263,6 @@ class CompFor(Simple): def get_defined_names(self): return _defined_names(self.children[1]) - def scope_names_generator(self, position): - yield self, [] - @property def asserts(self): """Since it's a scope, it can be asked for asserts."""