imap_processing.codice.utils.apply_replacements_to_attrs#

imap_processing.codice.utils.apply_replacements_to_attrs(attrs: dict, replacements: dict) dict#

Return a shallow-copied attrs dict with placeholders replaced.

This helper replaces occurrences of placeholders like ‘{species}’ and ‘{direction}’ in string values using simple str.replace calls. It does not use str.format to avoid errors when templates contain braces for other reasons.

Parameters:
  • attrs (dict) – The attributes dictionary to process (string values may contain placeholders).

  • replacements (dict) – Mapping of placeholder names (without braces) to replacement values.

Returns:

New attributes dict with replacements applied to string values.

Return type:

dict