from pathlib import Path


def check_file_exists(func):  # pragma: no cover
    """
    Decorator that throws an error if a function;s first argument
    is not a path to an existing file.
    """

    def inner(*args, **kwargs):
        if not Path(args[0]).exists():
            raise FileNotFoundError(
                f"File {args[0]} not found"
            )  # pragma: no cover
        return func(*args, **kwargs)

    return inner