pysatl_tsp.core.data_providers.file_data_provider
Module Contents
Classes
A data provider that reads time series data from a text file. |
Data
API
- class pysatl_tsp.core.data_providers.file_data_provider.FileDataProvider(filename: str, handler: Callable[[str], pysatl_tsp.core.data_providers.file_data_provider.X])[source]
Bases:
pysatl_tsp.core.data_providers.abstract.DataProvider[pysatl_tsp.core.data_providers.file_data_provider.X]A data provider that reads time series data from a text file.
This class implements a file-based data source that reads a file line by line and transforms each line into a data item using a specified handler function. It is useful for processing time series data stored in text files with various formats (CSV, JSON per line, custom formats, etc.).
- Parameters:
filename – Path to the file containing time series data
handler – A function that converts each line of text to a data item
- Raises:
FileNotFoundError – If the specified file does not exist
PermissionError – If the file cannot be read due to permission issues
Initialization
Initialize a file data provider.
- Parameters:
filename – Path to the file containing time series data
handler – A function that converts each line of text to a data item
- __iter__() collections.abc.Iterator[pysatl_tsp.core.data_providers.file_data_provider.X][source]
Create an iterator that reads the file line by line and yields processed data items.
The method opens the specified file, reads it line by line, and applies the handler function to each line to transform it into a data item.
- Returns:
An iterator yielding processed data items from the file
- Raises:
FileNotFoundError – If the specified file does not exist
PermissionError – If the file cannot be read due to permission issues
- pysatl_tsp.core.data_providers.file_data_provider.X = 'TypeVar(...)'