module documentation

Helpers for inspecting Python modules.

Class DefaultValue A simple wrapper for default value of the parameters of overload functions.
Class TypeAliasForwardRef Pseudo typing class for autodoc_type_aliases.
Class TypeAliasModule Pseudo module class for autodoc_type_aliases.
Class TypeAliasNamespace Pseudo namespace class for autodoc_type_aliases.
Function evaluate_signature Evaluate unresolved type annotations in a signature object.
Function getall Get __all__ attribute of the module as dict.
Function getannotations Get __annotations__ from given *obj* safely.
Function getdoc Get the docstring for the object.
Function getglobals Get __globals__ from given *obj* safely.
Function getmro Get __mro__ from given *obj* safely.
Function getorigbases Get __orig_bases__ from *obj* safely.
Function getslots Get __slots__ attribute of the class as dict.
Function is_builtin_class_method If attr_name is implemented at builtin class, return True.
Function is_cython_function_or_method Check if the object is a function or method in cython.
Function is_singledispatch_function Check if the object is singledispatch function.
Function is_singledispatch_method Check if the object is singledispatch method.
Function isabstractmethod Check if the object is an abstractmethod.
Function isattributedescriptor Check if the object is an attribute like descriptor.
Function isboundmethod Check if the method is a bound method.
Function isbuiltin Check if the object is builtin.
Function isclassmethod Check if the object is classmethod.
Function iscoroutinefunction Check if the object is coroutine-function.
Function isdescriptor Check if the object is some kind of descriptor.
Function isenumattribute Check if the object is attribute of enum.
Function isenumclass Check if the object is subclass of enum.
Function isfunction Check if the object is function.
Function isgenericalias Check if the object is GenericAlias.
Function isNewType Check the if object is a kind of NewType.
Function ispartial Check if the object is partial.
Function isproperty Check if the object is property.
Function isroutine Check is any kind of function or method.
Function isstaticmethod Check if the object is staticmethod.
Function object_description A repr() implementation that returns text safe to use in reST context.
Function safe_getattr A getattr() that turns all exceptions into AttributeErrors.
Function signature Return a Signature object for the given *subject*.
Function signature_from_ast Create a Signature object from AST *node*.
Function signature_from_str Create a Signature object from string.
Function stringify_signature Stringify a Signature object.
Function unpartial Get an original object from partial object.
Function unwrap Get an original object from wrapped object (wrapped functions).
Function unwrap_all Get an original object from wrapped object (unwrapping partials, wrapped functions, and other decorators).
Variable logger Undocumented
Variable memory_address_re Undocumented
Function _should_unwrap Check the function should be unwrapped on getting signature.
def evaluate_signature(sig, globalns=None, localns=None): (source)

Evaluate unresolved type annotations in a signature object.

Parameters
sig:inspect.SignatureUndocumented
globalns:dict|NoneUndocumented
localns:dict|NoneUndocumented
Returns
inspect.SignatureUndocumented
def getall(obj): (source)

Get __all__ attribute of the module as dict. Return None if given *obj* does not have __all__. Raises ValueError if given *obj* have invalid __all__.

Parameters
obj:AnyUndocumented
Returns
Sequence[str]|NoneUndocumented
def getannotations(obj): (source)

Get __annotations__ from given *obj* safely.

Parameters
obj:AnyUndocumented
Returns
Mapping[str, Any]Undocumented
def getdoc(obj, attrgetter=safe_getattr, allow_inherited=False, cls=None, name=None): (source)

Get the docstring for the object. This tries to obtain the docstring for some kind of objects additionally: * partial functions * inherited docstring * inherited decorated methods

Parameters
obj:AnyUndocumented
attrgetter:CallableUndocumented
allow_inherited:boolUndocumented
cls:AnyUndocumented
name:str|NoneUndocumented
Returns
str|NoneUndocumented
def getglobals(obj): (source)

Get __globals__ from given *obj* safely.

Parameters
obj:AnyUndocumented
Returns
Mapping[str, Any]Undocumented
def getmro(obj): (source)

Get __mro__ from given *obj* safely.

Parameters
obj:AnyUndocumented
Returns
tuple[type, ...]Undocumented
def getorigbases(obj): (source)

Get __orig_bases__ from *obj* safely.

Parameters
obj:AnyUndocumented
Returns
tuple[Any, ...]|NoneUndocumented
def getslots(obj): (source)

Get __slots__ attribute of the class as dict. Return None if gienv *obj* does not have __slots__. Raises TypeError if given *obj* is not a class. Raises ValueError if given *obj* have invalid __slots__.

Parameters
obj:AnyUndocumented
Returns
dict|NoneUndocumented
def is_builtin_class_method(obj, attr_name): (source)

If attr_name is implemented at builtin class, return True. >>> is_builtin_class_method(int, '__init__') True Why this function needed? CPython implements int.__init__ by Descriptor but PyPy implements it by pure Python code.

Parameters
obj:AnyUndocumented
attr_name:strUndocumented
Returns
boolUndocumented
def is_cython_function_or_method(obj): (source)

Check if the object is a function or method in cython.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def is_singledispatch_function(obj): (source)

Check if the object is singledispatch function.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def is_singledispatch_method(obj): (source)

Check if the object is singledispatch method.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isabstractmethod(obj): (source)

Check if the object is an abstractmethod.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isattributedescriptor(obj): (source)

Check if the object is an attribute like descriptor.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isboundmethod(method): (source)

Check if the method is a bound method.

Parameters
method:MethodTypeUndocumented
Returns
boolUndocumented
def isbuiltin(obj): (source)

Check if the object is builtin.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isclassmethod(obj, cls=None, name=None): (source)

Check if the object is classmethod.

Parameters
obj:AnyUndocumented
cls:AnyUndocumented
name:str|NoneUndocumented
Returns
boolUndocumented
def iscoroutinefunction(obj): (source)

Check if the object is coroutine-function.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isdescriptor(x): (source)

Check if the object is some kind of descriptor.

Parameters
x:AnyUndocumented
Returns
boolUndocumented
def isenumattribute(x): (source)

Check if the object is attribute of enum.

Parameters
x:AnyUndocumented
Returns
boolUndocumented
def isenumclass(x): (source)

Check if the object is subclass of enum.

Parameters
x:AnyUndocumented
Returns
boolUndocumented
def isfunction(obj): (source)

Check if the object is function.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isgenericalias(obj): (source)

Check if the object is GenericAlias.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isNewType(obj): (source)

Check the if object is a kind of NewType.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def ispartial(obj): (source)

Check if the object is partial.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isproperty(obj): (source)

Check if the object is property.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isroutine(obj): (source)

Check is any kind of function or method.

Parameters
obj:AnyUndocumented
Returns
boolUndocumented
def isstaticmethod(obj, cls=None, name=None): (source)

Check if the object is staticmethod.

Parameters
obj:AnyUndocumented
cls:AnyUndocumented
name:str|NoneUndocumented
Returns
boolUndocumented
def object_description(object): (source)

A repr() implementation that returns text safe to use in reST context.

Parameters
object:AnyUndocumented
Returns
strUndocumented
def safe_getattr(obj, name, *defargs): (source)

A getattr() that turns all exceptions into AttributeErrors.

Parameters
obj:AnyUndocumented
name:strUndocumented
*defargs:AnyUndocumented
Returns
AnyUndocumented
def signature(subject, bound_method=False, type_aliases={}): (source)

Return a Signature object for the given *subject*. :param bound_method: Specify *subject* is a bound method or not

Parameters
subject:CallableUndocumented
bound_method:boolUndocumented
type_aliases:dictUndocumented
Returns
inspect.SignatureUndocumented
def signature_from_ast(node, code=''): (source)

Create a Signature object from AST *node*.

Parameters
node:ast.FunctionDefUndocumented
code:strUndocumented
Returns
inspect.SignatureUndocumented
def signature_from_str(signature): (source)

Create a Signature object from string.

Parameters
signature:strUndocumented
Returns
inspect.SignatureUndocumented
def stringify_signature(sig, show_annotation=True, show_return_annotation=True, unqualified_typehints=False): (source)

Stringify a Signature object. :param show_annotation: If enabled, show annotations on the signature :param show_return_annotation: If enabled, show annotation of the return value :param unqualified_typehints: If enabled, show annotations as unqualified (ex. io.StringIO -> StringIO)

Parameters
sig:inspect.SignatureUndocumented
show_annotation:boolUndocumented
show_return_annotation:boolUndocumented
unqualified_typehints:boolUndocumented
Returns
strUndocumented
def unpartial(obj): (source)

Get an original object from partial object. This returns given object itself if not partial.

Parameters
obj:AnyUndocumented
Returns
AnyUndocumented
def unwrap(obj): (source)

Get an original object from wrapped object (wrapped functions).

Parameters
obj:AnyUndocumented
Returns
AnyUndocumented
def unwrap_all(obj, *, stop=None): (source)

Get an original object from wrapped object (unwrapping partials, wrapped functions, and other decorators).

Parameters
obj:AnyUndocumented
stop:Callable|NoneUndocumented
Returns
AnyUndocumented

Undocumented

memory_address_re = (source)

Undocumented

def _should_unwrap(subject): (source)

Check the function should be unwrapped on getting signature.

Parameters
subject:CallableUndocumented
Returns
boolUndocumented