Renamed "fh" to "fp" when opening files, following the Python convention.

This commit is contained in:
2023-02-09 00:02:14 +08:00
parent d99f592cff
commit 36f55900c7
4 changed files with 8 additions and 8 deletions

View File

@ -35,8 +35,8 @@ def init_base_accounts_command() -> None:
click.echo("Base accounts already exist.")
raise click.Abort
with open(data_dir / "base_accounts.csv") as fh:
data: list[dict[str, str]] = [x for x in csv.DictReader(fh)]
with open(data_dir / "base_accounts.csv") as fp:
data: list[dict[str, str]] = [x for x in csv.DictReader(fp)]
account_data: list[dict[str, str]] = [{"code": x["code"],
"title_l10n": x["title"]}
for x in data]

View File

@ -58,8 +58,8 @@ def init_currencies_command(username: str) -> None:
"""Initializes the currencies."""
existing_codes: set[str] = {x.code for x in Currency.query.all()}
with open(data_dir / "currencies.csv") as fh:
data: list[dict[str, str]] = [x for x in csv.DictReader(fh)]
with open(data_dir / "currencies.csv") as fp:
data: list[dict[str, str]] = [x for x in csv.DictReader(fp)]
to_add: list[dict[str, str]] = [x for x in data
if x["code"] not in existing_codes]
if len(to_add) == 0: