Timenet connectors.sources
timenet_connectors.sources ¶source
Shared source access and media conversion helpers for dataset connectors.
huggingface_hub ¶source
Helpers for downloading files from pinned Hugging Face dataset revisions.
:func:hub_snapshot calls huggingface_hub.snapshot_download for the files that match the given
patterns, such as a filename or data/*.parquet. The Hub client runs the downloads in its own thread
pool. Its progress bars are hidden; the file bytes go to the
:mod:~timenet_connectors.download.progress sink, so the build CLI shows them like any other download.
huggingface_hub is listed in the connector's requirements.txt and imported lazily, so
--no-isolation still works. The Hub client reads HF_TOKEN from the environment for gated datasets.
hub_snapshot
async
¶source
Download the files of a dataset revision that match patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo
|
str
|
The Hub dataset id, such as |
required |
revision
|
str
|
The revision to read, normally a pinned commit. |
required |
cache_dir
|
Path
|
Directory where the connector caches Hub files. |
required |
patterns
|
Sequence[str]
|
Repo-relative filenames or globs, such as |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The local snapshot directory, with the files at their repo paths. The caller checks |
Path
|
that the files it needs exist. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If |
TimeNetDownloadError
|
If the download fails. |
readers ¶source
Validated readers for common source file formats.
CsvDataReader ¶source
DataReader ¶source
Read and validate rows from one local source file.
The row schema determines validation strictness. CSV parses its string cells.
JsonArrayDataReader ¶source
JsonlDataReader ¶source
ParquetDataReader ¶source
Bases: DataReader[RowT]
Read a Parquet file in batches, yielding individual rows.
base ¶source
csv ¶source
Read CSV source rows.
CsvDataReader ¶source
json ¶source
Read JSON and JSON Lines source rows.