style: привести код к ruff format (line-length 120)

Обнаружено на шаге 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).
This commit is contained in:
oqyude committed 2026-10-25 05:17:27 +03:00
1 parent 9b53b25a91
commit af01efc41a
24 files changed
+219 -160

No files matched your search

+24 -28
View File
@@ -1,4 +1,5 @@
"""cf config — подкоманды для редактирования модели (базовая валюта, счета, транзакции, ...)."""
import typer
from rich.table import Table
@@ -52,11 +53,13 @@ def rate_set(
if existing:
existing[0].rate = rate
else:
model.exchange_rates.append(ExchangeRate(
from_currency=fc,
to_currency=tc,
rate=rate,
))
model.exchange_rates.append(
ExchangeRate(
from_currency=fc,
to_currency=tc,
rate=rate,
)
)
save_model(model)
console.print(f"[green]{t('global.ok')}[/green] {t('cmd.config.rate_set.ok', fc=fc, tc=tc, rate=rate)}")
@@ -86,10 +89,7 @@ def rate_remove(
model = load_model()
fc, tc = from_currency.upper(), to_currency.upper()
initial = len(model.exchange_rates)
model.exchange_rates = [
r for r in model.exchange_rates
if not (r.from_currency == fc and r.to_currency == tc)
]
model.exchange_rates = [r for r in model.exchange_rates if not (r.from_currency == fc and r.to_currency == tc)]
if len(model.exchange_rates) < initial:
save_model(model)
console.print(f"[green]{t('global.ok')}[/green] {t('cmd.config.rate_remove.ok', fc=fc, tc=tc)}")
@@ -143,10 +143,7 @@ def account_remove(
"""Удалить счёт по ID или названию"""
model = load_model()
initial = len(model.accounts)
model.accounts = [
a for a in model.accounts
if str(a.id) != identifier and a.name != identifier
]
model.accounts = [a for a in model.accounts if str(a.id) != identifier and a.name != identifier]
if len(model.accounts) < initial:
save_model(model)
console.print(f"[green]{t('global.ok')}[/green] {t('cmd.config.account_remove.ok', id=identifier)}")
@@ -204,12 +201,14 @@ def transaction_list() -> None:
table.add_column(t("table.transactions.col.description"))
for tx in model.transactions:
account_name = _account_name(model, tx.account)
amount_str = CurrencyConverter.format_money(
tx.amount, _account_currency(model, tx.account)
)
amount_str = CurrencyConverter.format_money(tx.amount, _account_currency(model, tx.account))
table.add_row(
str(tx.id)[:8], tx.date, account_name, tx.category,
amount_str, tx.description,
str(tx.id)[:8],
tx.date,
account_name,
tx.category,
amount_str,
tx.description,
)
console.print(table)
@@ -244,8 +243,11 @@ def recurring_add(
"""Добавить регулярный платёж"""
model = load_model()
rc = RecurringCashflow(
start_date=start_date or "", end_date=end_date or "",
frequency=frequency, amount=amount, category=category,
start_date=start_date or "",
end_date=end_date or "",
frequency=frequency,
amount=amount,
category=category,
)
model.recurring.append(rc)
save_model(model)
@@ -334,10 +336,7 @@ def asset_remove(
"""Удалить актив по ID или названию"""
model = load_model()
initial = len(model.assets)
model.assets = [
a for a in model.assets
if str(a.id) != identifier and a.name != identifier
]
model.assets = [a for a in model.assets if str(a.id) != identifier and a.name != identifier]
if len(model.assets) < initial:
save_model(model)
console.print(f"[green]{t('global.ok')}[/green] {t('cmd.config.asset_remove.ok', id=identifier)}")
@@ -392,10 +391,7 @@ def liability_remove(
"""Удалить обязательство по ID или названию"""
model = load_model()
initial = len(model.liabilities)
model.liabilities = [
li for li in model.liabilities
if str(li.id) != identifier and li.name != identifier
]
model.liabilities = [li for li in model.liabilities if str(li.id) != identifier and li.name != identifier]
if len(model.liabilities) < initial:
save_model(model)
console.print(f"[green]{t('global.ok')}[/green] {t('cmd.config.liability_remove.ok', id=identifier)}")