Skip to main content

reasons

The reason values scan_metadata rows carry, and how to read them back.

A row whose metadata columns are NULL records why the header extract produced nothing. The extractor writes those strings and consumers in another package branch on them, so they live here: a consumer matching on a literal would be silently broken by a reworded message.

classify_reason reports an unrecognised string as UNKNOWN rather than folding it into the nearest known kind. The kinds mean different things — one is worth a second attempt through another code path, the other is a file that cannot be read at all — and guessing wrong drops data with no trace. Consumers choose which disposition is safe for them.

Module​

Functions​

classify_reason​

def classify_reason(    reason: str | None,) ‑> ScanReasonKind:

Classify a stored reason value.

Arguments

  • reason: The row's reason, or None when it holds real metadata.

Returns The matching ScanReasonKind.

processing_failed_reason​

def processing_failed_reason(exc: BaseException) ‑> str:

Build the reason recorded for a file the extractor raised on.

Arguments

  • exc: The exception _process_file raised.

Returns The reason string to store on the row.

Classes​

ScanReasonKind​

class ScanReasonKind(*args, **kwds):

What a row's reason says about why it holds no metadata.

Ancestors​

Variables​

  • static EXTRACTED
  • static NO_SERIES
  • static PROCESSING_FAILED
  • static UNKNOWN