openrewrite-migrate-python 0.31.0__py3-none-any.whl → 0.33.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.
@@ -36,7 +36,9 @@ _SERIES = "pandas.core.series.Series"
36
36
 
37
37
  _df = capture('df')
38
38
  _x = capture('x')
39
- _concat_template = template(f"pd.concat([{_df}, {_x}])", context=["import pandas as pd"])
39
+ _concat_template = template(
40
+ f"pd.concat([{_df}, {_x}])", context=["import pandas as pd"], dependencies={"pandas": ">=2"}
41
+ )
40
42
 
41
43
 
42
44
  @categorize(_Cleanup)
@@ -8,7 +8,6 @@ calls `load_module()` on a custom loader.
8
8
  See: https://docs.python.org/3/whatsnew/3.15.html#removed
9
9
  """
10
10
 
11
- from dataclasses import replace
12
11
  from typing import Any, List
13
12
 
14
13
  from rewrite import Cursor, ExecutionContext, Preconditions, Recipe, TreeVisitor
@@ -16,10 +15,8 @@ from rewrite.category import CategoryDescriptor
16
15
  from rewrite.decorators import categorize
17
16
  from rewrite.marketplace import Python
18
17
  from rewrite.java.tree import ClassDeclaration, J, MethodDeclaration, MethodInvocation
19
- from rewrite.preconditions import RecipeRef
20
18
  from rewrite.python.method_matcher import MethodMatcher
21
19
  from rewrite.python.preconditions import uses_method, uses_type
22
- from rewrite.python.search import UsesType
23
20
  from rewrite.python.type_utils import is_assignable_to
24
21
  from rewrite.python.visitor import PythonVisitor
25
22
 
@@ -37,16 +34,6 @@ def _is_loader(type_: Any) -> bool:
37
34
  return any(is_assignable_to(loader, type_) for loader in _LOADER_TYPES)
38
35
 
39
36
 
40
- def _uses_loader_type(loader: str) -> RecipeRef:
41
- """``uses_type(loader, check_assignability=True)``, evaluated in-process without the flag.
42
-
43
- The host evaluates ``HasType`` with ``checkAssignability`` either way. In-process, openrewrite
44
- 8.94.0's ``UsesType`` with the flag raises a ``TypeError`` on a call whose method type has no
45
- parameter types, as ``Registry()`` has for a class without ``__init__``.
46
- """
47
- return replace(uses_type(loader, check_assignability=True), local_visitor=UsesType(loader))
48
-
49
-
50
37
  def _declaring_class(cursor: Cursor) -> ClassDeclaration | None:
51
38
  """The class whose body declares the method ``cursor`` stands on, None for a nested function."""
52
39
  enclosing = cursor.parent
@@ -143,6 +130,6 @@ class FindLoaderLoadModule(Recipe):
143
130
 
144
131
  gate = Preconditions.or_(
145
132
  *(uses_method(p, match_overrides=True) for p in _LOAD_MODULE_PATTERNS),
146
- *(_uses_loader_type(loader) for loader in _LOADER_TYPES),
133
+ *(uses_type(loader, check_assignability=True) for loader in _LOADER_TYPES),
147
134
  )
148
135
  return Preconditions.check(gate, Visitor())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openrewrite-migrate-python
3
- Version: 0.31.0
3
+ Version: 0.33.0
4
4
  Summary: OpenRewrite recipes for migrating Python codebases to newer Python versions.
5
5
  Author-email: "Moderne Inc." <support@moderne.io>
6
6
  License: Moderne Proprietary
@@ -19,7 +19,7 @@ Classifier: Typing :: Typed
19
19
  Requires-Python: >=3.12
20
20
  Description-Content-Type: text/markdown
21
21
  Provides-Extra: dev
22
- Requires-Dist: openrewrite>=8.96.3; extra == "dev"
22
+ Requires-Dist: openrewrite>=8.108.1; extra == "dev"
23
23
  Requires-Dist: pydantic>=2.11; extra == "dev"
24
24
  Requires-Dist: pytest>=8.0.0; extra == "dev"
25
25
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
@@ -22,7 +22,7 @@ openrewrite_code_quality_python/cleanup/naming_conventions.py,sha256=qqZuF5b8lVr
22
22
  openrewrite_code_quality_python/cleanup/negated_operators.py,sha256=DOXtB249IlPJovRNpCJPYHcv79u8bnNlwesqWRfJePg,5097
23
23
  openrewrite_code_quality_python/cleanup/none_and_identity.py,sha256=QVdFo9MdsF1RHGWLmR4179qAeYCEn99a-OJ8rEn9PBM,12092
24
24
  openrewrite_code_quality_python/cleanup/object_inheritance.py,sha256=7hy16CBEUNTRoXYuWqe0_ZZS5Ig4Yft6VTErkWpIfkc,3099
25
- openrewrite_code_quality_python/cleanup/pandas_cleanup.py,sha256=2eq7R5Cux9RTFCChaclSr0KIfAdn_SmW1wwB0Bmqj7g,8536
25
+ openrewrite_code_quality_python/cleanup/pandas_cleanup.py,sha256=vb6ZTf9RV_iAj5dnvWrXhonT-lmJhm-zD3LKqgbj8H0,8574
26
26
  openrewrite_code_quality_python/cleanup/python_best_practices.py,sha256=AkJa4Wr02cqKhlAsfr7yDKOUpSHkw8ljuj6uxLrF9-A,9309
27
27
  openrewrite_code_quality_python/cleanup/range_cleanup.py,sha256=9KFNSiiSc2pl_S6KdpUW_Hhtw9zweOAT393Zth72ids,5287
28
28
  openrewrite_code_quality_python/cleanup/redundant_code.py,sha256=aMPAAOO5uhBZy1j5o2LvX3lKD6Q3KuDKx1G0b_Mv5uk,6812
@@ -84,7 +84,7 @@ openrewrite_migrate_python/migrate/glob_deprecations.py,sha256=5GxGdA_TNsbwP9Ovf
84
84
  openrewrite_migrate_python/migrate/html_parser_deprecations.py,sha256=_fNulkNdMPDNsCjgCXw0tkUmQLJMUPsvm-maTIzxNN4,4153
85
85
  openrewrite_migrate_python/migrate/http_server_deprecations.py,sha256=7s6cEpjH-EzpomSamE_SdNr7kOH_pc2GrJYCiWLgLQg,2151
86
86
  openrewrite_migrate_python/migrate/imp_migrations.py,sha256=JfcFJ_HYaRnHz1s-EF60cDPqx58RZbKNEQY54OjGIOc,2532
87
- openrewrite_migrate_python/migrate/importlib_deprecations.py,sha256=1vOOeKyaFQeRL332yQ_WJJgVnqQ5oxHHMiHG1FO6W7c,6021
87
+ openrewrite_migrate_python/migrate/importlib_deprecations.py,sha256=aiFg4NBTLKNlL5BIjua7LrZEJtQoQz0Nb7802B7irCQ,5395
88
88
  openrewrite_migrate_python/migrate/importlib_resources_deprecations.py,sha256=AwAABMbGFtB6oxAUqDOKNUev32NjNZ46EXa3iyHoWZs,3557
89
89
  openrewrite_migrate_python/migrate/inspect_deprecations.py,sha256=q8ncWarLeD4-h7-gJ9ulVSKG-9oGpK6dAN2R37QWXLE,3170
90
90
  openrewrite_migrate_python/migrate/langchain_classic_imports.py,sha256=q6s88sXDRj4-Lld3OsunlUL4cSWVj9ikkfH2eEgitzQ,11097
@@ -146,8 +146,8 @@ openrewrite_migrate_python/migrate/wave_deprecations.py,sha256=QcjcFNpb2mQ4v8VdY
146
146
  openrewrite_migrate_python/migrate/webbrowser_deprecations.py,sha256=2ENvVuz5fcKAxnoMQVWIC62ipFeRy2_Ah_WEUushASM,2205
147
147
  openrewrite_migrate_python/migrate/xdrlib_migrations.py,sha256=khHPyP1TctExRMl1w_sR9d2fh5_QD04WQDNCqN3wUh4,2140
148
148
  openrewrite_migrate_python/migrate/xml_deprecations.py,sha256=mvyEUhVGPQTsjE81OkxBqKQCmis5xqTNg6LcUX1ipp4,7613
149
- openrewrite_migrate_python-0.31.0.dist-info/METADATA,sha256=PeVWEkZGSRJu6tCvRNQd3ClVltDtMXk3Fx5XChaZs14,1450
150
- openrewrite_migrate_python-0.31.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
151
- openrewrite_migrate_python-0.31.0.dist-info/entry_points.txt,sha256=SuygzlMJiKIW19FYJVxx0hhRyzW6HTDCweY7584XpXw,138
152
- openrewrite_migrate_python-0.31.0.dist-info/top_level.txt,sha256=y8dKeC9kb5GUzFraB-OhJGxjPemM3GaPdrAygz2RP0U,59
153
- openrewrite_migrate_python-0.31.0.dist-info/RECORD,,
149
+ openrewrite_migrate_python-0.33.0.dist-info/METADATA,sha256=paHCwLEWusHjRvOzfHNKsTrbmoQlDkPaDH6K7U0tdG0,1451
150
+ openrewrite_migrate_python-0.33.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
151
+ openrewrite_migrate_python-0.33.0.dist-info/entry_points.txt,sha256=SuygzlMJiKIW19FYJVxx0hhRyzW6HTDCweY7584XpXw,138
152
+ openrewrite_migrate_python-0.33.0.dist-info/top_level.txt,sha256=y8dKeC9kb5GUzFraB-OhJGxjPemM3GaPdrAygz2RP0U,59
153
+ openrewrite_migrate_python-0.33.0.dist-info/RECORD,,