id_translation.Translator.go_offline#

Translator.go_offline(translatable=None, names=None, *, ignore_names=None, override_function=None, max_fails=1.0, fmt=None, io_kwargs=None, path=None)[source]#

Retrieve and cache translations in memory.

Warning

The fetcher will be destroyed.

Subsequent calls to this method will return immediately.

Parameters:
  • translatable – Data from which IDs to fetch will be extracted. Fetch all IDs if None.

  • 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.

  • max_fails – The maximum fraction of IDs for which translation may fail. 1=disabled.

  • fmt – A format string such as ‘{id}:{name}’ use. Default is Translator.fmt.

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

  • path – If given, serialize the Translator to disk after retrieving data.

Returns:

Self, for chained assignment.

Raises:

Notes

🧵 This method is not thread safe. See Thread safety for details.

The Translator is guaranteed to be serializable() once offline. Fetchers often aren’t as they require things like database connections to function.

See also

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

The restore() method (when path is set).