Skip to content
heliaEDGE
Reference
HELIA

file

This module provides utility functions to interact with files.

Functions

Name Description
download_file Download file from supplied url to destination streaming
compute_checksum Compute checksum of file
load_pkl Load pickled file
save_pkl Save python objects into pickle file
resolve_template_path Resolve templated path w/ supplied substitutions

Machine-readable model

function

Download file from supplied url to destination streaming.

helia_edge/utils/file.py:26

download_file(src: str, dst: os.PathLike, progress: bool = True, chunk_size: int = 8192)

Download file from supplied url to destination streaming.

Parameters of download_file
NameTypeDefaultDescription
srcstrRequiredSource URL path
dstPathLikeRequiredDestination file path
progressboolTrueDisplay progress bar. Defaults to True.
function

Compute checksum of file.

helia_edge/utils/file.py:49

compute_checksum(file: Path, checksum_type: str = 'md5', chunk_size: int = 8192) -> str

Compute checksum of file.

Parameters of compute_checksum
NameTypeDefaultDescription
filePathRequiredFile path
checksum_typestr'md5'Checksum type. Defaults to "md5".
chunk_sizeint8192Chunk size. Defaults to 8192.
Returns of compute_checksum
ValueTypeDescription
strstrChecksum value
function

load_pkl

Python

Load pickled file.

helia_edge/utils/file.py:69

load_pkl(file: str, compress: bool = True) -> dict[str, Any]

Load pickled file.

Parameters of load_pkl
NameTypeDefaultDescription
filestrRequiredFile path (.pkl)
compressboolTrueIf file is compressed. Defaults to True.
Returns of load_pkl
TypeDescription
dict[str, Any]dict[str, Any]: Dictionary of pickled objects
function

save_pkl

Python

Save python objects into pickle file.

helia_edge/utils/file.py:87

save_pkl(file: str, compress: bool = True, **kwargs={})

Save python objects into pickle file.

Parameters of save_pkl
NameTypeDefaultDescription
filestrRequiredFile path (.pkl)
compressboolTrueWhether to compress file. Defaults to True.
function

Resolve templated path w/ supplied substitutions.

helia_edge/utils/file.py:102

resolve_template_path(fpath: Path, **kwargs: Any = {}) -> Path

Resolve templated path w/ supplied substitutions.

Parameters of resolve_template_path
NameTypeDefaultDescription
fpathPathRequiredFile path
**kwargsAny{}Template arguments
Returns of resolve_template_path
ValueTypeDescription
PathPathResolved file path