lacing.adapters#
I/O adapter registry.
The core never imports a format module. Each adapter registers itself by
calling register_adapter() at import time. Users opt in by importing
the adapter module:
from lacing.adapters import textgrid # noqa: F401 — registers itself
Or by using the convenience top-level loaders that look up by extension or
media_type.
Functions
|
Convenience: serialize |
|
Find an adapter by extension (case-insensitive) or media type. |
|
Look up an adapter by name. |
|
Convenience: dispatch |
|
Register an adapter. |
All currently registered adapters (in registration order). |
Classes
|
Registered adapter for one format. |
- class lacing.adapters.AdapterSpec(name, extensions, media_types, load, dump, body_schema_uris=<factory>, description='')[source]#
Bases:
objectRegistered adapter for one format.
- lacing.adapters.dump(store, target=None, *, format, **kwargs)[source]#
Convenience: serialize
storevia the named adapter.
- lacing.adapters.find_adapter(*, extension=None, media_type=None)[source]#
Find an adapter by extension (case-insensitive) or media type.
- Return type:
- lacing.adapters.get_adapter(name)[source]#
Look up an adapter by name. Raises
KeyErrorif missing.- Return type:
- lacing.adapters.load(source, *, format=None, **kwargs)[source]#
Convenience: dispatch
sourceto the right adapter.If
formatis given, looks up by name. Otherwise, ifsourceis a path, infers from extension. RaisesValueErrorif it can’t pick.- Return type:
- lacing.adapters.register_adapter(*, name, load, dump, extensions=(), media_types=(), body_schema_uris=(), description='')[source]#
Register an adapter. Idempotent: re-registering the same name replaces.
- Return type:
- lacing.adapters.registered()[source]#
All currently registered adapters (in registration order).
- Return type:
Modules
|
|
ELAN EAF adapter (Max Planck Institute's annotation tool format). |
|
JAMS (JSON Annotated Music Specification) adapter. |
|
Label Studio JSON adapter. |
|
OpenTimelineIO (OTIO) adapter — NLE / video editing interchange. |
|
Praat TextGrid adapter. |
|
W3C Web Annotation Data Model adapter (JSON-LD). |
|
WebVTT (W3C TimedText) adapter. |