Spaces:
Sleeping
Sleeping
Download app/utils/team_utils.py from otito254/epl-predictor-api: direct link, hf CLI and curl.
- Browser
- Download file 2.68 kB
-
https://huggingface.co/spaces/otito254/epl-predictor-api/resolve/main/app/utils/team_utils.py
- Command line
-
hf download hf://spaces/otito254/epl-predictor-api/app/utils/team_utils.py
-
curl -L -o team_utils.py https://huggingface.co/spaces/otito254/epl-predictor-api/resolve/main/app/utils/team_utils.py
2.68 kB
| 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) |