diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index d8451662..25b0d836 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -143,7 +143,7 @@ class Script(object): if not dot: # add named params for call_def in self.call_signatures(): - if not call_def.module.is_builtin(): + if not isinstance(call_def.module, compiled.PyObject): for p in call_def.params: completions.append((p.get_name(), p)) diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 8ab470db..36a410e7 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -282,8 +282,8 @@ class Evaluator(object): result += self.eval_call(call) elif call == '*': if [r for r in result if isinstance(r, iterable.Array) - or isinstance(r, er.Instance) - and str(r.name) == 'str']: + or isinstance(r, compiled.PyObject) + and isinstance(r.obj, (str, unicode))]: # if it is an iterable, ignore * operations next(calls_iterator) return set(result) @@ -452,8 +452,8 @@ def filter_private_variable(scope, call_scope, var_name): if isinstance(var_name, (str, unicode)) and isinstance(scope, er.Instance)\ and var_name.startswith('__') and not var_name.endswith('__'): s = call_scope.get_parent_until((pr.Class, er.Instance)) - if not isinstance(scope.base, compiled.PyObject): - if s != scope and s != scope.base.base: + if s != scope and (isinstance(scope.base, compiled.PyObject) + or s != scope.base.base): return True return False diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index fbb9e1de..78dafecc 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -109,6 +109,7 @@ class PyObject(Base): for name in dir(self._cls().obj): f = fake.get_faked(module.obj, self.obj, name) if f: + f.parent = self faked_subscopes.append(f) return faked_subscopes diff --git a/jedi/evaluate/helpers.py b/jedi/evaluate/helpers.py index 77a9e70a..b298d8bb 100644 --- a/jedi/evaluate/helpers.py +++ b/jedi/evaluate/helpers.py @@ -163,9 +163,10 @@ class FakeSubModule(): class FakeStatement(pr.Statement): - def __init__(self, token_list): + def __init__(self, expression_list): p = 0, 0 - super(FakeStatement, self).__init__(FakeSubModule, token_list, p, p) + super(FakeStatement, self).__init__(FakeSubModule, expression_list, p, p) + self._expression_list = expression_list class FakeName(pr.Name): diff --git a/jedi/evaluate/iterable.py b/jedi/evaluate/iterable.py index 842cac82..63aeb801 100644 --- a/jedi/evaluate/iterable.py +++ b/jedi/evaluate/iterable.py @@ -96,6 +96,8 @@ class Array(use_metaclass(CachedMetaClass, pr.Base)): str_key = key.value elif isinstance(key, pr.Name): str_key = str(key) + else: + continue if mixed_index == str_key: index = i