python

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 2 Imported by: 0

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.

Language is the single shared tree-sitter language instance for Python.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL