Commit 1838322
feat: Rewrite Python extractor on tree-sitter AST with Django support (#28)
* Enhance Python extractor with Django support and update tests
* Add Python AST extraction and related tests for improved fact generation
* Enhance Python AST extractor for Django support and improve route handling
- Added handling for assignment nodes in the AST to capture Django urlpatterns at the module level.
- Updated the expression statement handler to also process Django urlpatterns.
- Enhanced the decorated definition handler to back-fill route facts with the corresponding handler names.
- Improved dependency tracking by changing the target format in import statements.
- Modified the function handling to distinguish between methods and top-level functions.
- Updated tests to use a unified extraction function and removed redundant file handling code.
- Cleaned up unused helper tests and ensured consistent handling of class and function definitions.
* Fix stale pointer bug in pyWalker and skip @overload stubs
Replace ownerStack/pendingRouteIndices pointer captures with slice indices
to prevent silently lost call edges and handler back-fills when w.out
reallocates its backing array during body traversal.
Skip @overload-decorated function definitions to avoid emitting duplicate
symbol facts for type-checker-only stubs that have no runtime behaviour.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update tree-sitter-python dependency to v0.23.6 in go.mod and go.sum
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 7d4c54b commit 1838322
6 files changed
Lines changed: 1690 additions & 515 deletions
File tree
- internal/extractors/pythonextractor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
0 commit comments