From d1faad314b3ae6287a500fcf4d63355aa6009b78 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Tue, 14 Jul 2026 14:04:44 +0100 Subject: [PATCH] fmt --- analysis/build_pages.py | 1 - analysis/build_video_scripts.py | 4 +- analysis/generate_findings.py | 3 -- analysis/newbuild_vs_existing_london.ipynb | 38 ++++++++++++------- .../components/account/ResetPasswordPage.tsx | 9 ++--- .../map/filters/ActiveFilterList.tsx | 4 +- .../components/map/filters/AddFilterPanel.tsx | 3 +- frontend/src/hooks/useFilters.ts | 5 ++- frontend/src/hooks/useMapData.ts | 5 ++- frontend/src/i18n/descriptions.ts | 3 +- frontend/src/i18n/locales/hi.ts | 3 +- frontend/src/i18n/locales/hu.ts | 3 +- server-rs/src/data/actual_listings.rs | 8 +++- server-rs/src/main.rs | 1 - 14 files changed, 55 insertions(+), 35 deletions(-) diff --git a/analysis/build_pages.py b/analysis/build_pages.py index 130c1ea..b436e61 100644 --- a/analysis/build_pages.py +++ b/analysis/build_pages.py @@ -18,7 +18,6 @@ from __future__ import annotations import html import json -import urllib.parse from pathlib import Path ROOT = Path(".") diff --git a/analysis/build_video_scripts.py b/analysis/build_video_scripts.py index fce0630..8110d11 100644 --- a/analysis/build_video_scripts.py +++ b/analysis/build_video_scripts.py @@ -74,7 +74,7 @@ def twin_kit(f: dict) -> str: ] captions = [ f"{pn} vs {wn}", - f"Same station. Same schools.", + "Same station. Same schools.", f"{money} cheaper", f"Same {typ}, ~{s['build_year']}", f"{gap} less per m²", @@ -135,7 +135,7 @@ def twin_kit(f: dict) -> str: "", f"**Page:** {SITE}{f['page_path']} · **Format:** faceless screen-record, ~45–60s long + a 9:16 Short cut", "", - f"## 🎬 Map URL to record (open this, hit record)", + "## 🎬 Map URL to record (open this, hit record)", f"`{url}`", "*(filters are pre-applied so the value is on screen immediately)*", "", diff --git a/analysis/generate_findings.py b/analysis/generate_findings.py index e602f57..b3693f8 100644 --- a/analysis/generate_findings.py +++ b/analysis/generate_findings.py @@ -139,9 +139,6 @@ def curate(tw: pl.DataFrame) -> list[dict]: def national_findings(idx: pl.DataFrame, facts: dict) -> list[dict]: - named = idx.with_columns( - pl.col("Sector").str.extract(r"^([A-Z]+[0-9][A-Z0-9]?)", 1).alias("outward") - ) best = facts["best_value_sector"] dear = facts["dearest_sector"] return [ diff --git a/analysis/newbuild_vs_existing_london.ipynb b/analysis/newbuild_vs_existing_london.ipynb index aaa7443..bcf96af 100644 --- a/analysis/newbuild_vs_existing_london.ipynb +++ b/analysis/newbuild_vs_existing_london.ipynb @@ -315,7 +315,8 @@ "ax1.plot(yr, piv[\"existing\"].to_numpy(), marker=\"o\", label=\"Existing houses\", color=\"#0f766e\")\n", "ax1.plot(yr, piv[\"new\"].to_numpy(), marker=\"s\", label=\"New-build houses\", color=\"#d97706\")\n", "ax1.set_title(\"Median £/sqm by sale year\")\n", - "ax1.set_xlabel(\"Year\"); ax1.set_ylabel(\"£/sqm\")\n", + "ax1.set_xlabel(\"Year\")\n", + "ax1.set_ylabel(\"£/sqm\")\n", "ax1.yaxis.set_major_formatter(mticker.StrMethodFormatter(\"£{x:,.0f}\"))\n", "ax1.legend()\n", "\n", @@ -323,9 +324,11 @@ "ax2.bar(yr, piv[\"premium_pct\"].to_numpy(), color=colors)\n", "ax2.axhline(0, color=\"black\", lw=0.8)\n", "ax2.set_title(\"New-build premium (median £/sqm, new vs existing)\")\n", - "ax2.set_xlabel(\"Year\"); ax2.set_ylabel(\"Premium %\")\n", + "ax2.set_xlabel(\"Year\")\n", + "ax2.set_ylabel(\"Premium %\")\n", "ax2.yaxis.set_major_formatter(mticker.PercentFormatter(decimals=0))\n", - "plt.tight_layout(); plt.show()\n", + "plt.tight_layout()\n", + "plt.show()\n", "\n", "piv.select(\"year\", \"existing\", \"new\", \"premium_pct\", \"n_new\", \"n_existing\")" ] @@ -426,7 +429,8 @@ "for y, v, nnew in zip(range(len(labels)), vals, area_prem[\"n_new\"].to_list()):\n", " ax.text(v + (0.4 if v >= 0 else -0.4), y, f\"n={nnew}\", va=\"center\",\n", " ha=\"left\" if v >= 0 else \"right\", fontsize=8, color=\"#555\")\n", - "plt.tight_layout(); plt.show()\n", + "plt.tight_layout()\n", + "plt.show()\n", "area_prem" ] }, @@ -523,10 +527,12 @@ "ax.axvline(np.median(old_cagr), color=\"#0f766e\", ls=\"--\", lw=1.2)\n", "ax.axvline(np.median(new_cagr), color=\"#d97706\", ls=\"--\", lw=1.2)\n", "ax.set_title(\"Distribution of annualised resale growth (CAGR)\")\n", - "ax.set_xlabel(\"CAGR % per year\"); ax.set_ylabel(\"density\")\n", + "ax.set_xlabel(\"CAGR % per year\")\n", + "ax.set_ylabel(\"density\")\n", "ax.xaxis.set_major_formatter(mticker.PercentFormatter(decimals=0))\n", "ax.legend()\n", - "plt.tight_layout(); plt.show()" + "plt.tight_layout()\n", + "plt.show()" ] }, { @@ -603,16 +609,19 @@ "\n", "area_cagr = cagr_by(\"area\")\n", "labels = area_cagr[\"area\"].to_list()\n", - "x = np.arange(len(labels)); w = 0.4\n", + "x = np.arange(len(labels))\n", + "w = 0.4\n", "fig, ax = plt.subplots(figsize=(10, 4.5))\n", "ax.bar(x - w/2, area_cagr[\"existing_cagr\"].to_numpy(), w, label=\"Existing\", color=\"#0f766e\")\n", "ax.bar(x + w/2, area_cagr[\"newbuild_cagr\"].to_numpy(), w, label=\"New-build\", color=\"#d97706\")\n", - "ax.set_xticks(x); ax.set_xticklabels(labels)\n", + "ax.set_xticks(x)\n", + "ax.set_xticklabels(labels)\n", "ax.set_title(\"Median resale CAGR by postal area\")\n", "ax.set_ylabel(\"CAGR % per year\")\n", "ax.yaxis.set_major_formatter(mticker.PercentFormatter(decimals=0))\n", "ax.legend()\n", - "plt.tight_layout(); plt.show()\n", + "plt.tight_layout()\n", + "plt.show()\n", "area_cagr" ] }, @@ -699,22 +708,25 @@ " area_cagr.select(\"area\", \"cagr_gap\", \"newbuild_cagr\", \"existing_cagr\"), on=\"area\", how=\"inner\"\n", ")\n", "fig, ax = plt.subplots(figsize=(8, 6))\n", - "xs = combined[\"premium_pct\"].to_numpy(); ys = combined[\"cagr_gap\"].to_numpy()\n", + "xs = combined[\"premium_pct\"].to_numpy()\n", + "ys = combined[\"cagr_gap\"].to_numpy()\n", "ax.scatter(xs, ys, s=70, color=\"#d97706\", zorder=3)\n", "for a, xv, yv in zip(combined[\"area\"].to_list(), xs, ys):\n", " ax.annotate(a, (xv, yv), textcoords=\"offset points\", xytext=(6, 4), fontsize=10)\n", - "ax.axhline(0, color=\"black\", lw=0.8); ax.axvline(0, color=\"black\", lw=0.8)\n", + "ax.axhline(0, color=\"black\", lw=0.8)\n", + "ax.axvline(0, color=\"black\", lw=0.8)\n", "ax.set_xlabel(\"New-build £/sqm premium at purchase\")\n", "ax.set_ylabel(\"New-build CAGR minus existing CAGR (pp/yr)\")\n", "ax.xaxis.set_major_formatter(mticker.PercentFormatter(decimals=0))\n", "ax.set_title(\"Premium paid vs appreciation gap, by London postal area\")\n", - "plt.tight_layout(); plt.show()\n", + "plt.tight_layout()\n", + "plt.show()\n", "\n", "# Headline numbers for the writeup.\n", "hl = summary.to_dicts()\n", "new_row = next(r for r in hl if r[\"is_newbuild_prop\"])\n", "old_row = next(r for r in hl if not r[\"is_newbuild_prop\"])\n", - "print(f\"London terraced/detached, repeat sales:\")\n", + "print(\"London terraced/detached, repeat sales:\")\n", "print(f\" existing median CAGR: {old_row['median_cagr_pct']}%/yr (n={old_row['n']:,})\")\n", "print(f\" new-build median CAGR: {new_row['median_cagr_pct']}%/yr (n={new_row['n']:,})\")\n", "print(f\" appreciation gap: {round(new_row['median_cagr_pct']-old_row['median_cagr_pct'],2)} pp/yr\")\n", diff --git a/frontend/src/components/account/ResetPasswordPage.tsx b/frontend/src/components/account/ResetPasswordPage.tsx index 012fd06..861e0b9 100644 --- a/frontend/src/components/account/ResetPasswordPage.tsx +++ b/frontend/src/components/account/ResetPasswordPage.tsx @@ -24,10 +24,7 @@ export default function ResetPasswordPage({ onClearError: () => void; }) { const { t } = useTranslation(); - const token = useMemo( - () => new URLSearchParams(window.location.search).get('token') ?? '', - [] - ); + const token = useMemo(() => new URLSearchParams(window.location.search).get('token') ?? '', []); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const [done, setDone] = useState(false); @@ -60,7 +57,9 @@ export default function ResetPasswordPage({ {!token ? (
-

{t('auth.resetMissingToken')}

+

+ {t('auth.resetMissingToken')} +

diff --git a/frontend/src/components/map/filters/ActiveFilterList.tsx b/frontend/src/components/map/filters/ActiveFilterList.tsx index 403b792..ebf7f79 100644 --- a/frontend/src/components/map/filters/ActiveFilterList.tsx +++ b/frontend/src/components/map/filters/ActiveFilterList.tsx @@ -307,7 +307,9 @@ export function ActiveFilterList({ dragValue={dragValue} pinnedFeature={pinnedFeature} filterImpact={councilBackendName ? filterImpacts?.[councilBackendName] : undefined} - percentileScale={councilBackendName ? percentileScales.get(councilBackendName) : undefined} + percentileScale={ + councilBackendName ? percentileScales.get(councilBackendName) : undefined + } onFilterChange={onFilterChange} onDragStart={onDragStart} onDragChange={onDragChange} diff --git a/frontend/src/components/map/filters/AddFilterPanel.tsx b/frontend/src/components/map/filters/AddFilterPanel.tsx index 37acb45..41e101a 100644 --- a/frontend/src/components/map/filters/AddFilterPanel.tsx +++ b/frontend/src/components/map/filters/AddFilterPanel.tsx @@ -42,7 +42,8 @@ const FOLDED_FILTER_RESOLVERS: Array<(name: string) => string | null> = [ (name) => (isQualificationFilterName(name) ? QUALIFICATIONS_FILTER_NAME : null), (name) => (isTenureFilterName(name) ? TENURE_FILTER_NAME : null), (name) => (isCouncilFilterName(name) ? COUNCIL_FILTER_NAME : null), - (name) => (isPoiDistanceFilterName(name) ? (getPoiFilterName(name) ?? POI_DISTANCE_FILTER_NAME) : null), + (name) => + isPoiDistanceFilterName(name) ? (getPoiFilterName(name) ?? POI_DISTANCE_FILTER_NAME) : null, (name) => (isCrimeSeverityFilterName(name) ? (getCrimeSeverityFilterName(name) ?? name) : null), ]; diff --git a/frontend/src/hooks/useFilters.ts b/frontend/src/hooks/useFilters.ts index d70a6ae..6691e75 100644 --- a/frontend/src/hooks/useFilters.ts +++ b/frontend/src/hooks/useFilters.ts @@ -215,7 +215,10 @@ export function useFilters({ const normalizedOriginal = normalizeFilters(initialFilters); originalNormalizedRef.current = normalizedOriginal; const budget = filterLimit != null ? Math.max(0, filterLimit - reservedFilterSlots) : null; - initialFiltersRef.current = clampToBudget(dropUnknownFilters(normalizedOriginal, features), budget); + initialFiltersRef.current = clampToBudget( + dropUnknownFilters(normalizedOriginal, features), + budget + ); } const [filters, setFilters] = useState(() => initialFiltersRef.current!); diff --git a/frontend/src/hooks/useMapData.ts b/frontend/src/hooks/useMapData.ts index 5d2207b..582b882 100644 --- a/frontend/src/hooks/useMapData.ts +++ b/frontend/src/hooks/useMapData.ts @@ -42,7 +42,10 @@ async function detectSessionRejection( onSessionRejected?: () => void ): Promise { if (res.status !== 400 || !onSessionRejected || !pb.authStore.isValid) return; - const body = await res.clone().json().catch(() => null); + const body = await res + .clone() + .json() + .catch(() => null); if (body && (body as { error?: string }).error === 'filter_limit') { onSessionRejected(); } diff --git a/frontend/src/i18n/descriptions.ts b/frontend/src/i18n/descriptions.ts index 474d21e..a26f9fa 100644 --- a/frontend/src/i18n/descriptions.ts +++ b/frontend/src/i18n/descriptions.ts @@ -97,7 +97,8 @@ const descriptions: Record> = { '% Private rent': 'Part des ménages locataires dans le privé ou logés à titre gratuit', '% Council housing': 'Part des logements du code postal déjà enregistrés comme logement municipal ou social', - '% Ex-council': 'Part des logements du code postal autrefois municipaux mais qui ne le sont plus', + '% Ex-council': + 'Part des logements du code postal autrefois municipaux mais qui ne le sont plus', '% White': 'Part de la population s’identifiant comme blanche', '% South Asian': 'Part de la population s’identifiant comme sud-asiatique', '% Black': 'Part de la population s’identifiant comme noire', diff --git a/frontend/src/i18n/locales/hi.ts b/frontend/src/i18n/locales/hi.ts index bd2a663..8b15e83 100644 --- a/frontend/src/i18n/locales/hi.ts +++ b/frontend/src/i18n/locales/hi.ts @@ -635,7 +635,8 @@ const hi: Translations = { updatePassword: 'पासवर्ड अपडेट करें', resetSuccessBody: 'आपका पासवर्ड बदल दिया गया है। अब आप अपने नए पासवर्ड से लॉग इन कर सकते हैं।', resetMissingToken: 'यह रीसेट लिंक अधूरा है। लॉग इन स्क्रीन से नया लिंक प्राप्त करें।', - resetInvalidLink: 'यह रीसेट लिंक अमान्य है या समाप्त हो चुका है। लॉग इन स्क्रीन से नया लिंक प्राप्त करें।', + resetInvalidLink: + 'यह रीसेट लिंक अमान्य है या समाप्त हो चुका है। लॉग इन स्क्रीन से नया लिंक प्राप्त करें।', goToLogin: 'लॉग इन पर जाएँ', }, diff --git a/frontend/src/i18n/locales/hu.ts b/frontend/src/i18n/locales/hu.ts index c66686b..2c48ebe 100644 --- a/frontend/src/i18n/locales/hu.ts +++ b/frontend/src/i18n/locales/hu.ts @@ -651,8 +651,7 @@ const hu: Translations = { newPassword: 'Új jelszó', newPasswordPlaceholder: 'Legalább 8 karakter', updatePassword: 'Jelszó frissítése', - resetSuccessBody: - 'A jelszavad megváltozott. Mostantól bejelentkezhetsz az új jelszavaddal.', + resetSuccessBody: 'A jelszavad megváltozott. Mostantól bejelentkezhetsz az új jelszavaddal.', resetMissingToken: 'Ez a jelszó-visszaállító link hiányos. Kérj egy újat a bejelentkezési képernyőről.', resetInvalidLink: diff --git a/server-rs/src/data/actual_listings.rs b/server-rs/src/data/actual_listings.rs index ccd7e46..761b77d 100644 --- a/server-rs/src/data/actual_listings.rs +++ b/server-rs/src/data/actual_listings.rs @@ -673,14 +673,18 @@ fn extract_price_history(df: &DataFrame) -> Result>> let dates_s = structs .field_by_name("date") .context("Missing 'date' field in price_history struct")?; - let date_ca = dates_s.str().context("price_history.date is not a string")?; + let date_ca = dates_s + .str() + .context("price_history.date is not a string")?; let prices_s = structs .field_by_name("price") .context("Missing 'price' field in price_history struct")?; let prices_i64 = prices_s .cast(&DataType::Int64) .context("price_history.price is not castable to Int64")?; - let price_ca = prices_i64.i64().context("price_history.price is not Int64")?; + let price_ca = prices_i64 + .i64() + .context("price_history.price is not Int64")?; let reasons_s = structs .field_by_name("reason") .context("Missing 'reason' field in price_history struct")?; diff --git a/server-rs/src/main.rs b/server-rs/src/main.rs index 3150481..13b17f4 100644 --- a/server-rs/src/main.rs +++ b/server-rs/src/main.rs @@ -125,7 +125,6 @@ async fn static_cache_headers( response } - async fn security_headers( request: axum::extract::Request, next: middleware::Next,