chemigram.core.dtstyle¶
chemigram.core.dtstyle
¶
Parse darktable .dtstyle files.
A .dtstyle is darktable's style export format: XML containing one or more
single-module configurations. Calibrated to darktable 5.4.1 (see
tests/fixtures/README.md and docs/adr/TA.md contracts/dtstyle-schema).
Binary parameters (op_params, blendop_params) are opaque blobs
(ADR-008). They are never decoded — they pass through verbatim as strings.
XML parsing uses defusedxml for safety against malicious or malformed
input. (Adopted as a defensive default; not pinned to an ADR.)
Public API
- :func:
parse_dtstyle— parse a file from disk - :class:
DtstyleEntry, :class:PluginEntry— frozen dataclasses - :class:
DtstyleParseError— raised on malformed input
DtstyleParseError
¶
Bases: Exception
Raised when a .dtstyle file cannot be parsed.
PluginEntry
dataclass
¶
PluginEntry(operation, num, module, op_params, blendop_params, blendop_version, multi_priority, multi_name, enabled)
One <plugin> element from a .dtstyle file.
Calibrated to darktable 5.4.1. Binary blobs (op_params,
blendop_params) are kept as strings and NEVER decoded (ADR-008).
parse_dtstyle
¶
Parse a .dtstyle file from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to a .dtstyle file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
DtstyleEntry
|
class: |
DtstyleEntry
|
are returned as a tuple in document order. |
Raises:
| Type | Description |
|---|---|
DtstyleParseError
|
malformed XML; missing required elements
(e.g., no |
FileNotFoundError
|
|