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
Close
Hashes for py_configs_registry-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | daf235e89bb4bc619a85976b2c12533c50cbb335c044c455b29b25e94aeff71f |
|
MD5 | f3b4982fa0223213b1df4a9d3aae1cf5 |
|
BLAKE2b-256 | b8ac48a6890a1d1150b35dbd2070af8b90bda0a8430829610cdca0962f1c805f |
Close
Hashes for py_configs_registry-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afc6016f9681ed7d06a919ad35df4ba9c6c99185a0eb59caeabafae7c8a9da5b |
|
MD5 | 5ac26d933c736fdc60ba2c49d3aab942 |
|
BLAKE2b-256 | 353526f149d086a0f86eeea61a73194b325b874b5a88cb255e30cda3ed71b8c2 |