dictIO.dict_writer

DictWriter class for writing dictionaries in dictIO native file format, as well as JSON and XML.

Functions

create_target_file_name(source_file[, ...])

Create a well defined target file name.

Classes

DictWriter()

Writer for dictionaries in dictIO native file format, as well as JSON, XML and OpenFoam.

dictIO.dict_writer.create_target_file_name(source_file: str | PathLike[str], prefix: str | None = None, scope: MutableSequence[TKey] | None = None, output: str | None = None) → Path

Create a well defined target file name.

Helper function to create a target file name based on the source file name, a prefix, a scope and an output format.

Parameters:
  • source_file (str | PathLike[str]) – source dict file.

  • prefix (str | None) – Prefix to prepend to the file name. If None, do not add a prefix. Defaults to None.

  • scope (MutableSequence[TKey] | None) – Keys to append to the file name. If None or empty, do not add a scope suffix. Defaults to None.

  • output (str | None) – Output format (cpp, foam, xml, or json). If None, preserve the source file extension; unsupported values use cpp. Defaults to None.

Returns:

target dict file name

Return type:

Path