Skip to content

Commit 8018215

Browse files
committed
chore: linter checks
1 parent 647ec4d commit 8018215

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

packages/valory/skills/staking_abci/behaviours.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,8 @@ def _get_liveness_ratio(self) -> WaitableConditionType:
360360
placeholder=get_name(CallCheckpointBehaviour.liveness_ratio),
361361
)
362362
return status
363-
364-
def ensure_service_id(self) -> WaitableConditionType:
363+
364+
def ensure_service_id(self) -> bool:
365365
"""Ensure that the service id is set."""
366366
service_id = self.params.on_chain_service_id
367367
if service_id is None:
@@ -388,7 +388,7 @@ def _get_agent_ids(self) -> WaitableConditionType:
388388
"""Get the service information to retrieve the agent ids."""
389389
if not self.ensure_service_id():
390390
return True
391-
391+
392392
status = yield from self._staking_contract_interact(
393393
contract_callable="get_agent_ids",
394394
placeholder=get_name(CallCheckpointBehaviour.agent_ids),

packages/valory/skills/trader_abci/handlers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import json
2424
from http import HTTPStatus
2525
from pathlib import Path
26-
from typing import Any, Dict, List, Union
26+
from typing import Any, Dict, List, Optional, Union
2727
from urllib.parse import urlparse
2828

2929
from packages.valory.protocols.http.message import HttpMessage
@@ -146,13 +146,11 @@ def _send_ok_response(
146146
http_msg: HttpMessage,
147147
http_dialogue: HttpDialogue,
148148
data: Union[str, Dict, List, bytes],
149-
content_type: str = None,
149+
content_type: Optional[str] = None,
150150
) -> None:
151151
"""Send an OK response with the provided data"""
152152
headers = content_type or (
153-
CONTENT_TYPES[".json"]
154-
if isinstance(data, (dict, list))
155-
else DEFAULT_HEADER
153+
CONTENT_TYPES[".json"] if isinstance(data, (dict, list)) else DEFAULT_HEADER
156154
)
157155
headers += http_msg.headers
158156

@@ -216,7 +214,9 @@ def _handle_get_static_file(
216214
content_type = self._get_content_type(file_path)
217215

218216
# Send the file content as a response
219-
self._send_ok_response(http_msg, http_dialogue, file_content, content_type)
217+
self._send_ok_response(
218+
http_msg, http_dialogue, file_content, content_type
219+
)
220220
else:
221221
# If the file doesn't exist or is not a file, return the index.html file
222222
with open(

packages/valory/skills/trader_abci/tests/tests_handlers.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"""This module contains the tests for the handlers for the trader abci."""
2020

2121
import json
22+
from pathlib import Path
2223
from typing import Any, Dict
2324
from unittest.mock import MagicMock, patch
24-
from pathlib import Path
2525

2626
import pytest
2727
from aea.configurations.data_types import PublicId
@@ -56,15 +56,15 @@
5656
HandleTestCase,
5757
)
5858
from packages.valory.skills.trader_abci.handlers import (
59+
CONTENT_TYPES,
5960
ContractApiHandler,
61+
DEFAULT_HEADER,
6062
HttpHandler,
6163
IpfsHandler,
6264
LedgerApiHandler,
6365
SigningHandler,
6466
TendermintHandler,
6567
TraderHandler,
66-
CONTENT_TYPES,
67-
DEFAULT_HEADER,
6868
)
6969

7070

@@ -120,13 +120,19 @@ def test_get_content_type(self) -> None:
120120
"""Test _get_content_type method."""
121121
# Test known extensions
122122
assert self.handler._get_content_type(Path("test.js")) == CONTENT_TYPES[".js"]
123-
assert self.handler._get_content_type(Path("test.html")) == CONTENT_TYPES[".html"]
124-
assert self.handler._get_content_type(Path("test.json")) == CONTENT_TYPES[".json"]
123+
assert (
124+
self.handler._get_content_type(Path("test.html")) == CONTENT_TYPES[".html"]
125+
)
126+
assert (
127+
self.handler._get_content_type(Path("test.json")) == CONTENT_TYPES[".json"]
128+
)
125129
assert self.handler._get_content_type(Path("test.css")) == CONTENT_TYPES[".css"]
126130
assert self.handler._get_content_type(Path("test.png")) == CONTENT_TYPES[".png"]
127131
assert self.handler._get_content_type(Path("test.jpg")) == CONTENT_TYPES[".jpg"]
128-
assert self.handler._get_content_type(Path("test.jpeg")) == CONTENT_TYPES[".jpeg"]
129-
132+
assert (
133+
self.handler._get_content_type(Path("test.jpeg")) == CONTENT_TYPES[".jpeg"]
134+
)
135+
130136
# Test unknown extension
131137
assert self.handler._get_content_type(Path("test.xyz")) == DEFAULT_HEADER
132138

0 commit comments

Comments
 (0)