diff options
author | Helmut Grohne <helmut@subdivi.de> | 2024-01-31 07:28:58 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2024-01-31 07:28:58 +0100 |
commit | fe2cc26b5080a4ded33db67183bd5ef0c3e991b4 (patch) | |
tree | fb5106ee7f47c6760c235dc659ddb22e1205e1d0 | |
parent | 3e7a79b0b38336da4568de3c7161660301797fd4 (diff) | |
download | python-linuxnamespaces-fe2cc26b5080a4ded33db67183bd5ef0c3e991b4.tar.gz |
examples/chroottar.py: improve typing precision
-rwxr-xr-x | examples/chroottar.py | 6 |
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") |