Spaces:
Sleeping
Sleeping
File size: 2,682 Bytes
43280d3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | TEAM_NAME_MAP = {
# --- Exact DB names (pass-through) ---
"Arsenal": "Arsenal",
"Aston Villa": "Aston Villa",
"Bournemouth": "Bournemouth",
"Brentford": "Brentford",
"Brighton": "Brighton",
"Burnley": "Burnley",
"Chelsea": "Chelsea",
"Crystal Palace": "Crystal Palace",
"Everton": "Everton",
"Fulham": "Fulham",
"Ipswich": "Ipswich",
"Leeds": "Leeds",
"Leicester": "Leicester",
"Liverpool": "Liverpool",
"Luton": "Luton",
"Man City": "Man City",
"Man United": "Man United",
"Newcastle": "Newcastle",
"Nott'm Forest": "Nott'm Forest",
"QPR": "QPR",
"Sheffield United":"Sheffield United",
"Southampton": "Southampton",
"Tottenham": "Tottenham",
"Watford": "Watford",
"West Brom": "West Brom",
"West Ham": "West Ham",
"Wolves": "Wolves",
# --- Common alias → DB name ---
"Manchester City": "Man City",
"Manchester United": "Man United",
"Man Utd": "Man United",
"Tottenham Hotspur": "Tottenham",
"Spurs": "Tottenham",
"Wolverhampton Wanderers": "Wolves",
"Wolverhampton": "Wolves",
"Nottingham Forest": "Nott'm Forest",
"Notts Forest": "Nott'm Forest",
"Newcastle United": "Newcastle",
"West Ham United": "West Ham",
"Brighton & Hove Albion": "Brighton",
"Leicester City": "Leicester",
"Leeds United": "Leeds",
"Ipswich Town": "Ipswich",
"Luton Town": "Luton",
"Sheffield Utd": "Sheffield United",
"Cardiff City": "Cardiff",
"Hull City": "Hull",
"Stoke City": "Stoke",
"Swansea City": "Swansea",
"Birmingham City": "Birmingham",
"Blackburn Rovers": "Blackburn",
"Bolton Wanderers": "Bolton",
"Middlesbrough FC": "Middlesbrough",
"West Bromwich Albion": "West Brom",
"Wigan Athletic": "Wigan",
"Reading FC": "Reading",
"Norwich City": "Norwich",
"Sunderland AFC": "Sunderland",
"Huddersfield Town": "Huddersfield",
"Blackpool FC": "Blackpool",
}
def normalise_team(name: str) -> str | None:
"""Returns the canonical DB team name, or None if not found."""
return TEAM_NAME_MAP.get(name.strip(), None) |