1
0
forked from VimPlug/jedi

A lot more fixes - fix all evaluate integration tests.

This commit is contained in:
Dave Halter
2016-12-03 22:17:38 +01:00
parent ee1f077014
commit 6940900c58
10 changed files with 91 additions and 53 deletions
+22
View File
@@ -112,6 +112,17 @@ class CompiledObject(Context):
params.append(Param(parts, self))
return params
def get_param_names(self):
params_str, ret = self._parse_function_doc()
tokens = params_str.split(',')
if inspect.ismethoddescriptor(self.obj):
tokens.insert(0, 'self')
for p in tokens:
parts = p.strip().split('=')
if len(parts) > 1:
parts.insert(1, Operator('=', (0, 0)))
yield UnresolvableParamName(self, p[0])
def __repr__(self):
return '<%s: %s>' % (self.__class__.__name__, repr(self.obj))
@@ -278,6 +289,17 @@ class CompiledName(AbstractNameDefinition):
return [_create_from_name(self._evaluator, module, self.parent_context, self.string_name)]
class UnresolvableParamName(AbstractNameDefinition):
api_type = 'param'
def __init__(self, compiled_obj, name):
self.parent_context = compiled_obj.parent_context
self.string_name = name
def infer(self):
return set()
class CompiledContextName(AbstractNameDefinition):
def __init__(self, parent_context, name):
self.string_name = name
+1 -1
View File
@@ -431,7 +431,7 @@ class Importer(object):
if self.str_import_path == ('flask', 'ext'):
# List Flask extensions like ``flask_foo``
for mod in self._get_module_names():
modname = str(mod)
modname = mod.string_name
if modname.startswith('flask_'):
extname = modname[len('flask_'):]
names.append(self._generate_name(extname))
+6 -2
View File
@@ -564,10 +564,14 @@ class ModuleContext(use_metaclass(CachedMetaClass, context.TreeContext)):
# modules on sys_path or whatever the search_path is.
paths = set()
for s in search_path:
other = os.path.join(s, unicode(self.name))
other = os.path.join(s, self.name.string_name)
if os.path.isdir(other):
paths.add(other)
return list(paths)
if paths:
return list(paths)
# TODO I'm not sure if this is how nested namespace
# packages work. The tests are not really good enough to
# show that.
# Default to this.
return [self._get_init_directory()]