From dde202c733fe9a30932f56b2fcfc2dfafa5d7a63 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 6 May 2024 19:48:14 +0200 Subject: chroottar.py: don't raise NotImplementedError for misuse The mode actually can only have these three distinct literals. While more complex modes can get passed to TarFile.open, they're decomposed there and only of these three is passed to the compressor openers. --- examples/chroottar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/chroottar.py b/examples/chroottar.py index 49d9a7d..b210649 100755 --- a/examples/chroottar.py +++ b/examples/chroottar.py @@ -34,7 +34,7 @@ class TarFile(tarfile.TarFile): fileobj: typing.BinaryIO | None = None, ) -> tarfile.TarFile: if mode not in ("r", "w", "x"): - raise NotImplementedError(f"mode `{mode}' not implemented for zst") + raise ValueError("mode must be 'r', 'w' or 'x'") openobj: str | typing.BinaryIO = name if fileobj is None else fileobj try: import zstandard -- cgit v1.2.3