Skip to content

Commit d5ad330

Browse files
committed
ruff: Fix N802 Function name should be lowercase.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 2c4e706 commit d5ad330

File tree

5 files changed

+48
-48
lines changed

5 files changed

+48
-48
lines changed

zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_game_message_handler_responses(self) -> None:
127127
]
128128

129129
def test_connect_four_logic(self) -> None:
130-
def confirmAvailableMoves(
130+
def confirm_available_moves(
131131
good_moves: List[int], bad_moves: List[int], board: List[List[int]]
132132
) -> None:
133133
connectFourModel.update_board(board)
@@ -138,7 +138,7 @@ def confirmAvailableMoves(
138138
for move in bad_moves:
139139
self.assertFalse(connectFourModel.validate_move(move))
140140

141-
def confirmMove(
141+
def confirm_move(
142142
column_number: int,
143143
token_number: int,
144144
initial_board: List[List[int]],
@@ -149,18 +149,18 @@ def confirmMove(
149149

150150
self.assertEqual(test_board, final_board)
151151

152-
def confirmGameOver(board: List[List[int]], result: str) -> None:
152+
def confirm_game_over(board: List[List[int]], result: str) -> None:
153153
connectFourModel.update_board(board)
154154
game_over = connectFourModel.determine_game_over(["first_player", "second_player"])
155155

156156
self.assertEqual(game_over, result)
157157

158-
def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
158+
def confirm_win_states(array: List[List[List[List[int]]]]) -> None:
159159
for board in array[0]:
160-
confirmGameOver(board, "first_player")
160+
confirm_game_over(board, "first_player")
161161

162162
for board in array[1]:
163-
confirmGameOver(board, "second_player")
163+
confirm_game_over(board, "second_player")
164164

165165
connectFourModel = ConnectFourModel()
166166

@@ -428,9 +428,9 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
428428
]
429429

430430
# Test Move Validation Logic
431-
confirmAvailableMoves([0, 1, 2, 3, 4, 5, 6], [-1, 7], blank_board)
432-
confirmAvailableMoves([3], [0, 1, 2, 4, 5, 6], single_column_board)
433-
confirmAvailableMoves([0, 1, 2, 3, 4, 5], [6], diagonal_board)
431+
confirm_available_moves([0, 1, 2, 3, 4, 5, 6], [-1, 7], blank_board)
432+
confirm_available_moves([3], [0, 1, 2, 4, 5, 6], single_column_board)
433+
confirm_available_moves([0, 1, 2, 3, 4, 5], [6], diagonal_board)
434434

435435
# Test Available Move Logic
436436
connectFourModel.update_board(blank_board)
@@ -443,7 +443,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
443443
self.assertEqual(connectFourModel.available_moves(), [])
444444

445445
# Test Move Logic
446-
confirmMove(
446+
confirm_move(
447447
1,
448448
0,
449449
blank_board,
@@ -457,7 +457,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
457457
],
458458
)
459459

460-
confirmMove(
460+
confirm_move(
461461
1,
462462
1,
463463
blank_board,
@@ -471,7 +471,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
471471
],
472472
)
473473

474-
confirmMove(
474+
confirm_move(
475475
1,
476476
0,
477477
diagonal_board,
@@ -485,7 +485,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
485485
],
486486
)
487487

488-
confirmMove(
488+
confirm_move(
489489
2,
490490
0,
491491
diagonal_board,
@@ -499,7 +499,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
499499
],
500500
)
501501

502-
confirmMove(
502+
confirm_move(
503503
3,
504504
0,
505505
diagonal_board,
@@ -513,7 +513,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
513513
],
514514
)
515515

516-
confirmMove(
516+
confirm_move(
517517
4,
518518
0,
519519
diagonal_board,
@@ -527,7 +527,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
527527
],
528528
)
529529

530-
confirmMove(
530+
confirm_move(
531531
5,
532532
0,
533533
diagonal_board,
@@ -541,7 +541,7 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
541541
],
542542
)
543543

544-
confirmMove(
544+
confirm_move(
545545
6,
546546
0,
547547
diagonal_board,
@@ -556,14 +556,14 @@ def confirmWinStates(array: List[List[List[List[int]]]]) -> None:
556556
)
557557

558558
# Test Game Over Logic:
559-
confirmGameOver(blank_board, "")
560-
confirmGameOver(full_board, "draw")
559+
confirm_game_over(blank_board, "")
560+
confirm_game_over(full_board, "draw")
561561

562562
# Test Win States:
563-
confirmWinStates(horizontal_win_boards)
564-
confirmWinStates(vertical_win_boards)
565-
confirmWinStates(major_diagonal_win_boards)
566-
confirmWinStates(minor_diagonal_win_boards)
563+
confirm_win_states(horizontal_win_boards)
564+
confirm_win_states(vertical_win_boards)
565+
confirm_win_states(major_diagonal_win_boards)
566+
confirm_win_states(minor_diagonal_win_boards)
567567

568568
def test_more_logic(self) -> None:
569569
model = ConnectFourModel()

zulip_bots/zulip_bots/bots/game_of_fifteen/test_game_of_fifteen.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_game_message_handler_responses(self) -> None:
6969
winning_board = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
7070

7171
def test_game_of_fifteen_logic(self) -> None:
72-
def confirmAvailableMoves(
72+
def confirm_available_moves(
7373
good_moves: List[int], bad_moves: List[int], board: List[List[int]]
7474
) -> None:
7575
gameOfFifteenModel.update_board(board)
@@ -79,7 +79,7 @@ def confirmAvailableMoves(
7979
for move in bad_moves:
8080
self.assertFalse(gameOfFifteenModel.validate_move(move))
8181

82-
def confirmMove(
82+
def confirm_move(
8383
tile: str,
8484
token_number: int,
8585
initial_board: List[List[int]],
@@ -90,7 +90,7 @@ def confirmMove(
9090

9191
self.assertEqual(test_board, final_board)
9292

93-
def confirmGameOver(board: List[List[int]], result: str) -> None:
93+
def confirm_game_over(board: List[List[int]], result: str) -> None:
9494
gameOfFifteenModel.update_board(board)
9595
game_over = gameOfFifteenModel.determine_game_over(["first_player"])
9696

@@ -111,20 +111,20 @@ def confirm_coordinates(board: List[List[int]], result: Dict[int, Tuple[int, int
111111
winning_board = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
112112

113113
# Test Move Validation Logic
114-
confirmAvailableMoves([1, 2, 3, 4, 5, 6, 7, 8], [0, 9, -1], initial_board)
114+
confirm_available_moves([1, 2, 3, 4, 5, 6, 7, 8], [0, 9, -1], initial_board)
115115

116116
# Test Move Logic
117-
confirmMove("1", 0, initial_board, [[8, 7, 6], [5, 4, 3], [2, 0, 1]])
117+
confirm_move("1", 0, initial_board, [[8, 7, 6], [5, 4, 3], [2, 0, 1]])
118118

119-
confirmMove("1 2", 0, initial_board, [[8, 7, 6], [5, 4, 3], [0, 2, 1]])
119+
confirm_move("1 2", 0, initial_board, [[8, 7, 6], [5, 4, 3], [0, 2, 1]])
120120

121-
confirmMove("1 2 5", 0, initial_board, [[8, 7, 6], [0, 4, 3], [5, 2, 1]])
121+
confirm_move("1 2 5", 0, initial_board, [[8, 7, 6], [0, 4, 3], [5, 2, 1]])
122122

123-
confirmMove("1 2 5 4", 0, initial_board, [[8, 7, 6], [4, 0, 3], [5, 2, 1]])
123+
confirm_move("1 2 5 4", 0, initial_board, [[8, 7, 6], [4, 0, 3], [5, 2, 1]])
124124

125-
confirmMove("3", 0, sample_board, [[7, 6, 8], [0, 3, 1], [2, 4, 5]])
125+
confirm_move("3", 0, sample_board, [[7, 6, 8], [0, 3, 1], [2, 4, 5]])
126126

127-
confirmMove("3 7", 0, sample_board, [[0, 6, 8], [7, 3, 1], [2, 4, 5]])
127+
confirm_move("3 7", 0, sample_board, [[0, 6, 8], [7, 3, 1], [2, 4, 5]])
128128

129129
# Test coordinates logic:
130130
confirm_coordinates(
@@ -143,8 +143,8 @@ def confirm_coordinates(board: List[List[int]], result: Dict[int, Tuple[int, int
143143
)
144144

145145
# Test Game Over Logic:
146-
confirmGameOver(winning_board, "current turn")
147-
confirmGameOver(sample_board, "")
146+
confirm_game_over(winning_board, "current turn")
147+
confirm_game_over(sample_board, "")
148148

149149
def test_invalid_moves(self) -> None:
150150
model = GameOfFifteenModel()

zulip_bots/zulip_bots/bots/idonethis/idonethis.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class UnspecifiedProblemException(Exception):
3030
pass
3131

3232

33-
def make_API_request(
33+
def make_api_request(
3434
endpoint: str,
3535
method: str = "GET",
3636
body: Optional[Dict[str, str]] = None,
@@ -56,31 +56,31 @@ def make_API_request(
5656

5757

5858
def api_noop() -> None:
59-
make_API_request("/noop")
59+
make_api_request("/noop")
6060

6161

6262
def api_list_team() -> List[Dict[str, str]]:
63-
return make_API_request("/teams")
63+
return make_api_request("/teams")
6464

6565

6666
def api_show_team(hash_id: str) -> Dict[str, str]:
67-
return make_API_request(f"/teams/{hash_id}")
67+
return make_api_request(f"/teams/{hash_id}")
6868

6969

7070
# NOTE: This function is not currently used
7171
def api_show_users(hash_id: str) -> Any:
72-
return make_API_request(f"/teams/{hash_id}/members")
72+
return make_api_request(f"/teams/{hash_id}/members")
7373

7474

7575
def api_list_entries(team_id: Optional[str] = None) -> List[Dict[str, Any]]:
7676
if team_id:
77-
return make_API_request("/entries", params=dict(team_id=team_id))
77+
return make_api_request("/entries", params=dict(team_id=team_id))
7878
else:
79-
return make_API_request("/entries")
79+
return make_api_request("/entries")
8080

8181

8282
def api_create_entry(body: str, team_id: str) -> Dict[str, Any]:
83-
return make_API_request("/entries", "POST", {"body": body, "team_id": team_id})
83+
return make_api_request("/entries", "POST", {"body": body, "team_id": team_id})
8484

8585

8686
def list_teams() -> str:

zulip_bots/zulip_bots/bots/merels/libraries/game.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
COMMAND_PATTERN = re.compile("^(\\w*).*(\\d,\\d).*(\\d,\\d)|^(\\w+).*(\\d,\\d)")
1515

1616

17-
def getInfo():
17+
def get_info():
1818
"""Gets the info on starting the game
1919
2020
:return: Info on how to start the game
2121
"""
2222
return "To start a game, mention me and add `create`. A game will start in that topic. "
2323

2424

25-
def getHelp():
25+
def get_help():
2626
"""Gets the help message
2727
2828
:return: Help message

zulip_bots/zulip_bots/bots/merels/merels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def alert_move_message(self, original_player: str, move_info: str) -> str:
6464
return original_player + " :" + move_info
6565

6666
def game_start_message(self) -> str:
67-
return game.getHelp()
67+
return game.get_help()
6868

6969

7070
class MerelsHandler(GameAdapter):
@@ -79,15 +79,15 @@ class MerelsHandler(GameAdapter):
7979
}
8080

8181
def usage(self) -> str:
82-
return game.getInfo()
82+
return game.get_info()
8383

8484
def __init__(self) -> None:
8585
game_name = "Merels"
8686
bot_name = "merels"
8787
move_help_message = ""
8888
move_regex = ".*"
8989
model = MerelsModel
90-
rules = game.getInfo()
90+
rules = game.get_info()
9191
gameMessageHandler = MerelsMessageHandler
9292
super().__init__(
9393
game_name,

0 commit comments

Comments
 (0)