Files
altium-render-engine/backend/app/documents.py
T
nearology 56c5ee23d3
Verify / test (push) Failing after 2m54s
first commit
2026-11-05 17:31:17 +03:30

16 خطوط
689 B
Python

"""Document parser boundary. Future PCB support adds an adapter, not SchDoc branches."""
from typing import Protocol
from .models.schematic import Document
from .parser.schdoc_parser import parse_schdoc
from .parser.record_decoder import ParseError
class DocumentParser(Protocol):
def __call__(self, data: bytes, filename: str, identifier: str) -> Document: ...
PARSERS: dict[str, DocumentParser] = {'schematic': parse_schdoc}
def parse_document(data: bytes, filename: str, identifier: str, document_type='schematic') -> Document:
parser=PARSERS.get(document_type)
if parser is None: raise ParseError('Unsupported document type')
return parser(data,filename,identifier)