Documentation
¶
Index ¶
Constants ¶
View Source
const CallQueries = `
(call
function: (identifier) @callee) @call
(call
function: (attribute
attribute: (identifier) @callee)) @call
`
CallQueries captures direct function and method call sites in Python. Matches:
- plain calls: foo()
- attribute/method calls: obj.method()
View Source
const Queries = `` /* 228-byte string literal not displayed */
Queries contains tree-sitter query patterns for Python symbol extraction. Covers:
- top-level function definitions (def foo — direct children of module)
- class definitions (class Foo)
- method definitions (def foo inside a class body)
The @function pattern is anchored to module-level to avoid matching methods that are already captured by the @method pattern.
View Source
const RefQueries = `
(assignment
right: (identifier) @ref)
(pair
value: (identifier) @ref)
(keyword_argument
value: (identifier) @ref)
`
RefQueries captures identifiers used as values (not called directly) in:
- assignment statements: f = my_func (right-hand side plain identifier)
- dict literal values: {"handler": my_func}
- keyword arguments: handler=my_func
Combined with CallQueries in ExtractCalls so functions passed as values are recorded as "used" and do not appear as dead code.
Variables ¶
View Source
var Extensions = []string{".py", ".pyw"}
Extensions lists file extensions handled by the Python grammar.
View Source
var Language = tree_sitter.NewLanguage(tree_sitter_python.Language())
Language is the single shared tree-sitter language instance for Python.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.