module documentation

Undocumented

Function find_filepath_group_id Find the group ID assigned to an original file path.
Function find_filepath_uuid Find the UUID assigned to an original file path.
Function get_dir Undocumented
Function get_file Undocumented
@overload
def find_filepath_group_id(filepath: PathType, index: pl.DataFrame | None, *, raise_on_missing: Literal[False] = ...) -> str | None:
@overload
def find_filepath_group_id(filepath: PathType, index: pl.DataFrame | None, *, raise_on_missing: Literal[True] = ...) -> str:

Find the group ID assigned to an original file path.

Examples

>>> import polars as pl
>>> path = Path("image.jpg").absolute().resolve()
>>> index = pl.DataFrame({
...     "original_filepath": [str(path)],
...     "group_id": ["group-1"],
... })
>>> find_filepath_group_id(path, index)
'group-1'
>>> find_filepath_group_id(None, None) is None
True
Parameters
filepath:PathTypeOriginal file path to look up.
index:pl.DataFrame | NoneOptional dataframe containing original_filepath and group_id columns.
raise_on_missing:boolWhether to raise when the path is not in the index.
Returns
str | NoneMatching group ID, or None when index is None or the path is missing and raise_on_missing is False.
Raises
ValueErrorIf raise_on_missing is True and the path is not in the index.
@overload
def find_filepath_uuid(filepath: PathType, index: pl.DataFrame | None, *, raise_on_missing: Literal[False] = ...) -> str | None:
@overload
def find_filepath_uuid(filepath: PathType, index: pl.DataFrame | None, *, raise_on_missing: Literal[True] = ...) -> str:

Find the UUID assigned to an original file path.

Examples

>>> import polars as pl
>>> path = Path("image.jpg").absolute().resolve()
>>> index = pl.DataFrame({
...     "original_filepath": [str(path)],
...     "uuid": ["abc"],
... })
>>> find_filepath_uuid(path, index)
'abc'
>>> find_filepath_uuid("missing.jpg", index, raise_on_missing=True)
Traceback (most recent call last):
...
ValueError: File ...missing.jpg not found in index
Parameters
filepath:PathTypeOriginal file path to look up.
index:pl.DataFrame | NoneOptional dataframe containing original_filepath and uuid columns.
raise_on_missing:boolWhether to raise when the path is not in the index.
Returns
str | NoneMatching UUID, or None when index is None or the path is missing and raise_on_missing is False.
Raises
ValueErrorIf raise_on_missing is True and the path is not in the index.
@overload
def get_dir(fs: LuxonisFileSystem, remote_path: PosixPathType, local_dir: PathType, mlflow_instance: ModuleType | None = ..., *, default: None = None) -> Path | None:
@overload
def get_dir(fs: LuxonisFileSystem, remote_path: PosixPathType, local_dir: PathType, mlflow_instance: ModuleType | None = ..., *, default: Path = ...) -> Path:

Undocumented

@overload
def get_file(fs: LuxonisFileSystem, remote_path: PosixPathType, local_path: PathType, mlflow_instance: ModuleType | None = ..., default: None = ...) -> Path | None:
@overload
def get_file(fs: LuxonisFileSystem, remote_path: PosixPathType, local_path: PathType, mlflow_instance: ModuleType | None = ..., default: PathType = ...) -> Path:

Undocumented