Skip to content

Commit 050d78d

Browse files
authored
Merge pull request #580 from powerapi-ng/refactor/unnecessary-iterable-allocation-for-first-element
refactor: Use iterator to get first element of collections
2 parents e31ad68 + 4bbbad6 commit 050d78d

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ ignore = [
2020
"B008", # function-call-in-default-argument
2121
"F401", # unused-import
2222
"RUF013", # implicit-optional
23-
"RUF015", # unnecessary-iterable-allocation-for-first-element
2423

2524
"B010", # set-attr-with-constant
2625
"B905", # zip-without-explicit-strict

src/powerapi/dispatch_rule/hwpc_dispatch_rule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _number_of_core_per_socket(group):
9898
:type group: Dict
9999
:rtype: int : the number of core per socket in this group
100100
"""
101-
return len(list(group.values())[0])
101+
return len(next(iter(group.values())))
102102

103103

104104
def _extract_non_shared_group(report):

0 commit comments

Comments
 (0)