Skip to content

betting_combat.providers.ufcstats.client

client.py — UFCStats’ fight history through the Greco1899 mirror (CSV files on GitHub, refreshed upstream every day): each file read verbatim, its header checked.

MIRROR_HEADERS the four files and the exact header the datasets were built on
parse_mirror one file's rows, every cell as written, the header and widths checked
UfcStatsMirror the provider: ``file(name)`` the text, ``rows(name)`` parsed

Cito serves the same official lines (518 of 518 fighter-rounds identical); the mirror stays for what only it has: the date of birth (ufc_fighter_tott), first and last names apart (ufc_fighter_details), and the history’s check. Six files in all.

Classes

MirrorFormatError

Bases: ValueError

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

UfcStatsMirror

Bases: Provider

The mirror’s raw CSV files.

file

file(name: str) -> str

One mirror file as text; an empty file is refused.

rows

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

Functions

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.