Skip to content

Commit 5f86717

Browse files
committed
lint: action all ruff fixes
1 parent 846d89a commit 5f86717

File tree

6 files changed

+26
-25
lines changed

6 files changed

+26
-25
lines changed

Diff for: resources/plugins/hello/plugin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ def entrypoint(ctx, plugin_content: str, warnet_content: str):
7272

7373
hook_value = warnet_content.get(WarnetContent.HOOK_VALUE.value)
7474

75-
assert hook_value in {
76-
item.value for item in HookValue
77-
}, f"{hook_value} is not a valid HookValue"
75+
assert hook_value in {item.value for item in HookValue}, (
76+
f"{hook_value} is not a valid HookValue"
77+
)
7878

7979
if warnet_content.get(PLUGIN_ANNEX):
8080
for annex_member in [annex_item for annex_item in warnet_content.get(PLUGIN_ANNEX)]:
81-
assert annex_member in {
82-
item.value for item in AnnexMember
83-
}, f"{annex_member} is not a valid AnnexMember"
81+
assert annex_member in {item.value for item in AnnexMember}, (
82+
f"{annex_member} is not a valid AnnexMember"
83+
)
8484

8585
warnet_content[WarnetContent.HOOK_VALUE.value] = HookValue(hook_value)
8686

Diff for: resources/plugins/simln/plugin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ def entrypoint(ctx, plugin_content: str, warnet_content: str):
6363

6464
hook_value = warnet_content.get(WarnetContent.HOOK_VALUE.value)
6565

66-
assert hook_value in {
67-
item.value for item in HookValue
68-
}, f"{hook_value} is not a valid HookValue"
66+
assert hook_value in {item.value for item in HookValue}, (
67+
f"{hook_value} is not a valid HookValue"
68+
)
6969

7070
if warnet_content.get(PLUGIN_ANNEX):
7171
for annex_member in [annex_item for annex_item in warnet_content.get(PLUGIN_ANNEX)]:
72-
assert annex_member in {
73-
item.value for item in AnnexMember
74-
}, f"{annex_member} is not a valid AnnexMember"
72+
assert annex_member in {item.value for item in AnnexMember}, (
73+
f"{annex_member} is not a valid AnnexMember"
74+
)
7575

7676
warnet_content[WarnetContent.HOOK_VALUE.value] = HookValue(hook_value)
7777

Diff for: resources/scenarios/commander.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import tempfile
1212
import threading
1313
from time import sleep
14-
from typing import Dict
1514

1615
from kubernetes import client, config
1716
from ln_framework.ln import LND
17+
1818
from test_framework.authproxy import AuthServiceProxy
1919
from test_framework.p2p import NetworkThread
2020
from test_framework.test_framework import (
@@ -160,8 +160,8 @@ def setup(self):
160160
self.log.addHandler(ch)
161161

162162
# Keep a separate index of tanks by pod name
163-
self.tanks: Dict[str, TestNode] = {}
164-
self.lns: Dict[str, LND] = {}
163+
self.tanks: dict[str, TestNode] = {}
164+
self.lns: dict[str, LND] = {}
165165
self.channels = WARNET["channels"]
166166

167167
for i, tank in enumerate(WARNET["tanks"]):

Diff for: resources/scenarios/ln_init.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ def open_channel(self, ch, fee_rate):
261261
block_height = block["height"]
262262
for ch in channels:
263263
assert ch["id"]["block"] == block_height, f"Actual block:{block_height}\n{ch}"
264-
assert (
265-
block_txs[ch["id"]["index"]] == ch["txid"]
266-
), f"Actual txid:{block_txs[ch["id"]["index"]]}\n{ch}"
264+
assert block_txs[ch["id"]["index"]] == ch["txid"], (
265+
f"Actual txid:{block_txs[ch['id']['index']]}\n{ch}"
266+
)
267267
self.log.info("👍")
268268

269269
gen(5)
@@ -294,9 +294,9 @@ def ln_all_chs(self, ln):
294294
def update_policy(self, ln, txid_hex, policy, capacity):
295295
self.log.info(f"Sending update from {ln.name} for channel with outpoint: {txid_hex}:0")
296296
res = ln.update(txid_hex, policy, capacity)
297-
assert (
298-
len(res["failed_updates"]) == 0
299-
), f" Failed updates: {res["failed_updates"]}\n txid: {txid_hex}\n policy:{policy}"
297+
assert len(res["failed_updates"]) == 0, (
298+
f" Failed updates: {res['failed_updates']}\n txid: {txid_hex}\n policy:{policy}"
299+
)
300300

301301
update_threads = []
302302
for ch in self.channels:

Diff for: src/warnet/bitcoin.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
from typing import Optional
77

88
import click
9+
from urllib3.exceptions import MaxRetryError
10+
911
from test_framework.messages import ser_uint256
1012
from test_framework.p2p import MESSAGEMAP
11-
from urllib3.exceptions import MaxRetryError
1213

1314
from .constants import BITCOINCORE_CONTAINER
1415
from .k8s import get_default_namespace_or, get_mission, pod_log

Diff for: test/test_base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def _print_and_assert_msgs(self, message):
6060
self.log_msg_assertions_passed = True
6161

6262
def assert_log_msgs(self):
63-
assert (
64-
self.log_msg_assertions_passed
65-
), f"Log assertion failed. Expected message not found: {self.log_expected_msgs}"
63+
assert self.log_msg_assertions_passed, (
64+
f"Log assertion failed. Expected message not found: {self.log_expected_msgs}"
65+
)
6666
self.log_msg_assertions_passed = False
6767

6868
def warnet(self, cmd):

0 commit comments

Comments
 (0)