load_yaml_config.py 431 B

123456789101112131415
  1. # -*- coding: utf-8 -*-
  2. # @Time : 2022/2/25 17:00
  3. # @Author : MaochengHu
  4. # @Email : wojiaohumaocheng@gmail.com
  5. # @File : load_yaml_config.py
  6. # @Project : server_develop
  7. import os
  8. import yaml
  9. def load_yaml(yaml_path: str):
  10. assert os.path.exists(yaml_path), f"cannot find {yaml_path}"
  11. with open(yaml_path, 'r', encoding='utf-8') as yaml_file:
  12. config = yaml.load(yaml_file, Loader=yaml.FullLoader)
  13. return config