python registry package
Project description
Python Registry Package
说明
这是一个 Python 配置快速调用模块,主要解决 Json or Yaml 深层次配置调用问题。
使用
from registry import Registry
registry = Registry()
registry.set('a', 'a')
registry.set('b', {'bb': 'bbb'})
registry.set('c.h', 'h')
print(registry.get())
print(registry.get('b.bb'))
加载字典
from registry import Registry
registry = Registry()
registry.load({'a': {'aa': 'aaa'}})
print(registry.get('a.aa'))
合并字典
from registry import Registry
registry = Registry()
registry.load({'a': {'a1': 'aaa1'}})
registry.merge('a', {'a2': 'aaa2' })
print(registry.get('a'))
设置默认值
from registry import Registry
registry = Registry()
registry.set('a', 'aaa')
registry.default('a', 'bbb')
registry.default('c', 'ccc')
print(registry.get('a'))
print(registry.get('c'))
高级用法
### 实例化 Redis
Redis(**registry.get(prefix))
### 初始化 Mysql
Mysql(**registry.get(prefix))
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_configs_registry-0.0.2.tar.gz.
File metadata
- Download URL: py_configs_registry-0.0.2.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daf235e89bb4bc619a85976b2c12533c50cbb335c044c455b29b25e94aeff71f
|
|
| MD5 |
f3b4982fa0223213b1df4a9d3aae1cf5
|
|
| BLAKE2b-256 |
b8ac48a6890a1d1150b35dbd2070af8b90bda0a8430829610cdca0962f1c805f
|
File details
Details for the file py_configs_registry-0.0.2-py3-none-any.whl.
File metadata
- Download URL: py_configs_registry-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afc6016f9681ed7d06a919ad35df4ba9c6c99185a0eb59caeabafae7c8a9da5b
|
|
| MD5 |
5ac26d933c736fdc60ba2c49d3aab942
|
|
| BLAKE2b-256 |
353526f149d086a0f86eeea61a73194b325b874b5a88cb255e30cda3ed71b8c2
|