Skip to content

uri

UnsupportedFileTypeError(suffix)

Bases: Exception

Exception raised when a file type is not supported.

Initialize the UnsupportedFileTypeError.

Parameters:

Name Type Description Default
suffix str

File type suffix.

required
Source code in src/flowcean/environments/uri.py
12
13
14
15
16
17
18
def __init__(self, suffix: str) -> None:
    """Initialize the UnsupportedFileTypeError.

    Args:
        suffix: File type suffix.
    """
    super().__init__(f"file type `{suffix}` is not supported")

UriDataLoader(uri)

Bases: Dataset

DataLoader for files specified by an URI.

Initialize the UriDataLoader.

Parameters:

Name Type Description Default
uri str

Path to the URI file.

required
Source code in src/flowcean/environments/uri.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def __init__(self, uri: str) -> None:
    """Initialize the UriDataLoader.

    Args:
        uri: Path to the URI file.
    """
    path = _file_uri_to_path(uri)
    suffix = path.suffix
    if suffix == ".csv":
        data_loader = CsvDataLoader(path)
    elif suffix == ".parquet":
        data_loader = ParquetDataLoader(path)
    else:
        raise UnsupportedFileTypeError(suffix)
    super().__init__(data_loader.data)

InvalidUriSchemeError(scheme)

Bases: Exception

Exception raised when an URI scheme is invalid.

Initialize the InvalidUriSchemeError.

Parameters:

Name Type Description Default
scheme str

Invalid URI scheme.

required
Source code in src/flowcean/environments/uri.py
44
45
46
47
48
49
50
51
52
def __init__(self, scheme: str) -> None:
    """Initialize the InvalidUriSchemeError.

    Args:
        scheme: Invalid URI scheme.
    """
    super().__init__(
        f"only file URIs can be converted to a path, but got `{scheme}`",
    )