Skip to content

Commit 50602d7

Browse files
committed
Avoid B007 hound warning
We use the line number only outside the loop which triggers > Loop control variable 'num' not used within the loop body. If this is intended, start the name with an underscore.
1 parent fb11ab3 commit 50602d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

easybuild/easyblocks/generic/cargo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ def parse_toml(file_or_content: Union[Path, str]) -> Dict[str, str]:
164164
expected_end = None
165165
current_section = None
166166
content = read_file(file_or_content) if isinstance(file_or_content, Path) else file_or_content
167-
num = raw_line = None
167+
line_num = raw_line = None
168168
start_end = {
169169
'[': ']',
170170
'{': '}',
171171
'"""': '"""',
172172
"'''": "'''",
173173
}
174174
try:
175-
for num, raw_line in enumerate(content.splitlines()):
175+
for line_num, raw_line in enumerate(content.splitlines()): # noqa B007: line_num used in error only
176176
line: str = _clean_line(raw_line, expected_end)
177177
if not line:
178178
continue
@@ -196,7 +196,7 @@ def parse_toml(file_or_content: Union[Path, str]) -> Dict[str, str]:
196196
result[current_section][pending_key] = pending_value.strip()
197197
pending_key = None
198198
except Exception as e:
199-
raise ValueError(f'Failed to parse {file_or_content}, error {e} at line {num}: {raw_line}')
199+
raise ValueError(f'Failed to parse {file_or_content}, error {e} at line {line_num}: {raw_line}')
200200
return result
201201

202202

0 commit comments

Comments
 (0)