Thread safety#

Most functions and classes are thread safe. Notable exceptions are documented here.

Not thread safe

Comment

enable_verbose_debug_messages()

This function modifies global state.

AbstractFetcher.fetch_all()

When selective_fetch_all=True (default), a temporary Mapper instance may be used. All built-in fetchers (e.g. the SqlFetcher) inherit from this class.

Fetcher.initialize_sources()

Invoked implicitly before all translation tasks. Results are cached when using a MultiFetcher or AbstractFetcher subtype, after which initialize_sources is thread-safe for these types.

Translator.translated_names()

Reflects the most recent Translator.translate() call on the instance. The translate call itself is thread safe (when copy=True), but the recorded names are not. Use Translator.map() in multi-threaded contexts.

Translator.go_offline()

Performs Fetcher teardown. Once offline, the Translator is safe to share.

Transformers#

The Translator.transformers are reused for all translation tasks. Bundled Transformer types are thread safe. Transformers are inherited by any TranslationMap instances created by the Translator, including the Translator.cache) created by Translator.go_offline().

Fetchers#

Some thread-unsafe Fetcher operations emit a ConcurrentOperationWarning on a best-effort basis when entered from multiple threads at once. This detection is cheap and lock-free, so it may miss races; absence of a warning does not prove correctness.