Skip to content

decorators module

Class and function decorators.


cacheable function

cacheable(
    *args,
    use_cache=False,
    whitelist=False,
    max_size=None,
    ignore_args=None,
    **options
)

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

cached(
    *args,
    **options
)

cacheable with use_cache set to True.

Note

To decorate an instance method, use cached_method.


cached_method function

cached_method(
    *args,
    **options
)

cacheable_method with use_cache set to True.


custom_function function

custom_function(
    *args,
    **options
)

Custom function decorator.


custom_method function

custom_method(
    *args,
    **options
)

Custom method decorator.


memoized_method function

memoized_method(
    func
)

Dead-simple memoization decorator for methods.


cacheable_property class

cacheable_property(
    func,
    use_cache=False,
    whitelist=False,
    **options
)

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

Inherited members

Subclasses


get_ca_setup method

cacheable_property.get_ca_setup(
    instance=None
)

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 class property

Initial value for use_cache.


init_whitelist class property

Initial value for whitelist.


cached_property class

cached_property(
    func,
    **options
)

cacheable_property with use_cache set to True.

Superclasses

Inherited members


class_property class

class_property(
    func
)

Property that can be called on a class.

Superclasses

Inherited members


func class property

Wrapped function.


custom_property class

custom_property(
    func,
    **options
)

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

  • Base
  • builtins.property

Inherited members

Subclasses


func class property

Wrapped function.


name class property

Wrapped function name.


options class property

Options.


hybrid_property class

hybrid_property(
    func
)

Property that binds self to a class if the function is called as class method, otherwise to an instance.

Superclasses

Inherited members


func class property

Wrapped function.