Skip to content

Commit

Permalink
Fix mypy errors after upgrading to version 1.12 (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
AttackingOrDefending authored Oct 15, 2024
1 parent 1f70545 commit a507881
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def has_valid_list(name: str) -> bool:
for db_name, valid_selections in selection_choices.items():
is_online = db_name != "polyglot"
db_section = (CONFIG["engine"].get("online_moves") or {}) if is_online else CONFIG["engine"]
db_config = db_section.get(db_name)
db_config = db_section.get(db_name) or {}
select_key = "selection" if db_name == "polyglot" else "move_quality"
selection = db_config.get(select_key)
select = f"{'online_moves:' if is_online else ''}{db_name}:{select_key}"
Expand Down
4 changes: 2 additions & 2 deletions lib/lichess_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from http.client import RemoteDisconnected
from queue import Empty
from multiprocessing.pool import Pool
from typing import Optional, Union, TypedDict
from typing import Optional, Union, TypedDict, cast
from types import FrameType
MULTIPROCESSING_LIST_TYPE = MutableSequence[model.Challenge]
LICHESS_TYPE = Union[lichess.Lichess, test_bot.lichess.Lichess]
Expand Down Expand Up @@ -837,7 +837,7 @@ def print_move_number(board: chess.Board) -> None:
def next_update(lines: Iterator[bytes]) -> GameEventType:
"""Get the next game state."""
binary_chunk = next(lines)
upd: GameEventType = json.loads(binary_chunk.decode("utf-8")) if binary_chunk else {}
upd = cast(GameEventType, json.loads(binary_chunk.decode("utf-8"))) if binary_chunk else {}
if upd:
logger.debug(f"Game state: {upd}")
return upd
Expand Down

0 comments on commit a507881

Please sign in to comment.