Skip to content

Commit f9d9445

Browse files
authored
upath.implementations.tar: fix error handling for write methods (#519)
1 parent 22e598a commit f9d9445

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

upath/implementations/tar.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import TYPE_CHECKING
77

88
from upath._stat import UPathStatResult
9+
from upath.core import UnsupportedOperation
910
from upath.core import UPath
1011
from upath.types import JoinablePathLike
1112
from upath.types import StatResultType
@@ -41,6 +42,32 @@ def __init__(
4142
**storage_options: Unpack[TarStorageOptions],
4243
) -> None: ...
4344

45+
def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None:
46+
raise UnsupportedOperation
47+
48+
def mkdir(
49+
self,
50+
mode: int = 0o777,
51+
parents: bool = False,
52+
exist_ok: bool = False,
53+
) -> None:
54+
raise UnsupportedOperation
55+
56+
def unlink(self, missing_ok: bool = False) -> None:
57+
raise UnsupportedOperation
58+
59+
def write_bytes(self, data: bytes) -> int:
60+
raise UnsupportedOperation("DataPath does not support writing")
61+
62+
def write_text(
63+
self,
64+
data: str,
65+
encoding: str | None = None,
66+
errors: str | None = None,
67+
newline: str | None = None,
68+
) -> int:
69+
raise UnsupportedOperation("DataPath does not support writing")
70+
4471
def stat(
4572
self,
4673
*,

0 commit comments

Comments
 (0)