File

Lightweight file abstractions used by extractors.

This module defines simple wrappers around uploaded or on-disk files and provides helpers to normalize their contents to strings/JSON that the extractors can consume.

class algomancy_data.file.File(name, extension, path=None, content=None)[source]

Bases: ABC

Base file representation with name, extension, and content source.

read_contents_from_path()[source]

Read textual contents of the file from self.path.

class algomancy_data.file.CSVFile(name, path=None, content=None)[source]

Bases: File

CSV file backed by uploader content or a filesystem path.

class algomancy_data.file.JSONFile(name, path=None, content=None)[source]

Bases: File

JSON file backed by uploader content or a filesystem path.

class algomancy_data.file.XLSXFile(name, path=None, content=None)[source]

Bases: File

Excel file that exposes its sheets as a JSON payload.

The content string contains JSON with metadata (sheet names and order) and a sheets mapping where each sheet is a list of records.

read_contents_from_path()[source]

Read and convert the Excel file to the standard JSON payload.