Skip to content

Commit

Permalink
Mypy: add workaround for wrong type in ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
karlch committed May 10, 2024
1 parent 6239180 commit 0194ec3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vimiv/utils/imageheader.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

import functools

from typing import Optional, List, Callable, Tuple, BinaryIO
from typing import Optional, List, Callable, Tuple, BinaryIO, cast

from vimiv.qt.gui import QImageReader

Expand Down Expand Up @@ -127,7 +127,8 @@ def check_verified(header: bytes, file: BinaryIO) -> bool:
_registry.remove((filetype, check_verified))
return False

check_register = check_verified if validate else check
# See: https://github.com/python/mypy/issues/12056
check_register = cast(CheckFuncT, check_verified if validate else check)

if priority:
_registry.insert(0, (filetype, check_register))
Expand Down

0 comments on commit 0194ec3

Please sign in to comment.