/** * SMI-4293: Python Tree-Sitter Query Strings * * TypeScript-consumable tree-sitter queries used by the PythonAdapter * when the WASM parser is available. Paired with python.scm for reference * but this module is what runtime code imports (loadable without fs reads). * * These queries drive the query-based extraction path that replaces the * regex fallback. The extraction must match-or-exceed the regex baseline; * see queryExtractionMatchesOrExceedsRegex.test.ts (finding H3). * * @see docs/internal/implementation/github-wave-5c-tree-sitter-incremental.md * @module analysis/tree-sitter/queries/python */ /** * Query capturing `import x`, `import x as y`, `import x.y.z`. */ export declare const PYTHON_IMPORT_QUERY = "\n(import_statement\n name: (dotted_name) @import.module)\n\n(import_statement\n name: (aliased_import\n name: (dotted_name) @import.module\n alias: (identifier) @import.alias))\n"; /** * Query capturing `from module import name`, aliased imports, and wildcard. * Relative imports (`from .x import y`) capture the dotted_name portion as * the module name; the leading dots are preserved via relative_import wrapping. */ export declare const PYTHON_FROM_IMPORT_QUERY = "\n(import_from_statement\n module_name: (dotted_name) @from.module\n name: (dotted_name) @from.name)\n\n(import_from_statement\n module_name: (dotted_name) @from.module\n name: (aliased_import\n name: (dotted_name) @from.name\n alias: (identifier) @from.alias))\n\n(import_from_statement\n module_name: (dotted_name) @from.module\n (wildcard_import) @from.wildcard)\n\n(import_from_statement\n module_name: (relative_import) @from.module\n name: (_) @from.name)\n"; /** * Query capturing top-level and nested function definitions. * `async` is a child marker when present; we detect it via node type. */ export declare const PYTHON_FUNCTION_QUERY = "\n(function_definition\n name: (identifier) @function.name\n parameters: (parameters) @function.params) @function.def\n"; /** * Query capturing class definitions. */ export declare const PYTHON_CLASS_QUERY = "\n(class_definition\n name: (identifier) @class.name) @class.def\n"; /** * Query capturing `__all__ = [...]` export declarations. */ export declare const PYTHON_ALL_EXPORT_QUERY = "\n(assignment\n left: (identifier) @all.var\n right: (list\n (string) @all.name)\n (#eq? @all.var \"__all__\"))\n"; /** * Combined query used for a single pass over the tree. * Keeps capture names namespaced so extraction can partition results. */ export declare const PYTHON_COMBINED_QUERY: string; //# sourceMappingURL=python.d.ts.map