Skip to content

Reader

timenet.reader source

Deserialization of a TimeF version directory into a :class:~timenet.dataset.TimeFDataset.

TimeFReader source

Reads a committed TimeF version directory. Use as a context manager to close shard handles.

metadata property source

metadata: DatasetMetadata

The dataset's descriptive identity.

schema property source

schema: DatasetSchema

The dataset's type declaration, reconstructed from the manifest.

tasks property source

tasks: tuple[Task, ...]

All tasks, with from_tasks resolved. Decoded on first access and cached.

values_backend property source

values_backend: str

The manifest's values-plane backend tag ("parquet" or "zarr").

close source

close() -> None

Close the values backend and the control-table handles, releasing their decoded caches.

iter_records source

iter_records(
    record_ids: Iterable[str] | None = None,
    *,
    with_annotations: bool = True,
) -> Iterator[Record]

Yield records lazily without materializing a :class:TimeFDataset.

When you pass record_ids, this method filters the read on the stored id column. This prunes the row groups that cannot hold a requested id, and it does not scan the whole file. Records come back in stored order (sorted by record_id), not in the order you asked for them. An id that the dataset does not contain raises TimeFValidationError.

Parameters:

Name Type Description Default
record_ids Iterable[str] | None

The records to yield, or None to yield every record.

None
with_annotations bool

Whether to resolve the annotations of each record. False leaves :attr:Record.annotations empty and skips the lookup and the JSON parse that each one costs. The stored spans are then not checked against the record window.

True

Yields:

Type Description
Record

Each reconstructed :class:Record.

read source

read() -> TimeFDataset

Materialize the full dataset.

Returns:

Name Type Description
A TimeFDataset

class:TimeFDataset with lazy per-series loaders and the reconstructed schema/tasks.

verify source

verify() -> None

Check every file the manifest lists against its recorded sha256: checksum.

This method does not run automatically when you open a version. It reads and hashes every shard, so it reads the whole dataset. The lazy read design of this class avoids that cost on open.

When integrity matters more than speed, call this method explicitly. Examples are after a download, before a long training run, or inside a fsck-style command. This method reopens each file through the version's filesystem. As a result, a missing file now surfaces here, because __init__ no longer stat-sweeps the files.

Raises:

Type Description
TimeFFormatError

If a listed file is missing, or its contents do not match the manifest.