Skip to content

src.data.io

get_path(stage, filename)

Constructs path for file in the dataset.

Parameters:

Name Type Description Default
stage str

Stage of data processing

required
filename str

File name within that stage.

required

Raises:

Type Description
FileNotFoundError

If there is not directory named stage.

Returns:

Name Type Description
str str

Dataset path

Source code in reproML/src/data/io.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
@log
def get_path(stage: str, filename: str) -> str:
    """Constructs path for file in the dataset.

    Args:
        stage (str): Stage of data processing
        filename (str): File name within that stage.

    Raises:
        FileNotFoundError: If there is not directory named `stage`.

    Returns:
        str: Dataset path
    """
    directory = path.join("data", stage)
    if not path.exists(directory):
        raise FileNotFoundError(f"'{directory=}' does not exist.")
    return path.join(directory, filename)