openrewrite 8.73.0.dev20260129231611__py3-none-any.whl → 8.73.0.dev20260130223840__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.
- {openrewrite-8.73.0.dev20260129231611.dist-info → openrewrite-8.73.0.dev20260130223840.dist-info}/METADATA +2 -2
- {openrewrite-8.73.0.dev20260129231611.dist-info → openrewrite-8.73.0.dev20260130223840.dist-info}/RECORD +6 -6
- rewrite/python/type_mapping.py +13 -7
- {openrewrite-8.73.0.dev20260129231611.dist-info → openrewrite-8.73.0.dev20260130223840.dist-info}/WHEEL +0 -0
- {openrewrite-8.73.0.dev20260129231611.dist-info → openrewrite-8.73.0.dev20260130223840.dist-info}/entry_points.txt +0 -0
- {openrewrite-8.73.0.dev20260129231611.dist-info → openrewrite-8.73.0.dev20260130223840.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openrewrite
|
|
3
|
-
Version: 8.73.0.
|
|
3
|
+
Version: 8.73.0.dev20260130223840
|
|
4
4
|
Summary: OpenRewrite automated refactoring for Python.
|
|
5
5
|
Author-email: "Moderne Inc." <support@moderne.io>
|
|
6
6
|
License: Moderne Source Available License
|
|
@@ -26,7 +26,7 @@ Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
|
26
26
|
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
27
27
|
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
28
28
|
Provides-Extra: typing
|
|
29
|
-
Requires-Dist: ty>=0.0.
|
|
29
|
+
Requires-Dist: ty>=0.0.14; extra == "typing"
|
|
30
30
|
Provides-Extra: publish
|
|
31
31
|
Requires-Dist: build>=1.0.0; extra == "publish"
|
|
32
32
|
Requires-Dist: twine>=5.0.0; extra == "publish"
|
|
@@ -38,7 +38,7 @@ rewrite/python/support_types.pyi,sha256=BqqeskOQkDp7LzLhWG4Yyfr3HWenIF7fbBKPRn6M
|
|
|
38
38
|
rewrite/python/tree.py,sha256=IdRVnXQUyWk7ihOB3FUlFmrURlp6j98LCZAfic4iT4s,54821
|
|
39
39
|
rewrite/python/tree.pyi,sha256=6W7FI6nE_NyoDtIxHidzMuroDQCxO-TjYgRN0IaZCgU,33996
|
|
40
40
|
rewrite/python/ty_client.py,sha256=4pkj4v0futW7RNqDQFEcO2ORKrolsIaj10i8ydkCFLs,14548
|
|
41
|
-
rewrite/python/type_mapping.py,sha256=
|
|
41
|
+
rewrite/python/type_mapping.py,sha256=LLl-OsMjkwXawhOo_lEDXmdlzPwW-fN5cbM0KsKC4hE,29558
|
|
42
42
|
rewrite/python/visitor.py,sha256=Osy5M5BeKQoFsYbrjQinuJfu3tIxKWKaCKPOsgkt0GA,25868
|
|
43
43
|
rewrite/python/recipes/__init__.py,sha256=CkXk0iHjrMN1aBIEkBhy1n4S889bn0NSRKf20wmMV2s,1255
|
|
44
44
|
rewrite/python/recipes/change_import.py,sha256=L5cdF73Ycu0PiF2h4PDKW5AQNz6d-gZ3aS9LYA_nobg,11562
|
|
@@ -53,8 +53,8 @@ rewrite/rpc/server.py,sha256=znUF-fdGB7DYeGM56QHKGxh_I1dSGYg2kjWhPkV6a50,35850
|
|
|
53
53
|
rewrite/test/__init__.py,sha256=YYLCuGQUbB0eReBKynP5Q51-kKvWUCa-Xn1E0Rk5mv0,1759
|
|
54
54
|
rewrite/test/rewrite_test.py,sha256=AG9sFaEIeBGwN8sdPkyn8sAPHLS04B2_rNOCDNXhpmQ,10574
|
|
55
55
|
rewrite/test/spec.py,sha256=ytuYdSldrNfySyG4giS0hvqI7vqtAhzOo9FYcwd6PbU,5186
|
|
56
|
-
openrewrite-8.73.0.
|
|
57
|
-
openrewrite-8.73.0.
|
|
58
|
-
openrewrite-8.73.0.
|
|
59
|
-
openrewrite-8.73.0.
|
|
60
|
-
openrewrite-8.73.0.
|
|
56
|
+
openrewrite-8.73.0.dev20260130223840.dist-info/METADATA,sha256=COP7nMU3N6H3YsTWNZNcSIU9G4qfFBRvJVwx0z9Av-g,2938
|
|
57
|
+
openrewrite-8.73.0.dev20260130223840.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
58
|
+
openrewrite-8.73.0.dev20260130223840.dist-info/entry_points.txt,sha256=8GAn81ILDOuOTH29yC4hnCbjWO04hWNa_HPaFmxjuy8,53
|
|
59
|
+
openrewrite-8.73.0.dev20260130223840.dist-info/top_level.txt,sha256=eF4--0M-kNmHmBBz2eCSe8ggHIfdP4alXDV2fvQtsns,8
|
|
60
|
+
openrewrite-8.73.0.dev20260130223840.dist-info/RECORD,,
|
rewrite/python/type_mapping.py
CHANGED
|
@@ -50,6 +50,15 @@ _PYTHON_PRIMITIVES: Dict[str, JavaType.Primitive] = {
|
|
|
50
50
|
'bytes': JavaType.Primitive.String, # Close enough for matching
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
# Reverse mapping from JavaType.Primitive to Python type name
|
|
54
|
+
_PRIMITIVE_TO_PYTHON: Dict[JavaType.Primitive, str] = {
|
|
55
|
+
JavaType.Primitive.String: 'str',
|
|
56
|
+
JavaType.Primitive.Int: 'int',
|
|
57
|
+
JavaType.Primitive.Double: 'float',
|
|
58
|
+
JavaType.Primitive.Boolean: 'bool',
|
|
59
|
+
JavaType.Primitive.None_: 'None',
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
|
|
54
63
|
class PythonTypeMapping:
|
|
55
64
|
"""Maps Python types to JavaType for recipe matching.
|
|
@@ -502,7 +511,7 @@ class PythonTypeMapping:
|
|
|
502
511
|
if isinstance(java_type, JavaType.Class):
|
|
503
512
|
return java_type
|
|
504
513
|
if isinstance(java_type, JavaType.Primitive):
|
|
505
|
-
return self._create_class_type(java_type.
|
|
514
|
+
return self._create_class_type(_PRIMITIVE_TO_PYTHON.get(java_type, java_type.name.lower()))
|
|
506
515
|
|
|
507
516
|
return None
|
|
508
517
|
|
|
@@ -633,7 +642,7 @@ class PythonTypeMapping:
|
|
|
633
642
|
return java_type
|
|
634
643
|
# For primitives like str, create a class wrapper
|
|
635
644
|
if isinstance(java_type, JavaType.Primitive):
|
|
636
|
-
return self._create_class_type(java_type.
|
|
645
|
+
return self._create_class_type(_PRIMITIVE_TO_PYTHON.get(java_type, java_type.name.lower()))
|
|
637
646
|
return None
|
|
638
647
|
|
|
639
648
|
def _strip_markdown(self, hover: str) -> str:
|
|
@@ -757,12 +766,9 @@ class PythonTypeMapping:
|
|
|
757
766
|
self._type_cache[fqn] = class_type
|
|
758
767
|
return class_type
|
|
759
768
|
|
|
760
|
-
def _get_node_text(self, node: ast.
|
|
769
|
+
def _get_node_text(self, node: ast.expr) -> str:
|
|
761
770
|
"""Get the source text for an AST node."""
|
|
762
|
-
if not
|
|
763
|
-
return ""
|
|
764
|
-
|
|
765
|
-
if hasattr(node, 'end_lineno') and hasattr(node, 'end_col_offset'):
|
|
771
|
+
if node.end_lineno is not None and node.end_col_offset is not None:
|
|
766
772
|
if node.lineno == node.end_lineno:
|
|
767
773
|
line = self._source_lines[node.lineno - 1] if node.lineno <= len(self._source_lines) else ""
|
|
768
774
|
return line[node.col_offset:node.end_col_offset]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|