Load Experiments

class rupsycho.reader.ExperimentLoader(path_pattern=None)[source]

Bases: BaseLoader

A document loader that reads JSON files validated by the ExperimentDocument model.

Parameters:

path_pattern (str | None)

lazy_load(path_pattern=None)[source]

A lazy loader that reads JSON files from the resolved paths and validates them against the ExperimentDocument model.

Parameters:

path_pattern (Optional[str]) – A glob pattern or single file path to load JSON files from.

Yields:

ExperimentDocument – A document object with the validated JSON content.

Raises:

ValueError – If neither constructor nor method arguments provide a valid path pattern.

Return type:

Iterator[ExperimentDocument]

async alazy_load(path_pattern=None)[source]

An async lazy loader that reads JSON files from the resolved paths and validates them against the ExperimentDocument model.

Parameters:

path_pattern (Optional[str]) – A glob pattern or single file path to load JSON files from.

Yields:

ExperimentDocument – A document object with the validated JSON content.

Raises:

ValueError – If neither constructor nor method arguments provide a valid path pattern.

Return type:

AsyncIterator[ExperimentDocument]

lazy_load_from_dicts(dicts)[source]

A lazy loader that reads from a list of dictionaries (JSON objects) and validates them against the ExperimentDocument model.

Parameters:

dicts (List[dict]) – A list of dictionaries representing experiments.

Yields:

ExperimentDocument – A document object with the validated JSON content.

Return type:

Iterator[ExperimentDocument]

async alazy_load_from_dicts(dicts)[source]

An async lazy loader that reads from a list of dictionaries (JSON objects) and validates them against the ExperimentDocument model.

Parameters:

dicts (List[dict]) – A list of dictionaries representing experiments.

Yields:

ExperimentDocument – A document object with the validated JSON content.

Return type:

AsyncIterator[ExperimentDocument]