openrewrite-remote 0.3.5__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.
@@ -1,1873 +0,0 @@
1
- from pathlib import Path
2
- from typing import Optional, Any, cast, Type, Callable
3
- from uuid import UUID
4
-
5
- from rewrite import Cursor, Checksum, FileAttributes, Tree
6
- from rewrite.python import *
7
- from rewrite.python.support_types import *
8
- from rewrite.python.visitor import PythonVisitor
9
- from rewrite.java import *
10
-
11
- from rewrite.remote import Receiver, ReceiverContext, T, ReceiverFactory
12
- from . import extensions
13
-
14
- class PythonReceiver(Receiver):
15
- def fork(self, ctx: ReceiverContext) -> ReceiverContext:
16
- return ctx.fork(self.Visitor(), self.Factory())
17
-
18
- def receive(self, before: Optional[T], ctx: ReceiverContext) -> Any:
19
- forked = self.fork(ctx)
20
- return forked.visitor.visit(before, forked)
21
-
22
- # noinspection DuplicatedCode,PyMethodFirstArgAssignment,PyTypeChecker
23
- class Visitor(PythonVisitor[ReceiverContext]):
24
- def visit(self, tree: Optional[Tree], ctx: ReceiverContext, parent: Optional[Cursor] = None) -> Optional[J]:
25
- if parent is not None:
26
- self.cursor = parent
27
-
28
- self.cursor = Cursor(self.cursor, tree)
29
-
30
- tree = ctx.receive_node(cast(J, tree), ctx.receive_tree)
31
-
32
- self.cursor = self.cursor.parent
33
- return cast(J, tree)
34
-
35
- def visit_python_binary(self, binary: Binary, ctx: ReceiverContext) -> J:
36
- binary = binary.with_id(ctx.receive_value(binary.id, UUID))
37
- binary = binary.with_prefix(ctx.receive_node(binary.prefix, PythonReceiver.receive_space))
38
- binary = binary.with_markers(ctx.receive_node(binary.markers, ctx.receive_markers))
39
- binary = binary.with_left(ctx.receive_node(binary.left, ctx.receive_tree))
40
- binary = binary.padding.with_operator(ctx.receive_node(binary.padding.operator, PythonReceiver.left_padded_value_receiver(Binary.Type)))
41
- binary = binary.with_negation(ctx.receive_node(binary.negation, PythonReceiver.receive_space))
42
- binary = binary.with_right(ctx.receive_node(binary.right, ctx.receive_tree))
43
- binary = binary.with_type(ctx.receive_value(binary.type, JavaType))
44
- return binary
45
-
46
- def visit_exception_type(self, exception_type: ExceptionType, ctx: ReceiverContext) -> J:
47
- exception_type = exception_type.with_id(ctx.receive_value(exception_type.id, UUID))
48
- exception_type = exception_type.with_prefix(ctx.receive_node(exception_type.prefix, PythonReceiver.receive_space))
49
- exception_type = exception_type.with_markers(ctx.receive_node(exception_type.markers, ctx.receive_markers))
50
- exception_type = exception_type.with_type(ctx.receive_value(exception_type.type, JavaType))
51
- exception_type = exception_type.with_exception_group(ctx.receive_value(exception_type.exception_group, bool))
52
- exception_type = exception_type.with_expression(ctx.receive_node(exception_type.expression, ctx.receive_tree))
53
- return exception_type
54
-
55
- def visit_type_hint(self, type_hint: TypeHint, ctx: ReceiverContext) -> J:
56
- type_hint = type_hint.with_id(ctx.receive_value(type_hint.id, UUID))
57
- type_hint = type_hint.with_prefix(ctx.receive_node(type_hint.prefix, PythonReceiver.receive_space))
58
- type_hint = type_hint.with_markers(ctx.receive_node(type_hint.markers, ctx.receive_markers))
59
- type_hint = type_hint.with_type_tree(ctx.receive_node(type_hint.type_tree, ctx.receive_tree))
60
- type_hint = type_hint.with_type(ctx.receive_value(type_hint.type, JavaType))
61
- return type_hint
62
-
63
- def visit_compilation_unit(self, compilation_unit: CompilationUnit, ctx: ReceiverContext) -> J:
64
- compilation_unit = compilation_unit.with_id(ctx.receive_value(compilation_unit.id, UUID))
65
- compilation_unit = compilation_unit.with_prefix(ctx.receive_node(compilation_unit.prefix, PythonReceiver.receive_space))
66
- compilation_unit = compilation_unit.with_markers(ctx.receive_node(compilation_unit.markers, ctx.receive_markers))
67
- compilation_unit = compilation_unit.with_source_path(ctx.receive_value(compilation_unit.source_path, Path))
68
- compilation_unit = compilation_unit.with_file_attributes(ctx.receive_value(compilation_unit.file_attributes, FileAttributes))
69
- compilation_unit = compilation_unit.with_charset_name(ctx.receive_value(compilation_unit.charset_name, str))
70
- compilation_unit = compilation_unit.with_charset_bom_marked(ctx.receive_value(compilation_unit.charset_bom_marked, bool))
71
- compilation_unit = compilation_unit.with_checksum(ctx.receive_value(compilation_unit.checksum, Checksum))
72
- compilation_unit = compilation_unit.padding.with_imports(ctx.receive_nodes(compilation_unit.padding.imports, PythonReceiver.receive_right_padded_tree))
73
- compilation_unit = compilation_unit.padding.with_statements(ctx.receive_nodes(compilation_unit.padding.statements, PythonReceiver.receive_right_padded_tree))
74
- compilation_unit = compilation_unit.with_eof(ctx.receive_node(compilation_unit.eof, PythonReceiver.receive_space))
75
- return compilation_unit
76
-
77
- def visit_expression_statement(self, expression_statement: ExpressionStatement, ctx: ReceiverContext) -> J:
78
- expression_statement = expression_statement.with_id(ctx.receive_value(expression_statement.id, UUID))
79
- expression_statement = expression_statement.with_expression(ctx.receive_node(expression_statement.expression, ctx.receive_tree))
80
- return expression_statement
81
-
82
- def visit_statement_expression(self, statement_expression: StatementExpression, ctx: ReceiverContext) -> J:
83
- statement_expression = statement_expression.with_id(ctx.receive_value(statement_expression.id, UUID))
84
- statement_expression = statement_expression.with_statement(ctx.receive_node(statement_expression.statement, ctx.receive_tree))
85
- return statement_expression
86
-
87
- def visit_multi_import(self, multi_import: MultiImport, ctx: ReceiverContext) -> J:
88
- multi_import = multi_import.with_id(ctx.receive_value(multi_import.id, UUID))
89
- multi_import = multi_import.with_prefix(ctx.receive_node(multi_import.prefix, PythonReceiver.receive_space))
90
- multi_import = multi_import.with_markers(ctx.receive_node(multi_import.markers, ctx.receive_markers))
91
- multi_import = multi_import.padding.with_from(ctx.receive_node(multi_import.padding.from_, PythonReceiver.receive_right_padded_tree))
92
- multi_import = multi_import.with_parenthesized(ctx.receive_value(multi_import.parenthesized, bool))
93
- multi_import = multi_import.padding.with_names(ctx.receive_node(multi_import.padding.names, PythonReceiver.receive_container))
94
- return multi_import
95
-
96
- def visit_key_value(self, key_value: KeyValue, ctx: ReceiverContext) -> J:
97
- key_value = key_value.with_id(ctx.receive_value(key_value.id, UUID))
98
- key_value = key_value.with_prefix(ctx.receive_node(key_value.prefix, PythonReceiver.receive_space))
99
- key_value = key_value.with_markers(ctx.receive_node(key_value.markers, ctx.receive_markers))
100
- key_value = key_value.padding.with_key(ctx.receive_node(key_value.padding.key, PythonReceiver.receive_right_padded_tree))
101
- key_value = key_value.with_value(ctx.receive_node(key_value.value, ctx.receive_tree))
102
- key_value = key_value.with_type(ctx.receive_value(key_value.type, JavaType))
103
- return key_value
104
-
105
- def visit_dict_literal(self, dict_literal: DictLiteral, ctx: ReceiverContext) -> J:
106
- dict_literal = dict_literal.with_id(ctx.receive_value(dict_literal.id, UUID))
107
- dict_literal = dict_literal.with_prefix(ctx.receive_node(dict_literal.prefix, PythonReceiver.receive_space))
108
- dict_literal = dict_literal.with_markers(ctx.receive_node(dict_literal.markers, ctx.receive_markers))
109
- dict_literal = dict_literal.padding.with_elements(ctx.receive_node(dict_literal.padding.elements, PythonReceiver.receive_container))
110
- dict_literal = dict_literal.with_type(ctx.receive_value(dict_literal.type, JavaType))
111
- return dict_literal
112
-
113
- def visit_collection_literal(self, collection_literal: CollectionLiteral, ctx: ReceiverContext) -> J:
114
- collection_literal = collection_literal.with_id(ctx.receive_value(collection_literal.id, UUID))
115
- collection_literal = collection_literal.with_prefix(ctx.receive_node(collection_literal.prefix, PythonReceiver.receive_space))
116
- collection_literal = collection_literal.with_markers(ctx.receive_node(collection_literal.markers, ctx.receive_markers))
117
- collection_literal = collection_literal.with_kind(ctx.receive_value(collection_literal.kind, CollectionLiteral.Kind))
118
- collection_literal = collection_literal.padding.with_elements(ctx.receive_node(collection_literal.padding.elements, PythonReceiver.receive_container))
119
- collection_literal = collection_literal.with_type(ctx.receive_value(collection_literal.type, JavaType))
120
- return collection_literal
121
-
122
- def visit_formatted_string(self, formatted_string: FormattedString, ctx: ReceiverContext) -> J:
123
- formatted_string = formatted_string.with_id(ctx.receive_value(formatted_string.id, UUID))
124
- formatted_string = formatted_string.with_prefix(ctx.receive_node(formatted_string.prefix, PythonReceiver.receive_space))
125
- formatted_string = formatted_string.with_markers(ctx.receive_node(formatted_string.markers, ctx.receive_markers))
126
- formatted_string = formatted_string.with_delimiter(ctx.receive_value(formatted_string.delimiter, str))
127
- formatted_string = formatted_string.with_parts(ctx.receive_nodes(formatted_string.parts, ctx.receive_tree))
128
- return formatted_string
129
-
130
- def visit_formatted_string_value(self, value: FormattedString.Value, ctx: ReceiverContext) -> J:
131
- value = value.with_id(ctx.receive_value(value.id, UUID))
132
- value = value.with_prefix(ctx.receive_node(value.prefix, PythonReceiver.receive_space))
133
- value = value.with_markers(ctx.receive_node(value.markers, ctx.receive_markers))
134
- value = value.padding.with_expression(ctx.receive_node(value.padding.expression, PythonReceiver.receive_right_padded_tree))
135
- value = value.padding.with_debug(ctx.receive_node(value.padding.debug, PythonReceiver.right_padded_value_receiver(bool)))
136
- value = value.with_conversion(ctx.receive_value(value.conversion, FormattedString.Value.Conversion))
137
- value = value.with_format(ctx.receive_node(value.format, ctx.receive_tree))
138
- return value
139
-
140
- def visit_pass(self, pass_: Pass, ctx: ReceiverContext) -> J:
141
- pass_ = pass_.with_id(ctx.receive_value(pass_.id, UUID))
142
- pass_ = pass_.with_prefix(ctx.receive_node(pass_.prefix, PythonReceiver.receive_space))
143
- pass_ = pass_.with_markers(ctx.receive_node(pass_.markers, ctx.receive_markers))
144
- return pass_
145
-
146
- def visit_trailing_else_wrapper(self, trailing_else_wrapper: TrailingElseWrapper, ctx: ReceiverContext) -> J:
147
- trailing_else_wrapper = trailing_else_wrapper.with_id(ctx.receive_value(trailing_else_wrapper.id, UUID))
148
- trailing_else_wrapper = trailing_else_wrapper.with_prefix(ctx.receive_node(trailing_else_wrapper.prefix, PythonReceiver.receive_space))
149
- trailing_else_wrapper = trailing_else_wrapper.with_markers(ctx.receive_node(trailing_else_wrapper.markers, ctx.receive_markers))
150
- trailing_else_wrapper = trailing_else_wrapper.with_statement(ctx.receive_node(trailing_else_wrapper.statement, ctx.receive_tree))
151
- trailing_else_wrapper = trailing_else_wrapper.padding.with_else_block(ctx.receive_node(trailing_else_wrapper.padding.else_block, PythonReceiver.receive_left_padded_tree))
152
- return trailing_else_wrapper
153
-
154
- def visit_comprehension_expression(self, comprehension_expression: ComprehensionExpression, ctx: ReceiverContext) -> J:
155
- comprehension_expression = comprehension_expression.with_id(ctx.receive_value(comprehension_expression.id, UUID))
156
- comprehension_expression = comprehension_expression.with_prefix(ctx.receive_node(comprehension_expression.prefix, PythonReceiver.receive_space))
157
- comprehension_expression = comprehension_expression.with_markers(ctx.receive_node(comprehension_expression.markers, ctx.receive_markers))
158
- comprehension_expression = comprehension_expression.with_kind(ctx.receive_value(comprehension_expression.kind, ComprehensionExpression.Kind))
159
- comprehension_expression = comprehension_expression.with_result(ctx.receive_node(comprehension_expression.result, ctx.receive_tree))
160
- comprehension_expression = comprehension_expression.with_clauses(ctx.receive_nodes(comprehension_expression.clauses, ctx.receive_tree))
161
- comprehension_expression = comprehension_expression.with_suffix(ctx.receive_node(comprehension_expression.suffix, PythonReceiver.receive_space))
162
- comprehension_expression = comprehension_expression.with_type(ctx.receive_value(comprehension_expression.type, JavaType))
163
- return comprehension_expression
164
-
165
- def visit_comprehension_condition(self, condition: ComprehensionExpression.Condition, ctx: ReceiverContext) -> J:
166
- condition = condition.with_id(ctx.receive_value(condition.id, UUID))
167
- condition = condition.with_prefix(ctx.receive_node(condition.prefix, PythonReceiver.receive_space))
168
- condition = condition.with_markers(ctx.receive_node(condition.markers, ctx.receive_markers))
169
- condition = condition.with_expression(ctx.receive_node(condition.expression, ctx.receive_tree))
170
- return condition
171
-
172
- def visit_comprehension_clause(self, clause: ComprehensionExpression.Clause, ctx: ReceiverContext) -> J:
173
- clause = clause.with_id(ctx.receive_value(clause.id, UUID))
174
- clause = clause.with_prefix(ctx.receive_node(clause.prefix, PythonReceiver.receive_space))
175
- clause = clause.with_markers(ctx.receive_node(clause.markers, ctx.receive_markers))
176
- clause = clause.with_iterator_variable(ctx.receive_node(clause.iterator_variable, ctx.receive_tree))
177
- clause = clause.padding.with_iterated_list(ctx.receive_node(clause.padding.iterated_list, PythonReceiver.receive_left_padded_tree))
178
- clause = clause.with_conditions(ctx.receive_nodes(clause.conditions, ctx.receive_tree))
179
- return clause
180
-
181
- def visit_await(self, await_: Await, ctx: ReceiverContext) -> J:
182
- await_ = await_.with_id(ctx.receive_value(await_.id, UUID))
183
- await_ = await_.with_prefix(ctx.receive_node(await_.prefix, PythonReceiver.receive_space))
184
- await_ = await_.with_markers(ctx.receive_node(await_.markers, ctx.receive_markers))
185
- await_ = await_.with_expression(ctx.receive_node(await_.expression, ctx.receive_tree))
186
- await_ = await_.with_type(ctx.receive_value(await_.type, JavaType))
187
- return await_
188
-
189
- def visit_yield_from(self, yield_from: YieldFrom, ctx: ReceiverContext) -> J:
190
- yield_from = yield_from.with_id(ctx.receive_value(yield_from.id, UUID))
191
- yield_from = yield_from.with_prefix(ctx.receive_node(yield_from.prefix, PythonReceiver.receive_space))
192
- yield_from = yield_from.with_markers(ctx.receive_node(yield_from.markers, ctx.receive_markers))
193
- yield_from = yield_from.with_expression(ctx.receive_node(yield_from.expression, ctx.receive_tree))
194
- yield_from = yield_from.with_type(ctx.receive_value(yield_from.type, JavaType))
195
- return yield_from
196
-
197
- def visit_variable_scope(self, variable_scope: VariableScope, ctx: ReceiverContext) -> J:
198
- variable_scope = variable_scope.with_id(ctx.receive_value(variable_scope.id, UUID))
199
- variable_scope = variable_scope.with_prefix(ctx.receive_node(variable_scope.prefix, PythonReceiver.receive_space))
200
- variable_scope = variable_scope.with_markers(ctx.receive_node(variable_scope.markers, ctx.receive_markers))
201
- variable_scope = variable_scope.with_kind(ctx.receive_value(variable_scope.kind, VariableScope.Kind))
202
- variable_scope = variable_scope.padding.with_names(ctx.receive_nodes(variable_scope.padding.names, PythonReceiver.receive_right_padded_tree))
203
- return variable_scope
204
-
205
- def visit_del(self, del_: Del, ctx: ReceiverContext) -> J:
206
- del_ = del_.with_id(ctx.receive_value(del_.id, UUID))
207
- del_ = del_.with_prefix(ctx.receive_node(del_.prefix, PythonReceiver.receive_space))
208
- del_ = del_.with_markers(ctx.receive_node(del_.markers, ctx.receive_markers))
209
- del_ = del_.padding.with_targets(ctx.receive_nodes(del_.padding.targets, PythonReceiver.receive_right_padded_tree))
210
- return del_
211
-
212
- def visit_special_parameter(self, special_parameter: SpecialParameter, ctx: ReceiverContext) -> J:
213
- special_parameter = special_parameter.with_id(ctx.receive_value(special_parameter.id, UUID))
214
- special_parameter = special_parameter.with_prefix(ctx.receive_node(special_parameter.prefix, PythonReceiver.receive_space))
215
- special_parameter = special_parameter.with_markers(ctx.receive_node(special_parameter.markers, ctx.receive_markers))
216
- special_parameter = special_parameter.with_kind(ctx.receive_value(special_parameter.kind, SpecialParameter.Kind))
217
- special_parameter = special_parameter.with_type_hint(ctx.receive_node(special_parameter.type_hint, ctx.receive_tree))
218
- special_parameter = special_parameter.with_type(ctx.receive_value(special_parameter.type, JavaType))
219
- return special_parameter
220
-
221
- def visit_star(self, star: Star, ctx: ReceiverContext) -> J:
222
- star = star.with_id(ctx.receive_value(star.id, UUID))
223
- star = star.with_prefix(ctx.receive_node(star.prefix, PythonReceiver.receive_space))
224
- star = star.with_markers(ctx.receive_node(star.markers, ctx.receive_markers))
225
- star = star.with_kind(ctx.receive_value(star.kind, Star.Kind))
226
- star = star.with_expression(ctx.receive_node(star.expression, ctx.receive_tree))
227
- star = star.with_type(ctx.receive_value(star.type, JavaType))
228
- return star
229
-
230
- def visit_named_argument(self, named_argument: NamedArgument, ctx: ReceiverContext) -> J:
231
- named_argument = named_argument.with_id(ctx.receive_value(named_argument.id, UUID))
232
- named_argument = named_argument.with_prefix(ctx.receive_node(named_argument.prefix, PythonReceiver.receive_space))
233
- named_argument = named_argument.with_markers(ctx.receive_node(named_argument.markers, ctx.receive_markers))
234
- named_argument = named_argument.with_name(ctx.receive_node(named_argument.name, ctx.receive_tree))
235
- named_argument = named_argument.padding.with_value(ctx.receive_node(named_argument.padding.value, PythonReceiver.receive_left_padded_tree))
236
- named_argument = named_argument.with_type(ctx.receive_value(named_argument.type, JavaType))
237
- return named_argument
238
-
239
- def visit_type_hinted_expression(self, type_hinted_expression: TypeHintedExpression, ctx: ReceiverContext) -> J:
240
- type_hinted_expression = type_hinted_expression.with_id(ctx.receive_value(type_hinted_expression.id, UUID))
241
- type_hinted_expression = type_hinted_expression.with_prefix(ctx.receive_node(type_hinted_expression.prefix, PythonReceiver.receive_space))
242
- type_hinted_expression = type_hinted_expression.with_markers(ctx.receive_node(type_hinted_expression.markers, ctx.receive_markers))
243
- type_hinted_expression = type_hinted_expression.with_type_hint(ctx.receive_node(type_hinted_expression.type_hint, ctx.receive_tree))
244
- type_hinted_expression = type_hinted_expression.with_expression(ctx.receive_node(type_hinted_expression.expression, ctx.receive_tree))
245
- type_hinted_expression = type_hinted_expression.with_type(ctx.receive_value(type_hinted_expression.type, JavaType))
246
- return type_hinted_expression
247
-
248
- def visit_error_from(self, error_from: ErrorFrom, ctx: ReceiverContext) -> J:
249
- error_from = error_from.with_id(ctx.receive_value(error_from.id, UUID))
250
- error_from = error_from.with_prefix(ctx.receive_node(error_from.prefix, PythonReceiver.receive_space))
251
- error_from = error_from.with_markers(ctx.receive_node(error_from.markers, ctx.receive_markers))
252
- error_from = error_from.with_error(ctx.receive_node(error_from.error, ctx.receive_tree))
253
- error_from = error_from.padding.with_from(ctx.receive_node(error_from.padding.from_, PythonReceiver.receive_left_padded_tree))
254
- error_from = error_from.with_type(ctx.receive_value(error_from.type, JavaType))
255
- return error_from
256
-
257
- def visit_match_case(self, match_case: MatchCase, ctx: ReceiverContext) -> J:
258
- match_case = match_case.with_id(ctx.receive_value(match_case.id, UUID))
259
- match_case = match_case.with_prefix(ctx.receive_node(match_case.prefix, PythonReceiver.receive_space))
260
- match_case = match_case.with_markers(ctx.receive_node(match_case.markers, ctx.receive_markers))
261
- match_case = match_case.with_pattern(ctx.receive_node(match_case.pattern, ctx.receive_tree))
262
- match_case = match_case.padding.with_guard(ctx.receive_node(match_case.padding.guard, PythonReceiver.receive_left_padded_tree))
263
- match_case = match_case.with_type(ctx.receive_value(match_case.type, JavaType))
264
- return match_case
265
-
266
- def visit_match_case_pattern(self, pattern: MatchCase.Pattern, ctx: ReceiverContext) -> J:
267
- pattern = pattern.with_id(ctx.receive_value(pattern.id, UUID))
268
- pattern = pattern.with_prefix(ctx.receive_node(pattern.prefix, PythonReceiver.receive_space))
269
- pattern = pattern.with_markers(ctx.receive_node(pattern.markers, ctx.receive_markers))
270
- pattern = pattern.with_kind(ctx.receive_value(pattern.kind, MatchCase.Pattern.Kind))
271
- pattern = pattern.padding.with_children(ctx.receive_node(pattern.padding.children, PythonReceiver.receive_container))
272
- pattern = pattern.with_type(ctx.receive_value(pattern.type, JavaType))
273
- return pattern
274
-
275
- def visit_slice(self, slice: Slice, ctx: ReceiverContext) -> J:
276
- slice = slice.with_id(ctx.receive_value(slice.id, UUID))
277
- slice = slice.with_prefix(ctx.receive_node(slice.prefix, PythonReceiver.receive_space))
278
- slice = slice.with_markers(ctx.receive_node(slice.markers, ctx.receive_markers))
279
- slice = slice.padding.with_start(ctx.receive_node(slice.padding.start, PythonReceiver.receive_right_padded_tree))
280
- slice = slice.padding.with_stop(ctx.receive_node(slice.padding.stop, PythonReceiver.receive_right_padded_tree))
281
- slice = slice.padding.with_step(ctx.receive_node(slice.padding.step, PythonReceiver.receive_right_padded_tree))
282
- return slice
283
-
284
- def visit_annotated_type(self, annotated_type: AnnotatedType, ctx: ReceiverContext) -> J:
285
- annotated_type = annotated_type.with_id(ctx.receive_value(annotated_type.id, UUID))
286
- annotated_type = annotated_type.with_prefix(ctx.receive_node(annotated_type.prefix, PythonReceiver.receive_space))
287
- annotated_type = annotated_type.with_markers(ctx.receive_node(annotated_type.markers, ctx.receive_markers))
288
- annotated_type = annotated_type.with_annotations(ctx.receive_nodes(annotated_type.annotations, ctx.receive_tree))
289
- annotated_type = annotated_type.with_type_expression(ctx.receive_node(annotated_type.type_expression, ctx.receive_tree))
290
- return annotated_type
291
-
292
- def visit_annotation(self, annotation: Annotation, ctx: ReceiverContext) -> J:
293
- annotation = annotation.with_id(ctx.receive_value(annotation.id, UUID))
294
- annotation = annotation.with_prefix(ctx.receive_node(annotation.prefix, PythonReceiver.receive_space))
295
- annotation = annotation.with_markers(ctx.receive_node(annotation.markers, ctx.receive_markers))
296
- annotation = annotation.with_annotation_type(ctx.receive_node(annotation.annotation_type, ctx.receive_tree))
297
- annotation = annotation.padding.with_arguments(ctx.receive_node(annotation.padding.arguments, PythonReceiver.receive_container))
298
- return annotation
299
-
300
- def visit_array_access(self, array_access: ArrayAccess, ctx: ReceiverContext) -> J:
301
- array_access = array_access.with_id(ctx.receive_value(array_access.id, UUID))
302
- array_access = array_access.with_prefix(ctx.receive_node(array_access.prefix, PythonReceiver.receive_space))
303
- array_access = array_access.with_markers(ctx.receive_node(array_access.markers, ctx.receive_markers))
304
- array_access = array_access.with_indexed(ctx.receive_node(array_access.indexed, ctx.receive_tree))
305
- array_access = array_access.with_dimension(ctx.receive_node(array_access.dimension, ctx.receive_tree))
306
- array_access = array_access.with_type(ctx.receive_value(array_access.type, JavaType))
307
- return array_access
308
-
309
- def visit_array_type(self, array_type: ArrayType, ctx: ReceiverContext) -> J:
310
- array_type = array_type.with_id(ctx.receive_value(array_type.id, UUID))
311
- array_type = array_type.with_prefix(ctx.receive_node(array_type.prefix, PythonReceiver.receive_space))
312
- array_type = array_type.with_markers(ctx.receive_node(array_type.markers, ctx.receive_markers))
313
- array_type = array_type.with_element_type(ctx.receive_node(array_type.element_type, ctx.receive_tree))
314
- array_type = array_type.with_annotations(ctx.receive_nodes(array_type.annotations, ctx.receive_tree))
315
- array_type = array_type.with_dimension(ctx.receive_node(array_type.dimension, PythonReceiver.left_padded_node_receiver(Space)))
316
- array_type = array_type.with_type(ctx.receive_value(array_type.type, JavaType))
317
- return array_type
318
-
319
- def visit_assert(self, assert_: Assert, ctx: ReceiverContext) -> J:
320
- assert_ = assert_.with_id(ctx.receive_value(assert_.id, UUID))
321
- assert_ = assert_.with_prefix(ctx.receive_node(assert_.prefix, PythonReceiver.receive_space))
322
- assert_ = assert_.with_markers(ctx.receive_node(assert_.markers, ctx.receive_markers))
323
- assert_ = assert_.with_condition(ctx.receive_node(assert_.condition, ctx.receive_tree))
324
- assert_ = assert_.with_detail(ctx.receive_node(assert_.detail, PythonReceiver.receive_left_padded_tree))
325
- return assert_
326
-
327
- def visit_assignment(self, assignment: Assignment, ctx: ReceiverContext) -> J:
328
- assignment = assignment.with_id(ctx.receive_value(assignment.id, UUID))
329
- assignment = assignment.with_prefix(ctx.receive_node(assignment.prefix, PythonReceiver.receive_space))
330
- assignment = assignment.with_markers(ctx.receive_node(assignment.markers, ctx.receive_markers))
331
- assignment = assignment.with_variable(ctx.receive_node(assignment.variable, ctx.receive_tree))
332
- assignment = assignment.padding.with_assignment(ctx.receive_node(assignment.padding.assignment, PythonReceiver.receive_left_padded_tree))
333
- assignment = assignment.with_type(ctx.receive_value(assignment.type, JavaType))
334
- return assignment
335
-
336
- def visit_assignment_operation(self, assignment_operation: AssignmentOperation, ctx: ReceiverContext) -> J:
337
- assignment_operation = assignment_operation.with_id(ctx.receive_value(assignment_operation.id, UUID))
338
- assignment_operation = assignment_operation.with_prefix(ctx.receive_node(assignment_operation.prefix, PythonReceiver.receive_space))
339
- assignment_operation = assignment_operation.with_markers(ctx.receive_node(assignment_operation.markers, ctx.receive_markers))
340
- assignment_operation = assignment_operation.with_variable(ctx.receive_node(assignment_operation.variable, ctx.receive_tree))
341
- assignment_operation = assignment_operation.padding.with_operator(ctx.receive_node(assignment_operation.padding.operator, PythonReceiver.left_padded_value_receiver(AssignmentOperation.Type)))
342
- assignment_operation = assignment_operation.with_assignment(ctx.receive_node(assignment_operation.assignment, ctx.receive_tree))
343
- assignment_operation = assignment_operation.with_type(ctx.receive_value(assignment_operation.type, JavaType))
344
- return assignment_operation
345
-
346
- def visit_binary(self, binary: Binary, ctx: ReceiverContext) -> J:
347
- binary = binary.with_id(ctx.receive_value(binary.id, UUID))
348
- binary = binary.with_prefix(ctx.receive_node(binary.prefix, PythonReceiver.receive_space))
349
- binary = binary.with_markers(ctx.receive_node(binary.markers, ctx.receive_markers))
350
- binary = binary.with_left(ctx.receive_node(binary.left, ctx.receive_tree))
351
- binary = binary.padding.with_operator(ctx.receive_node(binary.padding.operator, PythonReceiver.left_padded_value_receiver(Binary.Type)))
352
- binary = binary.with_right(ctx.receive_node(binary.right, ctx.receive_tree))
353
- binary = binary.with_type(ctx.receive_value(binary.type, JavaType))
354
- return binary
355
-
356
- def visit_block(self, block: Block, ctx: ReceiverContext) -> J:
357
- block = block.with_id(ctx.receive_value(block.id, UUID))
358
- block = block.with_prefix(ctx.receive_node(block.prefix, PythonReceiver.receive_space))
359
- block = block.with_markers(ctx.receive_node(block.markers, ctx.receive_markers))
360
- block = block.padding.with_static(ctx.receive_node(block.padding.static, PythonReceiver.right_padded_value_receiver(bool)))
361
- block = block.padding.with_statements(ctx.receive_nodes(block.padding.statements, PythonReceiver.receive_right_padded_tree))
362
- block = block.with_end(ctx.receive_node(block.end, PythonReceiver.receive_space))
363
- return block
364
-
365
- def visit_break(self, break_: Break, ctx: ReceiverContext) -> J:
366
- break_ = break_.with_id(ctx.receive_value(break_.id, UUID))
367
- break_ = break_.with_prefix(ctx.receive_node(break_.prefix, PythonReceiver.receive_space))
368
- break_ = break_.with_markers(ctx.receive_node(break_.markers, ctx.receive_markers))
369
- break_ = break_.with_label(ctx.receive_node(break_.label, ctx.receive_tree))
370
- return break_
371
-
372
- def visit_case(self, case: Case, ctx: ReceiverContext) -> J:
373
- case = case.with_id(ctx.receive_value(case.id, UUID))
374
- case = case.with_prefix(ctx.receive_node(case.prefix, PythonReceiver.receive_space))
375
- case = case.with_markers(ctx.receive_node(case.markers, ctx.receive_markers))
376
- case = case.with_type(ctx.receive_value(case.type, Case.Type))
377
- case = case.padding.with_expressions(ctx.receive_node(case.padding.expressions, PythonReceiver.receive_container))
378
- case = case.padding.with_statements(ctx.receive_node(case.padding.statements, PythonReceiver.receive_container))
379
- case = case.padding.with_body(ctx.receive_node(case.padding.body, PythonReceiver.receive_right_padded_tree))
380
- return case
381
-
382
- def visit_class_declaration(self, class_declaration: ClassDeclaration, ctx: ReceiverContext) -> J:
383
- class_declaration = class_declaration.with_id(ctx.receive_value(class_declaration.id, UUID))
384
- class_declaration = class_declaration.with_prefix(ctx.receive_node(class_declaration.prefix, PythonReceiver.receive_space))
385
- class_declaration = class_declaration.with_markers(ctx.receive_node(class_declaration.markers, ctx.receive_markers))
386
- class_declaration = class_declaration.with_leading_annotations(ctx.receive_nodes(class_declaration.leading_annotations, ctx.receive_tree))
387
- class_declaration = class_declaration.with_modifiers(ctx.receive_nodes(class_declaration.modifiers, ctx.receive_tree))
388
- class_declaration = class_declaration.padding.with_kind(ctx.receive_node(class_declaration.padding.kind, ctx.receive_tree))
389
- class_declaration = class_declaration.with_name(ctx.receive_node(class_declaration.name, ctx.receive_tree))
390
- class_declaration = class_declaration.padding.with_type_parameters(ctx.receive_node(class_declaration.padding.type_parameters, PythonReceiver.receive_container))
391
- class_declaration = class_declaration.padding.with_primary_constructor(ctx.receive_node(class_declaration.padding.primary_constructor, PythonReceiver.receive_container))
392
- class_declaration = class_declaration.padding.with_extends(ctx.receive_node(class_declaration.padding.extends, PythonReceiver.receive_left_padded_tree))
393
- class_declaration = class_declaration.padding.with_implements(ctx.receive_node(class_declaration.padding.implements, PythonReceiver.receive_container))
394
- class_declaration = class_declaration.padding.with_permits(ctx.receive_node(class_declaration.padding.permits, PythonReceiver.receive_container))
395
- class_declaration = class_declaration.with_body(ctx.receive_node(class_declaration.body, ctx.receive_tree))
396
- class_declaration = class_declaration.with_type(ctx.receive_value(class_declaration.type, JavaType.FullyQualified))
397
- return class_declaration
398
-
399
- def visit_class_declaration_kind(self, kind: ClassDeclaration.Kind, ctx: ReceiverContext) -> J:
400
- kind = kind.with_id(ctx.receive_value(kind.id, UUID))
401
- kind = kind.with_prefix(ctx.receive_node(kind.prefix, PythonReceiver.receive_space))
402
- kind = kind.with_markers(ctx.receive_node(kind.markers, ctx.receive_markers))
403
- kind = kind.with_annotations(ctx.receive_nodes(kind.annotations, ctx.receive_tree))
404
- kind = kind.with_type(ctx.receive_value(kind.type, ClassDeclaration.Kind.Type))
405
- return kind
406
-
407
- def visit_continue(self, continue_: Continue, ctx: ReceiverContext) -> J:
408
- continue_ = continue_.with_id(ctx.receive_value(continue_.id, UUID))
409
- continue_ = continue_.with_prefix(ctx.receive_node(continue_.prefix, PythonReceiver.receive_space))
410
- continue_ = continue_.with_markers(ctx.receive_node(continue_.markers, ctx.receive_markers))
411
- continue_ = continue_.with_label(ctx.receive_node(continue_.label, ctx.receive_tree))
412
- return continue_
413
-
414
- def visit_do_while_loop(self, do_while_loop: DoWhileLoop, ctx: ReceiverContext) -> J:
415
- do_while_loop = do_while_loop.with_id(ctx.receive_value(do_while_loop.id, UUID))
416
- do_while_loop = do_while_loop.with_prefix(ctx.receive_node(do_while_loop.prefix, PythonReceiver.receive_space))
417
- do_while_loop = do_while_loop.with_markers(ctx.receive_node(do_while_loop.markers, ctx.receive_markers))
418
- do_while_loop = do_while_loop.padding.with_body(ctx.receive_node(do_while_loop.padding.body, PythonReceiver.receive_right_padded_tree))
419
- do_while_loop = do_while_loop.padding.with_while_condition(ctx.receive_node(do_while_loop.padding.while_condition, PythonReceiver.receive_left_padded_tree))
420
- return do_while_loop
421
-
422
- def visit_empty(self, empty: Empty, ctx: ReceiverContext) -> J:
423
- empty = empty.with_id(ctx.receive_value(empty.id, UUID))
424
- empty = empty.with_prefix(ctx.receive_node(empty.prefix, PythonReceiver.receive_space))
425
- empty = empty.with_markers(ctx.receive_node(empty.markers, ctx.receive_markers))
426
- return empty
427
-
428
- def visit_enum_value(self, enum_value: EnumValue, ctx: ReceiverContext) -> J:
429
- enum_value = enum_value.with_id(ctx.receive_value(enum_value.id, UUID))
430
- enum_value = enum_value.with_prefix(ctx.receive_node(enum_value.prefix, PythonReceiver.receive_space))
431
- enum_value = enum_value.with_markers(ctx.receive_node(enum_value.markers, ctx.receive_markers))
432
- enum_value = enum_value.with_annotations(ctx.receive_nodes(enum_value.annotations, ctx.receive_tree))
433
- enum_value = enum_value.with_name(ctx.receive_node(enum_value.name, ctx.receive_tree))
434
- enum_value = enum_value.with_initializer(ctx.receive_node(enum_value.initializer, ctx.receive_tree))
435
- return enum_value
436
-
437
- def visit_enum_value_set(self, enum_value_set: EnumValueSet, ctx: ReceiverContext) -> J:
438
- enum_value_set = enum_value_set.with_id(ctx.receive_value(enum_value_set.id, UUID))
439
- enum_value_set = enum_value_set.with_prefix(ctx.receive_node(enum_value_set.prefix, PythonReceiver.receive_space))
440
- enum_value_set = enum_value_set.with_markers(ctx.receive_node(enum_value_set.markers, ctx.receive_markers))
441
- enum_value_set = enum_value_set.padding.with_enums(ctx.receive_nodes(enum_value_set.padding.enums, PythonReceiver.receive_right_padded_tree))
442
- enum_value_set = enum_value_set.with_terminated_with_semicolon(ctx.receive_value(enum_value_set.terminated_with_semicolon, bool))
443
- return enum_value_set
444
-
445
- def visit_field_access(self, field_access: FieldAccess, ctx: ReceiverContext) -> J:
446
- field_access = field_access.with_id(ctx.receive_value(field_access.id, UUID))
447
- field_access = field_access.with_prefix(ctx.receive_node(field_access.prefix, PythonReceiver.receive_space))
448
- field_access = field_access.with_markers(ctx.receive_node(field_access.markers, ctx.receive_markers))
449
- field_access = field_access.with_target(ctx.receive_node(field_access.target, ctx.receive_tree))
450
- field_access = field_access.padding.with_name(ctx.receive_node(field_access.padding.name, PythonReceiver.receive_left_padded_tree))
451
- field_access = field_access.with_type(ctx.receive_value(field_access.type, JavaType))
452
- return field_access
453
-
454
- def visit_for_each_loop(self, for_each_loop: ForEachLoop, ctx: ReceiverContext) -> J:
455
- for_each_loop = for_each_loop.with_id(ctx.receive_value(for_each_loop.id, UUID))
456
- for_each_loop = for_each_loop.with_prefix(ctx.receive_node(for_each_loop.prefix, PythonReceiver.receive_space))
457
- for_each_loop = for_each_loop.with_markers(ctx.receive_node(for_each_loop.markers, ctx.receive_markers))
458
- for_each_loop = for_each_loop.with_control(ctx.receive_node(for_each_loop.control, ctx.receive_tree))
459
- for_each_loop = for_each_loop.padding.with_body(ctx.receive_node(for_each_loop.padding.body, PythonReceiver.receive_right_padded_tree))
460
- return for_each_loop
461
-
462
- def visit_for_each_control(self, control: ForEachLoop.Control, ctx: ReceiverContext) -> J:
463
- control = control.with_id(ctx.receive_value(control.id, UUID))
464
- control = control.with_prefix(ctx.receive_node(control.prefix, PythonReceiver.receive_space))
465
- control = control.with_markers(ctx.receive_node(control.markers, ctx.receive_markers))
466
- control = control.padding.with_variable(ctx.receive_node(control.padding.variable, PythonReceiver.receive_right_padded_tree))
467
- control = control.padding.with_iterable(ctx.receive_node(control.padding.iterable, PythonReceiver.receive_right_padded_tree))
468
- return control
469
-
470
- def visit_for_loop(self, for_loop: ForLoop, ctx: ReceiverContext) -> J:
471
- for_loop = for_loop.with_id(ctx.receive_value(for_loop.id, UUID))
472
- for_loop = for_loop.with_prefix(ctx.receive_node(for_loop.prefix, PythonReceiver.receive_space))
473
- for_loop = for_loop.with_markers(ctx.receive_node(for_loop.markers, ctx.receive_markers))
474
- for_loop = for_loop.with_control(ctx.receive_node(for_loop.control, ctx.receive_tree))
475
- for_loop = for_loop.padding.with_body(ctx.receive_node(for_loop.padding.body, PythonReceiver.receive_right_padded_tree))
476
- return for_loop
477
-
478
- def visit_for_control(self, control: ForLoop.Control, ctx: ReceiverContext) -> J:
479
- control = control.with_id(ctx.receive_value(control.id, UUID))
480
- control = control.with_prefix(ctx.receive_node(control.prefix, PythonReceiver.receive_space))
481
- control = control.with_markers(ctx.receive_node(control.markers, ctx.receive_markers))
482
- control = control.padding.with_init(ctx.receive_nodes(control.padding.init, PythonReceiver.receive_right_padded_tree))
483
- control = control.padding.with_condition(ctx.receive_node(control.padding.condition, PythonReceiver.receive_right_padded_tree))
484
- control = control.padding.with_update(ctx.receive_nodes(control.padding.update, PythonReceiver.receive_right_padded_tree))
485
- return control
486
-
487
- def visit_parenthesized_type_tree(self, parenthesized_type_tree: ParenthesizedTypeTree, ctx: ReceiverContext) -> J:
488
- parenthesized_type_tree = parenthesized_type_tree.with_id(ctx.receive_value(parenthesized_type_tree.id, UUID))
489
- parenthesized_type_tree = parenthesized_type_tree.with_prefix(ctx.receive_node(parenthesized_type_tree.prefix, PythonReceiver.receive_space))
490
- parenthesized_type_tree = parenthesized_type_tree.with_markers(ctx.receive_node(parenthesized_type_tree.markers, ctx.receive_markers))
491
- parenthesized_type_tree = parenthesized_type_tree.with_annotations(ctx.receive_nodes(parenthesized_type_tree.annotations, ctx.receive_tree))
492
- parenthesized_type_tree = parenthesized_type_tree.with_parenthesized_type(ctx.receive_node(parenthesized_type_tree.parenthesized_type, ctx.receive_tree))
493
- return parenthesized_type_tree
494
-
495
- def visit_identifier(self, identifier: Identifier, ctx: ReceiverContext) -> J:
496
- identifier = identifier.with_id(ctx.receive_value(identifier.id, UUID))
497
- identifier = identifier.with_prefix(ctx.receive_node(identifier.prefix, PythonReceiver.receive_space))
498
- identifier = identifier.with_markers(ctx.receive_node(identifier.markers, ctx.receive_markers))
499
- identifier = identifier.with_annotations(ctx.receive_nodes(identifier.annotations, ctx.receive_tree))
500
- identifier = identifier.with_simple_name(ctx.receive_value(identifier.simple_name, str))
501
- identifier = identifier.with_type(ctx.receive_value(identifier.type, JavaType))
502
- identifier = identifier.with_field_type(ctx.receive_value(identifier.field_type, JavaType.Variable))
503
- return identifier
504
-
505
- def visit_if(self, if_: If, ctx: ReceiverContext) -> J:
506
- if_ = if_.with_id(ctx.receive_value(if_.id, UUID))
507
- if_ = if_.with_prefix(ctx.receive_node(if_.prefix, PythonReceiver.receive_space))
508
- if_ = if_.with_markers(ctx.receive_node(if_.markers, ctx.receive_markers))
509
- if_ = if_.with_if_condition(ctx.receive_node(if_.if_condition, ctx.receive_tree))
510
- if_ = if_.padding.with_then_part(ctx.receive_node(if_.padding.then_part, PythonReceiver.receive_right_padded_tree))
511
- if_ = if_.with_else_part(ctx.receive_node(if_.else_part, ctx.receive_tree))
512
- return if_
513
-
514
- def visit_else(self, else_: If.Else, ctx: ReceiverContext) -> J:
515
- else_ = else_.with_id(ctx.receive_value(else_.id, UUID))
516
- else_ = else_.with_prefix(ctx.receive_node(else_.prefix, PythonReceiver.receive_space))
517
- else_ = else_.with_markers(ctx.receive_node(else_.markers, ctx.receive_markers))
518
- else_ = else_.padding.with_body(ctx.receive_node(else_.padding.body, PythonReceiver.receive_right_padded_tree))
519
- return else_
520
-
521
- def visit_import(self, import_: Import, ctx: ReceiverContext) -> J:
522
- import_ = import_.with_id(ctx.receive_value(import_.id, UUID))
523
- import_ = import_.with_prefix(ctx.receive_node(import_.prefix, PythonReceiver.receive_space))
524
- import_ = import_.with_markers(ctx.receive_node(import_.markers, ctx.receive_markers))
525
- import_ = import_.padding.with_static(ctx.receive_node(import_.padding.static, PythonReceiver.left_padded_value_receiver(bool)))
526
- import_ = import_.with_qualid(ctx.receive_node(import_.qualid, ctx.receive_tree))
527
- import_ = import_.padding.with_alias(ctx.receive_node(import_.padding.alias, PythonReceiver.receive_left_padded_tree))
528
- return import_
529
-
530
- def visit_instance_of(self, instance_of: InstanceOf, ctx: ReceiverContext) -> J:
531
- instance_of = instance_of.with_id(ctx.receive_value(instance_of.id, UUID))
532
- instance_of = instance_of.with_prefix(ctx.receive_node(instance_of.prefix, PythonReceiver.receive_space))
533
- instance_of = instance_of.with_markers(ctx.receive_node(instance_of.markers, ctx.receive_markers))
534
- instance_of = instance_of.padding.with_expression(ctx.receive_node(instance_of.padding.expression, PythonReceiver.receive_right_padded_tree))
535
- instance_of = instance_of.with_clazz(ctx.receive_node(instance_of.clazz, ctx.receive_tree))
536
- instance_of = instance_of.with_pattern(ctx.receive_node(instance_of.pattern, ctx.receive_tree))
537
- instance_of = instance_of.with_type(ctx.receive_value(instance_of.type, JavaType))
538
- return instance_of
539
-
540
- def visit_intersection_type(self, intersection_type: IntersectionType, ctx: ReceiverContext) -> J:
541
- intersection_type = intersection_type.with_id(ctx.receive_value(intersection_type.id, UUID))
542
- intersection_type = intersection_type.with_prefix(ctx.receive_node(intersection_type.prefix, PythonReceiver.receive_space))
543
- intersection_type = intersection_type.with_markers(ctx.receive_node(intersection_type.markers, ctx.receive_markers))
544
- intersection_type = intersection_type.padding.with_bounds(ctx.receive_node(intersection_type.padding.bounds, PythonReceiver.receive_container))
545
- return intersection_type
546
-
547
- def visit_label(self, label: Label, ctx: ReceiverContext) -> J:
548
- label = label.with_id(ctx.receive_value(label.id, UUID))
549
- label = label.with_prefix(ctx.receive_node(label.prefix, PythonReceiver.receive_space))
550
- label = label.with_markers(ctx.receive_node(label.markers, ctx.receive_markers))
551
- label = label.padding.with_label(ctx.receive_node(label.padding.label, PythonReceiver.receive_right_padded_tree))
552
- label = label.with_statement(ctx.receive_node(label.statement, ctx.receive_tree))
553
- return label
554
-
555
- def visit_lambda(self, lambda_: Lambda, ctx: ReceiverContext) -> J:
556
- lambda_ = lambda_.with_id(ctx.receive_value(lambda_.id, UUID))
557
- lambda_ = lambda_.with_prefix(ctx.receive_node(lambda_.prefix, PythonReceiver.receive_space))
558
- lambda_ = lambda_.with_markers(ctx.receive_node(lambda_.markers, ctx.receive_markers))
559
- lambda_ = lambda_.with_parameters(ctx.receive_node(lambda_.parameters, ctx.receive_tree))
560
- lambda_ = lambda_.with_arrow(ctx.receive_node(lambda_.arrow, PythonReceiver.receive_space))
561
- lambda_ = lambda_.with_body(ctx.receive_node(lambda_.body, ctx.receive_tree))
562
- lambda_ = lambda_.with_type(ctx.receive_value(lambda_.type, JavaType))
563
- return lambda_
564
-
565
- def visit_lambda_parameters(self, parameters: Lambda.Parameters, ctx: ReceiverContext) -> J:
566
- parameters = parameters.with_id(ctx.receive_value(parameters.id, UUID))
567
- parameters = parameters.with_prefix(ctx.receive_node(parameters.prefix, PythonReceiver.receive_space))
568
- parameters = parameters.with_markers(ctx.receive_node(parameters.markers, ctx.receive_markers))
569
- parameters = parameters.with_parenthesized(ctx.receive_value(parameters.parenthesized, bool))
570
- parameters = parameters.padding.with_parameters(ctx.receive_nodes(parameters.padding.parameters, PythonReceiver.receive_right_padded_tree))
571
- return parameters
572
-
573
- def visit_literal(self, literal: Literal, ctx: ReceiverContext) -> J:
574
- literal = literal.with_id(ctx.receive_value(literal.id, UUID))
575
- literal = literal.with_prefix(ctx.receive_node(literal.prefix, PythonReceiver.receive_space))
576
- literal = literal.with_markers(ctx.receive_node(literal.markers, ctx.receive_markers))
577
- literal = literal.with_value(ctx.receive_value(literal.value, object))
578
- literal = literal.with_value_source(ctx.receive_value(literal.value_source, str))
579
- literal = literal.with_unicode_escapes(ctx.receive_values(literal.unicode_escapes, Literal.UnicodeEscape))
580
- literal = literal.with_type(ctx.receive_value(literal.type, JavaType.Primitive))
581
- return literal
582
-
583
- def visit_member_reference(self, member_reference: MemberReference, ctx: ReceiverContext) -> J:
584
- member_reference = member_reference.with_id(ctx.receive_value(member_reference.id, UUID))
585
- member_reference = member_reference.with_prefix(ctx.receive_node(member_reference.prefix, PythonReceiver.receive_space))
586
- member_reference = member_reference.with_markers(ctx.receive_node(member_reference.markers, ctx.receive_markers))
587
- member_reference = member_reference.padding.with_containing(ctx.receive_node(member_reference.padding.containing, PythonReceiver.receive_right_padded_tree))
588
- member_reference = member_reference.padding.with_type_parameters(ctx.receive_node(member_reference.padding.type_parameters, PythonReceiver.receive_container))
589
- member_reference = member_reference.padding.with_reference(ctx.receive_node(member_reference.padding.reference, PythonReceiver.receive_left_padded_tree))
590
- member_reference = member_reference.with_type(ctx.receive_value(member_reference.type, JavaType))
591
- member_reference = member_reference.with_method_type(ctx.receive_value(member_reference.method_type, JavaType.Method))
592
- member_reference = member_reference.with_variable_type(ctx.receive_value(member_reference.variable_type, JavaType.Variable))
593
- return member_reference
594
-
595
- def visit_method_declaration(self, method_declaration: MethodDeclaration, ctx: ReceiverContext) -> J:
596
- method_declaration = method_declaration.with_id(ctx.receive_value(method_declaration.id, UUID))
597
- method_declaration = method_declaration.with_prefix(ctx.receive_node(method_declaration.prefix, PythonReceiver.receive_space))
598
- method_declaration = method_declaration.with_markers(ctx.receive_node(method_declaration.markers, ctx.receive_markers))
599
- method_declaration = method_declaration.with_leading_annotations(ctx.receive_nodes(method_declaration.leading_annotations, ctx.receive_tree))
600
- method_declaration = method_declaration.with_modifiers(ctx.receive_nodes(method_declaration.modifiers, ctx.receive_tree))
601
- method_declaration = method_declaration.annotations.with_type_parameters(ctx.receive_node(method_declaration.annotations.type_parameters, ctx.receive_tree))
602
- method_declaration = method_declaration.with_return_type_expression(ctx.receive_node(method_declaration.return_type_expression, ctx.receive_tree))
603
- method_declaration = method_declaration.annotations.with_name(ctx.receive_node(method_declaration.annotations.name, PythonReceiver.receive_method_identifier_with_annotations))
604
- method_declaration = method_declaration.padding.with_parameters(ctx.receive_node(method_declaration.padding.parameters, PythonReceiver.receive_container))
605
- method_declaration = method_declaration.padding.with_throws(ctx.receive_node(method_declaration.padding.throws, PythonReceiver.receive_container))
606
- method_declaration = method_declaration.with_body(ctx.receive_node(method_declaration.body, ctx.receive_tree))
607
- method_declaration = method_declaration.padding.with_default_value(ctx.receive_node(method_declaration.padding.default_value, PythonReceiver.receive_left_padded_tree))
608
- method_declaration = method_declaration.with_method_type(ctx.receive_value(method_declaration.method_type, JavaType.Method))
609
- return method_declaration
610
-
611
- def visit_method_invocation(self, method_invocation: MethodInvocation, ctx: ReceiverContext) -> J:
612
- method_invocation = method_invocation.with_id(ctx.receive_value(method_invocation.id, UUID))
613
- method_invocation = method_invocation.with_prefix(ctx.receive_node(method_invocation.prefix, PythonReceiver.receive_space))
614
- method_invocation = method_invocation.with_markers(ctx.receive_node(method_invocation.markers, ctx.receive_markers))
615
- method_invocation = method_invocation.padding.with_select(ctx.receive_node(method_invocation.padding.select, PythonReceiver.receive_right_padded_tree))
616
- method_invocation = method_invocation.padding.with_type_parameters(ctx.receive_node(method_invocation.padding.type_parameters, PythonReceiver.receive_container))
617
- method_invocation = method_invocation.with_name(ctx.receive_node(method_invocation.name, ctx.receive_tree))
618
- method_invocation = method_invocation.padding.with_arguments(ctx.receive_node(method_invocation.padding.arguments, PythonReceiver.receive_container))
619
- method_invocation = method_invocation.with_method_type(ctx.receive_value(method_invocation.method_type, JavaType.Method))
620
- return method_invocation
621
-
622
- def visit_modifier(self, modifier: Modifier, ctx: ReceiverContext) -> J:
623
- modifier = modifier.with_id(ctx.receive_value(modifier.id, UUID))
624
- modifier = modifier.with_prefix(ctx.receive_node(modifier.prefix, PythonReceiver.receive_space))
625
- modifier = modifier.with_markers(ctx.receive_node(modifier.markers, ctx.receive_markers))
626
- modifier = modifier.with_keyword(ctx.receive_value(modifier.keyword, str))
627
- modifier = modifier.with_type(ctx.receive_value(modifier.type, Modifier.Type))
628
- modifier = modifier.with_annotations(ctx.receive_nodes(modifier.annotations, ctx.receive_tree))
629
- return modifier
630
-
631
- def visit_multi_catch(self, multi_catch: MultiCatch, ctx: ReceiverContext) -> J:
632
- multi_catch = multi_catch.with_id(ctx.receive_value(multi_catch.id, UUID))
633
- multi_catch = multi_catch.with_prefix(ctx.receive_node(multi_catch.prefix, PythonReceiver.receive_space))
634
- multi_catch = multi_catch.with_markers(ctx.receive_node(multi_catch.markers, ctx.receive_markers))
635
- multi_catch = multi_catch.padding.with_alternatives(ctx.receive_nodes(multi_catch.padding.alternatives, PythonReceiver.receive_right_padded_tree))
636
- return multi_catch
637
-
638
- def visit_new_array(self, new_array: NewArray, ctx: ReceiverContext) -> J:
639
- new_array = new_array.with_id(ctx.receive_value(new_array.id, UUID))
640
- new_array = new_array.with_prefix(ctx.receive_node(new_array.prefix, PythonReceiver.receive_space))
641
- new_array = new_array.with_markers(ctx.receive_node(new_array.markers, ctx.receive_markers))
642
- new_array = new_array.with_type_expression(ctx.receive_node(new_array.type_expression, ctx.receive_tree))
643
- new_array = new_array.with_dimensions(ctx.receive_nodes(new_array.dimensions, ctx.receive_tree))
644
- new_array = new_array.padding.with_initializer(ctx.receive_node(new_array.padding.initializer, PythonReceiver.receive_container))
645
- new_array = new_array.with_type(ctx.receive_value(new_array.type, JavaType))
646
- return new_array
647
-
648
- def visit_array_dimension(self, array_dimension: ArrayDimension, ctx: ReceiverContext) -> J:
649
- array_dimension = array_dimension.with_id(ctx.receive_value(array_dimension.id, UUID))
650
- array_dimension = array_dimension.with_prefix(ctx.receive_node(array_dimension.prefix, PythonReceiver.receive_space))
651
- array_dimension = array_dimension.with_markers(ctx.receive_node(array_dimension.markers, ctx.receive_markers))
652
- array_dimension = array_dimension.padding.with_index(ctx.receive_node(array_dimension.padding.index, PythonReceiver.receive_right_padded_tree))
653
- return array_dimension
654
-
655
- def visit_new_class(self, new_class: NewClass, ctx: ReceiverContext) -> J:
656
- new_class = new_class.with_id(ctx.receive_value(new_class.id, UUID))
657
- new_class = new_class.with_prefix(ctx.receive_node(new_class.prefix, PythonReceiver.receive_space))
658
- new_class = new_class.with_markers(ctx.receive_node(new_class.markers, ctx.receive_markers))
659
- new_class = new_class.padding.with_enclosing(ctx.receive_node(new_class.padding.enclosing, PythonReceiver.receive_right_padded_tree))
660
- new_class = new_class.with_new(ctx.receive_node(new_class.new, PythonReceiver.receive_space))
661
- new_class = new_class.with_clazz(ctx.receive_node(new_class.clazz, ctx.receive_tree))
662
- new_class = new_class.padding.with_arguments(ctx.receive_node(new_class.padding.arguments, PythonReceiver.receive_container))
663
- new_class = new_class.with_body(ctx.receive_node(new_class.body, ctx.receive_tree))
664
- new_class = new_class.with_constructor_type(ctx.receive_value(new_class.constructor_type, JavaType.Method))
665
- return new_class
666
-
667
- def visit_nullable_type(self, nullable_type: NullableType, ctx: ReceiverContext) -> J:
668
- nullable_type = nullable_type.with_id(ctx.receive_value(nullable_type.id, UUID))
669
- nullable_type = nullable_type.with_prefix(ctx.receive_node(nullable_type.prefix, PythonReceiver.receive_space))
670
- nullable_type = nullable_type.with_markers(ctx.receive_node(nullable_type.markers, ctx.receive_markers))
671
- nullable_type = nullable_type.with_annotations(ctx.receive_nodes(nullable_type.annotations, ctx.receive_tree))
672
- nullable_type = nullable_type.padding.with_type_tree(ctx.receive_node(nullable_type.padding.type_tree, PythonReceiver.receive_right_padded_tree))
673
- return nullable_type
674
-
675
- def visit_package(self, package: Package, ctx: ReceiverContext) -> J:
676
- package = package.with_id(ctx.receive_value(package.id, UUID))
677
- package = package.with_prefix(ctx.receive_node(package.prefix, PythonReceiver.receive_space))
678
- package = package.with_markers(ctx.receive_node(package.markers, ctx.receive_markers))
679
- package = package.with_expression(ctx.receive_node(package.expression, ctx.receive_tree))
680
- package = package.with_annotations(ctx.receive_nodes(package.annotations, ctx.receive_tree))
681
- return package
682
-
683
- def visit_parameterized_type(self, parameterized_type: ParameterizedType, ctx: ReceiverContext) -> J:
684
- parameterized_type = parameterized_type.with_id(ctx.receive_value(parameterized_type.id, UUID))
685
- parameterized_type = parameterized_type.with_prefix(ctx.receive_node(parameterized_type.prefix, PythonReceiver.receive_space))
686
- parameterized_type = parameterized_type.with_markers(ctx.receive_node(parameterized_type.markers, ctx.receive_markers))
687
- parameterized_type = parameterized_type.with_clazz(ctx.receive_node(parameterized_type.clazz, ctx.receive_tree))
688
- parameterized_type = parameterized_type.padding.with_type_parameters(ctx.receive_node(parameterized_type.padding.type_parameters, PythonReceiver.receive_container))
689
- parameterized_type = parameterized_type.with_type(ctx.receive_value(parameterized_type.type, JavaType))
690
- return parameterized_type
691
-
692
- def visit_parentheses(self, parentheses: Parentheses[J2], ctx: ReceiverContext) -> J:
693
- parentheses = parentheses.with_id(ctx.receive_value(parentheses.id, UUID))
694
- parentheses = parentheses.with_prefix(ctx.receive_node(parentheses.prefix, PythonReceiver.receive_space))
695
- parentheses = parentheses.with_markers(ctx.receive_node(parentheses.markers, ctx.receive_markers))
696
- parentheses = parentheses.padding.with_tree(ctx.receive_node(parentheses.padding.tree, PythonReceiver.receive_right_padded_tree))
697
- return parentheses
698
-
699
- def visit_control_parentheses(self, control_parentheses: ControlParentheses[J2], ctx: ReceiverContext) -> J:
700
- control_parentheses = control_parentheses.with_id(ctx.receive_value(control_parentheses.id, UUID))
701
- control_parentheses = control_parentheses.with_prefix(ctx.receive_node(control_parentheses.prefix, PythonReceiver.receive_space))
702
- control_parentheses = control_parentheses.with_markers(ctx.receive_node(control_parentheses.markers, ctx.receive_markers))
703
- control_parentheses = control_parentheses.padding.with_tree(ctx.receive_node(control_parentheses.padding.tree, PythonReceiver.receive_right_padded_tree))
704
- return control_parentheses
705
-
706
- def visit_primitive(self, primitive: Primitive, ctx: ReceiverContext) -> J:
707
- primitive = primitive.with_id(ctx.receive_value(primitive.id, UUID))
708
- primitive = primitive.with_prefix(ctx.receive_node(primitive.prefix, PythonReceiver.receive_space))
709
- primitive = primitive.with_markers(ctx.receive_node(primitive.markers, ctx.receive_markers))
710
- primitive = primitive.with_type(ctx.receive_value(primitive.type, JavaType.Primitive))
711
- return primitive
712
-
713
- def visit_return(self, return_: Return, ctx: ReceiverContext) -> J:
714
- return_ = return_.with_id(ctx.receive_value(return_.id, UUID))
715
- return_ = return_.with_prefix(ctx.receive_node(return_.prefix, PythonReceiver.receive_space))
716
- return_ = return_.with_markers(ctx.receive_node(return_.markers, ctx.receive_markers))
717
- return_ = return_.with_expression(ctx.receive_node(return_.expression, ctx.receive_tree))
718
- return return_
719
-
720
- def visit_switch(self, switch: Switch, ctx: ReceiverContext) -> J:
721
- switch = switch.with_id(ctx.receive_value(switch.id, UUID))
722
- switch = switch.with_prefix(ctx.receive_node(switch.prefix, PythonReceiver.receive_space))
723
- switch = switch.with_markers(ctx.receive_node(switch.markers, ctx.receive_markers))
724
- switch = switch.with_selector(ctx.receive_node(switch.selector, ctx.receive_tree))
725
- switch = switch.with_cases(ctx.receive_node(switch.cases, ctx.receive_tree))
726
- return switch
727
-
728
- def visit_switch_expression(self, switch_expression: SwitchExpression, ctx: ReceiverContext) -> J:
729
- switch_expression = switch_expression.with_id(ctx.receive_value(switch_expression.id, UUID))
730
- switch_expression = switch_expression.with_prefix(ctx.receive_node(switch_expression.prefix, PythonReceiver.receive_space))
731
- switch_expression = switch_expression.with_markers(ctx.receive_node(switch_expression.markers, ctx.receive_markers))
732
- switch_expression = switch_expression.with_selector(ctx.receive_node(switch_expression.selector, ctx.receive_tree))
733
- switch_expression = switch_expression.with_cases(ctx.receive_node(switch_expression.cases, ctx.receive_tree))
734
- return switch_expression
735
-
736
- def visit_synchronized(self, synchronized: Synchronized, ctx: ReceiverContext) -> J:
737
- synchronized = synchronized.with_id(ctx.receive_value(synchronized.id, UUID))
738
- synchronized = synchronized.with_prefix(ctx.receive_node(synchronized.prefix, PythonReceiver.receive_space))
739
- synchronized = synchronized.with_markers(ctx.receive_node(synchronized.markers, ctx.receive_markers))
740
- synchronized = synchronized.with_lock(ctx.receive_node(synchronized.lock, ctx.receive_tree))
741
- synchronized = synchronized.with_body(ctx.receive_node(synchronized.body, ctx.receive_tree))
742
- return synchronized
743
-
744
- def visit_ternary(self, ternary: Ternary, ctx: ReceiverContext) -> J:
745
- ternary = ternary.with_id(ctx.receive_value(ternary.id, UUID))
746
- ternary = ternary.with_prefix(ctx.receive_node(ternary.prefix, PythonReceiver.receive_space))
747
- ternary = ternary.with_markers(ctx.receive_node(ternary.markers, ctx.receive_markers))
748
- ternary = ternary.with_condition(ctx.receive_node(ternary.condition, ctx.receive_tree))
749
- ternary = ternary.padding.with_true_part(ctx.receive_node(ternary.padding.true_part, PythonReceiver.receive_left_padded_tree))
750
- ternary = ternary.padding.with_false_part(ctx.receive_node(ternary.padding.false_part, PythonReceiver.receive_left_padded_tree))
751
- ternary = ternary.with_type(ctx.receive_value(ternary.type, JavaType))
752
- return ternary
753
-
754
- def visit_throw(self, throw: Throw, ctx: ReceiverContext) -> J:
755
- throw = throw.with_id(ctx.receive_value(throw.id, UUID))
756
- throw = throw.with_prefix(ctx.receive_node(throw.prefix, PythonReceiver.receive_space))
757
- throw = throw.with_markers(ctx.receive_node(throw.markers, ctx.receive_markers))
758
- throw = throw.with_exception(ctx.receive_node(throw.exception, ctx.receive_tree))
759
- return throw
760
-
761
- def visit_try(self, try_: Try, ctx: ReceiverContext) -> J:
762
- try_ = try_.with_id(ctx.receive_value(try_.id, UUID))
763
- try_ = try_.with_prefix(ctx.receive_node(try_.prefix, PythonReceiver.receive_space))
764
- try_ = try_.with_markers(ctx.receive_node(try_.markers, ctx.receive_markers))
765
- try_ = try_.padding.with_resources(ctx.receive_node(try_.padding.resources, PythonReceiver.receive_container))
766
- try_ = try_.with_body(ctx.receive_node(try_.body, ctx.receive_tree))
767
- try_ = try_.with_catches(ctx.receive_nodes(try_.catches, ctx.receive_tree))
768
- try_ = try_.padding.with_finally(ctx.receive_node(try_.padding.finally_, PythonReceiver.receive_left_padded_tree))
769
- return try_
770
-
771
- def visit_try_resource(self, resource: Try.Resource, ctx: ReceiverContext) -> J:
772
- resource = resource.with_id(ctx.receive_value(resource.id, UUID))
773
- resource = resource.with_prefix(ctx.receive_node(resource.prefix, PythonReceiver.receive_space))
774
- resource = resource.with_markers(ctx.receive_node(resource.markers, ctx.receive_markers))
775
- resource = resource.with_variable_declarations(ctx.receive_node(resource.variable_declarations, ctx.receive_tree))
776
- resource = resource.with_terminated_with_semicolon(ctx.receive_value(resource.terminated_with_semicolon, bool))
777
- return resource
778
-
779
- def visit_catch(self, catch: Try.Catch, ctx: ReceiverContext) -> J:
780
- catch = catch.with_id(ctx.receive_value(catch.id, UUID))
781
- catch = catch.with_prefix(ctx.receive_node(catch.prefix, PythonReceiver.receive_space))
782
- catch = catch.with_markers(ctx.receive_node(catch.markers, ctx.receive_markers))
783
- catch = catch.with_parameter(ctx.receive_node(catch.parameter, ctx.receive_tree))
784
- catch = catch.with_body(ctx.receive_node(catch.body, ctx.receive_tree))
785
- return catch
786
-
787
- def visit_type_cast(self, type_cast: TypeCast, ctx: ReceiverContext) -> J:
788
- type_cast = type_cast.with_id(ctx.receive_value(type_cast.id, UUID))
789
- type_cast = type_cast.with_prefix(ctx.receive_node(type_cast.prefix, PythonReceiver.receive_space))
790
- type_cast = type_cast.with_markers(ctx.receive_node(type_cast.markers, ctx.receive_markers))
791
- type_cast = type_cast.with_clazz(ctx.receive_node(type_cast.clazz, ctx.receive_tree))
792
- type_cast = type_cast.with_expression(ctx.receive_node(type_cast.expression, ctx.receive_tree))
793
- return type_cast
794
-
795
- def visit_type_parameter(self, type_parameter: TypeParameter, ctx: ReceiverContext) -> J:
796
- type_parameter = type_parameter.with_id(ctx.receive_value(type_parameter.id, UUID))
797
- type_parameter = type_parameter.with_prefix(ctx.receive_node(type_parameter.prefix, PythonReceiver.receive_space))
798
- type_parameter = type_parameter.with_markers(ctx.receive_node(type_parameter.markers, ctx.receive_markers))
799
- type_parameter = type_parameter.with_annotations(ctx.receive_nodes(type_parameter.annotations, ctx.receive_tree))
800
- type_parameter = type_parameter.with_modifiers(ctx.receive_nodes(type_parameter.modifiers, ctx.receive_tree))
801
- type_parameter = type_parameter.with_name(ctx.receive_node(type_parameter.name, ctx.receive_tree))
802
- type_parameter = type_parameter.padding.with_bounds(ctx.receive_node(type_parameter.padding.bounds, PythonReceiver.receive_container))
803
- return type_parameter
804
-
805
- def visit_type_parameters(self, type_parameters: TypeParameters, ctx: ReceiverContext) -> J:
806
- type_parameters = type_parameters.with_id(ctx.receive_value(type_parameters.id, UUID))
807
- type_parameters = type_parameters.with_prefix(ctx.receive_node(type_parameters.prefix, PythonReceiver.receive_space))
808
- type_parameters = type_parameters.with_markers(ctx.receive_node(type_parameters.markers, ctx.receive_markers))
809
- type_parameters = type_parameters.with_annotations(ctx.receive_nodes(type_parameters.annotations, ctx.receive_tree))
810
- type_parameters = type_parameters.padding.with_type_parameters(ctx.receive_nodes(type_parameters.padding.type_parameters, PythonReceiver.receive_right_padded_tree))
811
- return type_parameters
812
-
813
- def visit_unary(self, unary: Unary, ctx: ReceiverContext) -> J:
814
- unary = unary.with_id(ctx.receive_value(unary.id, UUID))
815
- unary = unary.with_prefix(ctx.receive_node(unary.prefix, PythonReceiver.receive_space))
816
- unary = unary.with_markers(ctx.receive_node(unary.markers, ctx.receive_markers))
817
- unary = unary.padding.with_operator(ctx.receive_node(unary.padding.operator, PythonReceiver.left_padded_value_receiver(Unary.Type)))
818
- unary = unary.with_expression(ctx.receive_node(unary.expression, ctx.receive_tree))
819
- unary = unary.with_type(ctx.receive_value(unary.type, JavaType))
820
- return unary
821
-
822
- def visit_variable_declarations(self, variable_declarations: VariableDeclarations, ctx: ReceiverContext) -> J:
823
- variable_declarations = variable_declarations.with_id(ctx.receive_value(variable_declarations.id, UUID))
824
- variable_declarations = variable_declarations.with_prefix(ctx.receive_node(variable_declarations.prefix, PythonReceiver.receive_space))
825
- variable_declarations = variable_declarations.with_markers(ctx.receive_node(variable_declarations.markers, ctx.receive_markers))
826
- variable_declarations = variable_declarations.with_leading_annotations(ctx.receive_nodes(variable_declarations.leading_annotations, ctx.receive_tree))
827
- variable_declarations = variable_declarations.with_modifiers(ctx.receive_nodes(variable_declarations.modifiers, ctx.receive_tree))
828
- variable_declarations = variable_declarations.with_type_expression(ctx.receive_node(variable_declarations.type_expression, ctx.receive_tree))
829
- variable_declarations = variable_declarations.with_varargs(ctx.receive_node(variable_declarations.varargs, PythonReceiver.receive_space))
830
- variable_declarations = variable_declarations.with_dimensions_before_name(ctx.receive_nodes(variable_declarations.dimensions_before_name, PythonReceiver.left_padded_node_receiver(Space)))
831
- variable_declarations = variable_declarations.padding.with_variables(ctx.receive_nodes(variable_declarations.padding.variables, PythonReceiver.receive_right_padded_tree))
832
- return variable_declarations
833
-
834
- def visit_variable(self, named_variable: VariableDeclarations.NamedVariable, ctx: ReceiverContext) -> J:
835
- named_variable = named_variable.with_id(ctx.receive_value(named_variable.id, UUID))
836
- named_variable = named_variable.with_prefix(ctx.receive_node(named_variable.prefix, PythonReceiver.receive_space))
837
- named_variable = named_variable.with_markers(ctx.receive_node(named_variable.markers, ctx.receive_markers))
838
- named_variable = named_variable.with_name(ctx.receive_node(named_variable.name, ctx.receive_tree))
839
- named_variable = named_variable.with_dimensions_after_name(ctx.receive_nodes(named_variable.dimensions_after_name, PythonReceiver.left_padded_node_receiver(Space)))
840
- named_variable = named_variable.padding.with_initializer(ctx.receive_node(named_variable.padding.initializer, PythonReceiver.receive_left_padded_tree))
841
- named_variable = named_variable.with_variable_type(ctx.receive_value(named_variable.variable_type, JavaType.Variable))
842
- return named_variable
843
-
844
- def visit_while_loop(self, while_loop: WhileLoop, ctx: ReceiverContext) -> J:
845
- while_loop = while_loop.with_id(ctx.receive_value(while_loop.id, UUID))
846
- while_loop = while_loop.with_prefix(ctx.receive_node(while_loop.prefix, PythonReceiver.receive_space))
847
- while_loop = while_loop.with_markers(ctx.receive_node(while_loop.markers, ctx.receive_markers))
848
- while_loop = while_loop.with_condition(ctx.receive_node(while_loop.condition, ctx.receive_tree))
849
- while_loop = while_loop.padding.with_body(ctx.receive_node(while_loop.padding.body, PythonReceiver.receive_right_padded_tree))
850
- return while_loop
851
-
852
- def visit_wildcard(self, wildcard: Wildcard, ctx: ReceiverContext) -> J:
853
- wildcard = wildcard.with_id(ctx.receive_value(wildcard.id, UUID))
854
- wildcard = wildcard.with_prefix(ctx.receive_node(wildcard.prefix, PythonReceiver.receive_space))
855
- wildcard = wildcard.with_markers(ctx.receive_node(wildcard.markers, ctx.receive_markers))
856
- wildcard = wildcard.padding.with_bound(ctx.receive_node(wildcard.padding.bound, PythonReceiver.left_padded_value_receiver(Wildcard.Bound)))
857
- wildcard = wildcard.with_bounded_type(ctx.receive_node(wildcard.bounded_type, ctx.receive_tree))
858
- return wildcard
859
-
860
- def visit_yield(self, yield_: Yield, ctx: ReceiverContext) -> J:
861
- yield_ = yield_.with_id(ctx.receive_value(yield_.id, UUID))
862
- yield_ = yield_.with_prefix(ctx.receive_node(yield_.prefix, PythonReceiver.receive_space))
863
- yield_ = yield_.with_markers(ctx.receive_node(yield_.markers, ctx.receive_markers))
864
- yield_ = yield_.with_implicit(ctx.receive_value(yield_.implicit, bool))
865
- yield_ = yield_.with_value(ctx.receive_node(yield_.value, ctx.receive_tree))
866
- return yield_
867
-
868
- def visit_unknown(self, unknown: Unknown, ctx: ReceiverContext) -> J:
869
- unknown = unknown.with_id(ctx.receive_value(unknown.id, UUID))
870
- unknown = unknown.with_prefix(ctx.receive_node(unknown.prefix, PythonReceiver.receive_space))
871
- unknown = unknown.with_markers(ctx.receive_node(unknown.markers, ctx.receive_markers))
872
- unknown = unknown.with_source(ctx.receive_node(unknown.source, ctx.receive_tree))
873
- return unknown
874
-
875
- def visit_unknown_source(self, source: Unknown.Source, ctx: ReceiverContext) -> J:
876
- source = source.with_id(ctx.receive_value(source.id, UUID))
877
- source = source.with_prefix(ctx.receive_node(source.prefix, PythonReceiver.receive_space))
878
- source = source.with_markers(ctx.receive_node(source.markers, ctx.receive_markers))
879
- source = source.with_text(ctx.receive_value(source.text, str))
880
- return source
881
-
882
- # noinspection PyTypeChecker
883
- class Factory(ReceiverFactory):
884
- def create(self, type: str, ctx: ReceiverContext) -> Tree:
885
- if type in ["rewrite.python.tree.Binary", "org.openrewrite.python.tree.Py$Binary"]:
886
- return Binary(
887
- ctx.receive_value(None, UUID),
888
- ctx.receive_node(None, PythonReceiver.receive_space),
889
- ctx.receive_node(None, ctx.receive_markers),
890
- ctx.receive_node(None, ctx.receive_tree),
891
- ctx.receive_node(None, PythonReceiver.left_padded_value_receiver(Binary.Type)),
892
- ctx.receive_node(None, PythonReceiver.receive_space),
893
- ctx.receive_node(None, ctx.receive_tree),
894
- ctx.receive_value(None, JavaType)
895
- )
896
-
897
- if type in ["rewrite.python.tree.ExceptionType", "org.openrewrite.python.tree.Py$ExceptionType"]:
898
- return ExceptionType(
899
- ctx.receive_value(None, UUID),
900
- ctx.receive_node(None, PythonReceiver.receive_space),
901
- ctx.receive_node(None, ctx.receive_markers),
902
- ctx.receive_value(None, JavaType),
903
- ctx.receive_value(None, bool),
904
- ctx.receive_node(None, ctx.receive_tree)
905
- )
906
-
907
- if type in ["rewrite.python.tree.TypeHint", "org.openrewrite.python.tree.Py$TypeHint"]:
908
- return TypeHint(
909
- ctx.receive_value(None, UUID),
910
- ctx.receive_node(None, PythonReceiver.receive_space),
911
- ctx.receive_node(None, ctx.receive_markers),
912
- ctx.receive_node(None, ctx.receive_tree),
913
- ctx.receive_value(None, JavaType)
914
- )
915
-
916
- if type in ["rewrite.python.tree.CompilationUnit", "org.openrewrite.python.tree.Py$CompilationUnit"]:
917
- return CompilationUnit(
918
- ctx.receive_value(None, UUID),
919
- ctx.receive_node(None, PythonReceiver.receive_space),
920
- ctx.receive_node(None, ctx.receive_markers),
921
- ctx.receive_value(None, Path),
922
- ctx.receive_value(None, FileAttributes),
923
- ctx.receive_value(None, str),
924
- ctx.receive_value(None, bool),
925
- ctx.receive_value(None, Checksum),
926
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree),
927
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree),
928
- ctx.receive_node(None, PythonReceiver.receive_space)
929
- )
930
-
931
- if type in ["rewrite.python.tree.ExpressionStatement", "org.openrewrite.python.tree.Py$ExpressionStatement"]:
932
- return ExpressionStatement(
933
- ctx.receive_value(None, UUID),
934
- ctx.receive_node(None, ctx.receive_tree)
935
- )
936
-
937
- if type in ["rewrite.python.tree.StatementExpression", "org.openrewrite.python.tree.Py$StatementExpression"]:
938
- return StatementExpression(
939
- ctx.receive_value(None, UUID),
940
- ctx.receive_node(None, ctx.receive_tree)
941
- )
942
-
943
- if type in ["rewrite.python.tree.MultiImport", "org.openrewrite.python.tree.Py$MultiImport"]:
944
- return MultiImport(
945
- ctx.receive_value(None, UUID),
946
- ctx.receive_node(None, PythonReceiver.receive_space),
947
- ctx.receive_node(None, ctx.receive_markers),
948
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
949
- ctx.receive_value(None, bool),
950
- ctx.receive_node(None, PythonReceiver.receive_container)
951
- )
952
-
953
- if type in ["rewrite.python.tree.KeyValue", "org.openrewrite.python.tree.Py$KeyValue"]:
954
- return KeyValue(
955
- ctx.receive_value(None, UUID),
956
- ctx.receive_node(None, PythonReceiver.receive_space),
957
- ctx.receive_node(None, ctx.receive_markers),
958
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
959
- ctx.receive_node(None, ctx.receive_tree),
960
- ctx.receive_value(None, JavaType)
961
- )
962
-
963
- if type in ["rewrite.python.tree.DictLiteral", "org.openrewrite.python.tree.Py$DictLiteral"]:
964
- return DictLiteral(
965
- ctx.receive_value(None, UUID),
966
- ctx.receive_node(None, PythonReceiver.receive_space),
967
- ctx.receive_node(None, ctx.receive_markers),
968
- ctx.receive_node(None, PythonReceiver.receive_container),
969
- ctx.receive_value(None, JavaType)
970
- )
971
-
972
- if type in ["rewrite.python.tree.CollectionLiteral", "org.openrewrite.python.tree.Py$CollectionLiteral"]:
973
- return CollectionLiteral(
974
- ctx.receive_value(None, UUID),
975
- ctx.receive_node(None, PythonReceiver.receive_space),
976
- ctx.receive_node(None, ctx.receive_markers),
977
- ctx.receive_value(None, CollectionLiteral.Kind),
978
- ctx.receive_node(None, PythonReceiver.receive_container),
979
- ctx.receive_value(None, JavaType)
980
- )
981
-
982
- if type in ["rewrite.python.tree.FormattedString", "org.openrewrite.python.tree.Py$FormattedString"]:
983
- return FormattedString(
984
- ctx.receive_value(None, UUID),
985
- ctx.receive_node(None, PythonReceiver.receive_space),
986
- ctx.receive_node(None, ctx.receive_markers),
987
- ctx.receive_value(None, str),
988
- ctx.receive_nodes(None, ctx.receive_tree)
989
- )
990
-
991
- if type in ["rewrite.python.tree.FormattedString.Value", "org.openrewrite.python.tree.Py$FormattedString$Value"]:
992
- return FormattedString.Value(
993
- ctx.receive_value(None, UUID),
994
- ctx.receive_node(None, PythonReceiver.receive_space),
995
- ctx.receive_node(None, ctx.receive_markers),
996
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
997
- ctx.receive_node(None, PythonReceiver.right_padded_value_receiver(bool)),
998
- ctx.receive_value(None, FormattedString.Value.Conversion),
999
- ctx.receive_node(None, ctx.receive_tree)
1000
- )
1001
-
1002
- if type in ["rewrite.python.tree.Pass", "org.openrewrite.python.tree.Py$Pass"]:
1003
- return Pass(
1004
- ctx.receive_value(None, UUID),
1005
- ctx.receive_node(None, PythonReceiver.receive_space),
1006
- ctx.receive_node(None, ctx.receive_markers)
1007
- )
1008
-
1009
- if type in ["rewrite.python.tree.TrailingElseWrapper", "org.openrewrite.python.tree.Py$TrailingElseWrapper"]:
1010
- return TrailingElseWrapper(
1011
- ctx.receive_value(None, UUID),
1012
- ctx.receive_node(None, PythonReceiver.receive_space),
1013
- ctx.receive_node(None, ctx.receive_markers),
1014
- ctx.receive_node(None, ctx.receive_tree),
1015
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree)
1016
- )
1017
-
1018
- if type in ["rewrite.python.tree.ComprehensionExpression", "org.openrewrite.python.tree.Py$ComprehensionExpression"]:
1019
- return ComprehensionExpression(
1020
- ctx.receive_value(None, UUID),
1021
- ctx.receive_node(None, PythonReceiver.receive_space),
1022
- ctx.receive_node(None, ctx.receive_markers),
1023
- ctx.receive_value(None, ComprehensionExpression.Kind),
1024
- ctx.receive_node(None, ctx.receive_tree),
1025
- ctx.receive_nodes(None, ctx.receive_tree),
1026
- ctx.receive_node(None, PythonReceiver.receive_space),
1027
- ctx.receive_value(None, JavaType)
1028
- )
1029
-
1030
- if type in ["rewrite.python.tree.ComprehensionExpression.Condition", "org.openrewrite.python.tree.Py$ComprehensionExpression$Condition"]:
1031
- return ComprehensionExpression.Condition(
1032
- ctx.receive_value(None, UUID),
1033
- ctx.receive_node(None, PythonReceiver.receive_space),
1034
- ctx.receive_node(None, ctx.receive_markers),
1035
- ctx.receive_node(None, ctx.receive_tree)
1036
- )
1037
-
1038
- if type in ["rewrite.python.tree.ComprehensionExpression.Clause", "org.openrewrite.python.tree.Py$ComprehensionExpression$Clause"]:
1039
- return ComprehensionExpression.Clause(
1040
- ctx.receive_value(None, UUID),
1041
- ctx.receive_node(None, PythonReceiver.receive_space),
1042
- ctx.receive_node(None, ctx.receive_markers),
1043
- ctx.receive_node(None, ctx.receive_tree),
1044
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1045
- ctx.receive_nodes(None, ctx.receive_tree)
1046
- )
1047
-
1048
- if type in ["rewrite.python.tree.Await", "org.openrewrite.python.tree.Py$Await"]:
1049
- return Await(
1050
- ctx.receive_value(None, UUID),
1051
- ctx.receive_node(None, PythonReceiver.receive_space),
1052
- ctx.receive_node(None, ctx.receive_markers),
1053
- ctx.receive_node(None, ctx.receive_tree),
1054
- ctx.receive_value(None, JavaType)
1055
- )
1056
-
1057
- if type in ["rewrite.python.tree.YieldFrom", "org.openrewrite.python.tree.Py$YieldFrom"]:
1058
- return YieldFrom(
1059
- ctx.receive_value(None, UUID),
1060
- ctx.receive_node(None, PythonReceiver.receive_space),
1061
- ctx.receive_node(None, ctx.receive_markers),
1062
- ctx.receive_node(None, ctx.receive_tree),
1063
- ctx.receive_value(None, JavaType)
1064
- )
1065
-
1066
- if type in ["rewrite.python.tree.VariableScope", "org.openrewrite.python.tree.Py$VariableScope"]:
1067
- return VariableScope(
1068
- ctx.receive_value(None, UUID),
1069
- ctx.receive_node(None, PythonReceiver.receive_space),
1070
- ctx.receive_node(None, ctx.receive_markers),
1071
- ctx.receive_value(None, VariableScope.Kind),
1072
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1073
- )
1074
-
1075
- if type in ["rewrite.python.tree.Del", "org.openrewrite.python.tree.Py$Del"]:
1076
- return Del(
1077
- ctx.receive_value(None, UUID),
1078
- ctx.receive_node(None, PythonReceiver.receive_space),
1079
- ctx.receive_node(None, ctx.receive_markers),
1080
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1081
- )
1082
-
1083
- if type in ["rewrite.python.tree.SpecialParameter", "org.openrewrite.python.tree.Py$SpecialParameter"]:
1084
- return SpecialParameter(
1085
- ctx.receive_value(None, UUID),
1086
- ctx.receive_node(None, PythonReceiver.receive_space),
1087
- ctx.receive_node(None, ctx.receive_markers),
1088
- ctx.receive_value(None, SpecialParameter.Kind),
1089
- ctx.receive_node(None, ctx.receive_tree),
1090
- ctx.receive_value(None, JavaType)
1091
- )
1092
-
1093
- if type in ["rewrite.python.tree.Star", "org.openrewrite.python.tree.Py$Star"]:
1094
- return Star(
1095
- ctx.receive_value(None, UUID),
1096
- ctx.receive_node(None, PythonReceiver.receive_space),
1097
- ctx.receive_node(None, ctx.receive_markers),
1098
- ctx.receive_value(None, Star.Kind),
1099
- ctx.receive_node(None, ctx.receive_tree),
1100
- ctx.receive_value(None, JavaType)
1101
- )
1102
-
1103
- if type in ["rewrite.python.tree.NamedArgument", "org.openrewrite.python.tree.Py$NamedArgument"]:
1104
- return NamedArgument(
1105
- ctx.receive_value(None, UUID),
1106
- ctx.receive_node(None, PythonReceiver.receive_space),
1107
- ctx.receive_node(None, ctx.receive_markers),
1108
- ctx.receive_node(None, ctx.receive_tree),
1109
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1110
- ctx.receive_value(None, JavaType)
1111
- )
1112
-
1113
- if type in ["rewrite.python.tree.TypeHintedExpression", "org.openrewrite.python.tree.Py$TypeHintedExpression"]:
1114
- return TypeHintedExpression(
1115
- ctx.receive_value(None, UUID),
1116
- ctx.receive_node(None, PythonReceiver.receive_space),
1117
- ctx.receive_node(None, ctx.receive_markers),
1118
- ctx.receive_node(None, ctx.receive_tree),
1119
- ctx.receive_node(None, ctx.receive_tree),
1120
- ctx.receive_value(None, JavaType)
1121
- )
1122
-
1123
- if type in ["rewrite.python.tree.ErrorFrom", "org.openrewrite.python.tree.Py$ErrorFrom"]:
1124
- return ErrorFrom(
1125
- ctx.receive_value(None, UUID),
1126
- ctx.receive_node(None, PythonReceiver.receive_space),
1127
- ctx.receive_node(None, ctx.receive_markers),
1128
- ctx.receive_node(None, ctx.receive_tree),
1129
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1130
- ctx.receive_value(None, JavaType)
1131
- )
1132
-
1133
- if type in ["rewrite.python.tree.MatchCase", "org.openrewrite.python.tree.Py$MatchCase"]:
1134
- return MatchCase(
1135
- ctx.receive_value(None, UUID),
1136
- ctx.receive_node(None, PythonReceiver.receive_space),
1137
- ctx.receive_node(None, ctx.receive_markers),
1138
- ctx.receive_node(None, ctx.receive_tree),
1139
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1140
- ctx.receive_value(None, JavaType)
1141
- )
1142
-
1143
- if type in ["rewrite.python.tree.MatchCase.Pattern", "org.openrewrite.python.tree.Py$MatchCase$Pattern"]:
1144
- return MatchCase.Pattern(
1145
- ctx.receive_value(None, UUID),
1146
- ctx.receive_node(None, PythonReceiver.receive_space),
1147
- ctx.receive_node(None, ctx.receive_markers),
1148
- ctx.receive_value(None, MatchCase.Pattern.Kind),
1149
- ctx.receive_node(None, PythonReceiver.receive_container),
1150
- ctx.receive_value(None, JavaType)
1151
- )
1152
-
1153
- if type in ["rewrite.python.tree.Slice", "org.openrewrite.python.tree.Py$Slice"]:
1154
- return Slice(
1155
- ctx.receive_value(None, UUID),
1156
- ctx.receive_node(None, PythonReceiver.receive_space),
1157
- ctx.receive_node(None, ctx.receive_markers),
1158
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1159
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1160
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1161
- )
1162
-
1163
- if type in ["rewrite.python.tree.AnnotatedType", "org.openrewrite.java.tree.J$AnnotatedType"]:
1164
- return AnnotatedType(
1165
- ctx.receive_value(None, UUID),
1166
- ctx.receive_node(None, PythonReceiver.receive_space),
1167
- ctx.receive_node(None, ctx.receive_markers),
1168
- ctx.receive_nodes(None, ctx.receive_tree),
1169
- ctx.receive_node(None, ctx.receive_tree)
1170
- )
1171
-
1172
- if type in ["rewrite.python.tree.Annotation", "org.openrewrite.java.tree.J$Annotation"]:
1173
- return Annotation(
1174
- ctx.receive_value(None, UUID),
1175
- ctx.receive_node(None, PythonReceiver.receive_space),
1176
- ctx.receive_node(None, ctx.receive_markers),
1177
- ctx.receive_node(None, ctx.receive_tree),
1178
- ctx.receive_node(None, PythonReceiver.receive_container)
1179
- )
1180
-
1181
- if type in ["rewrite.python.tree.ArrayAccess", "org.openrewrite.java.tree.J$ArrayAccess"]:
1182
- return ArrayAccess(
1183
- ctx.receive_value(None, UUID),
1184
- ctx.receive_node(None, PythonReceiver.receive_space),
1185
- ctx.receive_node(None, ctx.receive_markers),
1186
- ctx.receive_node(None, ctx.receive_tree),
1187
- ctx.receive_node(None, ctx.receive_tree),
1188
- ctx.receive_value(None, JavaType)
1189
- )
1190
-
1191
- if type in ["rewrite.python.tree.ArrayType", "org.openrewrite.java.tree.J$ArrayType"]:
1192
- return ArrayType(
1193
- ctx.receive_value(None, UUID),
1194
- ctx.receive_node(None, PythonReceiver.receive_space),
1195
- ctx.receive_node(None, ctx.receive_markers),
1196
- ctx.receive_node(None, ctx.receive_tree),
1197
- ctx.receive_nodes(None, ctx.receive_tree),
1198
- ctx.receive_node(None, PythonReceiver.left_padded_node_receiver(Space)),
1199
- ctx.receive_value(None, JavaType)
1200
- )
1201
-
1202
- if type in ["rewrite.python.tree.Assert", "org.openrewrite.java.tree.J$Assert"]:
1203
- return Assert(
1204
- ctx.receive_value(None, UUID),
1205
- ctx.receive_node(None, PythonReceiver.receive_space),
1206
- ctx.receive_node(None, ctx.receive_markers),
1207
- ctx.receive_node(None, ctx.receive_tree),
1208
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree)
1209
- )
1210
-
1211
- if type in ["rewrite.python.tree.Assignment", "org.openrewrite.java.tree.J$Assignment"]:
1212
- return Assignment(
1213
- ctx.receive_value(None, UUID),
1214
- ctx.receive_node(None, PythonReceiver.receive_space),
1215
- ctx.receive_node(None, ctx.receive_markers),
1216
- ctx.receive_node(None, ctx.receive_tree),
1217
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1218
- ctx.receive_value(None, JavaType)
1219
- )
1220
-
1221
- if type in ["rewrite.python.tree.AssignmentOperation", "org.openrewrite.java.tree.J$AssignmentOperation"]:
1222
- return AssignmentOperation(
1223
- ctx.receive_value(None, UUID),
1224
- ctx.receive_node(None, PythonReceiver.receive_space),
1225
- ctx.receive_node(None, ctx.receive_markers),
1226
- ctx.receive_node(None, ctx.receive_tree),
1227
- ctx.receive_node(None, PythonReceiver.left_padded_value_receiver(AssignmentOperation.Type)),
1228
- ctx.receive_node(None, ctx.receive_tree),
1229
- ctx.receive_value(None, JavaType)
1230
- )
1231
-
1232
- if type in ["rewrite.python.tree.Binary", "org.openrewrite.java.tree.J$Binary"]:
1233
- return Binary(
1234
- ctx.receive_value(None, UUID),
1235
- ctx.receive_node(None, PythonReceiver.receive_space),
1236
- ctx.receive_node(None, ctx.receive_markers),
1237
- ctx.receive_node(None, ctx.receive_tree),
1238
- ctx.receive_node(None, PythonReceiver.left_padded_value_receiver(Binary.Type)),
1239
- ctx.receive_node(None, ctx.receive_tree),
1240
- ctx.receive_value(None, JavaType)
1241
- )
1242
-
1243
- if type in ["rewrite.python.tree.Block", "org.openrewrite.java.tree.J$Block"]:
1244
- return Block(
1245
- ctx.receive_value(None, UUID),
1246
- ctx.receive_node(None, PythonReceiver.receive_space),
1247
- ctx.receive_node(None, ctx.receive_markers),
1248
- ctx.receive_node(None, PythonReceiver.right_padded_value_receiver(bool)),
1249
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree),
1250
- ctx.receive_node(None, PythonReceiver.receive_space)
1251
- )
1252
-
1253
- if type in ["rewrite.python.tree.Break", "org.openrewrite.java.tree.J$Break"]:
1254
- return Break(
1255
- ctx.receive_value(None, UUID),
1256
- ctx.receive_node(None, PythonReceiver.receive_space),
1257
- ctx.receive_node(None, ctx.receive_markers),
1258
- ctx.receive_node(None, ctx.receive_tree)
1259
- )
1260
-
1261
- if type in ["rewrite.python.tree.Case", "org.openrewrite.java.tree.J$Case"]:
1262
- return Case(
1263
- ctx.receive_value(None, UUID),
1264
- ctx.receive_node(None, PythonReceiver.receive_space),
1265
- ctx.receive_node(None, ctx.receive_markers),
1266
- ctx.receive_value(None, Case.Type),
1267
- ctx.receive_node(None, PythonReceiver.receive_container),
1268
- ctx.receive_node(None, PythonReceiver.receive_container),
1269
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1270
- )
1271
-
1272
- if type in ["rewrite.python.tree.ClassDeclaration", "org.openrewrite.java.tree.J$ClassDeclaration"]:
1273
- return ClassDeclaration(
1274
- ctx.receive_value(None, UUID),
1275
- ctx.receive_node(None, PythonReceiver.receive_space),
1276
- ctx.receive_node(None, ctx.receive_markers),
1277
- ctx.receive_nodes(None, ctx.receive_tree),
1278
- ctx.receive_nodes(None, ctx.receive_tree),
1279
- ctx.receive_node(None, ctx.receive_tree),
1280
- ctx.receive_node(None, ctx.receive_tree),
1281
- ctx.receive_node(None, PythonReceiver.receive_container),
1282
- ctx.receive_node(None, PythonReceiver.receive_container),
1283
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1284
- ctx.receive_node(None, PythonReceiver.receive_container),
1285
- ctx.receive_node(None, PythonReceiver.receive_container),
1286
- ctx.receive_node(None, ctx.receive_tree),
1287
- ctx.receive_value(None, JavaType.FullyQualified)
1288
- )
1289
-
1290
- if type in ["rewrite.python.tree.ClassDeclaration.Kind", "org.openrewrite.java.tree.J$ClassDeclaration$Kind"]:
1291
- return ClassDeclaration.Kind(
1292
- ctx.receive_value(None, UUID),
1293
- ctx.receive_node(None, PythonReceiver.receive_space),
1294
- ctx.receive_node(None, ctx.receive_markers),
1295
- ctx.receive_nodes(None, ctx.receive_tree),
1296
- ctx.receive_value(None, ClassDeclaration.Kind.Type)
1297
- )
1298
-
1299
- if type in ["rewrite.python.tree.Continue", "org.openrewrite.java.tree.J$Continue"]:
1300
- return Continue(
1301
- ctx.receive_value(None, UUID),
1302
- ctx.receive_node(None, PythonReceiver.receive_space),
1303
- ctx.receive_node(None, ctx.receive_markers),
1304
- ctx.receive_node(None, ctx.receive_tree)
1305
- )
1306
-
1307
- if type in ["rewrite.python.tree.DoWhileLoop", "org.openrewrite.java.tree.J$DoWhileLoop"]:
1308
- return DoWhileLoop(
1309
- ctx.receive_value(None, UUID),
1310
- ctx.receive_node(None, PythonReceiver.receive_space),
1311
- ctx.receive_node(None, ctx.receive_markers),
1312
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1313
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree)
1314
- )
1315
-
1316
- if type in ["rewrite.python.tree.Empty", "org.openrewrite.java.tree.J$Empty"]:
1317
- return Empty(
1318
- ctx.receive_value(None, UUID),
1319
- ctx.receive_node(None, PythonReceiver.receive_space),
1320
- ctx.receive_node(None, ctx.receive_markers)
1321
- )
1322
-
1323
- if type in ["rewrite.python.tree.EnumValue", "org.openrewrite.java.tree.J$EnumValue"]:
1324
- return EnumValue(
1325
- ctx.receive_value(None, UUID),
1326
- ctx.receive_node(None, PythonReceiver.receive_space),
1327
- ctx.receive_node(None, ctx.receive_markers),
1328
- ctx.receive_nodes(None, ctx.receive_tree),
1329
- ctx.receive_node(None, ctx.receive_tree),
1330
- ctx.receive_node(None, ctx.receive_tree)
1331
- )
1332
-
1333
- if type in ["rewrite.python.tree.EnumValueSet", "org.openrewrite.java.tree.J$EnumValueSet"]:
1334
- return EnumValueSet(
1335
- ctx.receive_value(None, UUID),
1336
- ctx.receive_node(None, PythonReceiver.receive_space),
1337
- ctx.receive_node(None, ctx.receive_markers),
1338
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree),
1339
- ctx.receive_value(None, bool)
1340
- )
1341
-
1342
- if type in ["rewrite.python.tree.FieldAccess", "org.openrewrite.java.tree.J$FieldAccess"]:
1343
- return FieldAccess(
1344
- ctx.receive_value(None, UUID),
1345
- ctx.receive_node(None, PythonReceiver.receive_space),
1346
- ctx.receive_node(None, ctx.receive_markers),
1347
- ctx.receive_node(None, ctx.receive_tree),
1348
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1349
- ctx.receive_value(None, JavaType)
1350
- )
1351
-
1352
- if type in ["rewrite.python.tree.ForEachLoop", "org.openrewrite.java.tree.J$ForEachLoop"]:
1353
- return ForEachLoop(
1354
- ctx.receive_value(None, UUID),
1355
- ctx.receive_node(None, PythonReceiver.receive_space),
1356
- ctx.receive_node(None, ctx.receive_markers),
1357
- ctx.receive_node(None, ctx.receive_tree),
1358
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1359
- )
1360
-
1361
- if type in ["rewrite.python.tree.ForEachLoop.Control", "org.openrewrite.java.tree.J$ForEachLoop$Control"]:
1362
- return ForEachLoop.Control(
1363
- ctx.receive_value(None, UUID),
1364
- ctx.receive_node(None, PythonReceiver.receive_space),
1365
- ctx.receive_node(None, ctx.receive_markers),
1366
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1367
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1368
- )
1369
-
1370
- if type in ["rewrite.python.tree.ForLoop", "org.openrewrite.java.tree.J$ForLoop"]:
1371
- return ForLoop(
1372
- ctx.receive_value(None, UUID),
1373
- ctx.receive_node(None, PythonReceiver.receive_space),
1374
- ctx.receive_node(None, ctx.receive_markers),
1375
- ctx.receive_node(None, ctx.receive_tree),
1376
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1377
- )
1378
-
1379
- if type in ["rewrite.python.tree.ForLoop.Control", "org.openrewrite.java.tree.J$ForLoop$Control"]:
1380
- return ForLoop.Control(
1381
- ctx.receive_value(None, UUID),
1382
- ctx.receive_node(None, PythonReceiver.receive_space),
1383
- ctx.receive_node(None, ctx.receive_markers),
1384
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree),
1385
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1386
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1387
- )
1388
-
1389
- if type in ["rewrite.python.tree.ParenthesizedTypeTree", "org.openrewrite.java.tree.J$ParenthesizedTypeTree"]:
1390
- return ParenthesizedTypeTree(
1391
- ctx.receive_value(None, UUID),
1392
- ctx.receive_node(None, PythonReceiver.receive_space),
1393
- ctx.receive_node(None, ctx.receive_markers),
1394
- ctx.receive_nodes(None, ctx.receive_tree),
1395
- ctx.receive_node(None, ctx.receive_tree)
1396
- )
1397
-
1398
- if type in ["rewrite.python.tree.Identifier", "org.openrewrite.java.tree.J$Identifier"]:
1399
- return Identifier(
1400
- ctx.receive_value(None, UUID),
1401
- ctx.receive_node(None, PythonReceiver.receive_space),
1402
- ctx.receive_node(None, ctx.receive_markers),
1403
- ctx.receive_nodes(None, ctx.receive_tree),
1404
- ctx.receive_value(None, str),
1405
- ctx.receive_value(None, JavaType),
1406
- ctx.receive_value(None, JavaType.Variable)
1407
- )
1408
-
1409
- if type in ["rewrite.python.tree.If", "org.openrewrite.java.tree.J$If"]:
1410
- return If(
1411
- ctx.receive_value(None, UUID),
1412
- ctx.receive_node(None, PythonReceiver.receive_space),
1413
- ctx.receive_node(None, ctx.receive_markers),
1414
- ctx.receive_node(None, ctx.receive_tree),
1415
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1416
- ctx.receive_node(None, ctx.receive_tree)
1417
- )
1418
-
1419
- if type in ["rewrite.python.tree.If.Else", "org.openrewrite.java.tree.J$If$Else"]:
1420
- return If.Else(
1421
- ctx.receive_value(None, UUID),
1422
- ctx.receive_node(None, PythonReceiver.receive_space),
1423
- ctx.receive_node(None, ctx.receive_markers),
1424
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1425
- )
1426
-
1427
- if type in ["rewrite.python.tree.Import", "org.openrewrite.java.tree.J$Import"]:
1428
- return Import(
1429
- ctx.receive_value(None, UUID),
1430
- ctx.receive_node(None, PythonReceiver.receive_space),
1431
- ctx.receive_node(None, ctx.receive_markers),
1432
- ctx.receive_node(None, PythonReceiver.left_padded_value_receiver(bool)),
1433
- ctx.receive_node(None, ctx.receive_tree),
1434
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree)
1435
- )
1436
-
1437
- if type in ["rewrite.python.tree.InstanceOf", "org.openrewrite.java.tree.J$InstanceOf"]:
1438
- return InstanceOf(
1439
- ctx.receive_value(None, UUID),
1440
- ctx.receive_node(None, PythonReceiver.receive_space),
1441
- ctx.receive_node(None, ctx.receive_markers),
1442
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1443
- ctx.receive_node(None, ctx.receive_tree),
1444
- ctx.receive_node(None, ctx.receive_tree),
1445
- ctx.receive_value(None, JavaType)
1446
- )
1447
-
1448
- if type in ["rewrite.python.tree.IntersectionType", "org.openrewrite.java.tree.J$IntersectionType"]:
1449
- return IntersectionType(
1450
- ctx.receive_value(None, UUID),
1451
- ctx.receive_node(None, PythonReceiver.receive_space),
1452
- ctx.receive_node(None, ctx.receive_markers),
1453
- ctx.receive_node(None, PythonReceiver.receive_container)
1454
- )
1455
-
1456
- if type in ["rewrite.python.tree.Label", "org.openrewrite.java.tree.J$Label"]:
1457
- return Label(
1458
- ctx.receive_value(None, UUID),
1459
- ctx.receive_node(None, PythonReceiver.receive_space),
1460
- ctx.receive_node(None, ctx.receive_markers),
1461
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1462
- ctx.receive_node(None, ctx.receive_tree)
1463
- )
1464
-
1465
- if type in ["rewrite.python.tree.Lambda", "org.openrewrite.java.tree.J$Lambda"]:
1466
- return Lambda(
1467
- ctx.receive_value(None, UUID),
1468
- ctx.receive_node(None, PythonReceiver.receive_space),
1469
- ctx.receive_node(None, ctx.receive_markers),
1470
- ctx.receive_node(None, ctx.receive_tree),
1471
- ctx.receive_node(None, PythonReceiver.receive_space),
1472
- ctx.receive_node(None, ctx.receive_tree),
1473
- ctx.receive_value(None, JavaType)
1474
- )
1475
-
1476
- if type in ["rewrite.python.tree.Lambda.Parameters", "org.openrewrite.java.tree.J$Lambda$Parameters"]:
1477
- return Lambda.Parameters(
1478
- ctx.receive_value(None, UUID),
1479
- ctx.receive_node(None, PythonReceiver.receive_space),
1480
- ctx.receive_node(None, ctx.receive_markers),
1481
- ctx.receive_value(None, bool),
1482
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1483
- )
1484
-
1485
- if type in ["rewrite.python.tree.Literal", "org.openrewrite.java.tree.J$Literal"]:
1486
- return Literal(
1487
- ctx.receive_value(None, UUID),
1488
- ctx.receive_node(None, PythonReceiver.receive_space),
1489
- ctx.receive_node(None, ctx.receive_markers),
1490
- ctx.receive_value(None, object),
1491
- ctx.receive_value(None, str),
1492
- ctx.receive_values(None, Literal.UnicodeEscape),
1493
- ctx.receive_value(None, JavaType.Primitive)
1494
- )
1495
-
1496
- if type in ["rewrite.python.tree.MemberReference", "org.openrewrite.java.tree.J$MemberReference"]:
1497
- return MemberReference(
1498
- ctx.receive_value(None, UUID),
1499
- ctx.receive_node(None, PythonReceiver.receive_space),
1500
- ctx.receive_node(None, ctx.receive_markers),
1501
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1502
- ctx.receive_node(None, PythonReceiver.receive_container),
1503
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1504
- ctx.receive_value(None, JavaType),
1505
- ctx.receive_value(None, JavaType.Method),
1506
- ctx.receive_value(None, JavaType.Variable)
1507
- )
1508
-
1509
- if type in ["rewrite.python.tree.MethodDeclaration", "org.openrewrite.java.tree.J$MethodDeclaration"]:
1510
- return MethodDeclaration(
1511
- ctx.receive_value(None, UUID),
1512
- ctx.receive_node(None, PythonReceiver.receive_space),
1513
- ctx.receive_node(None, ctx.receive_markers),
1514
- ctx.receive_nodes(None, ctx.receive_tree),
1515
- ctx.receive_nodes(None, ctx.receive_tree),
1516
- ctx.receive_node(None, ctx.receive_tree),
1517
- ctx.receive_node(None, ctx.receive_tree),
1518
- ctx.receive_node(None, PythonReceiver.receive_method_identifier_with_annotations),
1519
- ctx.receive_node(None, PythonReceiver.receive_container),
1520
- ctx.receive_node(None, PythonReceiver.receive_container),
1521
- ctx.receive_node(None, ctx.receive_tree),
1522
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1523
- ctx.receive_value(None, JavaType.Method)
1524
- )
1525
-
1526
- if type in ["rewrite.python.tree.MethodInvocation", "org.openrewrite.java.tree.J$MethodInvocation"]:
1527
- return MethodInvocation(
1528
- ctx.receive_value(None, UUID),
1529
- ctx.receive_node(None, PythonReceiver.receive_space),
1530
- ctx.receive_node(None, ctx.receive_markers),
1531
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1532
- ctx.receive_node(None, PythonReceiver.receive_container),
1533
- ctx.receive_node(None, ctx.receive_tree),
1534
- ctx.receive_node(None, PythonReceiver.receive_container),
1535
- ctx.receive_value(None, JavaType.Method)
1536
- )
1537
-
1538
- if type in ["rewrite.python.tree.Modifier", "org.openrewrite.java.tree.J$Modifier"]:
1539
- return Modifier(
1540
- ctx.receive_value(None, UUID),
1541
- ctx.receive_node(None, PythonReceiver.receive_space),
1542
- ctx.receive_node(None, ctx.receive_markers),
1543
- ctx.receive_value(None, str),
1544
- ctx.receive_value(None, Modifier.Type),
1545
- ctx.receive_nodes(None, ctx.receive_tree)
1546
- )
1547
-
1548
- if type in ["rewrite.python.tree.MultiCatch", "org.openrewrite.java.tree.J$MultiCatch"]:
1549
- return MultiCatch(
1550
- ctx.receive_value(None, UUID),
1551
- ctx.receive_node(None, PythonReceiver.receive_space),
1552
- ctx.receive_node(None, ctx.receive_markers),
1553
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1554
- )
1555
-
1556
- if type in ["rewrite.python.tree.NewArray", "org.openrewrite.java.tree.J$NewArray"]:
1557
- return NewArray(
1558
- ctx.receive_value(None, UUID),
1559
- ctx.receive_node(None, PythonReceiver.receive_space),
1560
- ctx.receive_node(None, ctx.receive_markers),
1561
- ctx.receive_node(None, ctx.receive_tree),
1562
- ctx.receive_nodes(None, ctx.receive_tree),
1563
- ctx.receive_node(None, PythonReceiver.receive_container),
1564
- ctx.receive_value(None, JavaType)
1565
- )
1566
-
1567
- if type in ["rewrite.python.tree.ArrayDimension", "org.openrewrite.java.tree.J$ArrayDimension"]:
1568
- return ArrayDimension(
1569
- ctx.receive_value(None, UUID),
1570
- ctx.receive_node(None, PythonReceiver.receive_space),
1571
- ctx.receive_node(None, ctx.receive_markers),
1572
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1573
- )
1574
-
1575
- if type in ["rewrite.python.tree.NewClass", "org.openrewrite.java.tree.J$NewClass"]:
1576
- return NewClass(
1577
- ctx.receive_value(None, UUID),
1578
- ctx.receive_node(None, PythonReceiver.receive_space),
1579
- ctx.receive_node(None, ctx.receive_markers),
1580
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree),
1581
- ctx.receive_node(None, PythonReceiver.receive_space),
1582
- ctx.receive_node(None, ctx.receive_tree),
1583
- ctx.receive_node(None, PythonReceiver.receive_container),
1584
- ctx.receive_node(None, ctx.receive_tree),
1585
- ctx.receive_value(None, JavaType.Method)
1586
- )
1587
-
1588
- if type in ["rewrite.python.tree.NullableType", "org.openrewrite.java.tree.J$NullableType"]:
1589
- return NullableType(
1590
- ctx.receive_value(None, UUID),
1591
- ctx.receive_node(None, PythonReceiver.receive_space),
1592
- ctx.receive_node(None, ctx.receive_markers),
1593
- ctx.receive_nodes(None, ctx.receive_tree),
1594
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1595
- )
1596
-
1597
- if type in ["rewrite.python.tree.Package", "org.openrewrite.java.tree.J$Package"]:
1598
- return Package(
1599
- ctx.receive_value(None, UUID),
1600
- ctx.receive_node(None, PythonReceiver.receive_space),
1601
- ctx.receive_node(None, ctx.receive_markers),
1602
- ctx.receive_node(None, ctx.receive_tree),
1603
- ctx.receive_nodes(None, ctx.receive_tree)
1604
- )
1605
-
1606
- if type in ["rewrite.python.tree.ParameterizedType", "org.openrewrite.java.tree.J$ParameterizedType"]:
1607
- return ParameterizedType(
1608
- ctx.receive_value(None, UUID),
1609
- ctx.receive_node(None, PythonReceiver.receive_space),
1610
- ctx.receive_node(None, ctx.receive_markers),
1611
- ctx.receive_node(None, ctx.receive_tree),
1612
- ctx.receive_node(None, PythonReceiver.receive_container),
1613
- ctx.receive_value(None, JavaType)
1614
- )
1615
-
1616
- if type in ["rewrite.python.tree.Parentheses", "org.openrewrite.java.tree.J$Parentheses"]:
1617
- return Parentheses[J2](
1618
- ctx.receive_value(None, UUID),
1619
- ctx.receive_node(None, PythonReceiver.receive_space),
1620
- ctx.receive_node(None, ctx.receive_markers),
1621
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1622
- )
1623
-
1624
- if type in ["rewrite.python.tree.ControlParentheses", "org.openrewrite.java.tree.J$ControlParentheses"]:
1625
- return ControlParentheses[J2](
1626
- ctx.receive_value(None, UUID),
1627
- ctx.receive_node(None, PythonReceiver.receive_space),
1628
- ctx.receive_node(None, ctx.receive_markers),
1629
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1630
- )
1631
-
1632
- if type in ["rewrite.python.tree.Primitive", "org.openrewrite.java.tree.J$Primitive"]:
1633
- return Primitive(
1634
- ctx.receive_value(None, UUID),
1635
- ctx.receive_node(None, PythonReceiver.receive_space),
1636
- ctx.receive_node(None, ctx.receive_markers),
1637
- ctx.receive_value(None, JavaType.Primitive)
1638
- )
1639
-
1640
- if type in ["rewrite.python.tree.Return", "org.openrewrite.java.tree.J$Return"]:
1641
- return Return(
1642
- ctx.receive_value(None, UUID),
1643
- ctx.receive_node(None, PythonReceiver.receive_space),
1644
- ctx.receive_node(None, ctx.receive_markers),
1645
- ctx.receive_node(None, ctx.receive_tree)
1646
- )
1647
-
1648
- if type in ["rewrite.python.tree.Switch", "org.openrewrite.java.tree.J$Switch"]:
1649
- return Switch(
1650
- ctx.receive_value(None, UUID),
1651
- ctx.receive_node(None, PythonReceiver.receive_space),
1652
- ctx.receive_node(None, ctx.receive_markers),
1653
- ctx.receive_node(None, ctx.receive_tree),
1654
- ctx.receive_node(None, ctx.receive_tree)
1655
- )
1656
-
1657
- if type in ["rewrite.python.tree.SwitchExpression", "org.openrewrite.java.tree.J$SwitchExpression"]:
1658
- return SwitchExpression(
1659
- ctx.receive_value(None, UUID),
1660
- ctx.receive_node(None, PythonReceiver.receive_space),
1661
- ctx.receive_node(None, ctx.receive_markers),
1662
- ctx.receive_node(None, ctx.receive_tree),
1663
- ctx.receive_node(None, ctx.receive_tree)
1664
- )
1665
-
1666
- if type in ["rewrite.python.tree.Synchronized", "org.openrewrite.java.tree.J$Synchronized"]:
1667
- return Synchronized(
1668
- ctx.receive_value(None, UUID),
1669
- ctx.receive_node(None, PythonReceiver.receive_space),
1670
- ctx.receive_node(None, ctx.receive_markers),
1671
- ctx.receive_node(None, ctx.receive_tree),
1672
- ctx.receive_node(None, ctx.receive_tree)
1673
- )
1674
-
1675
- if type in ["rewrite.python.tree.Ternary", "org.openrewrite.java.tree.J$Ternary"]:
1676
- return Ternary(
1677
- ctx.receive_value(None, UUID),
1678
- ctx.receive_node(None, PythonReceiver.receive_space),
1679
- ctx.receive_node(None, ctx.receive_markers),
1680
- ctx.receive_node(None, ctx.receive_tree),
1681
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1682
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1683
- ctx.receive_value(None, JavaType)
1684
- )
1685
-
1686
- if type in ["rewrite.python.tree.Throw", "org.openrewrite.java.tree.J$Throw"]:
1687
- return Throw(
1688
- ctx.receive_value(None, UUID),
1689
- ctx.receive_node(None, PythonReceiver.receive_space),
1690
- ctx.receive_node(None, ctx.receive_markers),
1691
- ctx.receive_node(None, ctx.receive_tree)
1692
- )
1693
-
1694
- if type in ["rewrite.python.tree.Try", "org.openrewrite.java.tree.J$Try"]:
1695
- return Try(
1696
- ctx.receive_value(None, UUID),
1697
- ctx.receive_node(None, PythonReceiver.receive_space),
1698
- ctx.receive_node(None, ctx.receive_markers),
1699
- ctx.receive_node(None, PythonReceiver.receive_container),
1700
- ctx.receive_node(None, ctx.receive_tree),
1701
- ctx.receive_nodes(None, ctx.receive_tree),
1702
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree)
1703
- )
1704
-
1705
- if type in ["rewrite.python.tree.Try.Resource", "org.openrewrite.java.tree.J$Try$Resource"]:
1706
- return Try.Resource(
1707
- ctx.receive_value(None, UUID),
1708
- ctx.receive_node(None, PythonReceiver.receive_space),
1709
- ctx.receive_node(None, ctx.receive_markers),
1710
- ctx.receive_node(None, ctx.receive_tree),
1711
- ctx.receive_value(None, bool)
1712
- )
1713
-
1714
- if type in ["rewrite.python.tree.Try.Catch", "org.openrewrite.java.tree.J$Try$Catch"]:
1715
- return Try.Catch(
1716
- ctx.receive_value(None, UUID),
1717
- ctx.receive_node(None, PythonReceiver.receive_space),
1718
- ctx.receive_node(None, ctx.receive_markers),
1719
- ctx.receive_node(None, ctx.receive_tree),
1720
- ctx.receive_node(None, ctx.receive_tree)
1721
- )
1722
-
1723
- if type in ["rewrite.python.tree.TypeCast", "org.openrewrite.java.tree.J$TypeCast"]:
1724
- return TypeCast(
1725
- ctx.receive_value(None, UUID),
1726
- ctx.receive_node(None, PythonReceiver.receive_space),
1727
- ctx.receive_node(None, ctx.receive_markers),
1728
- ctx.receive_node(None, ctx.receive_tree),
1729
- ctx.receive_node(None, ctx.receive_tree)
1730
- )
1731
-
1732
- if type in ["rewrite.python.tree.TypeParameter", "org.openrewrite.java.tree.J$TypeParameter"]:
1733
- return TypeParameter(
1734
- ctx.receive_value(None, UUID),
1735
- ctx.receive_node(None, PythonReceiver.receive_space),
1736
- ctx.receive_node(None, ctx.receive_markers),
1737
- ctx.receive_nodes(None, ctx.receive_tree),
1738
- ctx.receive_nodes(None, ctx.receive_tree),
1739
- ctx.receive_node(None, ctx.receive_tree),
1740
- ctx.receive_node(None, PythonReceiver.receive_container)
1741
- )
1742
-
1743
- if type in ["rewrite.python.tree.TypeParameters", "org.openrewrite.java.tree.J$TypeParameters"]:
1744
- return TypeParameters(
1745
- ctx.receive_value(None, UUID),
1746
- ctx.receive_node(None, PythonReceiver.receive_space),
1747
- ctx.receive_node(None, ctx.receive_markers),
1748
- ctx.receive_nodes(None, ctx.receive_tree),
1749
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1750
- )
1751
-
1752
- if type in ["rewrite.python.tree.Unary", "org.openrewrite.java.tree.J$Unary"]:
1753
- return Unary(
1754
- ctx.receive_value(None, UUID),
1755
- ctx.receive_node(None, PythonReceiver.receive_space),
1756
- ctx.receive_node(None, ctx.receive_markers),
1757
- ctx.receive_node(None, PythonReceiver.left_padded_value_receiver(Unary.Type)),
1758
- ctx.receive_node(None, ctx.receive_tree),
1759
- ctx.receive_value(None, JavaType)
1760
- )
1761
-
1762
- if type in ["rewrite.python.tree.VariableDeclarations", "org.openrewrite.java.tree.J$VariableDeclarations"]:
1763
- return VariableDeclarations(
1764
- ctx.receive_value(None, UUID),
1765
- ctx.receive_node(None, PythonReceiver.receive_space),
1766
- ctx.receive_node(None, ctx.receive_markers),
1767
- ctx.receive_nodes(None, ctx.receive_tree),
1768
- ctx.receive_nodes(None, ctx.receive_tree),
1769
- ctx.receive_node(None, ctx.receive_tree),
1770
- ctx.receive_node(None, PythonReceiver.receive_space),
1771
- ctx.receive_nodes(None, PythonReceiver.left_padded_node_receiver(Space)),
1772
- ctx.receive_nodes(None, PythonReceiver.receive_right_padded_tree)
1773
- )
1774
-
1775
- if type in ["rewrite.python.tree.VariableDeclarations.NamedVariable", "org.openrewrite.java.tree.J$VariableDeclarations$NamedVariable"]:
1776
- return VariableDeclarations.NamedVariable(
1777
- ctx.receive_value(None, UUID),
1778
- ctx.receive_node(None, PythonReceiver.receive_space),
1779
- ctx.receive_node(None, ctx.receive_markers),
1780
- ctx.receive_node(None, ctx.receive_tree),
1781
- ctx.receive_nodes(None, PythonReceiver.left_padded_node_receiver(Space)),
1782
- ctx.receive_node(None, PythonReceiver.receive_left_padded_tree),
1783
- ctx.receive_value(None, JavaType.Variable)
1784
- )
1785
-
1786
- if type in ["rewrite.python.tree.WhileLoop", "org.openrewrite.java.tree.J$WhileLoop"]:
1787
- return WhileLoop(
1788
- ctx.receive_value(None, UUID),
1789
- ctx.receive_node(None, PythonReceiver.receive_space),
1790
- ctx.receive_node(None, ctx.receive_markers),
1791
- ctx.receive_node(None, ctx.receive_tree),
1792
- ctx.receive_node(None, PythonReceiver.receive_right_padded_tree)
1793
- )
1794
-
1795
- if type in ["rewrite.python.tree.Wildcard", "org.openrewrite.java.tree.J$Wildcard"]:
1796
- return Wildcard(
1797
- ctx.receive_value(None, UUID),
1798
- ctx.receive_node(None, PythonReceiver.receive_space),
1799
- ctx.receive_node(None, ctx.receive_markers),
1800
- ctx.receive_node(None, PythonReceiver.left_padded_value_receiver(Wildcard.Bound)),
1801
- ctx.receive_node(None, ctx.receive_tree)
1802
- )
1803
-
1804
- if type in ["rewrite.python.tree.Yield", "org.openrewrite.java.tree.J$Yield"]:
1805
- return Yield(
1806
- ctx.receive_value(None, UUID),
1807
- ctx.receive_node(None, PythonReceiver.receive_space),
1808
- ctx.receive_node(None, ctx.receive_markers),
1809
- ctx.receive_value(None, bool),
1810
- ctx.receive_node(None, ctx.receive_tree)
1811
- )
1812
-
1813
- if type in ["rewrite.python.tree.Unknown", "org.openrewrite.java.tree.J$Unknown"]:
1814
- return Unknown(
1815
- ctx.receive_value(None, UUID),
1816
- ctx.receive_node(None, PythonReceiver.receive_space),
1817
- ctx.receive_node(None, ctx.receive_markers),
1818
- ctx.receive_node(None, ctx.receive_tree)
1819
- )
1820
-
1821
- if type in ["rewrite.python.tree.Unknown.Source", "org.openrewrite.java.tree.J$Unknown$Source"]:
1822
- return Unknown.Source(
1823
- ctx.receive_value(None, UUID),
1824
- ctx.receive_node(None, PythonReceiver.receive_space),
1825
- ctx.receive_node(None, ctx.receive_markers),
1826
- ctx.receive_value(None, str)
1827
- )
1828
-
1829
- raise NotImplementedError("No factory method for type: " + type)
1830
-
1831
- @classmethod
1832
- def receive_method_identifier_with_annotations(cls, before: MethodDeclaration.IdentifierWithAnnotations, type: Optional[str], ctx: ReceiverContext) -> MethodDeclaration.IdentifierWithAnnotations:
1833
- if before is not None:
1834
- before = before.with_identifier(ctx.receive_node(before.identifier, ctx.receive_tree))
1835
- before = before.with_annotations(ctx.receive_nodes(before.annotations, ctx.receive_tree))
1836
- else:
1837
- before = MethodDeclaration.IdentifierWithAnnotations(
1838
- ctx.receive_node(None, ctx.receive_tree),
1839
- ctx.receive_nodes(None, ctx.receive_tree)
1840
- )
1841
- return before
1842
-
1843
- @classmethod
1844
- def receive_container(cls, container: Optional[JContainer[T]], type: Optional[str], ctx: ReceiverContext) -> JContainer[T]:
1845
- return extensions.receive_container(container, type, ctx)
1846
-
1847
- @classmethod
1848
- def left_padded_value_receiver(cls, type_: Type) -> Callable[[Optional[JLeftPadded[T]], Optional[str], ReceiverContext], JLeftPadded[T]]:
1849
- return extensions.left_padded_value_receiver(type_)
1850
-
1851
- @classmethod
1852
- def left_padded_node_receiver(cls, type_: Type) -> Callable[[Optional[JLeftPadded[T]], Optional[str], ReceiverContext], JLeftPadded[T]]:
1853
- return extensions.left_padded_node_receiver(type_)
1854
-
1855
- @classmethod
1856
- def receive_left_padded_tree(cls, left_padded: Optional[JLeftPadded[T]], type: Optional[str], ctx: ReceiverContext) -> JLeftPadded[T]:
1857
- return extensions.receive_left_padded_tree(left_padded, type, ctx)
1858
-
1859
- @classmethod
1860
- def right_padded_value_receiver(cls, type_: Type) -> Callable[[Optional[JRightPadded[T]], Optional[str], ReceiverContext], JRightPadded[T]]:
1861
- return extensions.right_padded_value_receiver(type_)
1862
-
1863
- @classmethod
1864
- def right_padded_node_receiver(cls, type_: Type) -> Callable[[Optional[JRightPadded[T]], Optional[str], ReceiverContext], JRightPadded[T]]:
1865
- return extensions.right_padded_node_receiver(type_)
1866
-
1867
- @classmethod
1868
- def receive_right_padded_tree(cls, right_padded: Optional[JRightPadded[T]], type: Optional[str], ctx: ReceiverContext) -> JRightPadded[T]:
1869
- return extensions.receive_right_padded_tree(right_padded, type, ctx)
1870
-
1871
- @classmethod
1872
- def receive_space(cls, space: Optional[Space], type: Optional[str], ctx: ReceiverContext) -> Space:
1873
- return extensions.receive_space(space, type, ctx)