forked from VimPlug/jedi
Fix more argument related stuff.
This commit is contained in:
@@ -184,7 +184,7 @@ class Evaluator(object):
|
|||||||
"""
|
"""
|
||||||
if isinstance(atom, pr.Name):
|
if isinstance(atom, pr.Name):
|
||||||
# This is the first global lookup.
|
# This is the first global lookup.
|
||||||
stmt = atom.get_parent_until((pr.ExprStmt, pr.ReturnStmt))
|
stmt = atom.get_parent_until((pr.ExprStmt, pr.ReturnStmt, pr.Scope))
|
||||||
return self.find_types(stmt.parent, atom, stmt.start_pos,
|
return self.find_types(stmt.parent, atom, stmt.start_pos,
|
||||||
search_global=True)
|
search_global=True)
|
||||||
elif isinstance(atom, pr.Literal):
|
elif isinstance(atom, pr.Literal):
|
||||||
|
|||||||
@@ -21,8 +21,12 @@ class Arguments(object):
|
|||||||
def _split(self):
|
def _split(self):
|
||||||
if isinstance(self._argument_node, (tuple, list)):
|
if isinstance(self._argument_node, (tuple, list)):
|
||||||
for el in self._argument_node:
|
for el in self._argument_node:
|
||||||
yield 0
|
yield 0, el
|
||||||
else:
|
else:
|
||||||
|
if not pr.is_node(self._argument_node, 'arglist'):
|
||||||
|
yield 0, self._argument_node
|
||||||
|
return
|
||||||
|
|
||||||
iterator = iter(self._argument_node.children)
|
iterator = iter(self._argument_node.children)
|
||||||
for child in iterator:
|
for child in iterator:
|
||||||
if child == ',':
|
if child == ',':
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ __
|
|||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
import pkgutil
|
import pkgutil
|
||||||
|
from itertools import chain
|
||||||
|
|
||||||
from jedi._compatibility import use_metaclass, unicode, Python3Method
|
from jedi._compatibility import use_metaclass, unicode, Python3Method
|
||||||
from jedi.parser import representation as pr
|
from jedi.parser import representation as pr
|
||||||
@@ -235,8 +236,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
|||||||
return getattr(self.base, name)
|
return getattr(self.base, name)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<e%s of %s (var_args: %s)>" % \
|
return "<e%s of %s %s>" % (type(self).__name__, self.base, self.var_args)
|
||||||
(type(self).__name__, self.base, len(self.var_args or []))
|
|
||||||
|
|
||||||
|
|
||||||
def get_instance_el(evaluator, instance, var, is_class_var=False):
|
def get_instance_el(evaluator, instance, var, is_class_var=False):
|
||||||
@@ -377,6 +377,10 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
|
|
||||||
@memoize_default(default=())
|
@memoize_default(default=())
|
||||||
def py__bases__(self, evaluator):
|
def py__bases__(self, evaluator):
|
||||||
|
args = param.Arguments(self._evaluator, self.base.get_super_arglist() or ())
|
||||||
|
return list(chain.from_iterable(args.eval_args()))
|
||||||
|
|
||||||
|
# TODO remove
|
||||||
supers = []
|
supers = []
|
||||||
for s in self.base.supers:
|
for s in self.base.supers:
|
||||||
# Super classes are statements.
|
# Super classes are statements.
|
||||||
|
|||||||
@@ -647,9 +647,11 @@ class Class(Scope):
|
|||||||
super(Class, self).__init__(children)
|
super(Class, self).__init__(children)
|
||||||
self.decorators = []
|
self.decorators = []
|
||||||
|
|
||||||
@property
|
def get_super_arglist(self):
|
||||||
def supers(self):
|
if len(self.children) == 4: # Has no parentheses
|
||||||
raise NotImplementedError
|
return None
|
||||||
|
else:
|
||||||
|
return self.children[3]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user