Replaced importing the "typing" module as "t" with importing the individual names in the "typing" module. Since Python 3.9 introduced type hinting generics in standard collections, we do not have as many names to import now. This is also to be consistent with the practices of most major and standard packages and examples.

This commit is contained in:
2023-04-26 18:22:45 +08:00
parent ee5b447c23
commit cda9e4e3c6
25 changed files with 116 additions and 113 deletions

View File

@ -17,15 +17,15 @@
"""The console commands for the account management.
"""
import typing as t
from secrets import randbelow
from typing import Any
import click
import sqlalchemy as sa
from accounting import db
from accounting.models import BaseAccount, Account, AccountL10n
from accounting.utils.user import get_user_pk
import sqlalchemy as sa
AccountData = tuple[int, str, int, str, str, str, bool]
"""The format of the account data, as a list of (ID, base account code, number,
@ -63,8 +63,8 @@ def init_accounts_command(username: str) -> None:
existing_id.add(new_id)
return new_id
data: list[dict[str, t.Any]] = []
l10n_data: list[dict[str, t.Any]] = []
data: list[dict[str, Any]] = []
l10n_data: list[dict[str, Any]] = []
for base in bases_to_add:
l10n: dict[str, str] = {x.locale: x.title for x in base.l10n}
account_id: int = get_new_id()