From df18505e8fd8a75172067a218d89fda7bec985d1 Mon Sep 17 00:00:00 2001 From: LightArrowsEXE Date: Mon, 16 Sep 2024 12:31:49 +0200 Subject: [PATCH] Rename new exception --- stgpytools/exceptions/file.py | 5 +++-- stgpytools/types/file.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/stgpytools/exceptions/file.py b/stgpytools/exceptions/file.py index 7be62f4..9c71b82 100644 --- a/stgpytools/exceptions/file.py +++ b/stgpytools/exceptions/file.py @@ -9,7 +9,8 @@ 'FilePermissionError', 'FileTypeMismatchError', 'FileIsADirectoryError', - 'NotADirectoryError', + + 'PathIsNotADirectoryError', ] @@ -33,5 +34,5 @@ class FileIsADirectoryError(CustomError, IsADirectoryError): """Raised when you try to access a file but it's a directory instead""" -class NotADirectoryError(CustomError, NotADirectoryError): +class PathIsNotADirectoryError(CustomError, NotADirectoryError): """Raised when you try to access a directory but it's not a directory""" diff --git a/stgpytools/types/file.py b/stgpytools/types/file.py index bc530a2..57381f0 100644 --- a/stgpytools/types/file.py +++ b/stgpytools/types/file.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, Iterable, Literal, TypeAlias, Union -from ..exceptions import NotADirectoryError +from ..exceptions import PathIsNotADirectoryError __all__ = [ 'FilePathType', 'FileDescriptor', @@ -182,7 +182,7 @@ def copy_dir(self, dst: SPath) -> SPath: """Copy the directory to the specified destination.""" if not self.is_dir(): - raise NotADirectoryError('The given path, \"{self}\" is not a directory!', self.copy_dir) + raise PathIsNotADirectoryError('The given path, \"{self}\" is not a directory!', self.copy_dir) dst.mkdirp() shutil.copytree(self, dst, dirs_exist_ok=True)