Skip to content

annotations module

Utilities for annotations.


flatten_annotations function

flatten_annotations(
    annotations,
    only_var_args=False,
    return_var_arg_maps=False
)

Flatten annotations of variable arguments.


get_annotations function

get_annotations(
    *args,
    **kwargs
)

Get annotations.


has_annotatables function

has_annotatables(
    func,
    target_cls=vectorbtpro.utils.annotations.Annotatable
)

Check if a function has subclasses or instances of Annotatable in its signature.


Annotatable class

Annotatable()

Class that can be used in annotations.

Subclasses


MetaAnnotatable class

MetaAnnotatable(
    *args,
    **kwargs
)

Metaclass that can be used in annotations.

Superclasses

  • builtins.type

Union class

Union(
    *annotations,
    resolved=False
)

Class representing a union of one to multiple annotations.

Superclasses

Inherited members


annotations class variable

Annotations.


resolve method

Union.resolve()

Resolve the union.


resolved class variable

Whether the instance is resolved.


VarArgs class

VarArgs(
    *args
)

Class representing annotations for variable positional arguments.

Superclasses

Inherited members


args class variable

Tuple with annotations.


VarKwargs class

VarKwargs(
    **kwargs
)

Class representing annotations for variable keyword arguments.

Superclasses

Inherited members


kwargs class variable

Dict with annotations.