ruff: enable PERF102

Which replaces uses of mapping.items() with mapping or mapping.values()
when the key or value is not used.
This commit is contained in:
Dylan Baker committed 2026-10-30 20:04:49 -07:00
1 parent 0ef4bf221d
commit 6933aaf2e5
8 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ line-length = 100
target-version = "py310"
[lint]
select = ["F"]
select = ["F", "PERF102"]
[lint.per-file-ignores]
"mesonbuild/mesonlib.py" = ["F403"]
+1 -1
View File
@@ -812,7 +812,7 @@ class AstInterpreter(InterpreterBase):
if hasattr(cur, 'args'):
for arg in cur.args.arguments:
self.dataflow_dag.add_edge(arg, cur)
for k, v in cur.args.kwargs.items():
for v in cur.args.kwargs.values():
self.dataflow_dag.add_edge(v, cur)
for attr in ['source_object', 'left', 'right', 'items', 'iobject', 'index', 'condition']:
if hasattr(cur, attr):
+1 -1
View File
@@ -1232,7 +1232,7 @@ class XCodeBackend(backends.Backend):
def generate_project_tree(self) -> FileTreeEntry:
tree_info = FileTreeEntry()
for tname, t in self.build_targets.items():
for t in self.build_targets.values():
self.add_target_to_tree(tree_info, t)
return tree_info
+1 -1
View File
@@ -121,7 +121,7 @@ class DictMergeValue(ConvertValue):
explicit: T.Set[str] = set(self.merge_key(x) for x in out)
out_d: T.Dict[str, object] = {self.out_key(x): x for x in out}
for k, v in self.default.items():
for v in self.default.values():
if self.merge_key(v) not in explicit:
out_d[self.out_key(v)] = v
return out_d
+1 -1
View File
@@ -71,7 +71,7 @@ class InterpreterObject:
cls.OPERATORS.update(superclass.OPERATORS)
cls.TRIVIAL_OPERATORS.update(superclass.TRIVIAL_OPERATORS)
for name, method in cls.__dict__.items():
for method in cls.__dict__.values():
if hasattr(method, 'meson_method'):
cls.METHODS[method.meson_method] = method
if hasattr(method, 'meson_operator'):
+1 -1
View File
@@ -327,7 +327,7 @@ class RustPackage(RustCrate):
cfg = self.package.cfg[for_machine]
if kwargs['dependencies']:
for dep_key, dep_pkg in cfg.dep_packages.items():
for dep_pkg in cfg.dep_packages.values():
if dep_pkg.manifest.lib:
# Get the dependency name for this package (rust or proc-macro ABI)
depname = dep_pkg.get_rust_dependency_name()
+1 -1
View File
@@ -647,7 +647,7 @@ class Rewriter:
self.modified_nodes += [node]
def find_assignment_node(self, node: BaseNode) -> T.Optional[AssignmentNode]:
for k, v in self.interpreter.all_assignment_nodes.items():
for v in self.interpreter.all_assignment_nodes.values():
for ass in v:
if ass.value == node:
return ass
+3 -3
View File
@@ -262,9 +262,9 @@ class RewriterTests(BasePlatformTests):
}
}
}
for k1, v1 in expected.items():
for k2, v2 in v1.items():
for k3, v3 in v2.items():
for v1 in expected.values():
for v2 in v1.values():
for v3 in v2.values():
if isinstance(v3, list):
for i in range(len(v3)):
v3[i] = v3[i].replace('/', os.path.sep)