diff --git a/recipes.py b/recipes.py index 06f4629..92e02a3 100644 --- a/recipes.py +++ b/recipes.py @@ -1,5 +1,4 @@ from typing import Dict, List, Any, Optional -from dataclasses import dataclass import os import yaml @@ -10,6 +9,7 @@ class Unit: def __init__(self, name: str) -> None: self.name = name + class Units: def __init__(self) -> None: self.units: List[Unit] = [] @@ -251,15 +251,7 @@ def rendertemplate( print(f"rendering {file}") outstr = template.render(args) - try: - os.mkdir("out") - except FileExistsError: - pass - - try: - os.mkdir(f"out/{format}") - except FileExistsError: - pass + os.makedirs(f"out/{format}", exist_ok=True) with open(f"out/{format}/{file}", "w", encoding="utf-8") as f: f.write(outstr)