Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • 1.1.3
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.0
6 results

README.md

Blame
  • user avatar
    Sebastian Lobinger authored
    4945f4e8
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.

    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.