Skip to content

Commit 5767109

Browse files
committed
fix linter findings
1 parent 915b70e commit 5767109

File tree

8 files changed

+167
-118
lines changed

8 files changed

+167
-118
lines changed

resources/plugins/simln/plugin.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
get_default_namespace,
1616
get_mission,
1717
get_static_client,
18+
read_file_from_container,
1819
wait_for_init,
1920
write_file_to_container,
20-
read_file_from_container,
2121
)
2222
from warnet.process import run_command
2323

@@ -146,7 +146,7 @@ def _launch_activity(activity: Optional[list[dict]], plugin_dir: str) -> str:
146146
activity_json = _generate_activity_json(activity)
147147
wait_for_init(name, namespace=get_default_namespace(), quiet=True)
148148

149-
#write cert files to container
149+
# write cert files to container
150150
transfer_cln_certs(name)
151151
if write_file_to_container(
152152
name,
@@ -186,24 +186,46 @@ def _generate_activity_json(activity: Optional[list[dict]]) -> str:
186186

187187
return json.dumps(data, indent=2)
188188

189+
189190
def transfer_cln_certs(name):
190191
dst_container = "init"
191192
cln_root = "/root/.lightning/regtest"
192193
for i in get_mission(LIGHTNING_MISSION):
193194
ln_name = i.metadata.name
194195
if "cln" in ln_name:
195-
copyfile(ln_name, "cln", f"{cln_root}/ca.pem", name, dst_container, f"/working/{ln_name}-ca.pem")
196-
copyfile(ln_name, "cln", f"{cln_root}/client.pem", name, dst_container, f"/working/{ln_name}-client.pem")
197-
copyfile(ln_name, "cln", f"{cln_root}/client-key.pem", name, dst_container, f"/working/{ln_name}-client-key.pem")
196+
copyfile(
197+
ln_name,
198+
"cln",
199+
f"{cln_root}/ca.pem",
200+
name,
201+
dst_container,
202+
f"/working/{ln_name}-ca.pem",
203+
)
204+
copyfile(
205+
ln_name,
206+
"cln",
207+
f"{cln_root}/client.pem",
208+
name,
209+
dst_container,
210+
f"/working/{ln_name}-client.pem",
211+
)
212+
copyfile(
213+
ln_name,
214+
"cln",
215+
f"{cln_root}/client-key.pem",
216+
name,
217+
dst_container,
218+
f"/working/{ln_name}-client-key.pem",
219+
)
198220

199221

200222
def copyfile(pod_name, src_container, source_path, dst_name, dst_container, dst_path):
201-
namespace=get_default_namespace()
223+
namespace = get_default_namespace()
202224
file_data = read_file_from_container(pod_name, source_path, src_container, namespace)
203225
if write_file_to_container(
204-
dst_name,
205-
dst_container,
206-
dst_path,
226+
dst_name,
227+
dst_container,
228+
dst_path,
207229
file_data,
208230
namespace=namespace,
209231
quiet=True,

resources/scenarios/commander.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,31 @@ def auth_proxy_request(self, method, path, postdata):
9090
AuthServiceProxy.oldrequest = AuthServiceProxy._request
9191
AuthServiceProxy._request = auth_proxy_request
9292

93+
9394
# Create a custom formatter
9495
class ColorFormatter(logging.Formatter):
9596
"""Custom formatter to add color based on log level."""
97+
9698
# Define ANSI color codes
97-
RED = '\033[91m'
98-
YELLOW = '\033[93m'
99-
GREEN = '\033[92m'
100-
RESET = '\033[0m'
99+
RED = "\033[91m"
100+
YELLOW = "\033[93m"
101+
GREEN = "\033[92m"
102+
RESET = "\033[0m"
101103

102104
FORMATS = {
103105
logging.DEBUG: f"{RESET}%(name)-8s - Thread-%(thread)d - %(message)s{RESET}",
104106
logging.INFO: f"{RESET}%(name)-8s - %(message)s{RESET}",
105107
logging.WARNING: f"{YELLOW}%(name)-8s - %(message)s{RESET}",
106108
logging.ERROR: f"{RED}%(name)-8s - %(message)s{RESET}",
107-
logging.CRITICAL: f"{RED}##%(name)-8s - %(message)s##{RESET}"
109+
logging.CRITICAL: f"{RED}##%(name)-8s - %(message)s##{RESET}",
108110
}
109111

110112
def format(self, record):
111113
log_fmt = self.FORMATS.get(record.levelno)
112114
formatter = logging.Formatter(log_fmt)
113115
return formatter.format(record)
114116

117+
115118
class Commander(BitcoinTestFramework):
116119
# required by subclasses of BitcoinTestFramework
117120
def set_test_params(self):
@@ -222,7 +225,7 @@ def setup(self):
222225
self.tanks[tank["tank"]] = node
223226

224227
for ln in WARNET["lightning"]:
225-
#create the correct implementation based on pod name
228+
# create the correct implementation based on pod name
226229
if "-cln" in ln:
227230
self.lns[ln] = CLN(ln)
228231
else:

0 commit comments

Comments
 (0)