Detector
detector
Format detection via parse-based heuristics.
Format
detect_format(text)
detect_format_parsed(text)
Detect format and return (format, parsed_data).
parsed_data is non-None only when the format is JSON, giving the
caller the already-parsed object so it can be injected into a
:class:SmeltContext without a redundant json.loads call.
Source code in packages/axm-smelt/src/axm_smelt/core/detector.py
try_json(stripped)
Return Format.JSON if stripped is valid JSON, else None.
Source code in packages/axm-smelt/src/axm_smelt/core/detector.py
try_markdown(stripped)
Return Format.MARKDOWN if stripped has >=2 distinct markdown indicators.
Source code in packages/axm-smelt/src/axm_smelt/core/detector.py
try_xml(stripped)
Return Format.XML if stripped looks like XML, else None.
Source code in packages/axm-smelt/src/axm_smelt/core/detector.py
try_yaml(stripped)
Return Format.YAML if stripped has YAML indicators, else None.
Source code in packages/axm-smelt/src/axm_smelt/core/detector.py
| Python | |
|---|---|