Skip to content

Commit 111acb7

Browse files
authored
Merge pull request #47 from emptybutton/dev
Pull 0.4.0
2 parents 96f25d5 + 5b8fea9 commit 111acb7

File tree

139 files changed

+6647
-693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+6647
-693
lines changed

deploy/dev/docker-compose.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ services:
3535
TTT_NATS_URL: nats://nats:4222
3636

3737
TTT_GEMINI_URL: https://my-openai-gemini-sigma-sandy.vercel.app
38-
39-
TTT_GAME_WAITING_QUEUE_PULLING_TIMEOUT_MIN_MS: 100
40-
TTT_GAME_WAITING_QUEUE_PULLING_TIMEOUT_SALT_MS: 100
4138
secrets:
4239
- secrets
4340
command: ttt-dev

deploy/prod/docker-compose.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ services:
3535
TTT_NATS_URL: nats://${NATS_TOKEN}@nats:4222
3636

3737
TTT_GEMINI_URL: ${GEMINI_URL}
38-
39-
TTT_GAME_WAITING_QUEUE_PULLING_TIMEOUT_MIN_MS: 100
40-
TTT_GAME_WAITING_QUEUE_PULLING_TIMEOUT_SALT_MS: 200
4138
secrets:
4239
- secrets
4340
networks:

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ttt"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
description = "Tic-Tac-Toe Telegram Bot"
55
authors = [
66
{name = "Alexander Smolin", email = "[email protected]"}
@@ -75,6 +75,9 @@ indent-width = 4
7575
[tool.ruff.lint.isort]
7676
lines-after-imports = 2
7777

78+
[tool.ruff.lint.pylint]
79+
allow-dunder-method-names = ["__entity__"]
80+
7881
[tool.ruff.lint]
7982
select = ["ALL"]
8083
ignore = [

src/ttt/application/common/ports/map.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
class NotUniqueUserIdError(Exception): ...
88

99

10+
class NotUniqueActiveInvitationToGameUserIdsError(Exception): ...
11+
12+
1013
type MappableTracking = Tracking[Atomic]
1114

1215

@@ -19,4 +22,5 @@ async def __call__(
1922
) -> None:
2023
"""
2124
:raises ttt.application.common.ports.map.NotUniqueUserIdError:
22-
"""
25+
:raises ttt.application.common.ports.map.NotUniqueActiveInvitationToGameUserIdsError:
26+
""" # noqa: E501

src/ttt/application/game/game/ports/game_log.py

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
from abc import ABC, abstractmethod
2-
from collections.abc import Sequence
32

43
from ttt.entities.core.game.game import Game
54
from ttt.entities.core.game.move import AiMove, UserMove
65
from ttt.entities.core.user.user import User
76

87

98
class GameLog(ABC):
10-
@abstractmethod
11-
async def waiting_for_game_start(
12-
self,
13-
user_id: int,
14-
/,
15-
) -> None: ...
16-
17-
@abstractmethod
18-
async def double_waiting_for_game_start(
19-
self,
20-
user_id: int,
21-
/,
22-
) -> None: ...
23-
249
@abstractmethod
2510
async def game_against_user_started(
2611
self,
@@ -70,7 +55,9 @@ async def game_completed(
7055
) -> None: ...
7156

7257
@abstractmethod
73-
async def user_already_in_game_to_start_game(self, user: User, /) -> None:
58+
async def user_already_in_game_to_start_game_against_ai(
59+
self, user: User, /,
60+
) -> None:
7461
...
7562

7663
@abstractmethod
@@ -116,17 +103,3 @@ async def already_completed_game_to_cancel(
116103
user_id: int,
117104
/,
118105
) -> None: ...
119-
120-
@abstractmethod
121-
async def users_already_in_game_to_start_game_via_game_starting_queue(
122-
self,
123-
user_ids: Sequence[int],
124-
/,
125-
) -> None: ...
126-
127-
@abstractmethod
128-
async def bad_attempt_to_start_game_via_game_starting_queue(
129-
self,
130-
user_ids: Sequence[int],
131-
/,
132-
) -> None: ...

src/ttt/application/game/game/ports/game_starting_queue.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/ttt/application/game/game/ports/game_views.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77

88
class GameViews(ABC):
9-
@abstractmethod
10-
async def waiting_for_game_view(self, user_id: int, /) -> None: ...
11-
129
@abstractmethod
1310
async def current_game_view_with_user_id(self, user_id: int, /) -> None: ...
1411

@@ -68,8 +65,4 @@ async def already_filled_cell_error(
6865
) -> None: ...
6966

7067
@abstractmethod
71-
async def users_already_in_game_views(
72-
self,
73-
user_ids: Sequence[int],
74-
/,
75-
) -> None: ...
68+
async def user_already_in_game_view(self, user_id: int, /) -> None: ...

src/ttt/application/game/game/start_game.py

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/ttt/application/game/game/start_game_with_ai.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
from ttt.application.common.ports.uuids import UUIDs
99
from ttt.application.game.game.ports.game_ai_gateway import GameAiGateway
1010
from ttt.application.game.game.ports.game_log import GameLog
11-
from ttt.application.game.game.ports.game_starting_queue import (
12-
GameStartingQueue,
13-
)
1411
from ttt.application.game.game.ports.game_views import GameViews
1512
from ttt.application.game.game.ports.games import Games
1613
from ttt.application.user.common.ports.user_views import CommonUserViews
@@ -32,7 +29,6 @@ class StartGameWithAi:
3229
user_views: CommonUserViews
3330
games: Games
3431
game_views: GameViews
35-
game_starting_queue: GameStartingQueue
3632
transaction: Transaction
3733
ai_gateway: GameAiGateway
3834
log: GameLog
@@ -66,8 +62,10 @@ async def __call__(self, user_id: int, ai_type: AiType) -> None:
6662
tracking,
6763
)
6864
except UserAlreadyInGameError:
69-
await self.log.user_already_in_game_to_start_game(user)
70-
await self.game_views.users_already_in_game_views([user_id])
65+
await self.log.user_already_in_game_to_start_game_against_ai(
66+
user,
67+
)
68+
await self.game_views.user_already_in_game_view(user_id)
7169
else:
7270
await self.log.game_against_ai_started(started_game.game)
7371

src/ttt/application/game/game/wait_game.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)