dicogis.export.output_path module

Default output path of an inventory, shared by the CLI and the GUI.

dicogis.export.output_path.determine_output_path(output_path, output_format='excel', input_folder=None, pg_services=None)

Get the output path depending on options passed.

Parameters:
  • output_path (Path | str | None) – output path passed to inventory CLI

  • output_format (str) – input output format passed to inventory CLI

  • input_folder (Path | None) – input folder passed to inventory CLI

  • pg_services (list[str] | None) – list of postgres services names to use

Raises:

ValueError – if output format is not supported

Return type:

Path

Returns:

output path to use. A folder if output_format==’json’,

a file if output_format==’excel’

dicogis.export.output_path.match_output_path_to_format(output_path, output_format)

Adapt an output path to an output format: an Excel workbook is a .xlsx file, a JSON export a folder.

Only the .xlsx extension is added or removed, so a name the user typed is otherwise kept as is (including dots in a folder name).

Parameters:
  • output_path (Path) – output path to adapt

  • output_format (str) – output format (see dicogis.constants.OutputFormats)

Raises:

ValueError – if output format is not supported

Return type:

Path

Returns:

output path matching the output format