diff --git a/extra_game_handlers.py b/extra_game_handlers.py index 7d3f97bae..f7d51de62 100644 --- a/extra_game_handlers.py +++ b/extra_game_handlers.py @@ -1,6 +1,6 @@ """Functions for the user to implement when the config file is not adequate to express bot requirements.""" from lib import model -from lib.types import OPTIONS_TYPE +from lib.lichess_types import OPTIONS_TYPE def game_specific_options(game: model.Game) -> OPTIONS_TYPE: # noqa: ARG001 diff --git a/homemade.py b/homemade.py index 19633d311..39870eaac 100644 --- a/homemade.py +++ b/homemade.py @@ -7,7 +7,7 @@ from chess.engine import PlayResult, Limit import random from lib.engine_wrapper import MinimalEngine -from lib.types import MOVE, HOMEMADE_ARGS_TYPE +from lib.lichess_types import MOVE, HOMEMADE_ARGS_TYPE import logging diff --git a/lib/config.py b/lib/config.py index dffd8985b..ba0f65894 100644 --- a/lib/config.py +++ b/lib/config.py @@ -6,7 +6,7 @@ import math from abc import ABCMeta from typing import Any, Union, ItemsView, Callable -from lib.types import CONFIG_DICT_TYPE, FilterType +from lib.lichess_types import CONFIG_DICT_TYPE, FilterType logger = logging.getLogger(__name__) diff --git a/lib/conversation.py b/lib/conversation.py index 84351b5ba..2ad21d8f1 100644 --- a/lib/conversation.py +++ b/lib/conversation.py @@ -4,7 +4,7 @@ from lib import model from lib.engine_wrapper import EngineWrapper from lib import lichess -from lib.types import GameEventType +from lib.lichess_types import GameEventType from collections.abc import Sequence from lib.timer import seconds from typing import Union diff --git a/lib/engine_wrapper.py b/lib/engine_wrapper.py index 58b1b008a..948383770 100644 --- a/lib/engine_wrapper.py +++ b/lib/engine_wrapper.py @@ -19,7 +19,7 @@ from lib import model, lichess from lib.config import Configuration, change_value_to_list from lib.timer import Timer, msec, seconds, msec_str, sec_str, to_seconds -from lib.types import (ReadableType, ChessDBMoveType, LichessEGTBMoveType, OPTIONS_GO_EGTB_TYPE, OPTIONS_TYPE, +from lib.lichess_types import (ReadableType, ChessDBMoveType, LichessEGTBMoveType, OPTIONS_GO_EGTB_TYPE, OPTIONS_TYPE, COMMANDS_TYPE, MOVE, InfoStrDict, InfoDictKeys, InfoDictValue, GO_COMMANDS_TYPE, EGTPATH_TYPE, ENGINE_INPUT_ARGS_TYPE, ENGINE_INPUT_KWARGS_TYPE) from extra_game_handlers import game_specific_options diff --git a/lib/lichess.py b/lib/lichess.py index f878b428c..896a4aef1 100644 --- a/lib/lichess.py +++ b/lib/lichess.py @@ -13,7 +13,7 @@ from lib.timer import Timer, seconds, sec_str from typing import Optional, Union, cast import chess.engine -from lib.types import (UserProfileType, REQUESTS_PAYLOAD_TYPE, GameType, PublicDataType, OnlineType, +from lib.lichess_types import (UserProfileType, REQUESTS_PAYLOAD_TYPE, GameType, PublicDataType, OnlineType, ChallengeType, TOKEN_TESTS_TYPE, BackoffDetails) diff --git a/lib/lichess_bot.py b/lib/lichess_bot.py index 1de52ac09..7a24e0ff1 100644 --- a/lib/lichess_bot.py +++ b/lib/lichess_bot.py @@ -28,8 +28,8 @@ from lib.config import load_config, Configuration, log_config from lib.conversation import Conversation, ChatLine from lib.timer import Timer, seconds, msec, hours, to_seconds -from lib.types import (UserProfileType, EventType, GameType, GameEventType, CONTROL_QUEUE_TYPE, CORRESPONDENCE_QUEUE_TYPE, - LOGGING_QUEUE_TYPE, PGN_QUEUE_TYPE) +from lib.lichess_types import (UserProfileType, EventType, GameType, GameEventType, CONTROL_QUEUE_TYPE, + CORRESPONDENCE_QUEUE_TYPE, LOGGING_QUEUE_TYPE, PGN_QUEUE_TYPE) from requests.exceptions import ChunkedEncodingError, ConnectionError, HTTPError, ReadTimeout from rich.logging import RichHandler from collections import defaultdict diff --git a/lib/types.py b/lib/lichess_types.py similarity index 100% rename from lib/types.py rename to lib/lichess_types.py diff --git a/lib/matchmaking.py b/lib/matchmaking.py index a2eea9bec..39fffafe3 100644 --- a/lib/matchmaking.py +++ b/lib/matchmaking.py @@ -11,7 +11,7 @@ from lib import lichess from lib.config import Configuration from typing import Optional, Union -from lib.types import UserProfileType, PerfType, EventType, FilterType +from lib.lichess_types import UserProfileType, PerfType, EventType, FilterType MULTIPROCESSING_LIST_TYPE = Sequence[model.Challenge] DAILY_TIMERS_TYPE = list[Timer] LICHESS_TYPE = Union[lichess.Lichess, test_bot.lichess.Lichess] diff --git a/lib/model.py b/lib/model.py index c4dfc7e82..525294acf 100644 --- a/lib/model.py +++ b/lib/model.py @@ -7,7 +7,7 @@ from lib.timer import Timer, msec, seconds, sec_str, to_msec, to_seconds, years from lib.config import Configuration from collections import defaultdict, Counter -from lib.types import UserProfileType, ChallengeType, GameEventType, PlayerType +from lib.lichess_types import UserProfileType, ChallengeType, GameEventType, PlayerType logger = logging.getLogger(__name__) diff --git a/test_bot/homemade.py b/test_bot/homemade.py index ab96c5bc6..e820712fe 100644 --- a/test_bot/homemade.py +++ b/test_bot/homemade.py @@ -6,7 +6,7 @@ from lib.config import Configuration from lib import model from typing import Optional -from lib.types import OPTIONS_GO_EGTB_TYPE, COMMANDS_TYPE, MOVE +from lib.lichess_types import OPTIONS_GO_EGTB_TYPE, COMMANDS_TYPE, MOVE # ruff: noqa: ARG002 diff --git a/test_bot/lichess.py b/test_bot/lichess.py index 40d1fb504..6f6f0dd4a 100644 --- a/test_bot/lichess.py +++ b/test_bot/lichess.py @@ -9,7 +9,7 @@ from queue import Queue from typing import Union, Optional, Generator from lib.timer import to_msec -from lib.types import (UserProfileType, ChallengeType, REQUESTS_PAYLOAD_TYPE, GameType, OnlineType, PublicDataType, +from lib.lichess_types import (UserProfileType, ChallengeType, REQUESTS_PAYLOAD_TYPE, GameType, OnlineType, PublicDataType, BackoffDetails) # Unused method argument diff --git a/test_bot/test-requirements.txt b/test_bot/test-requirements.txt index 6b4ca0416..8c6eaf386 100644 --- a/test_bot/test-requirements.txt +++ b/test_bot/test-requirements.txt @@ -1,6 +1,6 @@ pytest==8.3.4 pytest-timeout==2.3.1 -ruff==0.8.6 +ruff==0.9.0 mypy==1.14.1 types-requests==2.32.0.20241016 types-PyYAML==6.0.12.20241230 diff --git a/test_bot/test_bot.py b/test_bot/test_bot.py index f67a0e968..cddb0cca4 100644 --- a/test_bot/test_bot.py +++ b/test_bot/test_bot.py @@ -20,7 +20,7 @@ from lib.timer import Timer, to_seconds, seconds from typing import Optional from lib.engine_wrapper import test_suffix -from lib.types import CONFIG_DICT_TYPE +from lib.lichess_types import CONFIG_DICT_TYPE if "pytest" not in sys.modules: sys.exit(f"The script {os.path.basename(__file__)} should only be run by pytest.") from lib import lichess_bot diff --git a/test_bot/test_external_moves.py b/test_bot/test_external_moves.py index a17bd9a58..339d860a1 100644 --- a/test_bot/test_external_moves.py +++ b/test_bot/test_external_moves.py @@ -11,7 +11,7 @@ from copy import deepcopy from requests.exceptions import ConnectionError, HTTPError, ReadTimeout, RequestException from http.client import RemoteDisconnected -from lib.types import OnlineType, GameEventType +from lib.lichess_types import OnlineType, GameEventType from typing import Optional, Union, cast from lib.lichess import is_final, backoff_handler, Lichess from lib.config import Configuration, insert_default_values diff --git a/test_bot/test_model.py b/test_bot/test_model.py index 05482ec82..b4782733e 100644 --- a/test_bot/test_model.py +++ b/test_bot/test_model.py @@ -6,7 +6,7 @@ from lib import config from collections import defaultdict, Counter from lib.timer import Timer -from lib.types import ChallengeType, UserProfileType, GameEventType, PlayerType +from lib.lichess_types import ChallengeType, UserProfileType, GameEventType, PlayerType def test_challenge() -> None: