Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for dataset authors.

Provides helpers to download files, extract archives, verify SHA-256 hashes, and manage the dataset acquisition workflow.

Functions§

acquire_dataset
Get a dataset file, using a preparation closure that the caller provides.
download_to
Download a remote file into the given directory.
download_to_with_retries
Download a remote file into the given directory. It retries transient failures.
gunzip
Decompress a gzip (.gz) file into a single output file.
read_latin1
Read a file as Latin-1 (ISO-8859-1) text.
sha256_file
Compute a file’s SHA256 hash and return it as a lowercase hex string.
untar
Extract a tar (.tar) archive into a target directory.
untar_gz
Extract a gzip-compressed tar (.tar.gz / .tgz) archive into a target directory.
unzip
Extract a zip archive into a target directory.
verify_sha256
Verify that a file’s SHA256 hash matches an expected value (case-insensitive).