cache_translation

astro_metadata_translator.cache_translation(func: Callable, method: Optional[str] = None) Callable

Decorator to cache the result of a translation method.

Especially useful when a translation uses many other translation methods. Should be used only on to_x() methods.

Parameters:
funcfunction

Translation method to cache.

methodstr, optional

Name of the translation method to cache. Not needed if the decorator is used around a normal method, but necessary when the decorator is being used in a metaclass.

Returns:
wrappedfunction

Method wrapped by the caching function.