tree-sitter-analyzer 0.2.0__py3-none-any.whl → 0.4.0__py3-none-any.whl
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.
Potentially problematic release.
This version of tree-sitter-analyzer might be problematic. Click here for more details.
- tree_sitter_analyzer/__init__.py +134 -121
- tree_sitter_analyzer/__main__.py +11 -12
- tree_sitter_analyzer/api.py +533 -539
- tree_sitter_analyzer/cli/__init__.py +39 -39
- tree_sitter_analyzer/cli/__main__.py +12 -13
- tree_sitter_analyzer/cli/commands/__init__.py +26 -27
- tree_sitter_analyzer/cli/commands/advanced_command.py +88 -88
- tree_sitter_analyzer/cli/commands/base_command.py +160 -155
- tree_sitter_analyzer/cli/commands/default_command.py +18 -19
- tree_sitter_analyzer/cli/commands/partial_read_command.py +141 -133
- tree_sitter_analyzer/cli/commands/query_command.py +81 -82
- tree_sitter_analyzer/cli/commands/structure_command.py +138 -121
- tree_sitter_analyzer/cli/commands/summary_command.py +101 -93
- tree_sitter_analyzer/cli/commands/table_command.py +235 -233
- tree_sitter_analyzer/cli/info_commands.py +120 -121
- tree_sitter_analyzer/cli_main.py +278 -276
- tree_sitter_analyzer/core/__init__.py +15 -20
- tree_sitter_analyzer/core/analysis_engine.py +555 -574
- tree_sitter_analyzer/core/cache_service.py +320 -330
- tree_sitter_analyzer/core/engine.py +559 -560
- tree_sitter_analyzer/core/parser.py +293 -288
- tree_sitter_analyzer/core/query.py +502 -502
- tree_sitter_analyzer/encoding_utils.py +456 -460
- tree_sitter_analyzer/exceptions.py +337 -340
- tree_sitter_analyzer/file_handler.py +210 -222
- tree_sitter_analyzer/formatters/__init__.py +1 -1
- tree_sitter_analyzer/formatters/base_formatter.py +167 -168
- tree_sitter_analyzer/formatters/formatter_factory.py +78 -74
- tree_sitter_analyzer/formatters/java_formatter.py +291 -270
- tree_sitter_analyzer/formatters/python_formatter.py +259 -235
- tree_sitter_analyzer/interfaces/__init__.py +9 -10
- tree_sitter_analyzer/interfaces/cli.py +528 -557
- tree_sitter_analyzer/interfaces/cli_adapter.py +343 -319
- tree_sitter_analyzer/interfaces/mcp_adapter.py +206 -170
- tree_sitter_analyzer/interfaces/mcp_server.py +405 -416
- tree_sitter_analyzer/java_analyzer.py +187 -219
- tree_sitter_analyzer/language_detector.py +398 -400
- tree_sitter_analyzer/language_loader.py +224 -228
- tree_sitter_analyzer/languages/__init__.py +10 -11
- tree_sitter_analyzer/languages/java_plugin.py +1174 -1113
- tree_sitter_analyzer/{plugins → languages}/javascript_plugin.py +446 -439
- tree_sitter_analyzer/languages/python_plugin.py +747 -712
- tree_sitter_analyzer/mcp/__init__.py +31 -32
- tree_sitter_analyzer/mcp/resources/__init__.py +44 -47
- tree_sitter_analyzer/mcp/resources/code_file_resource.py +209 -213
- tree_sitter_analyzer/mcp/resources/project_stats_resource.py +555 -550
- tree_sitter_analyzer/mcp/server.py +333 -345
- tree_sitter_analyzer/mcp/tools/__init__.py +30 -31
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +654 -557
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +247 -245
- tree_sitter_analyzer/mcp/tools/base_tool.py +54 -55
- tree_sitter_analyzer/mcp/tools/read_partial_tool.py +300 -302
- tree_sitter_analyzer/mcp/tools/table_format_tool.py +362 -359
- tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +543 -476
- tree_sitter_analyzer/mcp/utils/__init__.py +107 -106
- tree_sitter_analyzer/mcp/utils/error_handler.py +549 -549
- tree_sitter_analyzer/models.py +470 -481
- tree_sitter_analyzer/output_manager.py +255 -264
- tree_sitter_analyzer/plugins/__init__.py +280 -334
- tree_sitter_analyzer/plugins/base.py +496 -446
- tree_sitter_analyzer/plugins/manager.py +379 -355
- tree_sitter_analyzer/queries/__init__.py +26 -27
- tree_sitter_analyzer/queries/java.py +391 -394
- tree_sitter_analyzer/queries/javascript.py +148 -149
- tree_sitter_analyzer/queries/python.py +285 -286
- tree_sitter_analyzer/queries/typescript.py +229 -230
- tree_sitter_analyzer/query_loader.py +257 -260
- tree_sitter_analyzer/table_formatter.py +471 -448
- tree_sitter_analyzer/utils.py +277 -277
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.4.0.dist-info}/METADATA +23 -8
- tree_sitter_analyzer-0.4.0.dist-info/RECORD +73 -0
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.4.0.dist-info}/entry_points.txt +2 -1
- tree_sitter_analyzer/plugins/java_plugin.py +0 -625
- tree_sitter_analyzer/plugins/plugin_loader.py +0 -83
- tree_sitter_analyzer/plugins/python_plugin.py +0 -598
- tree_sitter_analyzer/plugins/registry.py +0 -366
- tree_sitter_analyzer-0.2.0.dist-info/RECORD +0 -77
- {tree_sitter_analyzer-0.2.0.dist-info → tree_sitter_analyzer-0.4.0.dist-info}/WHEEL +0 -0
|
@@ -1,286 +1,285 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(decorator
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
(await
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
(lambda
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
"
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"
|
|
220
|
-
|
|
221
|
-
"
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
},
|
|
232
|
-
"
|
|
233
|
-
|
|
234
|
-
"
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
"
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
"
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
"
|
|
250
|
-
|
|
251
|
-
"
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
"
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
"
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return list(ALL_QUERIES.keys())
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Python Tree-sitter queries for code analysis.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# Function definitions
|
|
7
|
+
FUNCTIONS = """
|
|
8
|
+
(function_definition
|
|
9
|
+
name: (identifier) @function.name
|
|
10
|
+
parameters: (parameters) @function.params
|
|
11
|
+
body: (block) @function.body) @function.definition
|
|
12
|
+
|
|
13
|
+
(function_definition
|
|
14
|
+
name: (identifier) @function.name
|
|
15
|
+
parameters: (parameters) @function.params
|
|
16
|
+
body: (block) @function.body) @function.async
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
# Class definitions
|
|
20
|
+
CLASSES = """
|
|
21
|
+
(class_definition
|
|
22
|
+
name: (identifier) @class.name
|
|
23
|
+
superclasses: (argument_list)? @class.superclasses
|
|
24
|
+
body: (block) @class.body) @class.definition
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
# Import statements
|
|
28
|
+
IMPORTS = """
|
|
29
|
+
(import_statement
|
|
30
|
+
name: (dotted_name) @import.name) @import.statement
|
|
31
|
+
|
|
32
|
+
(import_from_statement
|
|
33
|
+
module_name: (dotted_name)? @import.module
|
|
34
|
+
name: (dotted_name) @import.name) @import.from
|
|
35
|
+
|
|
36
|
+
(import_from_statement
|
|
37
|
+
module_name: (dotted_name)? @import.module
|
|
38
|
+
name: (import_list) @import.list) @import.from_list
|
|
39
|
+
|
|
40
|
+
(aliased_import
|
|
41
|
+
name: (dotted_name) @import.name
|
|
42
|
+
alias: (identifier) @import.alias) @import.aliased
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
# Variable assignments
|
|
46
|
+
VARIABLES = """
|
|
47
|
+
(assignment
|
|
48
|
+
left: (identifier) @variable.name
|
|
49
|
+
right: (_) @variable.value) @variable.assignment
|
|
50
|
+
|
|
51
|
+
(assignment
|
|
52
|
+
left: (pattern_list) @variable.pattern
|
|
53
|
+
right: (_) @variable.value) @variable.multiple
|
|
54
|
+
|
|
55
|
+
(augmented_assignment
|
|
56
|
+
left: (identifier) @variable.name
|
|
57
|
+
right: (_) @variable.value) @variable.augmented
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
# Decorators
|
|
61
|
+
DECORATORS = """
|
|
62
|
+
(decorator
|
|
63
|
+
(identifier) @decorator.name) @decorator.simple
|
|
64
|
+
|
|
65
|
+
(decorator
|
|
66
|
+
(call
|
|
67
|
+
function: (identifier) @decorator.name
|
|
68
|
+
arguments: (argument_list) @decorator.args)) @decorator.call
|
|
69
|
+
|
|
70
|
+
(decorator
|
|
71
|
+
(attribute
|
|
72
|
+
object: (identifier) @decorator.object
|
|
73
|
+
attribute: (identifier) @decorator.name)) @decorator.attribute
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
# Method definitions
|
|
77
|
+
METHODS = """
|
|
78
|
+
(function_definition
|
|
79
|
+
name: (identifier) @method.name
|
|
80
|
+
parameters: (parameters
|
|
81
|
+
(identifier) @method.self
|
|
82
|
+
. (_)*) @method.params
|
|
83
|
+
body: (block) @method.body) @method.definition
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
# Exception handling
|
|
87
|
+
EXCEPTIONS = """
|
|
88
|
+
(try_statement
|
|
89
|
+
body: (block) @try.body
|
|
90
|
+
(except_clause
|
|
91
|
+
type: (_)? @except.type
|
|
92
|
+
name: (identifier)? @except.name
|
|
93
|
+
body: (block) @except.body)*
|
|
94
|
+
(else_clause
|
|
95
|
+
body: (block) @else.body)?
|
|
96
|
+
(finally_clause
|
|
97
|
+
body: (block) @finally.body)?) @try.statement
|
|
98
|
+
|
|
99
|
+
(raise_statement
|
|
100
|
+
(call
|
|
101
|
+
function: (identifier) @exception.name
|
|
102
|
+
arguments: (argument_list)? @exception.args)) @raise.statement
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
# Comprehensions
|
|
106
|
+
COMPREHENSIONS = """
|
|
107
|
+
(list_comprehension
|
|
108
|
+
body: (_) @comprehension.body
|
|
109
|
+
(for_in_clause
|
|
110
|
+
left: (_) @comprehension.var
|
|
111
|
+
right: (_) @comprehension.iter)) @list.comprehension
|
|
112
|
+
|
|
113
|
+
(dictionary_comprehension
|
|
114
|
+
body: (pair
|
|
115
|
+
key: (_) @comprehension.key
|
|
116
|
+
value: (_) @comprehension.value)
|
|
117
|
+
(for_in_clause
|
|
118
|
+
left: (_) @comprehension.var
|
|
119
|
+
right: (_) @comprehension.iter)) @dict.comprehension
|
|
120
|
+
|
|
121
|
+
(set_comprehension
|
|
122
|
+
body: (_) @comprehension.body
|
|
123
|
+
(for_in_clause
|
|
124
|
+
left: (_) @comprehension.var
|
|
125
|
+
right: (_) @comprehension.iter)) @set.comprehension
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
# Comments and docstrings
|
|
129
|
+
COMMENTS = """
|
|
130
|
+
(comment) @comment
|
|
131
|
+
|
|
132
|
+
(expression_statement
|
|
133
|
+
(string) @docstring)
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
# Type hints and annotations
|
|
137
|
+
TYPE_HINTS = """
|
|
138
|
+
(function_definition
|
|
139
|
+
parameters: (parameters
|
|
140
|
+
(typed_parameter
|
|
141
|
+
type: (_) @type.param)) @type.function_param)
|
|
142
|
+
|
|
143
|
+
(function_definition
|
|
144
|
+
return_type: (_) @type.return) @type.function_return
|
|
145
|
+
|
|
146
|
+
(assignment
|
|
147
|
+
type: (_) @type.variable) @type.variable_annotation
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
# Async/await patterns
|
|
151
|
+
ASYNC_PATTERNS = """
|
|
152
|
+
(function_definition) @async.function
|
|
153
|
+
|
|
154
|
+
(await
|
|
155
|
+
(call) @async.await_call) @async.await
|
|
156
|
+
|
|
157
|
+
(async_for_statement) @async.for
|
|
158
|
+
|
|
159
|
+
(async_with_statement) @async.with
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
# F-strings and string formatting
|
|
163
|
+
STRING_FORMATTING = """
|
|
164
|
+
(formatted_string
|
|
165
|
+
(interpolation) @string.interpolation) @string.fstring
|
|
166
|
+
|
|
167
|
+
(call
|
|
168
|
+
function: (attribute
|
|
169
|
+
object: (_)
|
|
170
|
+
attribute: (identifier) @string.format_method))
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
# Context managers
|
|
174
|
+
CONTEXT_MANAGERS = """
|
|
175
|
+
(with_statement
|
|
176
|
+
(with_clause
|
|
177
|
+
(with_item
|
|
178
|
+
value: (_) @context.manager)) @context.clause) @context.with
|
|
179
|
+
|
|
180
|
+
(async_with_statement
|
|
181
|
+
(with_clause
|
|
182
|
+
(with_item
|
|
183
|
+
value: (_) @context.manager)) @context.clause) @context.async_with
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
# Lambda expressions
|
|
187
|
+
LAMBDAS = """
|
|
188
|
+
(lambda
|
|
189
|
+
parameters: (lambda_parameters)? @lambda.params
|
|
190
|
+
body: (_) @lambda.body) @lambda.expression
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
# Modern Python patterns
|
|
194
|
+
MODERN_PATTERNS = """
|
|
195
|
+
(match_statement
|
|
196
|
+
subject: (_) @match.subject
|
|
197
|
+
body: (case_clause)+ @match.cases) @pattern.match
|
|
198
|
+
|
|
199
|
+
(case_clause
|
|
200
|
+
pattern: (_) @case.pattern
|
|
201
|
+
guard: (_)? @case.guard
|
|
202
|
+
consequence: (block) @case.body) @pattern.case
|
|
203
|
+
|
|
204
|
+
(walrus_operator
|
|
205
|
+
left: (_) @walrus.target
|
|
206
|
+
right: (_) @walrus.value) @assignment.walrus
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
# All queries combined
|
|
210
|
+
ALL_QUERIES = {
|
|
211
|
+
"functions": {
|
|
212
|
+
"query": FUNCTIONS,
|
|
213
|
+
"description": "すべての関数定義(async含む)を検索",
|
|
214
|
+
},
|
|
215
|
+
"classes": {"query": CLASSES, "description": "すべてのクラス定義を検索"},
|
|
216
|
+
"imports": {"query": IMPORTS, "description": "すべてのインポート文を検索"},
|
|
217
|
+
"variables": {"query": VARIABLES, "description": "すべての変数代入を検索"},
|
|
218
|
+
"decorators": {"query": DECORATORS, "description": "すべてのデコレータを検索"},
|
|
219
|
+
"methods": {
|
|
220
|
+
"query": METHODS,
|
|
221
|
+
"description": "クラス内のすべてのメソッド定義を検索",
|
|
222
|
+
},
|
|
223
|
+
"exceptions": {
|
|
224
|
+
"query": EXCEPTIONS,
|
|
225
|
+
"description": "例外処理とraise文を検索",
|
|
226
|
+
},
|
|
227
|
+
"comprehensions": {
|
|
228
|
+
"query": COMPREHENSIONS,
|
|
229
|
+
"description": "リスト、辞書、セット内包表記を検索",
|
|
230
|
+
},
|
|
231
|
+
"comments": {"query": COMMENTS, "description": "コメントとdocstringを検索"},
|
|
232
|
+
"type_hints": {
|
|
233
|
+
"query": TYPE_HINTS,
|
|
234
|
+
"description": "型ヒントとアノテーションを検索",
|
|
235
|
+
},
|
|
236
|
+
"async_patterns": {
|
|
237
|
+
"query": ASYNC_PATTERNS,
|
|
238
|
+
"description": "async/awaitパターンを検索",
|
|
239
|
+
},
|
|
240
|
+
"string_formatting": {
|
|
241
|
+
"query": STRING_FORMATTING,
|
|
242
|
+
"description": "f文字列と文字列フォーマットを検索",
|
|
243
|
+
},
|
|
244
|
+
"context_managers": {
|
|
245
|
+
"query": CONTEXT_MANAGERS,
|
|
246
|
+
"description": "コンテキストマネージャー(with文)を検索",
|
|
247
|
+
},
|
|
248
|
+
"lambdas": {"query": LAMBDAS, "description": "ラムダ式を検索"},
|
|
249
|
+
"modern_patterns": {
|
|
250
|
+
"query": MODERN_PATTERNS,
|
|
251
|
+
"description": "モダンなPythonパターン(match/case、セイウチ演算子)を検索",
|
|
252
|
+
},
|
|
253
|
+
# Convenience aliases
|
|
254
|
+
"function_names": {
|
|
255
|
+
"query": FUNCTIONS,
|
|
256
|
+
"description": "関数のエイリアス - すべての関数定義を検索",
|
|
257
|
+
},
|
|
258
|
+
"class_names": {
|
|
259
|
+
"query": CLASSES,
|
|
260
|
+
"description": "クラスのエイリアス - すべてのクラス定義を検索",
|
|
261
|
+
},
|
|
262
|
+
"all_declarations": {
|
|
263
|
+
"query": FUNCTIONS + "\n\n" + CLASSES + "\n\n" + VARIABLES,
|
|
264
|
+
"description": "すべての関数、クラス、変数宣言を検索",
|
|
265
|
+
},
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def get_query(name: str) -> str:
|
|
270
|
+
"""Get a specific query by name."""
|
|
271
|
+
if name in ALL_QUERIES:
|
|
272
|
+
return ALL_QUERIES[name]["query"]
|
|
273
|
+
raise ValueError(
|
|
274
|
+
f"Query '{name}' not found. Available queries: {list(ALL_QUERIES.keys())}"
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def get_all_queries() -> dict:
|
|
279
|
+
"""Get all available queries."""
|
|
280
|
+
return ALL_QUERIES
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def list_queries() -> list:
|
|
284
|
+
"""List all available query names."""
|
|
285
|
+
return list(ALL_QUERIES.keys())
|