multicon
A tiny module for joining multiple configs into one.
Usage
#!/usr/bin/env python3.8
import multicon
c1 = {
'a': 123,
'b': 256,
'c': [1, 2, 3],
'd': {
'da': 1,
'db': 2,
'dc': 3,
'dd': {
'dda': 997
}
}
}
c2 = {
'b': 112,
'e': 9427
}
# Create config, where c1 is default, and c2 is custom (c2 options can override c1 ones)
c = multicon.Config(c1, c2)
# Set a new custom option
c['g'] = 117
# Remove a custom option
del c['b']
# Print config as dict
print(dict(c))
import multicon
c1 = {
'a': 123,
'b': 256,
'c': [1, 2, 3],
'd': {
'da': 1,
'db': 2,
'dc': 3,
'dd': {
'dda': 997
}
}
}
c2 = {
'b': 112,
'e': 9427
}
c3 = {
'd': {
'db': 18,
'dd': [1, 2, 3, 4, 5, 6, 7],
}
}
# Config c1 is default, c2 overrides c1, c3 overrides both
# Custom config is empty at the moment
multiconfig = multicon.MultiConfig([c1, c2, c3], {})
try:
print(multiconfig['a'])
print(multiconfig['b'])
print(multiconfig['c'])
print(multiconfig['d'])
print(multiconfig['dd'])
except multicon.ConfigKeyNotExistError:
print('Key not exist')
Metadata
Release files for multicon 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| multicon-0.0.2.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multicon-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.4 kB
Release files / multicon-0.0.2.tar.gz
| Download URL | multicon-0.0.2.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa58e2e266c54a7b4f23d338bad6c9d2fae8d4c682b37b965de264dfbef3d8ac
|
|
BLAKE2b-256 checksum How to use checksums |
6b8affa428a4471b98726d0563e39aba80840f1615c605ce1877e67f0462438d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|
Release files / multicon-0.0.2-py3-none-any.whl
| Download URL | multicon-0.0.2-py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17850a413ef2e89737e19f689090db0a4181b409fdd133b802ef6989235487a8
|
|
BLAKE2b-256 checksum How to use checksums |
b92bfee0c56d98f54ed08c30813a727994a59824506d6857efff25dafca9f373
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|