Skip to content

Commit

Permalink
Rename lib/types.py to not shadow Python module
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkZH committed Jan 9, 2025
1 parent 164f75e commit 8f2ba48
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion extra_game_handlers.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion homemade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down
2 changes: 1 addition & 1 deletion lib/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/engine_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/lichess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
4 changes: 2 additions & 2 deletions lib/lichess_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/matchmaking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion lib/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down
2 changes: 1 addition & 1 deletion test_bot/homemade.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test_bot/lichess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test_bot/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test_bot/test_external_moves.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test_bot/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8f2ba48

Please sign in to comment.