BackendCandidate#
- class scikitplot.corpus.BackendCandidate(name, run, accept=<function _accept_any>, fallback_exceptions=(<class 'Exception'>, ), failure_level=30, miss_level=10, degrades_on_failure=True, capability=None, requires_network=False, may_download=False, offline_capable=False)[source]#
One lazy backend attempt.
- Parameters:
- namestr
Stable backend identifier used in logs and diagnostics.
- runcallable
Zero-argument callable that performs the backend work. Third-party imports should remain inside this callable.
- acceptcallable, optional
Predicate deciding whether a returned value is usable. Returning
Falseis a miss, not a failure, and advances to the next backend. The default accepts every returned value, includingNoneand empty containers.- fallback_exceptionstuple of exception classes, optional
Exceptions that mean “this backend could not serve the request; try the next one”. Exceptions outside this tuple propagate immediately. Defaults to ordinary
Exception, intentionally excludingKeyboardInterruptandSystemExit.- failure_levelint, optional
Logging level for backend exceptions. Default:
logging.WARNING.- miss_levelint, optional
Logging level when
acceptrejects a normal return value. Default:logging.DEBUG.- degrades_on_failurebool, optional
Whether failure of this preferred backend makes a later successful fallback
DEGRADED. SetFalsewhen absence/failure is an expected capability probe and the fallback is semantically equivalent.- capabilitystr or None, optional
Capability-registry key used for readiness preflight and provenance.
- requires_networkbool, optional
Whether normal execution requires network access.
- may_downloadbool, optional
Whether first use may need to download assets. This is a risk/property flag, not proof that a download is needed for the current request.
- offline_capablebool, optional
Whether the candidate can enforce local-only execution when policy forbids downloads/network. Such a candidate may be attempted when asset readiness is
UNKNOWN; its runner must then select a local-only mode rather than silently contacting the network.
- Parameters:
- fallback_exceptions: tuple[type[BaseException], ...] = (<class 'Exception'>,)#