fix(lint): Remove trailing whitespace and add ClassVar annotations to PureGraph benchmarks

- Fix RUF012: Annotate mutable class attributes (params, param_names) with
  typing.ClassVar in PureGraphBench benchmark suite
- Fix W293: Remove trailing whitespace from blank lines in benchmark file

This fixes the CI lint check that was failing on the pr-creator generated
benchmark code.

ISSUES CLOSED: #9531
This commit is contained in:
2026-05-07 14:34:47 +00:00
committed by drew
parent db048dd2d9
commit bf18068ee8
+7 -7
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from typing import Any
from typing import Any, ClassVar
from cleveragents.langgraph.nodes import Edge, NodeConfig, NodeType
from cleveragents.langgraph.pure_graph import PureGraph
@@ -11,8 +11,8 @@ from cleveragents.langgraph.pure_graph import PureGraph
class PureGraphBench:
"""Benchmark suite for PureGraph execution performance."""
params = [10, 50, 100, 500]
param_names = ["node_count"]
params: ClassVar[list[int]] = [10, 50, 100, 500]
param_names: ClassVar[list[str]] = ["node_count"]
def setup(self, node_count: int) -> None:
"""Set up benchmark with varying node counts."""
@@ -22,7 +22,7 @@ class PureGraphBench:
"end": NodeConfig(name="end", type=NodeType.END),
}
self.edges: list[Edge] = []
# Create a linear chain of nodes
previous = "start"
for i in range(node_count):
@@ -34,14 +34,14 @@ class PureGraphBench:
)
self.edges.append(Edge(source=previous, target=node_name))
previous = node_name
self.edges.append(Edge(source=previous, target="end"))
# Create function registry with identity functions
self.fn_registry: dict[str, Any] = {
f"fn_{i}": lambda x, i=i: x for i in range(node_count)
}
self.graph = PureGraph(
name=f"bench_graph_{node_count}",
nodes=self.nodes,