aeat.adapters.inbound.financial.providers._detection module

Provider registry and file-format auto-detection.

Exposes detect_provider, the entry point the financial-ingest application layer calls to pick a concrete FinancialProvider for an arbitrary path. The detection strategy combines extension hinting with magic-byte sniffing so a misnamed file (a PDF saved as .csv, an XLSX inside a .txt, etc.) still routes to the right parser.

provider_for_extension(path)[source]

Return a FinancialProvider keyed strictly off path’s suffix.

Cheap fallback used by CLI command surfaces when content-aware detection (detect_provider()) returns None but the path’s suffix is unambiguous. Unlike detect_provider() this does not open the file or sniff its bytes.

Returns None for every extension the project does not recognise (PDF among them — PdfN26Provider requires content-aware detection because the bare .pdf suffix carries no statement flavour information).

Return type:

FinancialProvider | None

Parameters:

path (Path)

detect_provider(path)[source]

Return the first provider that validates the source successfully.

Walks an extension- and content-prioritised candidate list and returns the first provider whose validate_source result is an is_valid ProviderValidation.

Parameters:

path (Path) – Source document to classify.

Return type:

FinancialProvider | None

Returns:

The matching FinancialProvider, or None when no provider can interpret path.