1
0
forked from VimPlug/jedi

trying to fix the getattr mess with compiled

This commit is contained in:
Dave Halter
2014-01-10 13:36:29 +01:00
parent b1409c8f74
commit f868668f0e
6 changed files with 30 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ Implementations of standard library functions, because it's not possible to
understand them with Jedi.
"""
from jedi._compatibility import unicode
from jedi.evaluate import compiled
from jedi.evaluate import representation as er
from jedi.evaluate import iterable
@@ -44,18 +45,18 @@ def builtins_getattr(evaluator, obj, params):
objects = _follow_param(evaluator, params, 0)
names = _follow_param(evaluator, params, 1)
for obj in objects:
if not isinstance(obj, (er.Instance, er.Class, pr.Module)):
if not isinstance(obj, (er.Instance, er.Class, pr.Module, compiled.PyObject)):
debug.warning('getattr called without instance')
continue
for arr_name in names:
if not isinstance(arr_name, er.Instance):
for name in names:
s = unicode, str
print name
if isinstance(name, compiled.PyObject) and isinstance(name.obj, s):
stmts += evaluator.follow_path(iter([name.obj]), [obj], obj)
else:
debug.warning('getattr called without str')
continue
if len(arr_name.var_args) != 1:
debug.warning('jedi getattr is too simple')
key = arr_name.var_args[0]
stmts += evaluator.follow_path(iter([key]), [obj], obj)
return stmts