Fix pycodestyle styling issues

This commit is contained in:
2026-04-05 07:05:20 +08:00
parent aa3bc1ed69
commit 29dfc6c5a4
6 changed files with 30 additions and 29 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
# The Mia! Accounting Project. # The Mia! Accounting Project.
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25 # Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/25
# Copyright (c) 2023 imacat. # Copyright (c) 2023-2026 imacat.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -34,8 +34,8 @@ def init_base_accounts_command() -> None:
with open(data_dir / "base_accounts.csv") as fp: with open(data_dir / "base_accounts.csv") as fp:
data: list[dict[str, str]] = [x for x in csv.DictReader(fp)] data: list[dict[str, str]] = [x for x in csv.DictReader(fp)]
account_data: list[dict[str, str]] = [{"code": x["code"], account_data: list[dict[str, str]] = \
"title_l10n": title_case(x["title"])} [{"code": x["code"], "title_l10n": title_case(x["title"])}
for x in data] for x in data]
locales: list[str] = [x[5:] for x in data[0] if x.startswith("l10n-")] locales: list[str] = [x[5:] for x in data[0] if x.startswith("l10n-")]
l10n_data: list[dict[str, str]] = [{"account_code": x["code"], l10n_data: list[dict[str, str]] = [{"account_code": x["code"],
+1 -2
View File
@@ -1,7 +1,7 @@
# The Mia! Accounting Project. # The Mia! Accounting Project.
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/26 # Author: imacat@mail.imacat.idv.tw (imacat), 2023/1/26
# Copyright (c) 2023 imacat. # Copyright (c) 2023-2026 imacat.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -50,4 +50,3 @@ def show_account_detail(account: BaseAccount) -> str:
:return: The detail. :return: The detail.
""" """
return render_template("accounting/base-account/detail.html", obj=account) return render_template("accounting/base-account/detail.html", obj=account)
@@ -1,7 +1,7 @@
# The Mia! Accounting Project. # The Mia! Accounting Project.
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/27 # Author: imacat@mail.imacat.idv.tw (imacat), 2023/2/27
# Copyright (c) 2023 imacat. # Copyright (c) 2023-2026 imacat.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
+8 -8
View File
@@ -334,8 +334,8 @@ class AccountTestCase(unittest.TestCase):
self.assertEqual(response.headers["Location"], create_uri) self.assertEqual(response.headers["Location"], create_uri)
# Success, with spaces to be stripped # Success, with spaces to be stripped
response = self.__client.post(store_uri, response = self.__client.post(
data={"csrf_token": self.__csrf_token, store_uri, data={"csrf_token": self.__csrf_token,
"base_code": f" {STOCK.base_code} ", "base_code": f" {STOCK.base_code} ",
"title": f" {STOCK.title} "}) "title": f" {STOCK.title} "})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
@@ -574,8 +574,8 @@ class AccountTestCase(unittest.TestCase):
set_locale(self.__app, self.__client, self.__csrf_token, "zh_Hant") set_locale(self.__app, self.__client, self.__csrf_token, "zh_Hant")
response = self.__client.post(update_uri, response = self.__client.post(
data={"csrf_token": self.__csrf_token, update_uri, data={"csrf_token": self.__csrf_token,
"base_code": CASH.base_code, "base_code": CASH.base_code,
"title": f"{CASH.title}-zh_Hant-2"}) "title": f"{CASH.title}-zh_Hant-2"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
@@ -656,8 +656,8 @@ class AccountTestCase(unittest.TestCase):
response: httpx.Response response: httpx.Response
for i in range(2, 6): for i in range(2, 6):
response = self.__client.post(f"{PREFIX}/store", response = self.__client.post(
data={"csrf_token": self.__csrf_token, f"{PREFIX}/store", data={"csrf_token": self.__csrf_token,
"base_code": "1111", "base_code": "1111",
"title": "Title"}) "title": "Title"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
@@ -707,8 +707,8 @@ class AccountTestCase(unittest.TestCase):
response: httpx.Response response: httpx.Response
for i in range(2, 6): for i in range(2, 6):
response = self.__client.post(f"{PREFIX}/store", response = self.__client.post(
data={"csrf_token": self.__csrf_token, f"{PREFIX}/store", data={"csrf_token": self.__csrf_token,
"base_code": "1111", "base_code": "1111",
"title": "Title"}) "title": "Title"})
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
+3 -2
View File
@@ -1,7 +1,7 @@
# The Mia! Accounting Demonstration Website. # The Mia! Accounting Demonstration Website.
# Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/13 # Author: imacat@mail.imacat.idv.tw (imacat), 2023/4/13
# Copyright (c) 2023-2024 imacat. # Copyright (c) 2023-2026 imacat.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -272,7 +272,8 @@ class BaseTestData(ABC):
existing_j_id: set[int] = {x["id"] for x in self.__journal_entries} existing_j_id: set[int] = {x["id"] for x in self.__journal_entries}
existing_l_id: set[int] = {x["id"] for x in self.__line_items} existing_l_id: set[int] = {x["id"] for x in self.__line_items}
journal_entry_data.id = self.__new_id(existing_j_id) journal_entry_data.id = self.__new_id(existing_j_id)
date: dt.date = get_today() - dt.timedelta(days=journal_entry_data.days) date: dt.date = get_today() - \
dt.timedelta(days=journal_entry_data.days)
self.__journal_entries.append( self.__journal_entries.append(
{"id": journal_entry_data.id, {"id": journal_entry_data.id,
"date": date, "date": date,
+2 -1
View File
@@ -146,7 +146,8 @@ class NextUriTestCase(unittest.TestCase):
# A foreign URI # A foreign URI
next_uri = "https://example.com" next_uri = "https://example.com"
response = client.get(f"/test-invalid-next?next={quote_plus(next_uri)}") response = client.get(
f"/test-invalid-next?next={quote_plus(next_uri)}")
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
response = client.post("/test-invalid-next", response = client.post("/test-invalid-next",
data={"csrf_token": csrf_token, data={"csrf_token": csrf_token,