Functional Weave
Code in Rust

todo.import-csv@1.1.0

impl/python/import_csv.py

407 bytes · the Python implementation · view raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

from typing import List

from .todo_import_csv_validate_todo_csv import read_todo_csv  ← validateTodoCsv, another function of this group · built into the same file, even by a slim install
from .todo_item import Todo  ← from todo.item ^1.0.0 · built alongside by fune


def import_csv(csv: str) -> List[Todo]:
    """Todos from CSV: 13 columns in any order, CRLF or LF, optional BOM; errors name the row (header = row 1)."""
    reading = read_todo_csv(csv)
    if reading.problems:
        raise ValueError(reading.problems[0].thrown)
    return reading.todos