mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Move get_signatures from Function to FunctionMixin
This commit is contained in:
@@ -100,6 +100,9 @@ class FunctionMixin(object):
|
||||
|
||||
return FunctionExecutionContext(self.evaluator, self.parent_context, self, arguments)
|
||||
|
||||
def get_signatures(self):
|
||||
return [TreeSignature(self)]
|
||||
|
||||
|
||||
class FunctionContext(use_metaclass(CachedMetaClass, FunctionMixin, FunctionAndClassBase)):
|
||||
"""
|
||||
@@ -147,9 +150,6 @@ class FunctionContext(use_metaclass(CachedMetaClass, FunctionMixin, FunctionAndC
|
||||
def get_default_param_context(self):
|
||||
return self.parent_context
|
||||
|
||||
def get_signatures(self):
|
||||
return [TreeSignature(self)]
|
||||
|
||||
|
||||
class MethodContext(FunctionContext):
|
||||
def __init__(self, evaluator, class_context, *args, **kwargs):
|
||||
@@ -394,7 +394,7 @@ class OverloadedFunctionContext(FunctionMixin, ContextWrapper):
|
||||
return ContextSet.from_sets(fe.infer() for fe in function_executions)
|
||||
|
||||
def get_signatures(self):
|
||||
return [TreeSignature(f) for f in self.overloaded_functions]
|
||||
return [s for f in self.overloaded_functions for s in f.get_signatures()]
|
||||
|
||||
|
||||
def signature_matches(function_context, arguments):
|
||||
|
||||
@@ -25,6 +25,7 @@ from jedi.evaluate.base_context import ContextualizedNode, \
|
||||
from jedi.evaluate.context import ClassContext, ModuleContext, \
|
||||
FunctionExecutionContext
|
||||
from jedi.evaluate.context.klass import ClassMixin
|
||||
from jedi.evaluate.context.function import FunctionMixin
|
||||
from jedi.evaluate.context import iterable
|
||||
from jedi.evaluate.lazy_context import LazyTreeContext, LazyKnownContext, \
|
||||
LazyKnownContexts
|
||||
@@ -656,7 +657,7 @@ class WrapsCallable(ContextWrapper):
|
||||
return ContextSet({Wrapped(func, self._wrapped_context) for func in funcs})
|
||||
|
||||
|
||||
class Wrapped(ContextWrapper):
|
||||
class Wrapped(ContextWrapper, FunctionMixin):
|
||||
def __init__(self, func, original_function):
|
||||
super(Wrapped, self).__init__(func)
|
||||
self._original_function = original_function
|
||||
@@ -665,12 +666,6 @@ class Wrapped(ContextWrapper):
|
||||
def name(self):
|
||||
return self._original_function.name
|
||||
|
||||
def get_signatures(self):
|
||||
return [
|
||||
ReplacedNameSignature(sig, self._original_function.name)
|
||||
for sig in self._wrapped_context.get_signatures()
|
||||
]
|
||||
|
||||
|
||||
class ReplacedNameSignature(SignatureWrapper):
|
||||
def __init__(self, signature, name):
|
||||
|
||||
Reference in New Issue
Block a user