Skip to content

Fetch API Core items

Interface for core items data fetching.

APIFetchCore

Bases: APIFetchInternal

Exposes functions for fetching core items data from the server.

Source code in src/rmlab/api/fetch/core.py
 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
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
class APIFetchCore(APIFetchInternal):
    """Exposes functions for fetching core items data from the server."""

    async def fetch_info(
        self, scen_id: int
    ) -> Tuple[ScenarioDates, ItemsCount, SchedulesCount, FlightsCount]:
        """Fetch summarized information about a scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            A 4-tuple with information about the scenario.
        """

        return await self._fetch_info(scen_id)

    async def fetch_aircrafts(self, scen_id: int) -> List[Aircraft]:
        """Fetch a list of all aircrafts of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of aircrafts
        """

        return await self._fetch_bounded_items(scen_id, Aircraft)

    async def fetch_airlines(self, scen_id: int) -> List[Airline]:
        """Fetch a list of all airlines of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of airlines
        """

        return await self._fetch_bounded_items(scen_id, Airline)

    async def fetch_airports(self, scen_id: int) -> List[Airport]:
        """Fetch a list of all airport of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of airport
        """

        return await self._fetch_bounded_items(scen_id, Airport)

    async def fetch_countries(self, scen_id: int) -> List[Country]:
        """Fetch a list of all countries of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of countries
        """

        return await self._fetch_bounded_items(scen_id, Country)

    async def fetch_cities(self, scen_id: int) -> List[City]:
        """Fetch a list of all cities of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of cities
        """

        return await self._fetch_bounded_items(scen_id, City)

    async def fetch_citysectors(self, scen_id: int) -> List[CitySector]:
        """Fetch a list of all citysectors of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of citysectors
        """

        return await self._fetch_bounded_items(scen_id, CitySector)

    async def fetch_sectors(self, scen_id: int) -> List[Sector]:
        """Fetch a list of all sectors of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of sectors
        """

        return await self._fetch_bounded_items(scen_id, Sector)

    async def fetch_cityroutes(self, scen_id: int) -> List[CityRoute]:
        """Fetch a list of all cityroutes of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of cityroutes
        """

        return await self._fetch_bounded_items(scen_id, CityRoute)

    async def fetch_routes(self, scen_id: int) -> List[Route]:
        """Fetch a list of all routes of scenario from server.

        Args:
            scen_id (int): Scenario ID

        Returns:
            List of routes
        """

        return await self._fetch_bounded_items(scen_id, Route)

    async def fetch_airline_sectors(
        self, scen_id: int, airline_id: str
    ) -> List[Sector]:
        """Fetch a list of sectors associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of sectors
        """

        return await self._fetch_airline_locations_items(scen_id, airline_id, Sector)

    async def fetch_airline_citysectors(
        self, scen_id: int, airline_id: str
    ) -> List[CitySector]:
        """Fetch a list of citysectors associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of citysectors
        """

        return await self._fetch_airline_locations_items(
            scen_id, airline_id, CitySector
        )

    async def fetch_airline_routes(self, scen_id: int, airline_id: str) -> List[Route]:
        """Fetch a list of routes associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of routes
        """

        return await self._fetch_airline_locations_items(scen_id, airline_id, Route)

    async def fetch_airline_cityroutes(
        self, scen_id: int, airline_id: str
    ) -> List[CityRoute]:
        """Fetch a list of cityroutes associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of cityroutes
        """

        return await self._fetch_airline_locations_items(scen_id, airline_id, CityRoute)

    async def fetch_airline_sectors_ids(
        self, scen_id: int, airline_id: str
    ) -> List[str]:
        """Fetch a list of sectors ids associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of sectors
        """

        return await self._fetch_airline_locations_ids(scen_id, airline_id, Sector)

    async def fetch_airline_citysectors_ids(
        self, scen_id: int, airline_id: str
    ) -> List[str]:
        """Fetch a list of citysectors ids associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of citysectors
        """

        return await self._fetch_airline_locations_ids(scen_id, airline_id, CitySector)

    async def fetch_airline_routes_ids(
        self, scen_id: int, airline_id: str
    ) -> List[str]:
        """Fetch a list of routes ids associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of routes
        """

        return await self._fetch_airline_locations_ids(scen_id, airline_id, Route)

    async def fetch_airline_cityroutes_ids(
        self, scen_id: int, airline_id: str
    ) -> List[str]:
        """Fetch a list of cityroutes associated to an airline from server.

        Args:
            scen_id (int): Scenario ID
            airline_id (str): Airline ID

        Returns:
            List of cityroutes
        """

        return await self._fetch_airline_locations_ids(scen_id, airline_id, CityRoute)

    async def fetch_schedules_ids(
        self,
        scen_id: int,
        *,
        citysector_id: Optional[str] = None,
        airline_id: Optional[str] = None,
        sector_id: Optional[str] = None,
    ) -> List[str]:
        """Fetch all flights schedules identifiers associated to a citysector or sector from server.
        At least `citysector_id` and/or `sector_id` associated to the items must be defined.

        Args:
            scen_id (int): Scenario ID
            citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
            airline_id (Optional[str], optional): Target airline ID. Defaults to None
            sector_id (Optional[str], optional): Target sector ID. Defaults to None

        Raises:
            ValueError: If none of `citysector_id`, `airline_id`, `sector_id` is defined
            ValueError: If only `airline_id` is defined

        Returns:
            List of identifiers of unbounded items
        """

        return await self._fetch_unbounded_ids(
            scen_id,
            Schedule,
            citysector_id=citysector_id,
            airline_id=airline_id,
            sector_id=sector_id,
        )

    async def fetch_schedules(
        self,
        scen_id: int,
        ids: List[str],
        *,
        citysector_id: Optional[str] = None,
        sector_id: Optional[str] = None,
    ) -> List[Schedule]:
        """Fetch all flights schedules associated to a citysector or sector from server.
        At least `citysector_id` and/or `sector_id` associated to the items must be defined.

        Args:
            scen_id (int): Scenario ID
            ids (List[str]): List of schedules IDs
            citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
            sector_id (Optional[str], optional): Target sector ID. Defaults to None

        Raises:
            ValueError: If none of `citysector_id`, `sector_id` is defined

        Returns:
            List of flights schedules.
        """

        return await self._fetch_unbounded_items(
            scen_id, Schedule, ids, citysector_id=citysector_id, sector_id=sector_id
        )

    async def fetch_flights_ids(
        self,
        scen_id: int,
        *,
        citysector_id: Optional[str] = None,
        airline_id: Optional[str] = None,
        sector_id: Optional[str] = None,
    ) -> List[str]:
        """Fetch all flights identifiers associated to a citysector or sector from server.
        At least `citysector_id` and/or `sector_id` associated to the items must be defined.

        Args:
            scen_id (int): Scenario ID
            citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
            airline_id (Optional[str], optional): Target airline ID. Defaults to None
            sector_id (Optional[str], optional): Target sector ID. Defaults to None

        Raises:
            ValueError: If none of `citysector_id`, `airline_id`, `sector_id` is defined
            ValueError: If only `airline_id` is defined

        Returns:
            List of identifiers of unbounded items
        """

        return await self._fetch_unbounded_ids(
            scen_id,
            Flight,
            citysector_id=citysector_id,
            airline_id=airline_id,
            sector_id=sector_id,
        )

    async def fetch_flights(
        self,
        scen_id: int,
        ids: List[str],
        *,
        citysector_id: Optional[str] = None,
        sector_id: Optional[str] = None,
    ) -> List[Flight]:
        """Fetch all flights associated to a citysector or sector from server.
        At least `citysector_id` and/or `sector_id` associated to the items must be defined.

        Args:
            scen_id (int): Scenario ID
            ids (List[str]): List of flights IDs
            citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
            sector_id (Optional[str], optional): Target sector ID. Defaults to None

        Raises:
            ValueError: If none of `citysector_id`, `sector_id` is defined

        Returns:
            List of flights
        """

        return await self._fetch_unbounded_items(
            scen_id, Flight, ids, citysector_id=citysector_id, sector_id=sector_id
        )

fetch_aircrafts(scen_id) async

Fetch a list of all aircrafts of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[Aircraft]

List of aircrafts

Source code in src/rmlab/api/fetch/core.py
45
46
47
48
49
50
51
52
53
54
55
async def fetch_aircrafts(self, scen_id: int) -> List[Aircraft]:
    """Fetch a list of all aircrafts of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of aircrafts
    """

    return await self._fetch_bounded_items(scen_id, Aircraft)

fetch_airline_cityroutes(scen_id, airline_id) async

Fetch a list of cityroutes associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[CityRoute]

List of cityroutes

Source code in src/rmlab/api/fetch/core.py
198
199
200
201
202
203
204
205
206
207
208
209
210
211
async def fetch_airline_cityroutes(
    self, scen_id: int, airline_id: str
) -> List[CityRoute]:
    """Fetch a list of cityroutes associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of cityroutes
    """

    return await self._fetch_airline_locations_items(scen_id, airline_id, CityRoute)

fetch_airline_cityroutes_ids(scen_id, airline_id) async

Fetch a list of cityroutes associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[str]

List of cityroutes

Source code in src/rmlab/api/fetch/core.py
258
259
260
261
262
263
264
265
266
267
268
269
270
271
async def fetch_airline_cityroutes_ids(
    self, scen_id: int, airline_id: str
) -> List[str]:
    """Fetch a list of cityroutes associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of cityroutes
    """

    return await self._fetch_airline_locations_ids(scen_id, airline_id, CityRoute)

fetch_airline_citysectors(scen_id, airline_id) async

Fetch a list of citysectors associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[CitySector]

List of citysectors

Source code in src/rmlab/api/fetch/core.py
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
async def fetch_airline_citysectors(
    self, scen_id: int, airline_id: str
) -> List[CitySector]:
    """Fetch a list of citysectors associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of citysectors
    """

    return await self._fetch_airline_locations_items(
        scen_id, airline_id, CitySector
    )

fetch_airline_citysectors_ids(scen_id, airline_id) async

Fetch a list of citysectors ids associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[str]

List of citysectors

Source code in src/rmlab/api/fetch/core.py
228
229
230
231
232
233
234
235
236
237
238
239
240
241
async def fetch_airline_citysectors_ids(
    self, scen_id: int, airline_id: str
) -> List[str]:
    """Fetch a list of citysectors ids associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of citysectors
    """

    return await self._fetch_airline_locations_ids(scen_id, airline_id, CitySector)

fetch_airline_routes(scen_id, airline_id) async

Fetch a list of routes associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[Route]

List of routes

Source code in src/rmlab/api/fetch/core.py
185
186
187
188
189
190
191
192
193
194
195
196
async def fetch_airline_routes(self, scen_id: int, airline_id: str) -> List[Route]:
    """Fetch a list of routes associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of routes
    """

    return await self._fetch_airline_locations_items(scen_id, airline_id, Route)

fetch_airline_routes_ids(scen_id, airline_id) async

Fetch a list of routes ids associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[str]

List of routes

Source code in src/rmlab/api/fetch/core.py
243
244
245
246
247
248
249
250
251
252
253
254
255
256
async def fetch_airline_routes_ids(
    self, scen_id: int, airline_id: str
) -> List[str]:
    """Fetch a list of routes ids associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of routes
    """

    return await self._fetch_airline_locations_ids(scen_id, airline_id, Route)

fetch_airline_sectors(scen_id, airline_id) async

Fetch a list of sectors associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[Sector]

List of sectors

Source code in src/rmlab/api/fetch/core.py
153
154
155
156
157
158
159
160
161
162
163
164
165
166
async def fetch_airline_sectors(
    self, scen_id: int, airline_id: str
) -> List[Sector]:
    """Fetch a list of sectors associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of sectors
    """

    return await self._fetch_airline_locations_items(scen_id, airline_id, Sector)

fetch_airline_sectors_ids(scen_id, airline_id) async

Fetch a list of sectors ids associated to an airline from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
airline_idstr

Airline ID

required

Returns:

TypeDescription
List[str]

List of sectors

Source code in src/rmlab/api/fetch/core.py
213
214
215
216
217
218
219
220
221
222
223
224
225
226
async def fetch_airline_sectors_ids(
    self, scen_id: int, airline_id: str
) -> List[str]:
    """Fetch a list of sectors ids associated to an airline from server.

    Args:
        scen_id (int): Scenario ID
        airline_id (str): Airline ID

    Returns:
        List of sectors
    """

    return await self._fetch_airline_locations_ids(scen_id, airline_id, Sector)

fetch_airlines(scen_id) async

Fetch a list of all airlines of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[Airline]

List of airlines

Source code in src/rmlab/api/fetch/core.py
57
58
59
60
61
62
63
64
65
66
67
async def fetch_airlines(self, scen_id: int) -> List[Airline]:
    """Fetch a list of all airlines of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of airlines
    """

    return await self._fetch_bounded_items(scen_id, Airline)

fetch_airports(scen_id) async

Fetch a list of all airport of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[Airport]

List of airport

Source code in src/rmlab/api/fetch/core.py
69
70
71
72
73
74
75
76
77
78
79
async def fetch_airports(self, scen_id: int) -> List[Airport]:
    """Fetch a list of all airport of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of airport
    """

    return await self._fetch_bounded_items(scen_id, Airport)

fetch_cities(scen_id) async

Fetch a list of all cities of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[City]

List of cities

Source code in src/rmlab/api/fetch/core.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
async def fetch_cities(self, scen_id: int) -> List[City]:
    """Fetch a list of all cities of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of cities
    """

    return await self._fetch_bounded_items(scen_id, City)

fetch_cityroutes(scen_id) async

Fetch a list of all cityroutes of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[CityRoute]

List of cityroutes

Source code in src/rmlab/api/fetch/core.py
129
130
131
132
133
134
135
136
137
138
139
async def fetch_cityroutes(self, scen_id: int) -> List[CityRoute]:
    """Fetch a list of all cityroutes of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of cityroutes
    """

    return await self._fetch_bounded_items(scen_id, CityRoute)

fetch_citysectors(scen_id) async

Fetch a list of all citysectors of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[CitySector]

List of citysectors

Source code in src/rmlab/api/fetch/core.py
105
106
107
108
109
110
111
112
113
114
115
async def fetch_citysectors(self, scen_id: int) -> List[CitySector]:
    """Fetch a list of all citysectors of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of citysectors
    """

    return await self._fetch_bounded_items(scen_id, CitySector)

fetch_countries(scen_id) async

Fetch a list of all countries of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[Country]

List of countries

Source code in src/rmlab/api/fetch/core.py
81
82
83
84
85
86
87
88
89
90
91
async def fetch_countries(self, scen_id: int) -> List[Country]:
    """Fetch a list of all countries of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of countries
    """

    return await self._fetch_bounded_items(scen_id, Country)

fetch_flights(scen_id, ids, *, citysector_id=None, sector_id=None) async

Fetch all flights associated to a citysector or sector from server. At least citysector_id and/or sector_id associated to the items must be defined.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
idsList[str]

List of flights IDs

required
citysector_idOptional[str]

Target citysector ID. Defaults to None

None
sector_idOptional[str]

Target sector ID. Defaults to None

None

Raises:

TypeDescription
ValueError

If none of citysector_id, sector_id is defined

Returns:

TypeDescription
List[Flight]

List of flights

Source code in src/rmlab/api/fetch/core.py
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
async def fetch_flights(
    self,
    scen_id: int,
    ids: List[str],
    *,
    citysector_id: Optional[str] = None,
    sector_id: Optional[str] = None,
) -> List[Flight]:
    """Fetch all flights associated to a citysector or sector from server.
    At least `citysector_id` and/or `sector_id` associated to the items must be defined.

    Args:
        scen_id (int): Scenario ID
        ids (List[str]): List of flights IDs
        citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
        sector_id (Optional[str], optional): Target sector ID. Defaults to None

    Raises:
        ValueError: If none of `citysector_id`, `sector_id` is defined

    Returns:
        List of flights
    """

    return await self._fetch_unbounded_items(
        scen_id, Flight, ids, citysector_id=citysector_id, sector_id=sector_id
    )

fetch_flights_ids(scen_id, *, citysector_id=None, airline_id=None, sector_id=None) async

Fetch all flights identifiers associated to a citysector or sector from server. At least citysector_id and/or sector_id associated to the items must be defined.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
citysector_idOptional[str]

Target citysector ID. Defaults to None

None
airline_idOptional[str]

Target airline ID. Defaults to None

None
sector_idOptional[str]

Target sector ID. Defaults to None

None

Raises:

TypeDescription
ValueError

If none of citysector_id, airline_id, sector_id is defined

ValueError

If only airline_id is defined

Returns:

TypeDescription
List[str]

List of identifiers of unbounded items

Source code in src/rmlab/api/fetch/core.py
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
async def fetch_flights_ids(
    self,
    scen_id: int,
    *,
    citysector_id: Optional[str] = None,
    airline_id: Optional[str] = None,
    sector_id: Optional[str] = None,
) -> List[str]:
    """Fetch all flights identifiers associated to a citysector or sector from server.
    At least `citysector_id` and/or `sector_id` associated to the items must be defined.

    Args:
        scen_id (int): Scenario ID
        citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
        airline_id (Optional[str], optional): Target airline ID. Defaults to None
        sector_id (Optional[str], optional): Target sector ID. Defaults to None

    Raises:
        ValueError: If none of `citysector_id`, `airline_id`, `sector_id` is defined
        ValueError: If only `airline_id` is defined

    Returns:
        List of identifiers of unbounded items
    """

    return await self._fetch_unbounded_ids(
        scen_id,
        Flight,
        citysector_id=citysector_id,
        airline_id=airline_id,
        sector_id=sector_id,
    )

fetch_info(scen_id) async

Fetch summarized information about a scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
Tuple[ScenarioDates, ItemsCount, SchedulesCount, FlightsCount]

A 4-tuple with information about the scenario.

Source code in src/rmlab/api/fetch/core.py
31
32
33
34
35
36
37
38
39
40
41
42
43
async def fetch_info(
    self, scen_id: int
) -> Tuple[ScenarioDates, ItemsCount, SchedulesCount, FlightsCount]:
    """Fetch summarized information about a scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        A 4-tuple with information about the scenario.
    """

    return await self._fetch_info(scen_id)

fetch_routes(scen_id) async

Fetch a list of all routes of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[Route]

List of routes

Source code in src/rmlab/api/fetch/core.py
141
142
143
144
145
146
147
148
149
150
151
async def fetch_routes(self, scen_id: int) -> List[Route]:
    """Fetch a list of all routes of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of routes
    """

    return await self._fetch_bounded_items(scen_id, Route)

fetch_schedules(scen_id, ids, *, citysector_id=None, sector_id=None) async

Fetch all flights schedules associated to a citysector or sector from server. At least citysector_id and/or sector_id associated to the items must be defined.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
idsList[str]

List of schedules IDs

required
citysector_idOptional[str]

Target citysector ID. Defaults to None

None
sector_idOptional[str]

Target sector ID. Defaults to None

None

Raises:

TypeDescription
ValueError

If none of citysector_id, sector_id is defined

Returns:

TypeDescription
List[Schedule]

List of flights schedules.

Source code in src/rmlab/api/fetch/core.py
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
async def fetch_schedules(
    self,
    scen_id: int,
    ids: List[str],
    *,
    citysector_id: Optional[str] = None,
    sector_id: Optional[str] = None,
) -> List[Schedule]:
    """Fetch all flights schedules associated to a citysector or sector from server.
    At least `citysector_id` and/or `sector_id` associated to the items must be defined.

    Args:
        scen_id (int): Scenario ID
        ids (List[str]): List of schedules IDs
        citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
        sector_id (Optional[str], optional): Target sector ID. Defaults to None

    Raises:
        ValueError: If none of `citysector_id`, `sector_id` is defined

    Returns:
        List of flights schedules.
    """

    return await self._fetch_unbounded_items(
        scen_id, Schedule, ids, citysector_id=citysector_id, sector_id=sector_id
    )

fetch_schedules_ids(scen_id, *, citysector_id=None, airline_id=None, sector_id=None) async

Fetch all flights schedules identifiers associated to a citysector or sector from server. At least citysector_id and/or sector_id associated to the items must be defined.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required
citysector_idOptional[str]

Target citysector ID. Defaults to None

None
airline_idOptional[str]

Target airline ID. Defaults to None

None
sector_idOptional[str]

Target sector ID. Defaults to None

None

Raises:

TypeDescription
ValueError

If none of citysector_id, airline_id, sector_id is defined

ValueError

If only airline_id is defined

Returns:

TypeDescription
List[str]

List of identifiers of unbounded items

Source code in src/rmlab/api/fetch/core.py
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
async def fetch_schedules_ids(
    self,
    scen_id: int,
    *,
    citysector_id: Optional[str] = None,
    airline_id: Optional[str] = None,
    sector_id: Optional[str] = None,
) -> List[str]:
    """Fetch all flights schedules identifiers associated to a citysector or sector from server.
    At least `citysector_id` and/or `sector_id` associated to the items must be defined.

    Args:
        scen_id (int): Scenario ID
        citysector_id (Optional[str], optional): Target citysector ID. Defaults to None
        airline_id (Optional[str], optional): Target airline ID. Defaults to None
        sector_id (Optional[str], optional): Target sector ID. Defaults to None

    Raises:
        ValueError: If none of `citysector_id`, `airline_id`, `sector_id` is defined
        ValueError: If only `airline_id` is defined

    Returns:
        List of identifiers of unbounded items
    """

    return await self._fetch_unbounded_ids(
        scen_id,
        Schedule,
        citysector_id=citysector_id,
        airline_id=airline_id,
        sector_id=sector_id,
    )

fetch_sectors(scen_id) async

Fetch a list of all sectors of scenario from server.

Parameters:

NameTypeDescriptionDefault
scen_idint

Scenario ID

required

Returns:

TypeDescription
List[Sector]

List of sectors

Source code in src/rmlab/api/fetch/core.py
117
118
119
120
121
122
123
124
125
126
127
async def fetch_sectors(self, scen_id: int) -> List[Sector]:
    """Fetch a list of all sectors of scenario from server.

    Args:
        scen_id (int): Scenario ID

    Returns:
        List of sectors
    """

    return await self._fetch_bounded_items(scen_id, Sector)