rbtr-lang-python 2026.9.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rbtr_lang_python-2026.9.0.dev1/LICENSE +21 -0
- rbtr_lang_python-2026.9.0.dev1/PKG-INFO +68 -0
- rbtr_lang_python-2026.9.0.dev1/README.md +41 -0
- rbtr_lang_python-2026.9.0.dev1/pyproject.toml +58 -0
- rbtr_lang_python-2026.9.0.dev1/pyproject.toml.orig +62 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/__init__.py +1 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/plugin.py +120 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/py.typed +0 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/python.scm +68 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/__init__.py +0 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/__snapshots__/test_samples/test_edges_match_snapshot.json +3 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/__snapshots__/test_samples/test_extraction_matches_snapshot.json +534 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/cases_docstrings.py +174 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/cases_extraction.py +572 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/samples/python/config.py +3 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/samples/python/python.py +85 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/test_docstrings.py +54 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/test_extraction.py +138 -0
- rbtr_lang_python-2026.9.0.dev1/src/rbtr_lang_python/tests/test_samples.py +83 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alejandro Giacometti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rbtr-lang-python
|
|
3
|
+
Version: 2026.9.0.dev1
|
|
4
|
+
Summary: rbtr — Python language plugin
|
|
5
|
+
Keywords: code-search,code-index,tree-sitter,static-analysis,semantic-search,developer-tools,python
|
|
6
|
+
Author: Alejandro Giacometti
|
|
7
|
+
Author-email: Alejandro Giacometti <alejandro.giacometti@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: rbtr==2026.9.0.dev1
|
|
19
|
+
Requires-Dist: tree-sitter-python
|
|
20
|
+
Requires-Python: >=3.13
|
|
21
|
+
Project-URL: Homepage, https://github.com/janrito/rbtr
|
|
22
|
+
Project-URL: Repository, https://github.com/janrito/rbtr
|
|
23
|
+
Project-URL: Documentation, https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-python#readme
|
|
24
|
+
Project-URL: Issues, https://github.com/janrito/rbtr/issues
|
|
25
|
+
Project-URL: Changelog, https://github.com/janrito/rbtr/releases
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# rbtr-lang-python
|
|
29
|
+
|
|
30
|
+
Python support for [rbtr]. A **default** plugin — installed with rbtr
|
|
31
|
+
itself (`pip install rbtr`).
|
|
32
|
+
|
|
33
|
+
[rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
|
|
34
|
+
|
|
35
|
+
## What it ingests
|
|
36
|
+
|
|
37
|
+
- **Functions & methods** — `def` / `async def`; methods are scoped to their
|
|
38
|
+
enclosing class.
|
|
39
|
+
- **Classes** — class definitions (which also form a scope for their members).
|
|
40
|
+
- **Variables** — module-level assignments, including flat tuple unpacking.
|
|
41
|
+
Function locals and class attributes stay within their enclosing chunk.
|
|
42
|
+
- **Imports** — `import` and `from … import` (relative, aliased, multi-name)
|
|
43
|
+
→ import chunks with resolved module + names, for cross-file edges.
|
|
44
|
+
|
|
45
|
+
A symbol's docstring (the leading `"""…"""`) is folded into its chunk content.
|
|
46
|
+
|
|
47
|
+
## Chunks produced
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
def greet(name): ... # function "greet"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class User: # class "User"
|
|
54
|
+
def save(self): ... # method "save", scope "User"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
MAX = 100 # variable "MAX"
|
|
58
|
+
from .utils import helper # import, metadata {module: ".utils", names: "helper"}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Embedded / injected chunks
|
|
62
|
+
|
|
63
|
+
None of its own — Python is embedded *by* Markdown fenced code blocks, which
|
|
64
|
+
delegate ` ```python ` blocks here.
|
|
65
|
+
|
|
66
|
+
## Grammar & dependencies
|
|
67
|
+
|
|
68
|
+
Uses the `tree-sitter-python` grammar. No dependency on other language plugins.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# rbtr-lang-python
|
|
2
|
+
|
|
3
|
+
Python support for [rbtr]. A **default** plugin — installed with rbtr
|
|
4
|
+
itself (`pip install rbtr`).
|
|
5
|
+
|
|
6
|
+
[rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
|
|
7
|
+
|
|
8
|
+
## What it ingests
|
|
9
|
+
|
|
10
|
+
- **Functions & methods** — `def` / `async def`; methods are scoped to their
|
|
11
|
+
enclosing class.
|
|
12
|
+
- **Classes** — class definitions (which also form a scope for their members).
|
|
13
|
+
- **Variables** — module-level assignments, including flat tuple unpacking.
|
|
14
|
+
Function locals and class attributes stay within their enclosing chunk.
|
|
15
|
+
- **Imports** — `import` and `from … import` (relative, aliased, multi-name)
|
|
16
|
+
→ import chunks with resolved module + names, for cross-file edges.
|
|
17
|
+
|
|
18
|
+
A symbol's docstring (the leading `"""…"""`) is folded into its chunk content.
|
|
19
|
+
|
|
20
|
+
## Chunks produced
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
def greet(name): ... # function "greet"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class User: # class "User"
|
|
27
|
+
def save(self): ... # method "save", scope "User"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
MAX = 100 # variable "MAX"
|
|
31
|
+
from .utils import helper # import, metadata {module: ".utils", names: "helper"}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Embedded / injected chunks
|
|
35
|
+
|
|
36
|
+
None of its own — Python is embedded *by* Markdown fenced code blocks, which
|
|
37
|
+
delegate ` ```python ` blocks here.
|
|
38
|
+
|
|
39
|
+
## Grammar & dependencies
|
|
40
|
+
|
|
41
|
+
Uses the `tree-sitter-python` grammar. No dependency on other language plugins.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.26,<1"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[tool.uv.build-backend]
|
|
6
|
+
module-name = "rbtr_lang_python"
|
|
7
|
+
|
|
8
|
+
[tool.uv.sources.rbtr]
|
|
9
|
+
workspace = true
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "rbtr-lang-python"
|
|
13
|
+
version = "2026.9.0-dev1"
|
|
14
|
+
description = "rbtr — Python language plugin"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
license-files = ["LICENSE"]
|
|
18
|
+
keywords = [
|
|
19
|
+
"code-search",
|
|
20
|
+
"code-index",
|
|
21
|
+
"tree-sitter",
|
|
22
|
+
"static-analysis",
|
|
23
|
+
"semantic-search",
|
|
24
|
+
"developer-tools",
|
|
25
|
+
"python",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 4 - Beta",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"Programming Language :: Python",
|
|
31
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Topic :: Software Development :: Libraries",
|
|
34
|
+
"Topic :: Text Processing :: Indexing",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
requires-python = ">=3.13"
|
|
38
|
+
dependencies = [
|
|
39
|
+
"rbtr==2026.9.0-dev1",
|
|
40
|
+
"tree-sitter-python",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[project.authors]]
|
|
44
|
+
name = "Alejandro Giacometti"
|
|
45
|
+
email = "alejandro.giacometti@gmail.com"
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://github.com/janrito/rbtr"
|
|
49
|
+
Repository = "https://github.com/janrito/rbtr"
|
|
50
|
+
Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-python#readme"
|
|
51
|
+
Issues = "https://github.com/janrito/rbtr/issues"
|
|
52
|
+
Changelog = "https://github.com/janrito/rbtr/releases"
|
|
53
|
+
|
|
54
|
+
[project.entry-points."rbtr.languages"]
|
|
55
|
+
python = "rbtr_lang_python.plugin:python"
|
|
56
|
+
|
|
57
|
+
[dependency-groups]
|
|
58
|
+
dev = ["rbtr[test]"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.11.26,<1"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[tool.uv.build-backend]
|
|
6
|
+
module-name = "rbtr_lang_python"
|
|
7
|
+
# No source-exclude: the plugin's tests, samples, and snapshots ship
|
|
8
|
+
# with the wheel (they are the language's golden record), and python.scm
|
|
9
|
+
# ships as package data.
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "rbtr-lang-python"
|
|
13
|
+
version = "2026.9.0-dev1"
|
|
14
|
+
description = "rbtr — Python language plugin"
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
license-files = ["LICENSE"]
|
|
18
|
+
authors = [
|
|
19
|
+
{ name = "Alejandro Giacometti", email = "alejandro.giacometti@gmail.com" },
|
|
20
|
+
]
|
|
21
|
+
keywords = [
|
|
22
|
+
"code-search",
|
|
23
|
+
"code-index",
|
|
24
|
+
"tree-sitter",
|
|
25
|
+
"static-analysis",
|
|
26
|
+
"semantic-search",
|
|
27
|
+
"developer-tools",
|
|
28
|
+
"python",
|
|
29
|
+
]
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 4 - Beta",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"Programming Language :: Python",
|
|
34
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Software Development :: Libraries",
|
|
37
|
+
"Topic :: Text Processing :: Indexing",
|
|
38
|
+
"Typing :: Typed",
|
|
39
|
+
]
|
|
40
|
+
requires-python = ">=3.13"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"rbtr==2026.9.0-dev1",
|
|
43
|
+
"tree-sitter-python",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/janrito/rbtr"
|
|
48
|
+
Repository = "https://github.com/janrito/rbtr"
|
|
49
|
+
Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-python#readme"
|
|
50
|
+
Issues = "https://github.com/janrito/rbtr/issues"
|
|
51
|
+
Changelog = "https://github.com/janrito/rbtr/releases"
|
|
52
|
+
|
|
53
|
+
[project.entry-points."rbtr.languages"]
|
|
54
|
+
# The value resolves to the language's `LanguageRegistration` (named by its
|
|
55
|
+
# id) — see the rbtr ARCHITECTURE "External plugins" note.
|
|
56
|
+
python = "rbtr_lang_python.plugin:python"
|
|
57
|
+
|
|
58
|
+
[tool.uv.sources]
|
|
59
|
+
rbtr = { workspace = true }
|
|
60
|
+
|
|
61
|
+
[dependency-groups]
|
|
62
|
+
dev = ["rbtr[test]"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Python language plugin package."""
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Python language plugin.
|
|
2
|
+
|
|
3
|
+
Provides full support: symbol extraction (functions, classes,
|
|
4
|
+
methods, imports) and structured import metadata.
|
|
5
|
+
|
|
6
|
+
Extracted chunks::
|
|
7
|
+
|
|
8
|
+
def hello(): → function "hello", scope ""
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
class Config: → class "Config", scope ""
|
|
12
|
+
def load(self): → method "load", scope "Config"
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
import os → import, metadata {module: "os"}
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
→ import, metadata {module: "pathlib", names: "Path"}
|
|
18
|
+
from ..core import engine
|
|
19
|
+
→ import, metadata {dots: "2", module: "core",
|
|
20
|
+
names: "engine"}
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
from typing import TYPE_CHECKING
|
|
26
|
+
|
|
27
|
+
from rbtr.domain.models import ImportMeta
|
|
28
|
+
from rbtr.languages.registration import (
|
|
29
|
+
ImportResolver,
|
|
30
|
+
LanguageRegistration,
|
|
31
|
+
ModuleStyle,
|
|
32
|
+
QueryExtraction,
|
|
33
|
+
load_query,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
if TYPE_CHECKING:
|
|
37
|
+
from tree_sitter import Node
|
|
38
|
+
|
|
39
|
+
# ── Query ────────────────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
# The `@_docstring` sub-capture marks the first-statement body
|
|
42
|
+
# docstring for doc-range detection (used by `extract_doc_spans`
|
|
43
|
+
# and the eval query sampler). It is optional in the match
|
|
44
|
+
# (`?`), so functions/classes without a docstring still match.
|
|
45
|
+
|
|
46
|
+
# ── Import extractor ─────────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def extract_import_meta(
|
|
50
|
+
resolver: ImportResolver, node: Node, captures: dict[str, list[Node]]
|
|
51
|
+
) -> ImportMeta:
|
|
52
|
+
"""Extract structured import data from a Python import node.
|
|
53
|
+
|
|
54
|
+
Reads query captures (`@_import_module`, `@_import_dots`)
|
|
55
|
+
and walks the node for multi-valued import names (which
|
|
56
|
+
the query can't capture).
|
|
57
|
+
|
|
58
|
+
Examples:
|
|
59
|
+
|
|
60
|
+
`import os.path`:
|
|
61
|
+
module="os.path"
|
|
62
|
+
|
|
63
|
+
`from pathlib import Path`:
|
|
64
|
+
module="pathlib", names="Path"
|
|
65
|
+
|
|
66
|
+
`from ..core import engine`:
|
|
67
|
+
dots="2", module="core", names="engine"
|
|
68
|
+
|
|
69
|
+
`from .models import Chunk as C`:
|
|
70
|
+
dots="1", module="models", names="Chunk"
|
|
71
|
+
|
|
72
|
+
`from . import utils`:
|
|
73
|
+
dots="1", names="utils"
|
|
74
|
+
"""
|
|
75
|
+
meta = resolver(node, captures)
|
|
76
|
+
|
|
77
|
+
# Convert @_import_dots from raw import_prefix (e.g. "..")
|
|
78
|
+
# to a count string.
|
|
79
|
+
dots_nodes = captures.get("_import_dots", [])
|
|
80
|
+
if dots_nodes and dots_nodes[0].text:
|
|
81
|
+
meta.dots = str(dots_nodes[0].text.decode().count("."))
|
|
82
|
+
|
|
83
|
+
if node.type == "import_from_statement":
|
|
84
|
+
# Imported names. The `name` field can be dotted_name
|
|
85
|
+
# or aliased_import; there may be multiple `name` fields.
|
|
86
|
+
names: list[str] = []
|
|
87
|
+
for name_node in node.children_by_field_name("name"):
|
|
88
|
+
match name_node.type:
|
|
89
|
+
case "dotted_name":
|
|
90
|
+
if name_node.text:
|
|
91
|
+
names.append(name_node.text.decode())
|
|
92
|
+
case "aliased_import":
|
|
93
|
+
original = name_node.child_by_field_name("name")
|
|
94
|
+
if original and original.text:
|
|
95
|
+
names.append(original.text.decode())
|
|
96
|
+
if names:
|
|
97
|
+
meta.names = ",".join(names)
|
|
98
|
+
|
|
99
|
+
return meta
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# ── Plugin ───────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
python = LanguageRegistration(
|
|
106
|
+
id="python",
|
|
107
|
+
extensions=frozenset({".py", ".pyi"}),
|
|
108
|
+
grammar_module="tree_sitter_python",
|
|
109
|
+
extraction=QueryExtraction(
|
|
110
|
+
query=load_query(__package__, "python"),
|
|
111
|
+
scope_types=frozenset({"class_definition", "function_definition"}),
|
|
112
|
+
class_scope_types=frozenset({"class_definition"}),
|
|
113
|
+
),
|
|
114
|
+
index_files=frozenset({"__init__.py"}),
|
|
115
|
+
source_roots=("", "src"),
|
|
116
|
+
module_style=ModuleStyle.DOTTED,
|
|
117
|
+
extraction_serial=6,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
python.import_extractor(extract_import_meta)
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
; Comments and the module docstring. The engine groups comments into
|
|
2
|
+
; blank-line-delimited blocks and either folds a block into the symbol flush
|
|
3
|
+
; after it (its docstring, possibly nested), drops it if interior, or emits
|
|
4
|
+
; it as a standalone COMMENT chunk.
|
|
5
|
+
(comment) @comment
|
|
6
|
+
(module (expression_statement (string) @comment))
|
|
7
|
+
|
|
8
|
+
(function_definition
|
|
9
|
+
name: (identifier) @_fn_name
|
|
10
|
+
body: (block
|
|
11
|
+
. (expression_statement (string) @_docstring)?)) @function
|
|
12
|
+
|
|
13
|
+
(class_definition
|
|
14
|
+
name: (identifier) @_cls_name
|
|
15
|
+
body: (block
|
|
16
|
+
. (expression_statement (string) @_docstring)?)) @class
|
|
17
|
+
|
|
18
|
+
(type_alias_statement
|
|
19
|
+
. (type (identifier) @_cls_name)) @class
|
|
20
|
+
|
|
21
|
+
(module
|
|
22
|
+
(expression_statement
|
|
23
|
+
(assignment
|
|
24
|
+
left: (identifier) @_var_name) @variable))
|
|
25
|
+
|
|
26
|
+
(module
|
|
27
|
+
(expression_statement
|
|
28
|
+
(assignment
|
|
29
|
+
left: (pattern_list (identifier) @_var_name)) @variable))
|
|
30
|
+
|
|
31
|
+
(module
|
|
32
|
+
(expression_statement
|
|
33
|
+
(assignment
|
|
34
|
+
left: (tuple_pattern (identifier) @_var_name)) @variable))
|
|
35
|
+
|
|
36
|
+
(module
|
|
37
|
+
(expression_statement
|
|
38
|
+
(assignment
|
|
39
|
+
left: (list_pattern (identifier) @_var_name)) @variable))
|
|
40
|
+
|
|
41
|
+
(module
|
|
42
|
+
(expression_statement
|
|
43
|
+
(assignment
|
|
44
|
+
left: (pattern_list (list_splat_pattern (identifier) @_var_name))) @variable))
|
|
45
|
+
|
|
46
|
+
(import_statement
|
|
47
|
+
name: (dotted_name) @_import_module) @import
|
|
48
|
+
|
|
49
|
+
; `import numpy as np` nests the module inside the alias.
|
|
50
|
+
(import_statement
|
|
51
|
+
name: (aliased_import
|
|
52
|
+
name: (dotted_name) @_import_module)) @import
|
|
53
|
+
|
|
54
|
+
(import_from_statement
|
|
55
|
+
module_name: (dotted_name) @_import_module) @import
|
|
56
|
+
|
|
57
|
+
(import_from_statement
|
|
58
|
+
module_name: (relative_import
|
|
59
|
+
(import_prefix) @_import_dots
|
|
60
|
+
(dotted_name) @_import_module)) @import
|
|
61
|
+
|
|
62
|
+
(import_from_statement
|
|
63
|
+
module_name: (relative_import
|
|
64
|
+
(import_prefix) @_import_dots .)) @import
|
|
65
|
+
|
|
66
|
+
; `from __future__ import annotations` has its own node type, and is an
|
|
67
|
+
; import like any other.
|
|
68
|
+
(future_import_statement) @import
|
|
File without changes
|