airportsdata 20241001__py3-none-any.whl → 20250523__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
airportsdata/__init__.py CHANGED
@@ -10,8 +10,8 @@ from pathlib import Path
10
10
  from typing import Dict, Literal, TypedDict
11
11
 
12
12
  __project_name__ = __package__
13
- __min_python_version__ = (3, 9) # minimum version of Python required to run; supported until 4 October 2024
14
- __version__ = '20241001' # numbering follows the release date
13
+ __min_python_version__ = (3, 10) # minimum version of Python required to run; supported until October 2025
14
+ __version__ = '20250523' # numbering follows the release date
15
15
  __author__ = 'Mike Borsetti <mike@borsetti.com>'
16
16
  __copyright__ = 'Copyright 2020- Mike Borsetti'
17
17
  __license__ = 'MIT'
@@ -57,14 +57,6 @@ def load(code_type: CodeType = 'ICAO') -> Dict[str, 'Airport']:
57
57
  Originally sourced from [TimeZoneDB](https://timezonedb.com)
58
58
  'lid': The FAA Location Identifier (for US country only; others is blank)
59
59
  """
60
- # with open(os.path.join(dir, 'airports.json'), encoding='utf8') as f:
61
- # airports = json.load(f)
62
- # if code_type.lower() == 'icao':
63
- # return airports
64
- # else:
65
- # return {airport['iata']: airport for airport in dict(airports).values() if airport['iata']}
66
- #
67
- #
68
60
  key = code_type.lower()
69
61
  if key not in ('icao', 'iata', 'lid'):
70
62
  raise ValueError(f'code_type must be one of ICAO, IATA or LID; received {code_type}')
@@ -73,6 +65,8 @@ def load(code_type: CodeType = 'ICAO') -> Dict[str, 'Airport']:
73
65
  with this_dir.joinpath('airports.csv').open(encoding='utf8') as f:
74
66
  reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
75
67
  for row in reader:
68
+ # if row[key] and row[key] in airports:
69
+ # raise ValueError(f"Duplicate key in csv: '{row[key]}'")
76
70
  airports[row[key]] = row # type: ignore[assignment]
77
71
  airports.pop('', None)
78
72
  return airports
@@ -88,18 +82,14 @@ def load_iata_macs() -> dict[str, IATAMAC]:
88
82
  'airports': a dict with the same data returned by load() for each airport that makes up the Multi Airport
89
83
  City, where the key is the airport's IATA code.
90
84
  """
91
- # with open(os.path.join(dir, 'airports.json'), encoding='utf8') as f:
92
- # airports = json.load(f)
93
- # if code_type.lower() == 'icao':
94
- # return airports
95
- # else:
96
- # return {airport['iata']: airport for airport in dict(airports).values() if airport['iata']}
97
- #
98
- #
99
85
  airports = load('IATA')
100
86
  this_dir = Path(__file__).parent
101
87
  iata_macs: dict[str, IATAMAC] = {}
102
88
  row_d: dict[str, str]
89
+ multi_airport_city_code = ''
90
+ name = ''
91
+ country = ''
92
+ airport = ''
103
93
  with this_dir.joinpath('iata_macs.csv').open(encoding='utf8') as f:
104
94
  reader = csv.DictReader(f, quoting=csv.QUOTE_NONNUMERIC)
105
95
  for row_d in reader: