Skip to content

Commit 43d0676

Browse files
committed
🧑‍💻 Fix linter warnings and improve pre-commit
1 parent ba5d0f6 commit 43d0676

File tree

4 files changed

+56
-57
lines changed

4 files changed

+56
-57
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
exclude: \.(po|pot|yml|yaml)$
2222
- repo: https://github.com/astral-sh/ruff-pre-commit
2323
# Ruff version.
24-
rev: v0.8.1
24+
rev: v0.9.4
2525
hooks:
2626
# Run the linter.
2727
- id: ruff
@@ -34,4 +34,5 @@ repos:
3434
name: copywrite
3535
entry: copywrite headers
3636
language: system
37-
files: .
37+
pass_filenames: false
38+
files: .

pdm.lock

Lines changed: 37 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ def __init__(
7676
logger.debug("", exc_info=e)
7777

7878

79-
def load_extensions() -> (
80-
tuple[
81-
"FunctionlistType",
82-
"FunctionlistType",
83-
"FunctionlistType",
84-
"list[ExtensionTranslation]",
85-
]
86-
):
79+
def load_extensions() -> tuple[
80+
"FunctionlistType",
81+
"FunctionlistType",
82+
"FunctionlistType",
83+
"list[ExtensionTranslation]",
84+
]:
8785
"""Load extensions from the extensions directory.
8886
8987
Returns:

src/utils/extensions.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ def check_typing(module: ModuleType, func: Callable, types: dict[str, Any]) -> N
3030
def check_func(module: ModuleType, func: Callable, max_args: int, types: dict[str, Any]) -> None:
3131
assert callable(func), f"Function {func.__name__} of module {module.__name__} is not callable"
3232
signature = inspect.signature(func)
33-
assert (
34-
len(signature.parameters) <= max_args
35-
), f"Function {func.__name__} of module {module.__name__} has too many arguments"
36-
assert all(
37-
param in types for param in signature.parameters
38-
), f"Function {func.__name__} of module {module.__name__} does not accept the correct arguments ({', '.join(types.keys())})" # noqa: E501
33+
assert len(signature.parameters) <= max_args, (
34+
f"Function {func.__name__} of module {module.__name__} has too many arguments"
35+
)
36+
assert all(param in types for param in signature.parameters), (
37+
f"Function {func.__name__} of module {module.__name__} does not accept the correct arguments"
38+
"({', '.join(types.keys())})"
39+
)
3940
# check_typing(module, func, types) # temporarily disabled due to unwanted behavior # noqa: ERA001
4041

4142

@@ -73,9 +74,9 @@ def validate_module(module: ModuleType, config: dict[str, Any] | None = None) ->
7374
module.default,
7475
dict,
7576
), f"Extension {module.__name__} has a default configuration of type {type(module.default)} instead of dict"
76-
assert (
77-
"enabled" in module.default
78-
), f"Extension {module.__name__} does not have an enabled key in its default configuration"
77+
assert "enabled" in module.default, (
78+
f"Extension {module.__name__} does not have an enabled key in its default configuration"
79+
)
7980
if hasattr(module, "schema"):
8081
assert isinstance(
8182
module.schema,

0 commit comments

Comments
 (0)