YAMLLoader.py 543 B

123456789101112131415161718
  1. import os
  2. import yaml
  3. class YAMLLoader() :
  4. def __init__(self, file):
  5. self.file = file
  6. def get_config(self):
  7. """
  8. Load settings file
  9. :return: cfg : the brain configuration file
  10. """
  11. # Load settings. Will be used to convert slot number into GPIO pin number
  12. __location__ = os.path.realpath(
  13. os.path.join(os.getcwd(), os.path.dirname(__file__)))
  14. with open(os.path.join(__location__, self.file)) as ymlfile:
  15. cfg = yaml.load(ymlfile)
  16. return cfg