decorators module¶
Class and function decorators.
cacheable function¶
Cacheable function decorator.
See notes on cacheable_property.
Note
To decorate an instance method, use cacheable_method().
cacheable_method function¶
cacheable_method(
*args,
use_cache=False,
whitelist=False,
max_size=None,
ignore_args=None,
**options
)
Cacheable method decorator.
See notes on cacheable_property.
cached function¶
cacheable() with use_cache set to True.
Note
To decorate an instance method, use cached_method().
cached_method function¶
cacheable_method() with use_cache set to True.
custom_function function¶
Custom function decorator.
custom_method function¶
Custom method decorator.
cacheable_functionT class¶
Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol):
def meth(self) -> int:
...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
__ class C__
def meth(self) -> int:
return 0
def func(x: Proto) -> int: return x.meth()
func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto(Protocol[T]):
def meth(self) -> T:
...
Superclasses
- custom_functionT
typing.Generictyping.Protocol
get_ca_setup class variable¶
is_cacheable class variable¶
cacheable_methodT class¶
Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol):
def meth(self) -> int:
...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
__ class C__
def meth(self) -> int:
return 0
def func(x: Proto) -> int: return x.meth()
func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto(Protocol[T]):
def meth(self) -> T:
...
Superclasses
- custom_functionT
- custom_methodT
typing.Generictyping.Protocol
get_ca_setup class variable¶
cacheable_property class¶
Extends custom_property for cacheable properties.
Note
Assumes that the instance (provided as self) won't change. If calculation depends upon object attributes that can be changed, it won't notice the change.
Superclasses
builtins.property- custom_property
Inherited members
Subclasses
get_ca_setup method¶
Get setup of type CARunSetup if instance is known, or CAUnboundSetup otherwise.
See vectorbtpro.registries.ca_registry for details on the caching procedure.
init_use_cache property¶
Initial value for use_cache.
init_whitelist property¶
Initial value for whitelist.
cached_property class¶
cacheable_property with use_cache set to True.
Superclasses
builtins.property- cacheable_property
- custom_property
Inherited members
- cacheable_property.func
- cacheable_property.get_ca_setup()
- cacheable_property.init_use_cache
- cacheable_property.init_whitelist
- cacheable_property.name
- cacheable_property.options
class_or_instanceproperty class¶
Property that binds self to a class if the function is called as class method, otherwise to an instance.
func property¶
Wrapped function.
classproperty class¶
Property that can be called on a class.
func property¶
Wrapped function.
custom_functionT class¶
Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol):
def meth(self) -> int:
...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
__ class C__
def meth(self) -> int:
return 0
def func(x: Proto) -> int: return x.meth()
func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto(Protocol[T]):
def meth(self) -> T:
...
Superclasses
typing.Generictyping.Protocol
Subclasses
func class variable¶
is_method class variable¶
name class variable¶
options class variable¶
custom_methodT class¶
Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol):
def meth(self) -> int:
...
Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
__ class C__
def meth(self) -> int:
return 0
def func(x: Proto) -> int: return x.meth()
func(C()) # Passes static type check
See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto(Protocol[T]):
def meth(self) -> T:
...
Superclasses
- custom_functionT
typing.Generictyping.Protocol
Subclasses
custom_property class¶
Custom extensible property that stores function and options as attributes.
Note
custom_property instances belong to classes, not class instances. Thus changing the property will do the same for each instance of the class where the property has been defined initially.
Superclasses
builtins.property
Subclasses
func property¶
Wrapped function.
name property¶
Wrapped function name.
options property¶
Options.