Skip to content

betting_combat.consumers.ufcstats

UFC fight history from UFCStats, via the Greco1899 mirror (CSV files on GitHub, refreshed upstream every day): each mirror file read verbatim, its header checked (parse_mirror), for strategy 4’s raw tables (services.rounds_data).

Classes

MirrorFormatError

Bases: ValueError

A mirror file whose shape is not the one the round datasets were built on.

Functions

fetch

fetch(client: httpx.AsyncClient, base_url: str, name: str) -> str

One mirror file as text. Raises on HTTP errors; a partial file is refused by length.

parse_mirror

parse_mirror(name: str, text: str) -> list[tuple[str, ...]]

Every data row of one mirror file, each cell exactly as the file writes it ('' for an empty cell), in file order; blank lines are skipped (as pandas skips them).

The header must be exactly MIRROR_HEADERS[name] and every row must have one cell per column: anything else is refused, never guessed.