forked from VimPlug/jedi
Rework some call signature issues
This commit is contained in:
@@ -323,12 +323,8 @@ class Evaluator(object):
|
||||
context_set = eval_trailer(context, context_set, trailer)
|
||||
param_names = []
|
||||
for context in context_set:
|
||||
try:
|
||||
get_param_names = context.get_param_names
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
for param_name in get_param_names():
|
||||
for signature in context.get_signatures():
|
||||
for param_name in signature.get_param_names():
|
||||
if param_name.string_name == name.value:
|
||||
param_names.append(param_name)
|
||||
return param_names
|
||||
|
||||
@@ -356,6 +356,9 @@ class ContextSet(BaseContextSet):
|
||||
context_set |= method()
|
||||
return context_set
|
||||
|
||||
def get_signatures(self):
|
||||
return [sig for c in self._set for sig in c.get_signatures()]
|
||||
|
||||
|
||||
NO_CONTEXTS = ContextSet([])
|
||||
|
||||
|
||||
@@ -218,6 +218,10 @@ class AbstractInstanceContext(Context):
|
||||
raise NotImplementedError
|
||||
return class_context
|
||||
|
||||
def get_signatures(self):
|
||||
init_funcs = self.py__getattribute__('__call__')
|
||||
return [sig.bind() for sig in init_funcs.get_signatures()]
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s of %s(%s)>" % (self.__class__.__name__, self.class_context,
|
||||
self.var_args)
|
||||
@@ -296,12 +300,14 @@ class TreeInstance(AbstractInstanceContext):
|
||||
return self._get_annotated_class_object() or self.class_context
|
||||
|
||||
def _get_annotation_init_functions(self):
|
||||
for init in self.class_context.py__getattribute__('__init__'):
|
||||
if isinstance(init, OverloadedFunctionContext):
|
||||
for func in init.overloaded_functions:
|
||||
yield func
|
||||
elif isinstance(init, FunctionContext):
|
||||
yield init
|
||||
filter = next(self.class_context.get_filters())
|
||||
for init_name in filter.get('__init__'):
|
||||
for init in init_name.infer():
|
||||
if isinstance(init, OverloadedFunctionContext):
|
||||
for func in init.overloaded_functions:
|
||||
yield func
|
||||
elif isinstance(init, FunctionContext):
|
||||
yield init
|
||||
|
||||
|
||||
class AnonymousInstance(TreeInstance):
|
||||
|
||||
@@ -292,6 +292,4 @@ class ClassContext(use_metaclass(CachedMetaClass, ClassMixin, TreeContext)):
|
||||
|
||||
def get_signatures(self):
|
||||
init_funcs = self.py__getattribute__('__init__')
|
||||
return [
|
||||
s for f in init_funcs for s in f.get_signatures()
|
||||
]
|
||||
return [sig.bind() for sig in init_funcs.get_signatures()]
|
||||
|
||||
Reference in New Issue
Block a user