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
Metadata
Release files for register-it 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| register_it-0.3.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| register_it-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / register_it-0.3.tar.gz
| Download URL | register_it-0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fc4e67e0dfcad22f154bede29bdcd54c99cb09a499bbcf40db6b13f8714e59e
|
|
BLAKE2b-256 checksum How to use checksums |
23e1c728c7e027bb092490b07c0baa13c13f5d2ace8d0f2fc82204b3f5fa4c0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / register_it-0.3-py3-none-any.whl
| Download URL | register_it-0.3-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12e5ccc852f16138269241e98c4d4646c72d76b26b5196524f7f4ec86ef3d33d
|
|
BLAKE2b-256 checksum How to use checksums |
0822f6bffa28b1afa4c1b224d0b31ce4fa1b4f10a03293fb75ab84c7c90a4b9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|