mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Some more docstring stuff
This commit is contained in:
@@ -728,9 +728,8 @@ class Definition(BaseDefinition):
|
|||||||
|
|
||||||
class BaseSignature(Definition):
|
class BaseSignature(Definition):
|
||||||
"""
|
"""
|
||||||
`BaseSignature` objects is the return value of `Script.function_definition`.
|
These signatures are returned by :meth:`BaseDefinition.get_signatures`
|
||||||
It knows what functions you are currently in. e.g. `isinstance(` would
|
calls.
|
||||||
return the `isinstance` function. without `(` it would return nothing.
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, inference_state, signature):
|
def __init__(self, inference_state, signature):
|
||||||
super(BaseSignature, self).__init__(inference_state, signature.name)
|
super(BaseSignature, self).__init__(inference_state, signature.name)
|
||||||
@@ -739,21 +738,28 @@ class BaseSignature(Definition):
|
|||||||
@property
|
@property
|
||||||
def params(self):
|
def params(self):
|
||||||
"""
|
"""
|
||||||
:return list of ParamDefinition:
|
Returns definitions for all parameters that a signature defines.
|
||||||
|
This includes stuff like ``*args`` and ``**kwargs``.
|
||||||
|
|
||||||
|
:rtype: list of :class:`ParamDefinition`
|
||||||
"""
|
"""
|
||||||
return [ParamDefinition(self._inference_state, n)
|
return [ParamDefinition(self._inference_state, n)
|
||||||
for n in self._signature.get_param_names(resolve_stars=True)]
|
for n in self._signature.get_param_names(resolve_stars=True)]
|
||||||
|
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
|
"""
|
||||||
|
Returns a text representation of the signature. This could for example
|
||||||
|
look like ``foo(bar, baz: int, **kwargs)``.
|
||||||
|
|
||||||
|
:return str
|
||||||
|
"""
|
||||||
return self._signature.to_string()
|
return self._signature.to_string()
|
||||||
|
|
||||||
|
|
||||||
class Signature(BaseSignature):
|
class Signature(BaseSignature):
|
||||||
"""
|
"""
|
||||||
``Signature`` objects is the return value of :meth:`.Script.get_signatures`.
|
A full signature object is the return value of
|
||||||
It knows what functions you are currently in. e.g. `isinstance(` would
|
:meth:`.Script.get_signatures`.
|
||||||
return the `isinstance` function with its params. Without `(` it would
|
|
||||||
return nothing.
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, inference_state, signature, call_details):
|
def __init__(self, inference_state, signature, call_details):
|
||||||
super(Signature, self).__init__(inference_state, signature)
|
super(Signature, self).__init__(inference_state, signature)
|
||||||
@@ -765,6 +771,8 @@ class Signature(BaseSignature):
|
|||||||
"""
|
"""
|
||||||
Returns the param index of the current cursor position.
|
Returns the param index of the current cursor position.
|
||||||
Returns None if the index cannot be found in the curent call.
|
Returns None if the index cannot be found in the curent call.
|
||||||
|
|
||||||
|
:rtype: int
|
||||||
"""
|
"""
|
||||||
return self._call_details.calculate_index(
|
return self._call_details.calculate_index(
|
||||||
self._signature.get_param_names(resolve_stars=True)
|
self._signature.get_param_names(resolve_stars=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user