Move location of config and cache

This commit is contained in:
Edward Betts 2023-12-21 19:13:29 +00:00
parent 239bfaa79b
commit 0aaa90c27a

View file

@ -14,8 +14,12 @@ import pytz
import requests
config = configparser.ConfigParser()
config.read("config")
config_file_path = os.path.expanduser(
os.path.join(os.getenv("XDG_CONFIG_HOME", "~/.config"), "bug-chart", "config")
)
assert os.path.exists(config_file_path)
config.read(os.path.expanduser(config_file_path))
Bug = dict[str, typing.Any]
CallParams = dict[str, str | int]
@ -48,7 +52,7 @@ def download_bugs(state: str) -> list[Bug]:
def get_all_bugs() -> list[Bug]:
"""Get all bugs."""
filename = "all_bugs.json"
filename = config.get("output", "cache")
if os.path.exists(filename):
with open(filename) as fh:
return typing.cast(list[Bug], json.load(fh))