Skip to main content

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))

Metadata

Release files for py-configs-registry 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-configs-registry 0.0.2
File Size Uploaded
py_configs_registry-0.0.2.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-configs-registry 0.0.2
File Interpreter ABI Platform
py_configs_registry-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.9 kB

Release files / py_configs_registry-0.0.2.tar.gz

Download URL py_configs_registry-0.0.2.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
daf235e89bb4bc619a85976b2c12533c50cbb335c044c455b29b25e94aeff71f
BLAKE2b-256 checksum
How to use checksums
b8ac48a6890a1d1150b35dbd2070af8b90bda0a8430829610cdca0962f1c805f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / py_configs_registry-0.0.2-py3-none-any.whl

Download URL py_configs_registry-0.0.2-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afc6016f9681ed7d06a919ad35df4ba9c6c99185a0eb59caeabafae7c8a9da5b
BLAKE2b-256 checksum
How to use checksums
353526f149d086a0f86eeea61a73194b325b874b5a88cb255e30cda3ed71b8c2
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page