summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-01-31 07:28:58 +0100
committerHelmut Grohne <helmut@subdivi.de>2024-01-31 07:28:58 +0100
commitfe2cc26b5080a4ded33db67183bd5ef0c3e991b4 (patch)
treefb5106ee7f47c6760c235dc659ddb22e1205e1d0
parent3e7a79b0b38336da4568de3c7161660301797fd4 (diff)
downloadpython-linuxnamespaces-fe2cc26b5080a4ded33db67183bd5ef0c3e991b4.tar.gz
examples/chroottar.py: improve typing precision
-rwxr-xr-xexamples/chroottar.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/chroottar.py b/examples/chroottar.py
index 523892c..8b374d1 100755
--- a/examples/chroottar.py
+++ b/examples/chroottar.py
@@ -13,6 +13,7 @@ import socket
import sys
import tarfile
import tempfile
+import typing
if __file__.split("/")[-2:-1] == ["examples"]:
sys.path.insert(0, "/".join(__file__.split("/")[:-2]))
@@ -27,7 +28,10 @@ class TarFile(tarfile.TarFile):
@classmethod
def zstopen(
- cls, name: str, mode: str = "r", fileobj: None = None
+ cls,
+ name: str,
+ mode: typing.Literal["r", "w", "x"] = "r",
+ fileobj: None = None,
) -> tarfile.TarFile:
if mode not in ("r", "w", "x"):
raise NotImplementedError(f"mode `{mode}' not implemented for zst")