Skip to content

Commit 1894fa3

Browse files
lapp0rlouf
authored andcommitted
Remove Broken pyairports Package, Replace with airportsdata
1 parent cfde8b7 commit 1894fa3

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

outlines/types/airports.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""Generate valid airport codes."""
22
from enum import Enum
33

4-
from pyairports.airports import AIRPORT_LIST
4+
import airportsdata
5+
6+
AIRPORT_IATA_LIST = [
7+
(v["iata"], v["iata"]) for v in airportsdata.load().values() if v["iata"]
8+
]
59

6-
AIRPORT_IATA_LIST = list(
7-
{(airport[3], airport[3]) for airport in AIRPORT_LIST if airport[3] != ""}
8-
)
910

1011
IATA = Enum("Airport", AIRPORT_IATA_LIST) # type:ignore

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040
"datasets",
4141
"typing_extensions",
4242
"pycountry",
43-
"pyairports",
43+
"airportsdata",
4444
]
4545
dynamic = ["version"]
4646

@@ -137,7 +137,7 @@ module = [
137137
"uvicorn.*",
138138
"fastapi.*",
139139
"pycountry.*",
140-
"pyairports.*",
140+
"airportsdata.*",
141141
]
142142
ignore_missing_imports = true
143143

0 commit comments

Comments
 (0)