1
0
forked from VimPlug/jedi

Use super().__getattribute__ instead of custom AttributeErrors in __getattr__.

This commit is contained in:
Dave Halter
2016-10-21 02:12:54 +02:00
parent cad9ae8ab1
commit 4ccfbb4962
5 changed files with 28 additions and 28 deletions

View File

@@ -63,11 +63,11 @@ class BaseDefinition(object):
"""
An instance of :class:`jedi.parser.reprsentation.Name` subclass.
"""
self._definition = evaluator.wrap(self._name.get_definition())
self.is_keyword = isinstance(self._definition, keywords.Keyword)
#self._definition = list(self._name.infer())[0]
#self.is_keyword = isinstance(self._definition, keywords.Keyword)
# generate a path to the definition
self._module = name.get_parent_until()
self._module = name.parent_context.get_root_context()
if self.in_builtin_module():
self.module_path = None
else:
@@ -508,6 +508,8 @@ class Completion(BaseDefinition):
def _follow_statements_imports(self):
# imports completion is very complicated and needs to be treated
# separately in Completion.
return self._name.infer()
# TODO REMOVE
definition = self._definition
if definition.isinstance(tree.Import):
i = imports.ImportWrapper(self._evaluator, self._name)

View File

@@ -28,16 +28,12 @@ def get_call_signature_param_names(call_signatures):
def filter_names(evaluator, completion_names, stack, like_name):
comp_dct = {}
for name in set(completion_names):
print(name)
for name in completion_names:
if settings.case_insensitive_completion \
and str(name).lower().startswith(like_name.lower()) \
or str(name).startswith(like_name):
and name.string_name.lower().startswith(like_name.lower()) \
or name.string_name.startswith(like_name):
if isinstance(name.parent, (tree.Function, tree.Class)):
# TODO I think this is a hack. It should be an
# er.Function/er.Class before that.
name = evaluator.wrap(name.parent).name
print(name, name.infer())
new = classes.Completion(
evaluator,
name,