pyslk.gen_file_query

Contents

pyslk.gen_file_query#

pyslk.gen_file_query(resources: str | list[str] | set[str] | Path | list[pathlib.Path] | set[pathlib.Path], recursive: bool = False, cached_only: bool = False, not_cached: bool = False, tape_barcodes: list[str] | str | None = None) str#

Generates a search query that searches for the listed resources

A search query will be generated which connects all elements of ‘resources’ with and ‘or’. A ‘resource’ (an element of ‘resources’) might be one of these:

  • a filename with full path (e.g. /arch/bm0146/k204221/INDEX.txt)

  • a filename without full path (e.g. INDEX.txt)

  • a regex describing a filename (e.g. /arch/bm0146/k204221/.*.txt)

  • a namespace (e.g. /arch/bm0146/k204221 or /arch/bm0146/k204221/)

Details are given in the slk_helpers documentation at https://docs.dkrz.de

Parameters:
  • resources (str or list or set or Path) – list of resources to be searched for

  • recursive (bool) – do recursive search in the namespaces

  • cached_only (bool) – do recursive search in the namespaces

  • not_cached (bool) – do recursive search in the namespaces

  • tape_barcodes (list[str]) – do recursive search in the namespaces

Returns:

generated search query

Return type:

str