Skip to content

Cache

cache ¤

Classes:

Name Description
FR24Cache
CacheLike
GlobMixin
FlightListRegCache
FlightListFlightCache
FlightListBy
PlaybackCache
TimestampedCache
NearestFlightsCache
FlightDetailsCache
Collection

A directory containing scannable files.

File

Attributes:

Name Type Description
PATH_CACHE

PATH_CACHE module-attribute ¤

PATH_CACHE = Path(user_cache_dir('fr24'))

FR24Cache ¤

FR24Cache(path: Path | str)

Methods:

Name Description
default

Create a cache in the

Attributes:

Name Type Description
path
flight_list
playback
live_feed
nearest_flights
live_flights_status
top_flights
flight_details
playback_flight

path instance-attribute ¤

path = Path(path)

flight_list instance-attribute ¤

flight_list = FlightListBy(
    reg=FlightListRegCache(
        Collection(flight_list_dir / "reg")
    ),
    flight=FlightListFlightCache(
        Collection(flight_list_dir / "flight")
    ),
)

playback instance-attribute ¤

playback = PlaybackCache(Collection(path / 'playback'))

live_feed instance-attribute ¤

live_feed = TimestampedCache(
    Collection(path / "feed"), schema=live_feed_schema
)

nearest_flights instance-attribute ¤

nearest_flights = NearestFlightsCache(
    Collection(path / "nearest_flights")
)

live_flights_status instance-attribute ¤

live_flights_status = TimestampedCache(
    Collection(path / "live_flights_status"),
    schema=live_flights_status_schema,
)

top_flights instance-attribute ¤

top_flights = TimestampedCache(
    Collection(path / "top_flights"),
    schema=top_flights_schema,
)

flight_details instance-attribute ¤

flight_details = FlightDetailsCache(
    Collection(path / "flight_details"),
    schema=flight_details_schema,
)

playback_flight instance-attribute ¤

playback_flight = FlightDetailsCache(
    Collection(path / "playback_flight"),
    schema=playback_flight_schema,
)

default classmethod ¤

default() -> FR24Cache

Create a cache in the default directory.

CacheLike ¤

Bases: Protocol

Methods:

Name Description
get_path

Get the path to the cached file.

scan_table

Lazily load a file from this collection.

Attributes:

Name Type Description
collection Collection

collection instance-attribute ¤

collection: Collection

get_path ¤

get_path(*args: Any, **kwargs: Any) -> BarePath

Get the path to the cached file.

scan_table ¤

scan_table(*args: Any, **kwargs: Any) -> LazyFrame

Lazily load a file from this collection.

GlobMixin ¤

Bases: CacheLike

Methods:

Name Description
glob

Yield all scannable files matching the given pattern.

get_path

Get the path to the cached file.

scan_table

Lazily load a file from this collection.

Attributes:

Name Type Description
collection Collection

collection instance-attribute ¤

collection: Collection

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

get_path ¤

get_path(*args: Any, **kwargs: Any) -> BarePath

Get the path to the cached file.

scan_table ¤

scan_table(*args: Any, **kwargs: Any) -> LazyFrame

Lazily load a file from this collection.

FlightListRegCache ¤

Bases: GlobMixin

Methods:

Name Description
get_path
scan_table

Lazily load a flight list file from this collection.

glob

Yield all scannable files matching the given pattern.

Attributes:

Name Type Description
collection Collection

collection instance-attribute ¤

collection: Collection

get_path ¤

get_path(reg: str) -> BarePath

scan_table ¤

scan_table(
    reg: str, *, format: TabularFileFmt = "parquet"
) -> LazyFrame

Lazily load a flight list file from this collection.

Parameters:

Name Type Description Default
reg str

The aircraft registration number (e.g. B-HUJ).

required

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

FlightListFlightCache ¤

Bases: GlobMixin

Methods:

Name Description
get_path
scan_table

Lazily load a flight list file from this collection.

glob

Yield all scannable files matching the given pattern.

Attributes:

Name Type Description
collection Collection

collection instance-attribute ¤

collection: Collection

get_path ¤

get_path(flight: str) -> BarePath

scan_table ¤

scan_table(
    flight: str, *, format: TabularFileFmt = "parquet"
) -> LazyFrame

Lazily load a flight list file from this collection.

Parameters:

Name Type Description Default
flight str

The flight number (e.g. CX8747).

required

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

FlightListBy ¤

Methods:

Name Description
__call__

Attributes:

Name Type Description
reg FlightListRegCache
flight FlightListFlightCache

reg instance-attribute ¤

flight instance-attribute ¤

__call__ ¤

__call__(
    kind: Literal["reg", "flight"],
) -> FlightListRegCache | FlightListFlightCache

PlaybackCache ¤

Bases: GlobMixin

Methods:

Name Description
get_path
scan_table

Lazily load a playback file.

glob

Yield all scannable files matching the given pattern.

Attributes:

Name Type Description
collection Collection

collection instance-attribute ¤

collection: Collection

get_path ¤

get_path(flight_id: IntoFlightId) -> BarePath

scan_table ¤

scan_table(
    flight_id: IntoFlightId,
    *,
    format: TabularFileFmt = "parquet",
) -> LazyFrame

Lazily load a playback file.

Parameters:

Name Type Description Default
flight_id IntoFlightId

The flight ID of the record.

required

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

TimestampedCache ¤

Bases: GlobMixin

Methods:

Name Description
get_path
scan_table

Lazily load a timestamped file.

glob

Yield all scannable files matching the given pattern.

Attributes:

Name Type Description
collection Collection
schema dict[str, DataType]

collection instance-attribute ¤

collection: Collection

schema instance-attribute ¤

schema: dict[str, DataType]

get_path ¤

get_path(timestamp: IntoTimestamp | str) -> BarePath

scan_table ¤

scan_table(
    timestamp: IntoTimestamp | str,
    *,
    format: TabularFileFmt = "parquet",
) -> LazyFrame

Lazily load a timestamped file.

Parameters:

Name Type Description Default
timestamp IntoTimestamp | str

A timestamp-like object, see fr24.utils.to_unix_timestamp. The now literal is not allowed.

required

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

NearestFlightsCache ¤

Bases: GlobMixin

Methods:

Name Description
get_path
scan_table

Lazily load a nearest flights file.

glob

Yield all scannable files matching the given pattern.

Attributes:

Name Type Description
collection Collection

collection instance-attribute ¤

collection: Collection

get_path ¤

get_path(
    lon: float, lat: float, timestamp: IntoTimestamp | str
) -> BarePath

scan_table ¤

scan_table(
    lon: float,
    lat: float,
    timestamp: IntoTimestamp | str,
    *,
    format: TabularFileFmt = "parquet",
) -> LazyFrame

Lazily load a nearest flights file.

Parameters:

Name Type Description Default
lat float

Latitude of the center point.

required
lon float

Longitude of the center point.

required
timestamp IntoTimestamp | str

A timestamp-like object, see fr24.utils.to_unix_timestamp. The now literal is not allowed.

required

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

FlightDetailsCache ¤

Bases: GlobMixin

Methods:

Name Description
get_path
scan_table

Lazily load a flight details file.

glob

Yield all scannable files matching the given pattern.

Attributes:

Name Type Description
collection Collection
schema dict[str, DataType]

collection instance-attribute ¤

collection: Collection

schema instance-attribute ¤

schema: dict[str, DataType]

get_path ¤

get_path(
    flight_id: IntoFlightId, timestamp: IntoTimestamp | str
) -> BarePath

scan_table ¤

scan_table(
    flight_id: IntoFlightId,
    timestamp: IntoTimestamp | str,
    *,
    format: TabularFileFmt = "parquet",
) -> LazyFrame

Lazily load a flight details file.

Parameters:

Name Type Description Default
flight_id IntoFlightId

The flight ID of the record.

required
timestamp IntoTimestamp | str

A timestamp-like object, see fr24.utils.to_unix_timestamp. The now literal is not allowed.

required

glob ¤

glob(pattern: str) -> Generator[File, None, None]

Yield all scannable files matching the given pattern.

Collection ¤

A directory containing scannable files.

Methods:

Name Description
new_bare_path

Returns the bare path (without the file extension) to the file.

Attributes:

Name Type Description
path Path

path instance-attribute ¤

path: Path

new_bare_path ¤

new_bare_path(ident: str) -> BarePath

Returns the bare path (without the file extension) to the file.

File ¤

Bases: Path

Methods:

Name Description
scan_table

Lazily load this file.

Attributes:

Name Type Description
format TabularFileFmt

format property ¤

scan_table ¤

scan_table() -> LazyFrame

Lazily load this file.