Register it: A more flexible register for the DeepLearning project.
Project description
RegisterIt
Register it: A more flexible register for the DeepLearning project.
The registry that provides name -> object mapping, to support classes and functions.
Install
pip install register_it
Usage
To create a registry (e.g. a class registry and a function registry):
DATASETS = Registry(name="dataset")
EVALUATE = Registry(name="evaluate")
To register an object:
@DATASETS.register(name='mymodule')
class MyModule(*args, **kwargs):
...
@EVALUATE.register(name='myfunc')
def my_func(*args, **kwargs):
...
Or:
DATASETS.register(name='mymodule', obj=MyModule)
EVALUATE.register(name='myfunc', obj=my_func)
To construct an object of the class or the function:
DATASETS = Registry(name="dataset")
# The callers of the DATASETS are from the module data, we need to manually import it.
DATASETS.import_module_from_module_names(["data"])
EVALUATE = Registry(name="evaluate")
# The callers of the EVALUATE are from the module evaluate, we need to manually import it.
EVALUATE.import_module_from_module_names(["evaluate"])
Thanks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
register_it-0.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for register_it-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d975d67909cf0a6c713c7ad9a2317e17cd52a56907a0ac33abcfee982b933a3 |
|
MD5 | 5341580984112b1249f69b79e27be571 |
|
BLAKE2b-256 | eee35cfcecf6174384bf5b18f93f447927d90f1842f02b125daae4eba44c2e83 |