Skip to content

grpc2py: fix F401 and E261 flake8 violations in generator and generated output#9142

Open
nGoline wants to merge 1 commit into
ElementsProject:masterfrom
nGoline:grpc2py-flake8-fixes
Open

grpc2py: fix F401 and E261 flake8 violations in generator and generated output#9142
nGoline wants to merge 1 commit into
ElementsProject:masterfrom
nGoline:grpc2py-flake8-fixes

Conversation

@nGoline
Copy link
Copy Markdown
Collaborator

@nGoline nGoline commented May 18, 2026

Summary

  • The generator (contrib/msggen/msggen/gen/grpc2py.py) emitted import json in every generated file's header, but json is never referenced in the output (F401 — unused import).
  • Three inline comments in the generator used a single space before # instead of the required two (E261 — inline comment spacing): the decodekeysend_routes2py and decodepay_routes2py manual-override functions, and the ArrayField[primitive] branch in generate_composite.
  • The generated output file (contrib/pyln-testing/pyln/testing/grpc2py.py) was regenerated to reflect these fixes.

This made it impossible to commit a regenerated grpc2py.py without --no-verify, since the project's own pre-commit flake8 hook rejects the output.

Closes #9128

🤖 Generated with Claude Code

@nGoline nGoline requested a review from cdecker as a code owner May 18, 2026 13:32
…ed output

The generator emitted `import json` in its header template despite json
never being referenced in the generated output (F401), and used a single
space before three inline `#` comments (E261). Fix by removing the unused
import from the template and adding the required second space before each
comment. Regenerate the output file accordingly.

Changelog-None

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nGoline nGoline force-pushed the grpc2py-flake8-fixes branch from 3fd05be to e482b03 Compare May 18, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

grpc2py.py: generator emits flake8 E261/F401 violations in generated output

1 participant