forked from VimPlug/jedi
Remove get_defined_names methods from evaluate representation objects.
This commit is contained in:
@@ -143,15 +143,6 @@ class NestedImportModule(pr.Module):
|
|||||||
debug.dbg('Generated a nested import: %s', new)
|
debug.dbg('Generated a nested import: %s', new)
|
||||||
return helpers.FakeName(str(i.namespace_names[1]), new)
|
return helpers.FakeName(str(i.namespace_names[1]), new)
|
||||||
|
|
||||||
def _get_defined_names(self):
|
|
||||||
"""
|
|
||||||
NesteImportModule don't seem to be actively used, right now.
|
|
||||||
However, they might in the future. If we do more sophisticated static
|
|
||||||
analysis checks.
|
|
||||||
"""
|
|
||||||
nested = self._get_nested_import_name()
|
|
||||||
return self._module.get_defined_names() + [nested]
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return getattr(self._module, name)
|
return getattr(self._module, name)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ from jedi.parser import tree as pr
|
|||||||
from jedi.evaluate import compiled
|
from jedi.evaluate import compiled
|
||||||
from jedi.evaluate import helpers
|
from jedi.evaluate import helpers
|
||||||
from jedi.evaluate.cache import CachedMetaClass, memoize_default, NO_DEFAULT
|
from jedi.evaluate.cache import CachedMetaClass, memoize_default, NO_DEFAULT
|
||||||
from jedi.cache import underscore_memoization
|
|
||||||
from jedi.evaluate import analysis
|
from jedi.evaluate import analysis
|
||||||
|
|
||||||
|
|
||||||
@@ -45,20 +44,6 @@ class IterableWrapper(pr.Base):
|
|||||||
|
|
||||||
|
|
||||||
class GeneratorMixin(object):
|
class GeneratorMixin(object):
|
||||||
@underscore_memoization
|
|
||||||
def _get_defined_names(self):
|
|
||||||
"""
|
|
||||||
Returns a list of names that define a generator, which can return the
|
|
||||||
content of a generator.
|
|
||||||
"""
|
|
||||||
executes_generator = '__next__', 'send', 'next'
|
|
||||||
for name in compiled.generator_obj.get_defined_names():
|
|
||||||
if name.name in executes_generator:
|
|
||||||
parent = GeneratorMethod(self, name.parent)
|
|
||||||
yield helpers.FakeName(name.name, parent)
|
|
||||||
else:
|
|
||||||
yield name
|
|
||||||
|
|
||||||
@memoize_default()
|
@memoize_default()
|
||||||
def names_dicts(self, search_global=False): # is always False
|
def names_dicts(self, search_global=False): # is always False
|
||||||
dct = {}
|
dct = {}
|
||||||
|
|||||||
@@ -674,19 +674,6 @@ class FunctionExecution(Executed):
|
|||||||
break
|
break
|
||||||
return types
|
return types
|
||||||
|
|
||||||
"""
|
|
||||||
@common.safe_property
|
|
||||||
@underscore_memoization
|
|
||||||
def names_dict(self):
|
|
||||||
self.children
|
|
||||||
d = {}
|
|
||||||
for key, values in self.base.names_dict.items():
|
|
||||||
d[key] = self._copy_list(values)
|
|
||||||
return d
|
|
||||||
self.base.names_dict
|
|
||||||
return LazyDict(self.base.names_dict, self._copy_list)
|
|
||||||
"""
|
|
||||||
|
|
||||||
def names_dicts(self, search_global):
|
def names_dicts(self, search_global):
|
||||||
self.children
|
self.children
|
||||||
yield dict((k, [self._copy_dict[v] for v in values])
|
yield dict((k, [self._copy_dict[v] for v in values])
|
||||||
@@ -708,13 +695,6 @@ class FunctionExecution(Executed):
|
|||||||
def name_for_position(self, position):
|
def name_for_position(self, position):
|
||||||
return pr.Function.name_for_position(self, position)
|
return pr.Function.name_for_position(self, position)
|
||||||
|
|
||||||
def get_defined_names(self):
|
|
||||||
"""
|
|
||||||
Call the default method with the own instance (self implements all
|
|
||||||
the necessary functions). Add also the params.
|
|
||||||
"""
|
|
||||||
return self._get_params() + pr.Scope.get_defined_names(self)
|
|
||||||
|
|
||||||
def _copy_list(self, lst):
|
def _copy_list(self, lst):
|
||||||
"""
|
"""
|
||||||
Copies a list attribute of a parser Function. Copying is very
|
Copies a list attribute of a parser Function. Copying is very
|
||||||
|
|||||||
Reference in New Issue
Block a user