### Development Commands with UV Source: https://github.com/enzoagosta/hypomnema/blob/main/README.md Commands for running tests, linting, and type checking using the uv tool. Ensure uv is installed and configured for the project. ```bash uv run pytest # run tests uv run ruff check src/ tests/ # lint uv run mypy --strict src/ # type check ``` -------------------------------- ### Hypomnema Architecture Overview Source: https://github.com/enzoagosta/hypomnema/blob/main/README.md This diagram illustrates the layered architecture of Hypomnema, showing the separation between operations, the domain model (IR), loaders/dumpers, and backends. It highlights how different components interact and the flow of data. ```text ┌─────────────────────────────────────────────────────┐ │ OPERATIONS │ │ (ops/ — walk, text, transform, normalize) │ │ Pure functions on domain nodes. No I/O. │ └──────────────────────┬──────────────────────────────┘ │ domain nodes only (no backend, no XML) │ ┌──────────────────────┴──────────────────────────────┐ │ DOMAIN │ │ (domain/ — nodes, attributes, value types) │ │ Immutable dataclasses. The IR. │ └──────────────────────┬──────────────────────────────┘ │ domain nodes in, domain nodes out │ ┌──────────────────────┴──────────────────────────────┐ │ LOADERS ←→ DUMPERS │ │ (format-specific entry points) │ │ │ │ XML ── XmlLoader → domain → XmlDumper ── XML │ │ JSON ─ JsonLoader → domain → JsonDumper ── JSON │ │ CSV ─ CsvLoader → domain → CsvDumper ── CSV │ └──────────────────────┬──────────────────────────────┘ │ backend elements (et.Element, lxml._Element, dict, …) │ ┌──────────────────────┴──────────────────────────────┐ │ BACKENDS │ │ (backends/xml/ — standard, lxml, namespace) │ │ XmlBackendLike[E] protocol, XmlBackend[E] ABC │ └─────────────────────────────────────────────────────┘ ``` -------------------------------- ### Namespace Resolution and Formatting Functions Source: https://github.com/enzoagosta/hypomnema/blob/main/README.md These pure functions handle namespace resolution and formatting. They operate on dictionaries and return results without mutating state, except for `register_namespace` which modifies a dictionary in-place. ```text resolve("ns:item", global_nsmap={...}, nsmap={...}) → ResolveResult format_notation(result, "local", global_nsmap={...}) → str register_namespace(nsmap, "ns", "http://...") # mutates dict in-place ``` -------------------------------- ### Iterating and Matching Segment Items Source: https://github.com/enzoagosta/hypomnema/blob/main/README.md Iterate through segment items and use pattern matching to handle different node types like strings, Bpt elements, and UnknownInlineNode. This is useful for processing and transforming segment content while preserving markup structure. ```python for item in variant.segment: match item: case str(): ... case Bpt(spec_attributes=a): print(a.internal_id) case UnknownInlineNode(payload=bytes): # preserved for round-trip, never touched ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.