pyslk.gen_file_query_raw

pyslk.gen_file_query_raw#

pyslk.gen_file_query_raw(resources: str | list | Path, recursive: bool = False, no_newline: bool = False, cached_only: bool = False, not_cached: bool = False, tape_barcodes: list[str] | str | None = None, return_type: int = 0) str | int | CompletedProcess#

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 Path) – list of resources to be searched for

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

  • no_newline (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

  • return_type (int) – select between 0 (== str output), 1 (== exit code), 2 (subprocess output)

Returns:

stdout of the slk_helpers call

Return type:

Union[str, int, subprocess.CompletedProcess]