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(file_path: str, args: list[str]) list[str][source]

Get a list of inputs from various sources, including 1. A file containing a list of entries 2. entries passed as command line arguments 3. entries piped in from standard input

Parameters:
  • file_path – full path to a file containing a list of entries

  • args – Arguments from command line

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.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) None[source]

Configure logging

merge_utils.io_utils.src_dir() str[source]

Get the source directory of the package