wrongmove/crawler/rec/districts.py
Viktor Barzin 150342bb9e
Refactor codebase following Clean Code principles and add 229 tests
- Extract helpers to reduce function sizes (listing_tasks, app.py, query.py, listing_fetcher)
  - Replace nonlocal mutations with _PipelineState dataclass in listing_tasks
  - Fix bugs: isinstance→equality check in repository, verify_exp for OIDC tokens
  - Consolidate duplicate filter methods in listing_repository
  - Move hardcoded config to env vars with backward-compatible defaults
  - Simplify CLI decorator to auto-build QueryParameters
  - Add deprecation docstring to data_access.py
  - Test count: 158 → 387 (all passing)
2026-02-07 20:19:57 +00:00

43 lines
1.5 KiB
Python

def get_districts() -> dict[str, str]:
return {
"Barking and Dagenham": "REGION^61400",
"Barnet": "REGION^93929",
"Bexley": "REGION^93932",
"Brent": "REGION^93935",
"Bromley": "REGION^93938",
"Camden": "REGION^93941",
"City of London": "REGION^61224",
"Croydon": "REGION^93944",
"Ealing": "REGION^93947",
"Enfield": "REGION^93950",
"Greenwich": "REGION^61226",
"Hackney": "REGION^93953",
"Hammersmith and Fulham": "REGION^61407",
"Haringey": "REGION^61227",
"Harrow": "REGION^93956",
"Havering": "REGION^61228",
"Hillingdon": "REGION^93959",
"Hounslow": "REGION^93962",
"Islington": "REGION^93965",
"London": "REGION^87490",
"Kensington and Chelsea": "REGION^61229",
"Kingston upon Thames": "REGION^93968",
"Lambeth": "REGION^93971",
"Lewisham": "REGION^61413",
"Merton": "REGION^61414",
"Newham": "REGION^61231",
"Redbridge": "REGION^61537",
"Richmond upon Thames": "REGION^61415",
"Southwark": "REGION^61518",
"Stratford": "REGION^85312",
"Sutton": "REGION^93974",
"Tower Hamlets": "REGION^61417",
"Waltham Forest": "REGION^61232",
"Wandsworth": "REGION^93977",
"Westminster": "REGION^93980",
}
def get_district_by_name(name: str) -> str | None:
"""Return the region ID for a district name, or None if not found."""
return get_districts().get(name)