neuralib.persistence.cli_persistence.get_options_and_cache
- neuralib.persistence.cli_persistence.get_options_and_cache(opt_cls, ref, error_when_missing=False, **kwargs)[source]
copy the arguments from PersistenceOpt (class that compute the cache) to Apply*Opt Can be used for analysis apply two different cached files
- Example
>>> @persistence.persistence_class >>> class SortIdxCache: ... # for cache attributes declare ... pass
>>> class SortIdxOptions(PersistenceOptions[SortIdxCache]): ... # for cache computing ... def empty_cache(self) -> SortIdxCache: ... pass ... def _compute_cache(self, cache: SortIdxCache) -> SortIdxCache: ... pass
>>> class ApplySortIdxOptions: ... # for cache applying, suppose to be the one layer before parent class for analysis class ... def apply_sort_idx_cache(self) -> SortIdxCache: ... return get_options_and_cache(SortIdxOptions, self)
>>> class CPBeltSortOptions(ApplyPosBinActOptions, ApplySortIdxOptions): ... pass
- Parameters:
opt_cls (type[PersistenceOptions[T]]) – PersistenceOpt
ref
error_when_missing
- Returns:
- Return type:
T