From 11697b68c5c61bf6b5dff0218cfdc788ac20f53d Mon Sep 17 00:00:00 2001 From: Greg Finley <gregory.finley@gmail.com> Date: Sun, 17 Mar 2024 21:50:07 -0700 Subject: [PATCH] flake8 --- lib/lichess.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/lichess.py b/lib/lichess.py index 6c805707c..9348bd0e2 100644 --- a/lib/lichess.py +++ b/lib/lichess.py @@ -41,6 +41,7 @@ MAX_CHAT_MESSAGE_LEN = 140 # The maximum characters in a chat message. + class OKResponse(TypedDict): """Often given by the API on POSTs or endpoints needing no further action.""" ok: bool @@ -268,8 +269,10 @@ def make_move(self, game_id: str, move: chess.engine.PlayResult) -> OKResponse: :param game_id: The id of the game. :param move: The move to make. """ - return cast(OKResponse, self.api_post("move", game_id, move.move, - params={"offeringDraw": str(move.draw_offered).lower()})) + return cast(OKResponse, self.api_post( + "move", game_id, move.move, + params={"offeringDraw": str(move.draw_offered).lower()} + )) def chat(self, game_id: str, room: str, text: str) -> OKResponse: """ @@ -309,11 +312,12 @@ def accept_challenge(self, challenge_id: str) -> OKResponse: def decline_challenge(self, challenge_id: str, reason: str = "generic") -> OKResponse: """Decline a challenge.""" try: - return cast(OKResponse, self.api_post("decline", challenge_id, - data=f"reason={reason}", - headers={"Content-Type": - "application/x-www-form-urlencoded"}, - raise_for_status=False)) + return cast(OKResponse, self.api_post( + "decline", challenge_id, + data=f"reason={reason}", + headers={"Content-Type": "application/x-www-form-urlencoded"}, + raise_for_status=False + )) except Exception: return {"ok": False}