Parser
omniread.csv.parser
Summary
CSV parser implementations for OmniRead.
This module provides a concrete, generic parser for comma-separated-value
documents. It exposes records as lists of string cells so downstream
consumers can interpret tabular content without depending on the csv
module directly.
The parser is intentionally statement-agnostic: it performs no header detection or column interpretation beyond basic cell normalization and delimiter detection.
Classes
CsvParser
Bases: CsvParserBase[list[list[str]]]
Generic csv parser producing string rows from the document.
Notes
Responsibilities:
1 2 3 4 5 | |
Constraints:
1 2 3 4 | |
Initialize the parser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content |
Content
|
CSV content to parse; its type must be supported. |
required |
Attributes
supported_types
class-attribute
instance-attribute
Set of content types supported by this parser (CSV only).
Functions
parse
Parse the document into normalized string rows.
Returns:
| Type | Description |
|---|---|
list[list[str]]
|
List[List[str]]: Rows of the document. |
rows
Extract normalized string rows from the document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip_empty |
bool
|
When True (default), rows whose cells are all blank are omitted. |
True
|
Returns:
| Type | Description |
|---|---|
list[list[str]]
|
List[List[str]]: Normalized rows; trailing blank cells are trimmed per row. |
supports
Check whether this parser supports the content's type.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the content type is supported; False otherwise. |