game.db.airport_repo

db/airport_repo.py

Handles database access for Airport data.

Includes methods to fetch airport by ICAO code and list airports by country code.

Classes

AirportRepository()

Repository for querying airports from the database.

class game.db.airport_repo.AirportRepository

Bases: object

Repository for querying airports from the database.

static get_by_icao(icao: str) Airport | None

Fetch an airport by ICAO code.

Parameters:

icao (str) – The ICAO code of the airport.

Returns:

Airport object if found, else None.

Return type:

Optional[Airport]

static list_airports(country: str = 'FI', allow_types: Sequence[str] = ('small_airport', 'medium_airport', 'large_airport')) List[Airport]

List airports filtered by country and type (small, medium, large).

Parameters:
  • country (str) – ISO country code (default: “FI”).

  • allow_types (Sequence[str]) – List of airport types to include in filtering.

Returns:

Filtered list of Airport objects.

Return type:

List[Airport]

game.db.airport_repo._row_to_airport(row: Dict[str, Any]) Airport

Convert a database row to an Airport object.