datadings.reader.zipfile module

class datadings.reader.zipfile.ZipFileReader(path: str | ~pathlib.Path, patterns: ~typing.Sequence[str | ~pathlib.Path] = '{LABEL}/**', labels=None, numeric_labels=True, initfun: ~typing.Callable = <function noop>, convertfun: ~typing.Callable = <function noop>, include=(), exclude=(), separator='\t')[source]

Bases: ListReader

Reader that reads files from a ZIP file.

Note

Functionally identical to the DirectoryReader, expect it reads from ZIP files instead of filesystem directories. Please refer to its documentation for more detailed explanations.

Parameters:
  • patterns – One or more search patterns.

  • labels – Optional. List of labels in desired order, or path to file with one label per line. If None, get "label" keys from samples, if any, and sort.

  • numeric_labels – If true, convert labels to numeric index to list of all labels.

  • initfun – Callable initfun(sample: dict) to modify samples in-place during initialization.

  • convertfun – Callable convertfun(sample: dict) to modify samples in-place before they are returned.

  • include – Set of inclusion patterns.

  • exclude – Set of exclusion patterns.

  • separator – Separator string for file patterns.

datadings.reader.zipfile.glob_pattern(infos, pattern)[source]
datadings.reader.zipfile.yield_zipfile(zipfile_, patterns, separator)[source]