YAMLLoader.py 525 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 configuration file
  10. """
  11. # Load settings. Will be used to convert slot number into GPIO pin number
  12. __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
  13. with open(os.path.join(__location__, self.file)) as ymlfile:
  14. cfg = yaml.load(ymlfile)
  15. return cfg