Skip to content

Commit 63043f8

Browse files
committed
Added exception to base class
1 parent aaec0fb commit 63043f8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cfdppy/filestore.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def read_data(self, file: Path, offset: int | None, read_len: int) -> bytes:
3838
:param offset: Offset to read from
3939
:param read_len: Number of bytes to read
4040
:return: The read data
41+
:raises PermissionError: In case the file is not readable
42+
:raises FileNotFoundError: In case the file does not exist.
4143
"""
4244

4345
@abc.abstractmethod
@@ -55,7 +57,7 @@ def is_directory(self, path: Path) -> bool:
5557
"""Check if a given path is a directory.
5658
5759
:param path: Path to check
58-
:return: True if the path is
60+
:return: True if the path is a directory
5961
"""
6062

6163
@abc.abstractmethod
@@ -79,6 +81,7 @@ def truncate_file(self, file: Path) -> None:
7981
"""Truncate a file to zero bytes.
8082
8183
:param file: File to truncate
84+
:raises FileNotFoundError: In case the file does not exist
8285
"""
8386

8487
@abc.abstractmethod
@@ -87,16 +90,21 @@ def file_size(self, file: Path) -> int:
8790
8891
:param file: File to get the size of as number of bytes
8992
:return: Size of the file in bytes
93+
:raises FileNotFoundError: In case the file does not exist
9094
"""
9195

9296
@abc.abstractmethod
9397
def write_data(self, file: Path, data: bytes, offset: int | None) -> None:
9498
"""This is not used as part of a filestore request, it is used to build up the received
9599
file.
96100
101+
The file needs to exist before writing to it.
102+
97103
:param file: File to write to
98104
:param data: Data to write
99105
:param offset: Offset to write, may be None for no offset
106+
:raises PermissionError: In case the file is not writable
107+
:raises FileNotFoundError: In case the file does not exist
100108
"""
101109

102110
@abc.abstractmethod

0 commit comments

Comments
 (0)