jacinle.utils.registry#
Classes
A callable manager utils. |
|
Functions
|
|
|
|
|
Class CallbackRegistry
- class CallbackRegistry[source]#
Bases:
Registry
A callable manager utils.
If there exists a super callback, it will block all callbacks. A super callback will receive the called name as its first argument.
Then the dispatcher will try to call the callback by name. If such name does not exists, a fallback callback will be called.
The fallback callback will also receive the called name as its first argument.
Example
>>> registry = CallbackRegistry() >>> callback_func = print >>> registry.register('name', callback_func) # register a callback. >>> registry.dispatch('name', 'arg1', 'arg2', kwarg1='kwarg1') # dispatch.
- __new__(**kwargs)#
- has(entry)#
- items()#
- keys()#
- lookup(entry, fallback=True, default=None)#
- register(entry, value)#
- set_fallback(value)#
- unregister(entry)#
- property fallback#
- property fallback_callback#
- property super_callback#
Class DefaultRegistry
- class DefaultRegistry[source]#
Bases:
Registry
- __init__()#
- __new__(**kwargs)#
- has(entry)#
- items()#
- keys()#
- register(entry, value)#
- set_fallback(value)#
- unregister(entry)#
- property fallback#
Class EventRegistry
- class EventRegistry[source]#
Bases:
Registry
- __init__()#
- __new__(**kwargs)#
- has(entry)#
- items()#
- keys()#
- set_fallback(value)#
- DEF_PRIORITY = 10#
- property fallback#
Class EventRegistryGroup
- class EventRegistryGroup[source]#
Bases:
RegistryGroup
- __init__()#
- __new__(**kwargs)#
- register(registry_name, entry, value, **kwargs)#
Class LockRegistry
- class LockRegistry[source]#
Bases:
DefaultRegistry
- __init__()#
- __new__(**kwargs)#
- has(entry)#
- items()#
- keys()#
- lookup(entry, fallback=False, default=None)#
- register(entry, value)#
- set_fallback(value)#
- unregister(entry)#
- property fallback#
Class Registry
Class RegistryGroup
Class SimpleEventRegistry
Functions
- register_event(registry_name, entry, value, **kwargs)#
- trigger_event(registry_name, entry, *args, **kwargs)#