Skip to content

Refactor: Add type hints to CodeParser AST visitor methods#339

Merged
vicsanity623 merged 5 commits into
pyob-evolution-v3-1781233198from
pyob-evolution-v4-1781233382
Jun 12, 2026
Merged

Refactor: Add type hints to CodeParser AST visitor methods#339
vicsanity623 merged 5 commits into
pyob-evolution-v3-1781233198from
pyob-evolution-v4-1781233382

Conversation

@pyob-bot

Copy link
Copy Markdown
Collaborator

Summary of Changes

This PR introduces explicit type annotations to the CodeParser class methods within src/pyob/pyob_code_parser.py. Specifically, it updates the ast visitor methods (visit_ImportFrom, visit_ClassDef, visit_FunctionDef, visit_AsyncFunctionDef) and the helper method handle_function to include proper type hints for ast nodes and return types.

Technical Impact

  • Improved Type Safety: By explicitly defining the expected ast node types, the code is now more resilient to type-related bugs and better supported by static analysis tools like mypy or pyright.
  • Enhanced Maintainability: The addition of type hints improves code readability and provides better IDE autocompletion and documentation for developers working on the parser.
  • No Functional Changes: This is a non-breaking refactor; the logic remains identical to the previous implementation.

@vicsanity623 vicsanity623 merged commit ddd6bc8 into pyob-evolution-v3-1781233198 Jun 12, 2026
1 check passed
@vicsanity623 vicsanity623 deleted the pyob-evolution-v4-1781233382 branch June 12, 2026 03:12
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.

2 participants