File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 11from itertools import chain
2+ from os import PathLike , fspath
23from tarfile import open as tarfile_open
4+ from typing import Union
35
46from xtarfile .zstd import ZstandardTarfile
57from xtarfile .lz4 import Lz4Tarfile
2022SUPPORTED_FORMATS = frozenset (chain (_HANDLERS .keys (), _NATIVE_FORMATS ))
2123
2224
23- def get_compression (path : str , mode : str ) -> str :
25+ def get_compression (path : Union [str , PathLike ], mode : str ) -> str :
26+ path = fspath (path )
2427 for delim in (':' , '|' ):
2528 delim_index = mode .rfind (delim )
2629 if delim_index > - 1 :
@@ -33,7 +36,7 @@ def get_compression(path: str, mode: str) -> str:
3336 return ''
3437
3538
36- def xtarfile_open (path : str , mode : str , ** kwargs ):
39+ def xtarfile_open (path : Union [ str , PathLike ] , mode : str , ** kwargs ):
3740 compression = get_compression (path , mode )
3841
3942 if not compression or compression in _NATIVE_FORMATS :
You can’t perform that action at this time.
0 commit comments