mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
Remove some get_defined_names methods, that are not needed anymore.
This commit is contained in:
@@ -230,7 +230,12 @@ class NestedImportModule(pr.Module):
|
||||
debug.dbg('Generated a nested import: %s', new)
|
||||
return helpers.FakeName(str(i.namespace.names[1]), new)
|
||||
|
||||
def get_defined_names(self):
|
||||
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]
|
||||
|
||||
@@ -256,12 +261,6 @@ class StarImportModule(pr.Module):
|
||||
for s in self.star_import_modules:
|
||||
yield s, s.get_defined_names()
|
||||
|
||||
def get_defined_names(self):
|
||||
result = self._module.get_defined_names()
|
||||
for m in self.star_import_modules:
|
||||
result += m.get_defined_names()
|
||||
return result
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._module, name)
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ class Array(use_metaclass(CachedMetaClass, pr.Base)):
|
||||
# `array.type` is a string with the type, e.g. 'list'.
|
||||
scope = self._evaluator.find_types(compiled.builtin, self._array.type)[0]
|
||||
scope = self._evaluator.execute(scope)[0] # builtins only have one class
|
||||
names = scope.get_defined_names()
|
||||
for _, names in scope.scope_names_generator():
|
||||
yield self, [ArrayMethod(n) for n in names]
|
||||
|
||||
@common.safe_property
|
||||
|
||||
@@ -139,18 +139,6 @@ class Instance(use_metaclass(CachedMetaClass, Executable)):
|
||||
args = [obj, obj.base] if isinstance(obj, Instance) else [None, obj]
|
||||
return self.execute_subscope_by_name('__get__', args)
|
||||
|
||||
@memoize_default([])
|
||||
def get_defined_names(self):
|
||||
"""
|
||||
Get the instance vars of a class. This includes the vars of all
|
||||
classes
|
||||
"""
|
||||
names = self.get_self_attributes()
|
||||
|
||||
for var in self.base.instance_names():
|
||||
names.append(InstanceElement(self._evaluator, self, var, True))
|
||||
return names
|
||||
|
||||
def scope_names_generator(self, position=None):
|
||||
"""
|
||||
An Instance has two scopes: The scope with self names and the class
|
||||
@@ -309,12 +297,6 @@ class Class(use_metaclass(CachedMetaClass, pr.IsScope)):
|
||||
result += super_result
|
||||
return result
|
||||
|
||||
@memoize_default(default=())
|
||||
def get_defined_names(self):
|
||||
result = self.instance_names()
|
||||
type_cls = self._evaluator.find_types(compiled.builtin, 'type')[0]
|
||||
return result + list(type_cls.get_defined_names())
|
||||
|
||||
def scope_names_generator(self, position=None):
|
||||
yield self, self.instance_names()
|
||||
yield self, compiled.type_names
|
||||
|
||||
@@ -62,5 +62,5 @@ def test_string_literals():
|
||||
assert typ('b""') == 'bytes'
|
||||
assert typ('u""') == 'str'
|
||||
else:
|
||||
assert typ('b""') == 'string'
|
||||
assert typ('b""') == 'str'
|
||||
assert typ('u""') == 'unicode'
|
||||
|
||||
Reference in New Issue
Block a user