YAMLLoader.py 476 B

12345678910111213141516171819
  1. import os
  2. import yaml
  3. class YAMLLoader:
  4. def __init__(self, yaml_file):
  5. self.file = yaml_file
  6. def get_config(self):
  7. """
  8. Load settings file
  9. :return: cfg : the configuration file
  10. """
  11. # Load settings.
  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