Обнаружено на шаге 0: `ruff format --check .` НЕ был чистым в baseline (24 файла расходились с форматом ruff). `ruff check .` был чистым. Изменение только косметическое (переносы, пустая строка после docstring модуля, склейка вызовов в пределах line-length=120 из [tool.ruff]); поведение не меняется — pytest 81/81 зелёные, `ruff check .` — без ошибок. Нужно, чтобы `ruff format --check .` стал рабочим гейтом (D13 CI).
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
"""cf import-xlsx — импорт данных из Excel."""
|
|
|
|
import typer
|
|
|
|
from infrastructure.cli.i18n import t
|
|
from infrastructure.cli.services import console, save_model
|
|
from infrastructure.repositories import ExcelRepository, ExcelRepositoryError
|
|
|
|
_repo = ExcelRepository()
|
|
|
|
|
|
def import_xlsx(
|
|
path: str = typer.Argument(..., help=t("cmd.import.arg.path")),
|
|
) -> None:
|
|
"""Импорт данных из Excel"""
|
|
try:
|
|
model = _repo.load(path)
|
|
save_model(model)
|
|
console.print(
|
|
t(
|
|
"cmd.import.ok",
|
|
accounts=len(model.accounts),
|
|
transactions=len(model.transactions),
|
|
recurring=len(model.recurring),
|
|
assets=len(model.assets),
|
|
liabilities=len(model.liabilities),
|
|
)
|
|
)
|
|
console.print(t("cmd.import.base_currency", currency=model.base_currency))
|
|
except ExcelRepositoryError as e:
|
|
console.print(f"[red]{t('cmd.import.err', error=str(e))}[/red]")
|
|
raise typer.Exit(1)
|