specless.dataset.PathToFileDataset
- class specless.dataset.PathToFileDataset(filepath: str)[source]
Bases:
BaseDataset
Dataset class that contains a path to a file
A dataset that contains a path to a file, but not the data itself.
This can be useful for algorithms that require only the filename, not the data.
Examples
>>> filepath = 'examples/demo/pdfa.yaml' >>> dataset = PathToFileDataset(filepath)
Methods
Apply a function to each item in the data.
Convert the data to a list.
Attributes
Get the length of the data.
- apply(func: Callable[[...], Any]) None
Apply a function to each item in the data.
- Parameters:
func (Callable[..., Any]) – The function to apply to each item.
- property length: int
Get the length of the data.
- Returns:
The length of the data.
- Return type:
int
- tolist(key: str | None = None)
Convert the data to a list.
- Parameters:
key (Optional[str], default=None) – The key to use to convert the data to a list. If None, all data is converted.
- Returns:
The data converted to a list.
- Return type:
list