configurable - Class integration with config files
Project description
Allows attributes of classes and/or instances to be set directly through config
files. Config file example followed by code:
[sect1]
foo=bar
[Klass]
prop1=qwe
prop2=456
prop3=false
[SubKlass]
hihi = HEHE
------------------------
class Klass(Configurable):
class SubKlass(Configurable):
config = Config(hihi = "hoho")
config = Config(
prop1="asd",
prop2=123,
prop3=True
)
assert Klass.config.prop1 == "asd"
assert Klass.config.prop2 == 123
assert Klass.config.prop3 == True
assert Klass.SubKlass.config.hihi == "hoho"
c = ConfigFile(path, globals())
assert Klass.config.prop1 == "qwe"
assert Klass.config.prop2 == 456
assert Klass.config.prop3 == False
assert c.Klass.prop1 == "qwe"
assert c.Klass.prop2 == "456"
assert c.Klass.prop3 == "false"
files. Config file example followed by code:
[sect1]
foo=bar
[Klass]
prop1=qwe
prop2=456
prop3=false
[SubKlass]
hihi = HEHE
------------------------
class Klass(Configurable):
class SubKlass(Configurable):
config = Config(hihi = "hoho")
config = Config(
prop1="asd",
prop2=123,
prop3=True
)
assert Klass.config.prop1 == "asd"
assert Klass.config.prop2 == 123
assert Klass.config.prop3 == True
assert Klass.SubKlass.config.hihi == "hoho"
c = ConfigFile(path, globals())
assert Klass.config.prop1 == "qwe"
assert Klass.config.prop2 == 456
assert Klass.config.prop3 == False
assert c.Klass.prop1 == "qwe"
assert c.Klass.prop2 == "456"
assert c.Klass.prop3 == "false"
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
configurable-0.1dev.tar.gz
(4.3 kB
view details)
File details
Details for the file configurable-0.1dev.tar.gz
.
File metadata
- Download URL: configurable-0.1dev.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8be92d3dd082b71e222c90589e18053082e07ec56f65a924191244481f8cbd57 |
|
MD5 | b8bb287f2288c0fdead7cdc4c8dc731b |
|
BLAKE2b-256 | 5c6bf3e709515b94c41860850646e0f1efcf0afc993f7abae2b74f5a54ee84f6 |