id_translation.transform.types#
Classes used for ID and translation transformation.
Module Attributes
A dict |
Classes
|
Transformation API type. |
- class Transformer(*args, **kwargs)[source]#
-
Transformation API type.
Warning
The
update_ids()-method is not called when theTranslatoris working offline.Transformers are persistent entities owned by a single
Translatorinstance. See theBitmaskTransformerfor a concrete example.- try_add_missing_key(key, /, *, translations)[source]#
Attempt to create and add a translation for an unknown ID.
Callback function used by
MagicDictwhenever an unknown ID is requested.- Parameters:
key – An ID which is not present in the translations.
translations – A mutable mapping of translations. Typically, the
MagicDictcaller itself.
- Transformers#
A dict
{source: transformer}of initializedTransformerinstances.alias of
dict[SourceType,Transformer[IdType]]