Skip to content

ch_registry module

Global registry for chunkables.


ch_reg ChunkableRegistry

Default registry of type ChunkableRegistry.


register_chunkable function

register_chunkable(
    func=None,
    setup_id=None,
    registry=<vectorbtpro.registries.ch_registry.ChunkableRegistry object>,
    tags=None,
    return_wrapped=False,
    **options
)

Register a new chunkable function.

If return_wrapped is True, wraps with the chunked decorator. Otherwise, leaves the function as-is (preferred).

Options are merged in the following order:

Note

Calling the register_chunkable decorator before (or below) the register_jitted decorator with return_wrapped set to True won't work. Doing the same after (or above) register_jitted will work for calling the function from Python but not from Numba. Generally, avoid wrapping right away and use ChunkableRegistry.decorate to perform decoration.


ChunkableRegistry class

ChunkableRegistry()

Class for registering chunkable functions.

Superclasses

Inherited members


decorate method

ChunkableRegistry.decorate(
    setup_id_or_func,
    target_func=None,
    **kwargs
)

Decorate the setup's function using the chunked decorator.

Finds setup using ChunkableRegistry.get_setup.

Merges setup's options with options.

Specify target_func to apply the found setup on another function.


get_setup method

ChunkableRegistry.get_setup(
    setup_id_or_func
)

Get setup by its id or function.

setup_id_or_func can be an identifier or a function. If it's a function, will build the identifier using its module and name.


match_setups method

ChunkableRegistry.match_setups(
    expression=None,
    context=None
)

Match setups against an expression with each setup being a context.


register method

ChunkableRegistry.register(
    func,
    setup_id=None,
    options=None,
    tags=None
)

Register a new setup.


resolve_option method

ChunkableRegistry.resolve_option(
    setup_id_or_func,
    option,
    target_func=None,
    **kwargs
)

Same as ChunkableRegistry.decorate but using resolve_chunked.


setups class property

Dict of registered ChunkedSetup instances by ChunkedSetup.setup_id.


ChunkedSetup class

ChunkedSetup(
    *args,
    **kwargs
)

Class that represents a chunkable setup.

Note

Hashed solely by setup_id.

Superclasses

Inherited members


func field

Chunkable function.


options field

Options dictionary.


setup_id field

Setup id.


tags field

Set of tags.