import json from pathlib import Path class ConfigLoad: base_dir: Path def __init__(self, base_dir: str): self.base_dir = Path(base_dir) def load_file(self, client, year): with open(self.base_dir.joinpath(client + ".json"), "r") as frh: cfg = json.load(frh) year_new = {"plan": year, "actuals": str(int(year) - 1), "previous": str(int(year) - 2)} cfg["config"]["year"] = year_new cfg["config"]["previous"] = [ "Ist " + year_new["previous"], "Plan " + year_new["actuals"], "Ist per 10/" + year_new["actuals"], "FC 12/" + year_new["actuals"], "Ist " + year_new["actuals"], ] return cfg