Skip to content

Commit 37d6bf3

Browse files
Fix formatting
1 parent ae6ebea commit 37d6bf3

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/extensions/score_metamodel/checks/check_options.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,17 @@ def validate_fields(
5353
:param field_type: A string indicating the field type ('option' or 'link').
5454
"""
5555

56-
def remove_prefix(values: list[str], prefixes: list[str]) -> Generator[str, None,None]:
56+
def remove_prefix(
57+
values: list[str], prefixes: list[str]
58+
) -> Generator[str, None, None]:
5759
# Memory and allocation wise better to use a generator here.
5860
# Removes any prefix allowed by configuration, if prefix is there.
5961
return (
60-
next((text.removeprefix(p) for p in prefixes if text.startswith(p)), text) for text in values
62+
next((text.removeprefix(p) for p in prefixes if text.startswith(p)), text)
63+
for text in values
6164
)
6265

63-
6466
for field, pattern in fields.items():
65-
6667
raw_value: str | list[str] | None = need.get(field, None)
6768
if raw_value in [None, [], ""]:
6869
if required:
@@ -82,7 +83,7 @@ def remove_prefix(values: list[str], prefixes: list[str]) -> Generator[str, None
8283

8384
# The filter ensures that the function is only called when needed.
8485
if field_type == "link" and allowed_prefixes:
85-
values = list(remove_prefix(values,allowed_prefixes))
86+
values = list(remove_prefix(values, allowed_prefixes))
8687

8788
for value in values:
8889
try:
@@ -140,7 +141,7 @@ def check_options(
140141

141142
# If undefined this is an empty list
142143
allowed_prefixes = app.config.allowed_external_prefixes
143-
144+
144145
for field_type, check_fields in checking_dict.items():
145146
for field_values, is_required in check_fields:
146147
validate_fields(
@@ -149,7 +150,7 @@ def check_options(
149150
field_values,
150151
required=is_required,
151152
field_type=field_type,
152-
allowed_prefixes=allowed_prefixes
153+
allowed_prefixes=allowed_prefixes,
153154
)
154155

155156

src/extensions/score_metamodel/checks/id_contains_feature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def id_contains_feature(app: Sphinx, need: NeedsInfoType, log: CheckLogger):
3737

3838
# Get the part of the string after the first two underscores: the path
3939
feature = parts[1]
40-
40+
4141
dir_docname = os.path.dirname(str(need.get("docname", "")))
4242

43-
# If the 'rst' file is not in a directory, the above expression will be "".
43+
# If the 'rst' file is not in a directory, the above expression will be "".
4444
# Even if the need itself has a docname. That's why we have this logic here.
4545
docname = dir_docname if dir_docname else need.get("docname", "")
4646

0 commit comments

Comments
 (0)