Skip to content

Commit 9d3321c

Browse files
committed
Lint and cleanup
1 parent 5d843e1 commit 9d3321c

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

easybuild/tools/entrypoints.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from easybuild.base import fancylogger
1414
from easybuild.tools.build_log import EasyBuildError
1515

16+
1617
_log = fancylogger.getLogger('entrypoints', fname=False)
1718

1819
def get_group_entrypoints(group: str) -> set[EntryPoint]:
@@ -39,7 +40,8 @@ def get_group_entrypoints(group: str) -> set[EntryPoint]:
3940
HOOKS_ENTRYPOINT_MARK = "_is_easybuild_hook"
4041
HOOKS_ENTRYPOINT_PRIORITY = "_priority"
4142

42-
#########################################################################################3
43+
44+
#########################################################################################
4345
# Easyblock entrypoints
4446
def register_easyblock_entrypoint():
4547
"""Decorator to register an easyblock entrypoint."""
@@ -77,7 +79,7 @@ def validate_easyblock_entrypoints() -> list[str]:
7779
return invalid_easyblocks
7880

7981

80-
def get_easyblock_entrypoints(name = None) -> dict:
82+
def get_easyblock_entrypoints(name=None) -> dict:
8183
"""Get all easyblock entrypoints.
8284
8385
Returns:
@@ -97,9 +99,6 @@ def get_easyblock_entrypoints(name = None) -> dict:
9799
'loc': mod.__file__,
98100
}
99101
easyblocks[f'{ep.module}'] = ptr
100-
# print('--' * 80)
101-
# print(easyblocks)
102-
# print('--' * 80)
103102
if name is not None:
104103
for key, value in easyblocks.items():
105104
if value['class'] == name:
@@ -110,6 +109,7 @@ def get_easyblock_entrypoints(name = None) -> dict:
110109

111110
return easyblocks
112111

112+
113113
#########################################################################################
114114
# Hooks entrypoints
115115
def register_entrypoint_hooks(step, pre_step=False, post_step=False, priority=0):
@@ -183,9 +183,7 @@ def validate_entrypoint_hooks(known_hooks: list[str], pre_prefix: str, post_pref
183183
def find_entrypoint_hooks(label, pre_step_hook=False, post_step_hook=False) -> list[Callable]:
184184
"""Get all hooks defined in entry points."""
185185
hooks = []
186-
# print(f"--- Searching for entry point hooks with label: {label}, pre_step_hook: {pre_step_hook}, post_step_hook: {post_step_hook}")
187186
for ep in get_group_entrypoints(HOOKS_ENTRYPOINT):
188-
# print(f"--- Processing entry point: {ep.name}")
189187
try:
190188
hook = ep.load()
191189
except Exception as e:
@@ -202,6 +200,7 @@ def find_entrypoint_hooks(label, pre_step_hook=False, post_step_hook=False) -> l
202200

203201
return hooks
204202

203+
205204
#########################################################################################
206205
# Toolchain entrypoints
207206
def register_toolchain_entrypoint(prepend=False):
@@ -228,8 +227,6 @@ def get_toolchain_entrypoints() -> set[EntryPoint]:
228227
_log.error(f"Error loading toolchain entry point {ep.name}: {e}")
229228
raise EasyBuildError(f"Error loading toolchain entry point {ep.name}: {e}")
230229
toolchains.append(tc)
231-
# print(f"Found {len(toolchains)} toolchain entry points")
232-
# print(f"Toolchain entry points: {toolchains}")
233230
return toolchains
234231

235232

easybuild/tools/hooks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@
3131
"""
3232
import difflib
3333
import os
34-
from functools import wraps
3534

3635
from easybuild.tools.entrypoints import (
3736
find_entrypoint_hooks, validate_entrypoint_hooks,
38-
HOOKS_ENTRYPOINT_MARK, HOOKS_ENTRYPOINT_STEP, HOOKS_ENTRYPOINT_PRE_STEP, HOOKS_ENTRYPOINT_POST_STEP,
3937
HOOKS_ENTRYPOINT_PRIORITY
4038
)
4139

@@ -266,7 +264,10 @@ def run_hook(label, hooks, pre_step_hook=False, post_step_hook=False, args=None,
266264
key=lambda x: (-getattr(x, HOOKS_ENTRYPOINT_PRIORITY, 0), x.__name__),
267265
)
268266
for hook in entrypoint_hooks:
269-
_log.info("Running entry point '%s' hook function (args: %s, keyword args: %s)...", hook.__name__, args, kwargs)
267+
_log.info(
268+
"Running entry point '%s' hook function (args: %s, keyword args: %s)...",
269+
hook.__name__, args, kwargs
270+
)
270271
try:
271272
res = hook(*args, **kwargs)
272273
except Exception as e:

easybuild/tools/toolchain/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import easybuild.tools.toolchain
4343
from easybuild.tools.entrypoints import (
4444
get_toolchain_entrypoints, validate_toolchain_entrypoints,
45-
TOOLCHAIN_ENTRYPOINT_MARK, TOOLCHAIN_ENTRYPOINT_PREPEND
45+
TOOLCHAIN_ENTRYPOINT_PREPEND
4646
)
4747
from easybuild.base import fancylogger
4848
from easybuild.tools.build_log import EasyBuildError

0 commit comments

Comments
 (0)