Skip to content

Commit 9f64fdb

Browse files
committed
ref: fix inconsistent naming (#24)
1 parent 8f3e2af commit 9f64fdb

File tree

30 files changed

+151
-143
lines changed

30 files changed

+151
-143
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ build-backend = "hatchling.build"
4848
packages = ["src/ttt"]
4949

5050
[project.scripts]
51-
ttt = "ttt.main.aiogram_slim.__main__:main"
51+
ttt = "ttt.main.aiogram_prod.__main__:main"
5252
ttt-dev = "ttt.main.aiogram_dev.__main__:main"
5353

5454
[tool.uv]

src/ttt/application/game/common/ports/waiting_locations.py renamed to src/ttt/application/game/common/ports/game_starting_queue.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77

88
@dataclass(frozen=True)
9-
class WaitingLocationsPush:
9+
class GameStartingQueuePush:
1010
was_location_dedublicated: bool
1111

1212

13-
class WaitingLocations(ABC):
13+
class GameStartingQueue(ABC):
1414
@abstractmethod
1515
async def push(
1616
self,
1717
location: UserLocation,
1818
/,
19-
) -> WaitingLocationsPush: ...
19+
) -> GameStartingQueuePush: ...
2020

2121
@abstractmethod
2222
async def push_many(

src/ttt/application/game/game/make_move_in_game.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async def __call__(
5858

5959
try:
6060
tracking = Tracking()
61-
user_move = game.make_move(
61+
user_move = game.make_user_move(
6262
location.user_id,
6363
cell_number_int,
6464
game_result_id,

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
from ttt.application.common.ports.map import Map
66
from ttt.application.common.ports.transaction import Transaction
77
from ttt.application.common.ports.uuids import UUIDs
8+
from ttt.application.game.common.ports.game_starting_queue import (
9+
GameStartingQueue,
10+
)
811
from ttt.application.game.common.ports.game_views import GameViews
912
from ttt.application.game.common.ports.games import Games
10-
from ttt.application.game.common.ports.waiting_locations import WaitingLocations
1113
from ttt.application.game.game.ports.game_log import GameLog
1214
from ttt.application.user.common.ports.user_views import CommonUserViews
1315
from ttt.application.user.common.ports.users import Users
@@ -25,12 +27,12 @@ class StartGame:
2527
user_views: CommonUserViews
2628
games: Games
2729
game_views: GameViews
28-
waiting_locations: WaitingLocations
30+
game_starting_queue: GameStartingQueue
2931
transaction: Transaction
3032
log: GameLog
3133

3234
async def __call__(self) -> None:
33-
async for user1_location, user2_location in self.waiting_locations:
35+
async for user1_location, user2_location in self.game_starting_queue:
3436
async with self.transaction, self.emojis:
3537
user1, user2 = await self.users.users_with_ids(
3638
(user1_location.user_id, user2_location.user_id),
@@ -63,7 +65,7 @@ async def __call__(self) -> None:
6365
user2_location,
6466
)
6567
if user1 is None or user2 is None:
66-
await self.waiting_locations.push_many(
68+
await self.game_starting_queue.push_many(
6769
tuple(
6870
location
6971
for user, location in users_and_locations
@@ -109,7 +111,7 @@ async def __call__(self) -> None:
109111
)
110112
)
111113

112-
await self.waiting_locations.push_many(
114+
await self.game_starting_queue.push_many(
113115
locations_of_users_not_in_game,
114116
)
115117
await self.game_views.user_already_in_game_views(

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from dataclasses import dataclass
22

33
from ttt.application.common.ports.transaction import Transaction
4+
from ttt.application.game.common.ports.game_starting_queue import (
5+
GameStartingQueue,
6+
)
47
from ttt.application.game.common.ports.game_views import GameViews
5-
from ttt.application.game.common.ports.waiting_locations import WaitingLocations
68
from ttt.application.game.game.ports.game_log import GameLog
79
from ttt.application.user.common.ports.user_views import CommonUserViews
810
from ttt.application.user.common.ports.users import Users
@@ -12,7 +14,7 @@
1214
@dataclass(frozen=True, unsafe_hash=False)
1315
class WaitGame:
1416
users: Users
15-
waiting_locations: WaitingLocations
17+
game_starting_queue: GameStartingQueue
1618
user_views: CommonUserViews
1719
game_views: GameViews
1820
transaction: Transaction
@@ -28,7 +30,7 @@ async def __call__(self, location: UserLocation) -> None:
2830
)
2931
return
3032

31-
push = await self.waiting_locations.push(location)
33+
push = await self.game_starting_queue.push(location)
3234

3335
if push.was_location_dedublicated:
3436
await self.log.double_waiting_for_game_start(location)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
from ttt.application.common.ports.transaction import Transaction
77
from ttt.application.common.ports.uuids import UUIDs
88
from ttt.application.game.common.ports.game_ai_gateway import GameAiGateway
9+
from ttt.application.game.common.ports.game_starting_queue import (
10+
GameStartingQueue,
11+
)
912
from ttt.application.game.common.ports.game_views import GameViews
1013
from ttt.application.game.common.ports.games import Games
11-
from ttt.application.game.common.ports.waiting_locations import WaitingLocations
1214
from ttt.application.game.game.ports.game_log import GameLog
1315
from ttt.application.user.common.ports.user_views import CommonUserViews
1416
from ttt.application.user.common.ports.users import Users
@@ -29,7 +31,7 @@ class StartGameWithAi:
2931
user_views: CommonUserViews
3032
games: Games
3133
game_views: GameViews
32-
waiting_locations: WaitingLocations
34+
game_starting_queue: GameStartingQueue
3335
transaction: Transaction
3436
ai_gateway: GameAiGateway
3537
log: GameLog

src/ttt/application/user/common/dto/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
@dataclass(frozen=True)
99
class PaidStarsPurchasePayment:
10-
purshase_id: UUID
10+
purchase_id: UUID
1111
location: UserLocation
1212
success: PaymentSuccess

src/ttt/application/user/common/ports/stars_purchase_payment_gateway.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class StarsPurchasePaymentGateway(ABC):
1111
@abstractmethod
1212
async def send_invoice(
1313
self,
14-
purshase: StarsPurchase,
14+
purchase: StarsPurchase,
1515
location: UserLocation,
1616
) -> None: ...
1717

src/ttt/application/user/stars_purchase/complete_stars_purshase_payment.py renamed to src/ttt/application/user/stars_purchase/complete_stars_purchase_payment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020

2121
@dataclass(frozen=True, unsafe_hash=False)
22-
class CompleteStarsPurshasePayment:
22+
class CompleteStarsPurchasePayment:
2323
clock: Clock
2424
inbox: PaidStarsPurchasePaymentInbox
2525
users: Users
2626
transaction: Transaction
2727
map_: Map
2828
common_views: CommonUserViews
29-
stars_purshase_views: StarsPurchaseUserViews
29+
stars_purchase_views: StarsPurchaseUserViews
3030
log: StarsPurchaseUserLog
3131

3232
async def __call__(self) -> None:
@@ -47,7 +47,7 @@ async def __call__(self) -> None:
4747
tracking = Tracking()
4848
try:
4949
user.complete_stars_purchase_payment(
50-
paid_payment.purshase_id,
50+
paid_payment.purchase_id,
5151
paid_payment.success,
5252
current_datetime,
5353
tracking,
@@ -58,16 +58,16 @@ async def __call__(self) -> None:
5858
paid_payment,
5959
)
6060
else:
61-
await self.log.stars_purshase_payment_completed(
61+
await self.log.stars_purchase_payment_completed(
6262
user,
6363
paid_payment,
6464
)
6565

6666
await self.map_(tracking)
6767
await (
68-
self.stars_purshase_views.completed_stars_purshase_view(
68+
self.stars_purchase_views.completed_stars_purchase_view(
6969
user,
70-
paid_payment.purshase_id,
70+
paid_payment.purchase_id,
7171
paid_payment.location,
7272
)
7373
)

src/ttt/application/user/stars_purchase/ports/user_log.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ async def user_started_stars_puchase_payment(
3131
) -> None: ...
3232

3333
@abstractmethod
34-
async def stars_purshase_payment_completion_started(
34+
async def stars_purchase_payment_completion_started(
3535
self,
3636
payment: PaidStarsPurchasePayment,
3737
/,
3838
) -> None: ...
3939

4040
@abstractmethod
41-
async def stars_purshase_payment_completed(
41+
async def stars_purchase_payment_completed(
4242
self,
4343
user: User,
4444
payment: PaidStarsPurchasePayment,

0 commit comments

Comments
 (0)