Select Git revision
Sebastian Lobinger authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
README.md 858 B
YamlConfig
Pyhton Konfigurationsklasse für YAML Dateien.
Einbindung in andere Projekte
Dieses Projekt ist selbst als python package Strukturiert und kann daher einfach als git submodule direkt in andere Projekte eingebunden werden.
git submodule add git@git.imp.fu-berlin.de:coding-at-fu/yaml_config.git dict_filter
Verwendung
Wurde das Projekt wie oben stehend eingebunden kann das Modul wie folgt verwendet werden:
from yaml_config import yaml_config
config = yaml_config.YamlConfig(path = '/path/to/conf/file.yml')
def do_whatever():
config = yaml_config.YamlConfig.getInstance()
print (config.toDict().get('config_key'))
# wird foo ausgeben wenn config_key den Wert foo hat.
def reconfigure():
config = yaml_config.YamlConfig.getInstance()
config.reload()
# Die Konfiguration wurde neu eingelesen.