io_utils

Utilites for reading and writing files and other I/O operations

merge_utils.io_utils.find_fcl(name: str) str[source]

Find the full path to a FCL file

Parameters:

name – Name of the FCL file

Returns:

Full path to the FCL file

Raises:

FileNotFoundError – If the file does not exist

merge_utils.io_utils.get_inputs(filelists: list[str] | None = None) list[str][source]

Get a list of inputs from the the file lists and standard input

Parameters:

filelists – full paths to files containing lists of entries

Returns:

combined list of entries

merge_utils.io_utils.get_timestamp() str[source]

Get the current timestamp as a string

merge_utils.io_utils.log_dict(msg: str, items: dict, level=30) int[source]

Log a message for a dictionary of items with counts

merge_utils.io_utils.log_list(msg: str, items: Iterable, level=30) int[source]

Log a message for a list of items

merge_utils.io_utils.log_nonzero(msg: str, value: int, level=10) int[source]

Log a message if the value is non-zero

merge_utils.io_utils.log_print(msg: str, level=20) None[source]

Print a message and save it to the log file

merge_utils.io_utils.pkg_dir() str[source]

Get the base directory of the package

merge_utils.io_utils.read_config_file(file_path: str | None = None) dict[source]

Read a configuration file in JSON, TOML, or YAML format

Parameters:

file_path – Path to the configuration file

Returns:

Dictionary containing the configuration settings

Raises:
  • FileNotFoundError – If the file does not exist

  • ValueError – If the file type is not supported

merge_utils.io_utils.set_log_level(level: int) None[source]

Override the logging level for the console

merge_utils.io_utils.setup_log(name: str, log_file: str | None = None, verbosity: int = 0) None[source]

Configure logging

merge_utils.io_utils.src_dir() str[source]

Get the source directory of the package