INNER CODE UNIT · Python
load_yaml
ahembree/ansible-hms-docker · settings_manager.py:17
def load_yaml(file_path):
with open(file_path, "r") as f:
return yaml_loader.load(f) or CommentedMap()
def save_yaml(file_path, data):
with open(file_path, "w") as f:
yaml_loader.dump(data, f)
def get_yaml_files():
if not os.path.isdir(YAML_DIR):
print(f"Directory {YAML_DIR} does not exist!")
return []
return [
os.path.join(YAML_DIR, f)
for f in os.listdir(YAML_DIR)
if f.endswith((".yml", ".yaml")) and os.path.isfile(os.path.join(YAML_DIR, f))
]