id_translation.Translator.map#

Translator.map(translatable, names=None, *, ignore_names=None, override_function=None, io_kwargs=None)[source]#

Map names to translation sources.

Parameters:
  • translatable – A data structure to map names for.

  • names – Explicit names to translate. Derive from translatable if None.

  • ignore_names – Names not to translate, or a predicate (NameType) -> bool.

  • override_function – A callable (name, sources, ids) -> Source | None. See Mapper.apply for details.

  • io_kwargs – Keyword arguments for the IO class (e.g. PandasIO).

Returns:

A mapping of names to translation sources. Returns None if mapping failed.

Raises:
  • MissingNamesError – If names are not given and cannot be derived from translatable.

  • UnmappedExplicitNamesError – If any required (explicitly given) names fail to map to a source.

  • MappingError – If name-to-source mapping is ambiguous.

  • UserMappingError – If override_function returns a source which is not known, and mapper.on_unknown_user_override != 'ignore'.

See also

🔑 This is a key event method. See Key Event Records for details.

See also

The extract_names() method.