Skip to content

Commit 82c0b7c

Browse files
committed
fixed linter issue
1 parent af4bc5f commit 82c0b7c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

scripts/generate_examples_md.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ def generate_markdown(examples: list[dict[str, Any]]) -> str:
150150

151151
def generate_registry(examples: list[dict[str, Any]]) -> str:
152152
"""Generate the registry.py content."""
153-
imports: list[str] = []
153+
imports: list[tuple[str, str]] = [("example_types", "ExampleResult")]
154154
for example in examples:
155155
module = example["file_name"].replace(".py", "")
156156
runner = f"run_{module}_example"
157-
imports.append(f"from .{module} import {runner}")
158-
imports.sort(key=len)
157+
imports.append((module, runner))
158+
imports.sort(key=lambda x: (len(x[0]), x[0]))
159+
import_lines = [f"from .{mod} import {name}" for mod, name in imports]
159160

160161
entries: list[str] = []
161162
for example in examples:
@@ -181,8 +182,7 @@ def generate_registry(examples: list[dict[str, Any]]) -> str:
181182
182183
from typing import Any, Callable, cast
183184
184-
from .example_types import ExampleResult
185-
{chr(10).join(imports)}
185+
{chr(10).join(import_lines)}
186186
187187
ExampleRegistryEntry = dict[str, Any]
188188

0 commit comments

Comments
 (0)