From 0fcafa2eddd34f15f34ad0a40f662cf3d5bcef0e Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 13 Nov 2023 15:03:42 +0100 Subject: Raise a ValueError for invalid FLAC files to please mypy --- libmat2/audio.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libmat2/audio.py') diff --git a/libmat2/audio.py b/libmat2/audio.py index 4e447c5..2029d9c 100644 --- a/libmat2/audio.py +++ b/libmat2/audio.py @@ -82,6 +82,8 @@ class FLACParser(MutagenParser): with open(fname, 'wb') as f: f.write(picture.data) p, _ = parser_factory.get_parser(fname) # type: ignore + if p is None: + raise ValueError p.sandbox = self.sandbox # Mypy chokes on ternaries :/ meta[name] = p.get_meta() if p else 'harmful data' # type: ignore -- cgit v1.3