ssb_tbmd_apis.paths package

ssb_tbmd_apis.paths.linux_stammer module

linux_stammer(insert_environ=False, flip=False)

Manually load the “linux-forkortelser” in as dict.

Parameters:
  • insert_environ (bool) – Set to True if you want the dict to be inserted into the environment variables (os.environ).

  • flip (bool) – Set to True if you want to flip the dict, so that the keys are the values and the values are the keys. This is useful if you want to convert a path with a “linux-forkortelse” to the full path.

Returns:

The “linux-forkortelser” as a dict

Return type:

dict[str, str]

Raises:

ValueError – If the stamme_variabel file is wrongly formatted.

ssb_tbmd_apis.paths.try_variations module

look_for_file_on_disk(path)

Look for a file on disk using various methods.

Parameters:

path (Path) – Path to the file.

Returns:

The path to the discovered file.

Return type:

Path

Raises:

FileNotFoundError – If the file cannot be found.

period_variations_path(path)

Generate variations of the path based on periods in the filename.

Parameters:

path (Path) – Path to the file.

Returns:

List of variations of the path.

Return type:

list[str]

swap_dollar_sign(path)

Swap the dollar sign in the path with the corresponding path from linux_stammer.

Parameters:

path (Path) – Path to the file.

Returns:

The modified path with the dollar sign swapped.

Return type:

Path

try_zeep_serialize_path(path, tbmd_service='datadok', operation='GetFileDescriptionByPath')

Try many different paths to get the file description from the datadok API.

Parameters:
  • path (Path) – Path to the file (string or Path).

  • tbmd_service (str) – The TBMD service to use (default is “datadok”).

  • operation (str) – The operation to perform (default is “GetFileDescriptionByPath”).

Returns:

A tuple containing the file description and the resolved Path.

Return type:

tuple

Raises:

FileNotFoundError – If the file description cannot be found.