openrewrite-remote 0.5.5__tar.gz → 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openrewrite-remote
3
- Version: 0.5.5
3
+ Version: 0.11.0
4
4
  Summary: Remoting functionality for the OpenRewrite library.
5
5
  License: Moderne, Inc. Commercial License
6
6
  Author: Moderne Inc.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "openrewrite-remote"
3
- version = "0.5.5" # This will be replaced by the GitHub Actions workflow
3
+ version = "0.11.0" # This will be replaced by the GitHub Actions workflow
4
4
  description = "Remoting functionality for the OpenRewrite library."
5
5
  authors = ["Moderne Inc. <support@moderne.io>"]
6
6
  license = "Moderne, Inc. Commercial License"
@@ -9,7 +9,7 @@ from uuid import UUID
9
9
 
10
10
  import cbor2
11
11
  from cbor2 import CBOREncoder
12
- from rewrite import Tree, Markers, Marker, ParseErrorVisitor, Cursor
12
+ from rewrite import Tree, Markers, Marker, ParseErrorVisitor, Cursor, Style
13
13
  from rewrite.remote.type_utils import to_java_type_name, to_java_field_name, to_java_type_name_from_value
14
14
  from rewrite.visitor import TreeVisitor
15
15
 
@@ -335,7 +335,7 @@ class ValueSerializer(ABC):
335
335
  encoder.encode_int(id)
336
336
 
337
337
  for field in fields(value):
338
- if field.name[0] == '_' and not hasattr(field.type, '__origin__') or field.type.__origin__ is not ClassVar:
338
+ if field.name[0] == '_' and (not hasattr(field.type, '__origin__') or field.type.__origin__ is not ClassVar):
339
339
  encoder.encode_string(to_java_field_name(field))
340
340
  context.serialize(getattr(value, field.name), None, encoder)
341
341
  encoder.write(BREAK_MARKER)
@@ -353,7 +353,7 @@ class DefaultValueSerializer(ValueSerializer):
353
353
  encoder.encode(value.value)
354
354
  elif isinstance(value, Path):
355
355
  encoder.encode(str(value))
356
- elif isinstance(value, list):
356
+ elif isinstance(value, (list, set, tuple)):
357
357
  encoder.encode_length(4, len(value))
358
358
  for item in value:
359
359
  context.serialize(item, None, encoder)
@@ -371,7 +371,7 @@ class DefaultValueSerializer(ValueSerializer):
371
371
  encoder.encode_length(4, len(value.markers))
372
372
  for marker in value.markers:
373
373
  context.serialize(marker, None, encoder)
374
- elif isinstance(value, Marker):
374
+ elif isinstance(value, (Marker, Style)):
375
375
  if (id := context.remoting_context.try_get_id(value)):
376
376
  encoder.encode_int(id)
377
377
  else:
@@ -382,8 +382,8 @@ class DefaultValueSerializer(ValueSerializer):
382
382
  encoder.encode_string('@ref')
383
383
  encoder.encode_int(id)
384
384
  for field in fields(value):
385
- if field.name[0] == '_' and not hasattr(field.type,
386
- '__origin__') or field.type.__origin__ is not ClassVar:
385
+ if field.name[0] == '_' and (not hasattr(field.type,
386
+ '__origin__') or field.type.__origin__ is not ClassVar):
387
387
  encoder.encode_string(to_java_field_name(field))
388
388
  context.serialize(getattr(value, field.name), None, encoder)
389
389
  encoder.write(BREAK_MARKER)
@@ -63,6 +63,8 @@ def to_java_type_name(t: typing.Type) -> str:
63
63
  return 'org.openrewrite.python.tree.PyContainer'
64
64
  if t.__module__.startswith('rewrite.python.markers'):
65
65
  return 'org.openrewrite.python.marker.' + t.__qualname__
66
+ if t.__module__.startswith('rewrite.python.style'):
67
+ return 'org.openrewrite.python.style.' + t.__qualname__
66
68
  if t.__module__.startswith('rewrite.python.tree'):
67
69
  return 'org.openrewrite.python.tree.Py$' + t.__qualname__.replace('.', '$')
68
70
  if t.__module__.startswith('rewrite.marker'):
@@ -71,6 +73,8 @@ def to_java_type_name(t: typing.Type) -> str:
71
73
  return 'org.openrewrite.marker.' + t.__qualname__.replace('.', '$')
72
74
  if t.__module__ == 'rewrite.parser' and t.__name__ == 'ParseError':
73
75
  return 'org.openrewrite.tree.ParseError'
76
+ if t.__module__.startswith('rewrite.style'):
77
+ return 'org.openrewrite.style.' + t.__qualname__
74
78
  if t.__module__.startswith('rewrite.') and t.__module__.endswith('.tree'):
75
79
  model = t.__module__.split('.')[1]
76
80
  return 'org.openrewrite.' + model + '.tree.' + model.capitalize() + '$' + t.__qualname__.replace('.', '$')