[docs]@staticmethoddefcheck(path:Union[str,Path]):""" Checks that a file has the correct extension and exists. :param path: Path to the file. :return: """path=Path(path)ifpath.suffix!=".wav":raiseNameError(f"Path {path} does not have a .wav extension.")ifnotpath.exists():raiseFileNotFoundError(f"File missing at path {path}")
[docs]@staticmethoddefcheck(path:Union[str,Path],overwrite:bool=False):""" Checks that a file has of the correct extension and verifies that we can overwrite it if it exists. :param path: Path to the file. :return: """path=Path(path)ifpath.suffix!=".wav":raiseNameError(f"Path {path} does not have a .wav extension.")ifpath.exists()andnotoverwrite:raiseFileExistsError(f"File {path} already exists.")