From 1f9be2c2367366397a9941f19849ecffee33515c Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Fri, 9 Oct 2020 20:55:27 +0100 Subject: [PATCH] fix after mypy version update --- my/kython/kompress.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/my/kython/kompress.py b/my/kython/kompress.py index df49bcc..4fa2840 100644 --- a/my/kython/kompress.py +++ b/my/kython/kompress.py @@ -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