nirs4all.api.dataset_documents module
Bounded dataset-document normalization for library hosts.
This boundary reads configuration documents and directory names, never matrix payloads. ConfigNormalizer remains the owner of aliases, sources, variations and folder conventions. Path authorization remains the caller’s responsibility.
- class nirs4all.api.dataset_documents.DatasetDocumentLimits(max_bytes: int = 2097152, max_depth: int = 64, max_nodes: int = 100000, max_aliases: int = 1024, max_directory_entries: int = 4096)[source]
Bases:
objectFinite admission limits, explicitly adjustable for trusted workloads.
- nirs4all.api.dataset_documents.normalize_dataset_document(document: str | Path | dict[str, Any], *, base_dir: str | Path | None = None, limits: DatasetDocumentLimits | None = None) dict[str, Any][source]
Return a JSON-compatible config with explicit absolute file references.
Supports existing folder, JSON/YAML, aliases, sources and variations syntax. Config bytes/structure and directory enumeration are bounded before parser conversion. Matrix files are not opened. Relative references in files use the document’s directory; dictionary references use
base_diror cwd. This normalizes paths, but does not authorize them or claim an OS sandbox.