CorpusPolicyBundle#

class scikitplot.corpus.CorpusPolicyBundle(name='default', runtime=None, backend=None, download=None, errors=ErrorPolicy.COLLECT)[source]#

Typed composition of the independent Corpus policy dimensions.

Parameters:
namestr, optional

Human-facing label used only in diagnostics/serialization.

runtimeRuntimePolicy, str, mapping or None, optional

Source-execution policy.

backendBackendPolicy, str, mapping or None, optional

Optional-backend orchestration policy.

downloadDownloadPolicy, str, mapping or None, optional

Transport/resource policy.

errorsErrorPolicy or str, optional

Per-document pipeline error behaviour.

Parameters:

Notes

The fields remain independent on purpose. For example, allowing URL source execution does not imply that an ASR backend may download a model, and an offline source policy does not require every pipeline error to raise.

backend: BackendPolicy | str | Mapping[str, Any] | None = None#
builder_config(**kwargs)[source]#

Construct BuilderConfig with this bundle’s download policy.

Other bundle dimensions remain explicit at their own execution seams; this method must not pretend that CorpusBuilder controls reader ASR or RuntimeCorpus URL-source permission.

Parameters:

kwargs (Any)

Return type:

Any

classmethod default()[source]#

Return policies matching the existing Corpus defaults.

Return type:

CorpusPolicyBundle

classmethod docs_ci()[source]#

Return bounded, local-only defaults suitable for docs/CI.

Return type:

CorpusPolicyBundle

download: DownloadPolicy | str | Mapping[str, Any] | None = None#
errors: ErrorPolicy | str = 'collect'[source]#
explain()[source]#

Return the bundle plus derived operational risk/strictness signals.

Return type:

dict[str, Any]

classmethod from_config(config)[source]#

Build from nested configuration with strict unknown-key rejection.

Parameters:

config (Mapping[str, Any])

Return type:

CorpusPolicyBundle

name: str = 'default'#
classmethod networked()[source]#

Permit URL sources while retaining secure transfer defaults.

Return type:

CorpusPolicyBundle

reader_kwargs(**overrides)[source]#

Return reader kwargs carrying this bundle’s backend policy.

This helper is intended for readers that expose backend_policy such as AudioReader and VideoReader. It deliberately does not inject the value into every reader automatically because many formats do not have interchangeable optional backends.

Parameters:

overrides (Any)

Return type:

dict[str, Any]

runtime: RuntimePolicy | str | Mapping[str, Any] | None = None#
classmethod safe_local()[source]#

Return an explicitly local/offline, fail-observable preset.

Return type:

CorpusPolicyBundle

classmethod strict_local()[source]#

Return local-only policies that raise instead of degrading.

Return type:

CorpusPolicyBundle

to_dict()[source]#

Return a JSON/YAML-compatible nested representation.

Return type:

dict[str, Any]

with_overrides(*, name=None, runtime=None, backend=None, download=None, errors=None)[source]#

Return a typed copy with explicitly selected policy dimensions changed.

Parameters:
Return type:

CorpusPolicyBundle