Skip to content

loqs.backends.model.basemodel

Classes

Functions

first_successful_rep

first_successful_rep(cache, cache_key, candidates, make_source, build_fn, kind='rep')

Return the rep for the first candidate type that is cached or builds.

When cache isn't None it is checked first, returning the entry stored under (cache_key, c) for the first candidate c that has one. On a miss make_source() runs once, then build_fn(source, c) is tried for each candidate in order, and the first success is stored (unless cache is None). A RepConstructionError from build_fn moves on to the next candidate; if every candidate fails a combined one is raised.