fix after mypy version update

This commit is contained in:
Dima Gerasimov 2020-10-09 20:55:27 +01:00 committed by karlicoss
parent 35b91a6fa2
commit 1f9be2c236

View file

@ -28,7 +28,11 @@ def kopen(path: PathIsh, *args, mode: str='rt', **kwargs) -> IO[str]:
suf = pp.suffix
if suf in {'.xz'}:
import lzma
return lzma.open(pp, mode, *args, **kwargs)
r = lzma.open(pp, mode, *args, **kwargs)
# should only happen for binary mode?
# file:///usr/share/doc/python3/html/library/lzma.html?highlight=lzma#lzma.open
assert not isinstance(r, lzma.LZMAFile), r
return r
elif suf in {'.zip'}:
# eh. this behaviour is a bit dodgy...
from zipfile import ZipFile