From fa43ea8dc87bb08b9bb93028e745a9b9a348cdca Mon Sep 17 00:00:00 2001 From: lekss361 Date: Sun, 24 May 2026 14:10:39 +0300 Subject: [PATCH] fix(tradein-estimator): ruff lint fixes (RUF046, E501) pre-existing in #507 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove redundant int() around round() — RUF046 - Wrap long f-strings in _compute_confidence to stay within 100 chars - Simplify photo_url expression in _listing_to_analog --- tradein-mvp/backend/app/services/estimator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tradein-mvp/backend/app/services/estimator.py b/tradein-mvp/backend/app/services/estimator.py index c840cc4d..939633a0 100644 --- a/tradein-mvp/backend/app/services/estimator.py +++ b/tradein-mvp/backend/app/services/estimator.py @@ -563,7 +563,7 @@ async def estimate_quality( range_low = int(range_low * repair_coef) range_high = int(range_high * repair_coef) median_ppm2 = median_ppm2 * repair_coef - pct = int(round((repair_coef - 1.0) * 100)) + pct = round((repair_coef - 1.0) * 100) repair_note = ( f" Цена скорректирована на состояние ремонта " f"({_REPAIR_LABEL.get(payload.repair_state, '')} {pct:+d}%)." @@ -1403,7 +1403,7 @@ def _listing_to_analog(row: dict[str, Any]) -> AnalogLot: price_per_m2=int(row.get("price_per_m2") or 0), listing_date=row.get("listing_date"), days_on_market=row.get("days_on_market"), - photo_url=(row.get("photo_urls") or [None])[0] if isinstance(row.get("photo_urls"), list) else None, + photo_url=(row["photo_urls"] or [None])[0] if row.get("photo_urls") else None, source=row.get("source"), source_url=row.get("source_url"), distance_m=int(row["distance_m"]) if row.get("distance_m") is not None else None,