Skip to content

Commit a5a0523

Browse files
fix: Cast verbosity comparison to Literal type (#84)
Signed-off-by: AlexNg <contact@ngjx.org>
1 parent 9919a22 commit a5a0523

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/thread/utils/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Callable, Literal, Union
1+
from typing import Any, Callable, Literal, Union, cast
22

33
_Verbosity_Num = Literal[0, 1, 2]
44
_Verbosity_Enum = Literal['quiet', 'normal', 'verbose']
@@ -79,6 +79,7 @@ def _compare(
7979
return operator(self.level_number, other)
8080
if isinstance(other, str):
8181
if Verbosity.is_valid_level(other):
82+
other = cast(_Verbosity_Enum, other)
8283
return operator(self.level_number, VerbosityMapping[other])
8384
return operator(self.level_string, other)
8485
raise ValueError('Cannot compare Verbosity with other types')

0 commit comments

Comments
 (0)