forked from VimPlug/jedi
Raise a deprecation warning on Definition.params
This commit is contained in:
+9
-2
@@ -362,10 +362,14 @@ class BaseDefinition(object):
|
|||||||
Raises an ``AttributeError`` if the definition is not callable.
|
Raises an ``AttributeError`` if the definition is not callable.
|
||||||
Otherwise returns a list of `Definition` that represents the params.
|
Otherwise returns a list of `Definition` that represents the params.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn(
|
||||||
|
"Deprecated since version 0.16.0. Use get_signatures()[...].params",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2
|
||||||
|
)
|
||||||
# Only return the first one. There might be multiple one, especially
|
# Only return the first one. There might be multiple one, especially
|
||||||
# with overloading.
|
# with overloading.
|
||||||
for value in self._name.infer():
|
for signature in self._get_signatures():
|
||||||
for signature in value.get_signatures():
|
|
||||||
return [
|
return [
|
||||||
Definition(self._inference_state, n)
|
Definition(self._inference_state, n)
|
||||||
for n in signature.get_param_names(resolve_stars=True)
|
for n in signature.get_param_names(resolve_stars=True)
|
||||||
@@ -435,6 +439,9 @@ class BaseDefinition(object):
|
|||||||
start_index = max(index - before, 0)
|
start_index = max(index - before, 0)
|
||||||
return ''.join(lines[start_index:index + after + 1])
|
return ''.join(lines[start_index:index + after + 1])
|
||||||
|
|
||||||
|
def _get_signatures(self):
|
||||||
|
return self._name.infer().get_signatures()
|
||||||
|
|
||||||
def get_signatures(self):
|
def get_signatures(self):
|
||||||
return [
|
return [
|
||||||
BaseSignature(self._inference_state, s)
|
BaseSignature(self._inference_state, s)
|
||||||
|
|||||||
Reference in New Issue
Block a user