pg.typing.Signature¶
Accessible via pg.typing.Signature
.
- class Signature(callable_type, name, module_name, args=None, kwonlyargs=None, varargs=None, varkw=None, return_value=None, qualname=None)[source]¶
Bases:
pg.Formattable
PY3 function signature.
Attributes:
Returns names of all arguments according to their declaration order.
Returns whether wildcard positional argument is present.
Returns whether wildcard keyword argument is present.
Returns whether any wildcard arguments are present.
Returns ID of the function.
Returns all named arguments according to their declaration order.
Methods:
format
(*args[, markdown])Format current object.
from_callable
(callable_object[, auto_typing])Creates Signature from a callable object.
from_schema
(schema, module_name, name[, ...])Creates a signature from a schema object.
get_value_spec
(name)Returns Value spec for an argument name.
make_function
(body[, exec_globals, exec_locals])Makes a function with current signature.
- classmethod from_callable(callable_object, auto_typing=False)[source]¶
Creates Signature from a callable object.
- Return type:
- classmethod from_schema(schema, module_name, name, qualname=None, is_method=True)[source]¶
Creates a signature from a schema object.
- Return type:
- Parameters:
schema – A pg.typing.Schema object associated with a pg.Object.
module_name – Module name for the signature.
name – Function or method name of the signature.
qualname – Qualname of the signature.
is_method – If True, self will be added in the signature as the first argument.
- Returns:
A signature object from the schema.
- get_value_spec(name)[source]¶
Returns Value spec for an argument name.
- Return type:
- Parameters:
name – Argument name.
- Returns:
ValueSpec for the requested argument. If name is not found, value spec of wildcard keyword argument will be used. None will be returned if name does not exist in signature and wildcard keyword is not accepted.