Skip to content

Parsers

Rendered at build time from the docstrings and signatures of continuous_gtfs.parsers. A member with no description has no docstring yet; the fix is in the code, never on this page.

The content_kind parser registry that turns input bytes into the objects steps read.

Parser registry for asset content kinds.

Every asset declares a content_kind (see specs/asset-registry.md §Content Kinds). This module owns the closed set of kinds and the functions that turn raw bytes into the Python objects transforms consume. The worker and the CLI both go through parse() so ctx.inputs[name] has the same shape regardless of whether it came from an orchestrator dispatch or a local file.

Adding a new kind: register a parser here, add the kind to the assets.content_kind CHECK constraint in a new migration.

register_parser

register_parser(
    content_kind: str,
) -> Callable[
    [Callable[[bytes], Any]], Callable[[bytes], Any]
]

Register a parser for a content kind.

Decorator form

@register_parser("csv_table") def _parse_csv(raw: bytes) -> pl.DataFrame: ...

parse

parse(content_kind: str, raw: bytes) -> Any

Parse raw bytes according to content_kind.

opaque_bytes is the escape hatch — bytes pass through untouched so transforms that want raw access can have it. Unknown kinds raise (a kind is unknown when no parser has been registered for it; assets.content_kind CHECK constraint keeps this in sync with the DB).

known_kinds

known_kinds() -> set[str]

Return the set of content kinds with registered parsers, plus opaque_bytes.