openrewrite-migrate-python 0.10.0.dev20260715110523__tar.gz → 0.10.0.dev20260715113533__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.
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/PKG-INFO +1 -1
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/pyproject.toml +1 -1
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/typing_callable.py +7 -2
- openrewrite_migrate_python-0.10.0.dev20260715113533/src/openrewrite_migrate_python/migrate/upgrade_to_python39.py +130 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python.egg-info/PKG-INFO +1 -1
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python.egg-info/SOURCES.txt +1 -0
- openrewrite_migrate_python-0.10.0.dev20260715113533/tests/test_change_type_recipes.py +65 -0
- openrewrite_migrate_python-0.10.0.dev20260715113533/tests/test_typing_callable.py +25 -0
- openrewrite_migrate_python-0.10.0.dev20260715110523/src/openrewrite_migrate_python/migrate/upgrade_to_python39.py +0 -128
- openrewrite_migrate_python-0.10.0.dev20260715110523/tests/test_typing_callable.py +0 -34
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/setup.cfg +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/__init__.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/__init__.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/_semantically_equal.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/all_branches_identical.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/boolean_checks_not_inverted.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/collapsible_if_statements.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/merge_identical_branches.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/remove_duplicate_conditions.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/remove_self_assignment.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/remove_unconditional_value_overwrite.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/simplify_boolean_literal.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_code_quality_python/codequality/simplify_redundant_logical_expression.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/__init__.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/__init__.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/_markers.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/aifc_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/array_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/ast_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/asyncio_coroutine_to_async.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/asyncio_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/avro_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/calendar_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/cgi_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/cgi_parse_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/collections_abc_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/configparser_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/datetime_utc.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/distutils_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/distutils_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/functools_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/future_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/gettext_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/html_parser_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/imp_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/langchain_classic_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/langchain_community_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/langchain_provider_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/locale_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/locale_getdefaultlocale_deprecation.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/macpath_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/mailcap_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/nntplib_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/os_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pathlib_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pep594_system_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pipes_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pkgutil_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/platform_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pydantic_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pydantic_fields.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/pydantic_model_fields.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/re_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/removed_modules_312.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/shutil_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/socket_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/ssl_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/string_formatting.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/sys_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/sys_last_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/tarfile_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/telnetlib_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/tempfile_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/threading_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/threading_is_alive_deprecation.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/typing_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/typing_union_to_pipe.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/unittest_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_langchain02.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_langchain1.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_pydantic.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_python310.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_python311.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_python312.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_python313.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_python314.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/upgrade_to_python38.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/urllib_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/uu_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/xdrlib_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python/migrate/xml_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python.egg-info/dependency_links.txt +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python.egg-info/entry_points.txt +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python.egg-info/requires.txt +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/src/openrewrite_migrate_python.egg-info/top_level.txt +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_aifc_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_array_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_ast_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_asyncio_coroutine_to_async.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_asyncio_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_avro_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_calendar_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_cgi_parse_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_change_import_recipes.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_collections_abc_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_configparser_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_datetime_utc.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_distutils_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_future_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_gettext_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_html_parser_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_imp_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_langchain_classic_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_langchain_community_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_langchain_provider_imports.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_locale_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_locale_getdefaultlocale_deprecation.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_macpath_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_os_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_pep594_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_pep594_system_migrations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_pkgutil_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_platform_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_pydantic_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_pydantic_fields.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_pydantic_model_fields.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_re_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_removed_modules_312.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_shutil_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_ssl_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_string_formatting.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_sys_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_sys_last_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_tarfile_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_threading_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_threading_extended.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_threading_is_alive_deprecation.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_typing_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_typing_union_to_pipe.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_unittest_deprecations.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_upgrade_recipes.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_upgrade_to_pydantic.py +0 -0
- {openrewrite_migrate_python-0.10.0.dev20260715110523 → openrewrite_migrate_python-0.10.0.dev20260715113533}/tests/test_xml_deprecations.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openrewrite-migrate-python
|
|
3
|
-
Version: 0.10.0.
|
|
3
|
+
Version: 0.10.0.dev20260715113533
|
|
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
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "openrewrite-migrate-python"
|
|
7
7
|
description = "OpenRewrite recipes for migrating Python codebases to newer Python versions."
|
|
8
|
-
version = "0.10.0.
|
|
8
|
+
version = "0.10.0.dev20260715113533" # Updated dynamically during release
|
|
9
9
|
authors = [{ name = "Moderne Inc.", email = "support@moderne.io" }]
|
|
10
10
|
license = { text = "Moderne Proprietary" }
|
|
11
11
|
readme = "README.md"
|
|
@@ -15,7 +15,7 @@ from rewrite import Recipe
|
|
|
15
15
|
from rewrite.category import CategoryDescriptor
|
|
16
16
|
from rewrite.decorators import categorize
|
|
17
17
|
from rewrite.marketplace import Python
|
|
18
|
-
from rewrite.python.recipes import
|
|
18
|
+
from rewrite.python.recipes import ChangeType
|
|
19
19
|
|
|
20
20
|
# Define category path
|
|
21
21
|
_Python39 = [
|
|
@@ -59,4 +59,9 @@ class ReplaceTypingCallableWithCollectionsAbcCallable(Recipe):
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
def recipe_list(self) -> List[Recipe]:
|
|
62
|
-
return [
|
|
62
|
+
return [
|
|
63
|
+
ChangeType(
|
|
64
|
+
old_fully_qualified_type_name="typing.Callable",
|
|
65
|
+
new_fully_qualified_type_name="collections.abc.Callable",
|
|
66
|
+
)
|
|
67
|
+
]
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Composite recipe for upgrading from Python 3.8 to Python 3.9."""
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from rewrite import Recipe
|
|
6
|
+
from rewrite.category import CategoryDescriptor
|
|
7
|
+
from rewrite.decorators import categorize
|
|
8
|
+
from rewrite.marketplace import Python
|
|
9
|
+
from rewrite.rpc import RpcRecipe
|
|
10
|
+
from rewrite.python.recipes import ChangeImport, ChangeType
|
|
11
|
+
|
|
12
|
+
# Define category path: Python > Migrate
|
|
13
|
+
_Migrate = [*Python, CategoryDescriptor(display_name="Migrate")]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@categorize(_Migrate)
|
|
17
|
+
class UpgradeToPython39(Recipe):
|
|
18
|
+
"""
|
|
19
|
+
Migrate deprecated APIs for Python 3.9 compatibility.
|
|
20
|
+
|
|
21
|
+
This composite recipe applies all necessary migrations for code
|
|
22
|
+
running on Python 3.8 to be compatible with Python 3.9.
|
|
23
|
+
|
|
24
|
+
Key changes in Python 3.9:
|
|
25
|
+
- PEP 585: Built-in generics (`list[int]` instead of `typing.List[int]`)
|
|
26
|
+
- `base64.encodestring()` / `decodestring()` removed
|
|
27
|
+
- `Element.getiterator()` deprecated (use `iter()`)
|
|
28
|
+
- `Element.getchildren()` deprecated (use `list(element)`)
|
|
29
|
+
- `typing.Callable` deprecated in favor of `collections.abc.Callable`
|
|
30
|
+
|
|
31
|
+
See: https://docs.python.org/3/whatsnew/3.9.html
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def name(self) -> str:
|
|
36
|
+
return "org.openrewrite.python.migrate.UpgradeToPython39"
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def display_name(self) -> str:
|
|
40
|
+
return "Upgrade to Python 3.9"
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def description(self) -> str:
|
|
44
|
+
return (
|
|
45
|
+
"Migrate deprecated APIs for Python 3.9 compatibility. "
|
|
46
|
+
"This includes PEP 585 built-in generics, removed base64 functions, "
|
|
47
|
+
"and deprecated XML Element methods."
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def tags(self) -> List[str]:
|
|
52
|
+
return ["python", "migration", "3.9"]
|
|
53
|
+
|
|
54
|
+
def recipe_list(self) -> List[Recipe]:
|
|
55
|
+
"""Return the list of recipes to apply for Python 3.9 upgrade."""
|
|
56
|
+
from .html_parser_deprecations import ReplaceHtmlParserUnescape
|
|
57
|
+
from .threading_is_alive_deprecation import ReplaceThreadIsAlive
|
|
58
|
+
from .typing_callable import ReplaceTypingCallableWithCollectionsAbcCallable
|
|
59
|
+
from .upgrade_to_python38 import UpgradeToPython38
|
|
60
|
+
from .xml_deprecations import ReplaceElementGetchildren, ReplaceElementGetiterator
|
|
61
|
+
|
|
62
|
+
return [
|
|
63
|
+
# First apply all Python 3.8 upgrades
|
|
64
|
+
UpgradeToPython38(),
|
|
65
|
+
# base64 encodestring/decodestring removed in Python 3.9.
|
|
66
|
+
# These are functions, not types, so they stay on ChangeImport
|
|
67
|
+
ChangeImport(old_module="base64", old_name="encodestring", new_module="base64", new_name="encodebytes"),
|
|
68
|
+
ChangeImport(old_module="base64", old_name="decodestring", new_module="base64", new_name="decodebytes"),
|
|
69
|
+
# PEP 585: Replace typing.List[X] with list[X], etc. (Python 3.9+).
|
|
70
|
+
# These targets are genuine types (typing.List, typing.Mapping, ...) with ChangeType
|
|
71
|
+
ChangeType(old_fully_qualified_type_name="typing.List", new_fully_qualified_type_name="builtins.list"),
|
|
72
|
+
ChangeType(old_fully_qualified_type_name="typing.Dict", new_fully_qualified_type_name="builtins.dict"),
|
|
73
|
+
ChangeType(old_fully_qualified_type_name="typing.Set", new_fully_qualified_type_name="builtins.set"),
|
|
74
|
+
ChangeType(old_fully_qualified_type_name="typing.FrozenSet", new_fully_qualified_type_name="builtins.frozenset"),
|
|
75
|
+
ChangeType(old_fully_qualified_type_name="typing.Tuple", new_fully_qualified_type_name="builtins.tuple"),
|
|
76
|
+
ChangeType(old_fully_qualified_type_name="typing.Type", new_fully_qualified_type_name="builtins.type"),
|
|
77
|
+
# typing.Callable -> collections.abc.Callable (PEP 585)
|
|
78
|
+
ReplaceTypingCallableWithCollectionsAbcCallable(),
|
|
79
|
+
# PEP 585: typing -> collections replacements
|
|
80
|
+
ChangeType(old_fully_qualified_type_name="typing.Deque", new_fully_qualified_type_name="collections.deque"),
|
|
81
|
+
ChangeType(old_fully_qualified_type_name="typing.DefaultDict", new_fully_qualified_type_name="collections.defaultdict"),
|
|
82
|
+
ChangeType(old_fully_qualified_type_name="typing.OrderedDict", new_fully_qualified_type_name="collections.OrderedDict"),
|
|
83
|
+
ChangeType(old_fully_qualified_type_name="typing.Counter", new_fully_qualified_type_name="collections.Counter"),
|
|
84
|
+
ChangeType(old_fully_qualified_type_name="typing.ChainMap", new_fully_qualified_type_name="collections.ChainMap"),
|
|
85
|
+
# PEP 585: typing -> re replacements
|
|
86
|
+
ChangeType(old_fully_qualified_type_name="typing.Pattern", new_fully_qualified_type_name="re.Pattern"),
|
|
87
|
+
ChangeType(old_fully_qualified_type_name="typing.Match", new_fully_qualified_type_name="re.Match"),
|
|
88
|
+
# PEP 585: typing -> contextlib replacements
|
|
89
|
+
ChangeType(old_fully_qualified_type_name="typing.ContextManager", new_fully_qualified_type_name="contextlib.AbstractContextManager"),
|
|
90
|
+
ChangeType(old_fully_qualified_type_name="typing.AsyncContextManager", new_fully_qualified_type_name="contextlib.AbstractAsyncContextManager"),
|
|
91
|
+
# PEP 585: typing -> collections.abc replacements
|
|
92
|
+
ChangeType(old_fully_qualified_type_name="typing.Iterable", new_fully_qualified_type_name="collections.abc.Iterable"),
|
|
93
|
+
ChangeType(old_fully_qualified_type_name="typing.Iterator", new_fully_qualified_type_name="collections.abc.Iterator"),
|
|
94
|
+
ChangeType(old_fully_qualified_type_name="typing.Generator", new_fully_qualified_type_name="collections.abc.Generator"),
|
|
95
|
+
ChangeType(old_fully_qualified_type_name="typing.Sequence", new_fully_qualified_type_name="collections.abc.Sequence"),
|
|
96
|
+
ChangeType(old_fully_qualified_type_name="typing.MutableSequence", new_fully_qualified_type_name="collections.abc.MutableSequence"),
|
|
97
|
+
ChangeType(old_fully_qualified_type_name="typing.Mapping", new_fully_qualified_type_name="collections.abc.Mapping"),
|
|
98
|
+
ChangeType(old_fully_qualified_type_name="typing.MutableMapping", new_fully_qualified_type_name="collections.abc.MutableMapping"),
|
|
99
|
+
ChangeType(old_fully_qualified_type_name="typing.AbstractSet", new_fully_qualified_type_name="collections.abc.Set"),
|
|
100
|
+
ChangeType(old_fully_qualified_type_name="typing.MutableSet", new_fully_qualified_type_name="collections.abc.MutableSet"),
|
|
101
|
+
ChangeType(old_fully_qualified_type_name="typing.Awaitable", new_fully_qualified_type_name="collections.abc.Awaitable"),
|
|
102
|
+
ChangeType(old_fully_qualified_type_name="typing.Coroutine", new_fully_qualified_type_name="collections.abc.Coroutine"),
|
|
103
|
+
ChangeType(old_fully_qualified_type_name="typing.AsyncIterable", new_fully_qualified_type_name="collections.abc.AsyncIterable"),
|
|
104
|
+
ChangeType(old_fully_qualified_type_name="typing.AsyncIterator", new_fully_qualified_type_name="collections.abc.AsyncIterator"),
|
|
105
|
+
ChangeType(old_fully_qualified_type_name="typing.AsyncGenerator", new_fully_qualified_type_name="collections.abc.AsyncGenerator"),
|
|
106
|
+
ChangeType(old_fully_qualified_type_name="typing.Reversible", new_fully_qualified_type_name="collections.abc.Reversible"),
|
|
107
|
+
ChangeType(old_fully_qualified_type_name="typing.Container", new_fully_qualified_type_name="collections.abc.Container"),
|
|
108
|
+
ChangeType(old_fully_qualified_type_name="typing.Collection", new_fully_qualified_type_name="collections.abc.Collection"),
|
|
109
|
+
ChangeType(old_fully_qualified_type_name="typing.MappingView", new_fully_qualified_type_name="collections.abc.MappingView"),
|
|
110
|
+
ChangeType(old_fully_qualified_type_name="typing.KeysView", new_fully_qualified_type_name="collections.abc.KeysView"),
|
|
111
|
+
ChangeType(old_fully_qualified_type_name="typing.ItemsView", new_fully_qualified_type_name="collections.abc.ItemsView"),
|
|
112
|
+
ChangeType(old_fully_qualified_type_name="typing.ValuesView", new_fully_qualified_type_name="collections.abc.ValuesView"),
|
|
113
|
+
ChangeType(old_fully_qualified_type_name="typing.Hashable", new_fully_qualified_type_name="collections.abc.Hashable"),
|
|
114
|
+
ChangeType(old_fully_qualified_type_name="typing.Sized", new_fully_qualified_type_name="collections.abc.Sized"),
|
|
115
|
+
# XML Element.getiterator() deprecated in 3.9, use iter()
|
|
116
|
+
ReplaceElementGetiterator(),
|
|
117
|
+
# XML Element.getchildren() -> list(element) (3.9)
|
|
118
|
+
ReplaceElementGetchildren(),
|
|
119
|
+
# fractions.gcd() removed in 3.9, use math.gcd() (function -> ChangeImport, not ChangeType)
|
|
120
|
+
ChangeImport(old_module="fractions", old_name="gcd", new_module="math"),
|
|
121
|
+
# sys.getcheckinterval/setcheckinterval removed in 3.9 (functions -> ChangeImport)
|
|
122
|
+
ChangeImport(old_module="sys", old_name="getcheckinterval", new_module="sys", new_name="getswitchinterval"),
|
|
123
|
+
ChangeImport(old_module="sys", old_name="setcheckinterval", new_module="sys", new_name="setswitchinterval"),
|
|
124
|
+
# Thread.isAlive() removed in 3.9
|
|
125
|
+
ReplaceThreadIsAlive(),
|
|
126
|
+
# HTMLParser.unescape() -> html.unescape() (removed in 3.9)
|
|
127
|
+
ReplaceHtmlParserUnescape(),
|
|
128
|
+
# Update project metadata, packaging, Dockerfiles, CloudFormation templates, and .whitesource files to the target version
|
|
129
|
+
RpcRecipe("org.openrewrite.python.migrate.UpgradePythonVersionTo39"),
|
|
130
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openrewrite-migrate-python
|
|
3
|
-
Version: 0.10.0.
|
|
3
|
+
Version: 0.10.0.dev20260715113533
|
|
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
|
|
@@ -96,6 +96,7 @@ tests/test_avro_migrations.py
|
|
|
96
96
|
tests/test_calendar_deprecations.py
|
|
97
97
|
tests/test_cgi_parse_deprecations.py
|
|
98
98
|
tests/test_change_import_recipes.py
|
|
99
|
+
tests/test_change_type_recipes.py
|
|
99
100
|
tests/test_collections_abc_migrations.py
|
|
100
101
|
tests/test_configparser_deprecations.py
|
|
101
102
|
tests/test_datetime_utc.py
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Structural tests for the ChangeType-based typing.* renames in UpgradeToPython39.
|
|
2
|
+
|
|
3
|
+
ChangeType delegates to the JVM peer, so it can't be run in this harness; these assert wiring.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from openrewrite_migrate_python.migrate import UpgradeToPython39
|
|
7
|
+
from rewrite.python.recipes import ChangeType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _change_type_pairs(recipe):
|
|
11
|
+
return {
|
|
12
|
+
(r.old_fully_qualified_type_name, r.new_fully_qualified_type_name)
|
|
13
|
+
for r in recipe.recipe_list()
|
|
14
|
+
if isinstance(r, ChangeType)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TestUpgradeToPython39TypingChangeTypes:
|
|
19
|
+
def test_wires_pep585_typing_renames(self):
|
|
20
|
+
expected = {
|
|
21
|
+
("typing.List", "builtins.list"),
|
|
22
|
+
("typing.Dict", "builtins.dict"),
|
|
23
|
+
("typing.Set", "builtins.set"),
|
|
24
|
+
("typing.FrozenSet", "builtins.frozenset"),
|
|
25
|
+
("typing.Tuple", "builtins.tuple"),
|
|
26
|
+
("typing.Type", "builtins.type"),
|
|
27
|
+
("typing.Deque", "collections.deque"),
|
|
28
|
+
("typing.DefaultDict", "collections.defaultdict"),
|
|
29
|
+
("typing.OrderedDict", "collections.OrderedDict"),
|
|
30
|
+
("typing.Counter", "collections.Counter"),
|
|
31
|
+
("typing.ChainMap", "collections.ChainMap"),
|
|
32
|
+
("typing.Pattern", "re.Pattern"),
|
|
33
|
+
("typing.Match", "re.Match"),
|
|
34
|
+
("typing.ContextManager", "contextlib.AbstractContextManager"),
|
|
35
|
+
("typing.AsyncContextManager", "contextlib.AbstractAsyncContextManager"),
|
|
36
|
+
("typing.Iterable", "collections.abc.Iterable"),
|
|
37
|
+
("typing.Iterator", "collections.abc.Iterator"),
|
|
38
|
+
("typing.Generator", "collections.abc.Generator"),
|
|
39
|
+
("typing.Sequence", "collections.abc.Sequence"),
|
|
40
|
+
("typing.MutableSequence", "collections.abc.MutableSequence"),
|
|
41
|
+
("typing.Mapping", "collections.abc.Mapping"),
|
|
42
|
+
("typing.MutableMapping", "collections.abc.MutableMapping"),
|
|
43
|
+
("typing.AbstractSet", "collections.abc.Set"),
|
|
44
|
+
("typing.MutableSet", "collections.abc.MutableSet"),
|
|
45
|
+
("typing.Awaitable", "collections.abc.Awaitable"),
|
|
46
|
+
("typing.Coroutine", "collections.abc.Coroutine"),
|
|
47
|
+
("typing.AsyncIterable", "collections.abc.AsyncIterable"),
|
|
48
|
+
("typing.AsyncIterator", "collections.abc.AsyncIterator"),
|
|
49
|
+
("typing.AsyncGenerator", "collections.abc.AsyncGenerator"),
|
|
50
|
+
("typing.Reversible", "collections.abc.Reversible"),
|
|
51
|
+
("typing.Container", "collections.abc.Container"),
|
|
52
|
+
("typing.Collection", "collections.abc.Collection"),
|
|
53
|
+
("typing.MappingView", "collections.abc.MappingView"),
|
|
54
|
+
("typing.KeysView", "collections.abc.KeysView"),
|
|
55
|
+
("typing.ItemsView", "collections.abc.ItemsView"),
|
|
56
|
+
("typing.ValuesView", "collections.abc.ValuesView"),
|
|
57
|
+
("typing.Hashable", "collections.abc.Hashable"),
|
|
58
|
+
("typing.Sized", "collections.abc.Sized"),
|
|
59
|
+
}
|
|
60
|
+
assert expected <= _change_type_pairs(UpgradeToPython39())
|
|
61
|
+
|
|
62
|
+
def test_function_renames_are_not_change_type(self):
|
|
63
|
+
# These are functions, not types; they must NOT be wired as ChangeType.
|
|
64
|
+
pairs = _change_type_pairs(UpgradeToPython39())
|
|
65
|
+
assert not any(old.startswith(("base64.", "fractions.", "sys.")) for old, _ in pairs)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Tests for the typing.Callable migration recipe.
|
|
2
|
+
|
|
3
|
+
The recipe now delegates to the RPC-backed ``ChangeType`` (Java's
|
|
4
|
+
``org.openrewrite.java.ChangeType``), which rewrites the ``typing.Callable`` reference
|
|
5
|
+
across both the ``from typing import Callable`` and qualified ``typing.Callable`` forms and
|
|
6
|
+
updates imports. ``ChangeType`` requires the JVM peer and is exercised in the Moderne runtime
|
|
7
|
+
rather than in this pytest harness, so this test is structural: it asserts the recipe wires
|
|
8
|
+
``ChangeType`` with the correct old/new fully-qualified names.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from rewrite.python.recipes import ChangeType
|
|
12
|
+
from openrewrite_migrate_python.migrate.typing_callable import (
|
|
13
|
+
ReplaceTypingCallableWithCollectionsAbcCallable,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestReplaceTypingCallableWithCollectionsAbcCallable:
|
|
18
|
+
def test_wires_change_type_for_callable(self):
|
|
19
|
+
recipe_list = ReplaceTypingCallableWithCollectionsAbcCallable().recipe_list()
|
|
20
|
+
change_types = [r for r in recipe_list if isinstance(r, ChangeType)]
|
|
21
|
+
assert any(
|
|
22
|
+
r.old_fully_qualified_type_name == "typing.Callable"
|
|
23
|
+
and r.new_fully_qualified_type_name == "collections.abc.Callable"
|
|
24
|
+
for r in change_types
|
|
25
|
+
)
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"""Composite recipe for upgrading from Python 3.8 to Python 3.9."""
|
|
2
|
-
|
|
3
|
-
from typing import List
|
|
4
|
-
|
|
5
|
-
from rewrite import Recipe
|
|
6
|
-
from rewrite.category import CategoryDescriptor
|
|
7
|
-
from rewrite.decorators import categorize
|
|
8
|
-
from rewrite.marketplace import Python
|
|
9
|
-
from rewrite.rpc import RpcRecipe
|
|
10
|
-
from rewrite.python.recipes import ChangeImport
|
|
11
|
-
|
|
12
|
-
# Define category path: Python > Migrate
|
|
13
|
-
_Migrate = [*Python, CategoryDescriptor(display_name="Migrate")]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@categorize(_Migrate)
|
|
17
|
-
class UpgradeToPython39(Recipe):
|
|
18
|
-
"""
|
|
19
|
-
Migrate deprecated APIs for Python 3.9 compatibility.
|
|
20
|
-
|
|
21
|
-
This composite recipe applies all necessary migrations for code
|
|
22
|
-
running on Python 3.8 to be compatible with Python 3.9.
|
|
23
|
-
|
|
24
|
-
Key changes in Python 3.9:
|
|
25
|
-
- PEP 585: Built-in generics (`list[int]` instead of `typing.List[int]`)
|
|
26
|
-
- `base64.encodestring()` / `decodestring()` removed
|
|
27
|
-
- `Element.getiterator()` deprecated (use `iter()`)
|
|
28
|
-
- `Element.getchildren()` deprecated (use `list(element)`)
|
|
29
|
-
- `typing.Callable` deprecated in favor of `collections.abc.Callable`
|
|
30
|
-
|
|
31
|
-
See: https://docs.python.org/3/whatsnew/3.9.html
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
@property
|
|
35
|
-
def name(self) -> str:
|
|
36
|
-
return "org.openrewrite.python.migrate.UpgradeToPython39"
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def display_name(self) -> str:
|
|
40
|
-
return "Upgrade to Python 3.9"
|
|
41
|
-
|
|
42
|
-
@property
|
|
43
|
-
def description(self) -> str:
|
|
44
|
-
return (
|
|
45
|
-
"Migrate deprecated APIs for Python 3.9 compatibility. "
|
|
46
|
-
"This includes PEP 585 built-in generics, removed base64 functions, "
|
|
47
|
-
"and deprecated XML Element methods."
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
@property
|
|
51
|
-
def tags(self) -> List[str]:
|
|
52
|
-
return ["python", "migration", "3.9"]
|
|
53
|
-
|
|
54
|
-
def recipe_list(self) -> List[Recipe]:
|
|
55
|
-
"""Return the list of recipes to apply for Python 3.9 upgrade."""
|
|
56
|
-
from .html_parser_deprecations import ReplaceHtmlParserUnescape
|
|
57
|
-
from .threading_is_alive_deprecation import ReplaceThreadIsAlive
|
|
58
|
-
from .typing_callable import ReplaceTypingCallableWithCollectionsAbcCallable
|
|
59
|
-
from .upgrade_to_python38 import UpgradeToPython38
|
|
60
|
-
from .xml_deprecations import ReplaceElementGetchildren, ReplaceElementGetiterator
|
|
61
|
-
|
|
62
|
-
return [
|
|
63
|
-
# First apply all Python 3.8 upgrades
|
|
64
|
-
UpgradeToPython38(),
|
|
65
|
-
# base64 encodestring/decodestring removed in Python 3.9
|
|
66
|
-
ChangeImport(old_module="base64", old_name="encodestring", new_module="base64", new_name="encodebytes"),
|
|
67
|
-
ChangeImport(old_module="base64", old_name="decodestring", new_module="base64", new_name="decodebytes"),
|
|
68
|
-
# PEP 585: Replace typing.List[X] with list[X], etc. (Python 3.9+)
|
|
69
|
-
ChangeImport(old_module="typing", old_name="List", new_module="builtins", new_name="list"),
|
|
70
|
-
ChangeImport(old_module="typing", old_name="Dict", new_module="builtins", new_name="dict"),
|
|
71
|
-
ChangeImport(old_module="typing", old_name="Set", new_module="builtins", new_name="set"),
|
|
72
|
-
ChangeImport(old_module="typing", old_name="FrozenSet", new_module="builtins", new_name="frozenset"),
|
|
73
|
-
ChangeImport(old_module="typing", old_name="Tuple", new_module="builtins", new_name="tuple"),
|
|
74
|
-
ChangeImport(old_module="typing", old_name="Type", new_module="builtins", new_name="type"),
|
|
75
|
-
# typing.Callable -> collections.abc.Callable (PEP 585)
|
|
76
|
-
ReplaceTypingCallableWithCollectionsAbcCallable(),
|
|
77
|
-
# PEP 585: typing -> collections replacements
|
|
78
|
-
ChangeImport(old_module="typing", old_name="Deque", new_module="collections", new_name="deque"),
|
|
79
|
-
ChangeImport(old_module="typing", old_name="DefaultDict", new_module="collections", new_name="defaultdict"),
|
|
80
|
-
ChangeImport(old_module="typing", old_name="OrderedDict", new_module="collections"),
|
|
81
|
-
ChangeImport(old_module="typing", old_name="Counter", new_module="collections"),
|
|
82
|
-
ChangeImport(old_module="typing", old_name="ChainMap", new_module="collections"),
|
|
83
|
-
# PEP 585: typing -> re replacements
|
|
84
|
-
ChangeImport(old_module="typing", old_name="Pattern", new_module="re"),
|
|
85
|
-
ChangeImport(old_module="typing", old_name="Match", new_module="re"),
|
|
86
|
-
# PEP 585: typing -> contextlib replacements
|
|
87
|
-
ChangeImport(old_module="typing", old_name="ContextManager", new_module="contextlib", new_name="AbstractContextManager"),
|
|
88
|
-
ChangeImport(old_module="typing", old_name="AsyncContextManager", new_module="contextlib", new_name="AbstractAsyncContextManager"),
|
|
89
|
-
# PEP 585: typing -> collections.abc replacements
|
|
90
|
-
ChangeImport(old_module="typing", old_name="Iterable", new_module="collections.abc"),
|
|
91
|
-
ChangeImport(old_module="typing", old_name="Iterator", new_module="collections.abc"),
|
|
92
|
-
ChangeImport(old_module="typing", old_name="Generator", new_module="collections.abc"),
|
|
93
|
-
ChangeImport(old_module="typing", old_name="Sequence", new_module="collections.abc"),
|
|
94
|
-
ChangeImport(old_module="typing", old_name="MutableSequence", new_module="collections.abc"),
|
|
95
|
-
ChangeImport(old_module="typing", old_name="Mapping", new_module="collections.abc"),
|
|
96
|
-
ChangeImport(old_module="typing", old_name="MutableMapping", new_module="collections.abc"),
|
|
97
|
-
ChangeImport(old_module="typing", old_name="AbstractSet", new_module="collections.abc", new_name="Set"),
|
|
98
|
-
ChangeImport(old_module="typing", old_name="MutableSet", new_module="collections.abc"),
|
|
99
|
-
ChangeImport(old_module="typing", old_name="Awaitable", new_module="collections.abc"),
|
|
100
|
-
ChangeImport(old_module="typing", old_name="Coroutine", new_module="collections.abc"),
|
|
101
|
-
ChangeImport(old_module="typing", old_name="AsyncIterable", new_module="collections.abc"),
|
|
102
|
-
ChangeImport(old_module="typing", old_name="AsyncIterator", new_module="collections.abc"),
|
|
103
|
-
ChangeImport(old_module="typing", old_name="AsyncGenerator", new_module="collections.abc"),
|
|
104
|
-
ChangeImport(old_module="typing", old_name="Reversible", new_module="collections.abc"),
|
|
105
|
-
ChangeImport(old_module="typing", old_name="Container", new_module="collections.abc"),
|
|
106
|
-
ChangeImport(old_module="typing", old_name="Collection", new_module="collections.abc"),
|
|
107
|
-
ChangeImport(old_module="typing", old_name="MappingView", new_module="collections.abc"),
|
|
108
|
-
ChangeImport(old_module="typing", old_name="KeysView", new_module="collections.abc"),
|
|
109
|
-
ChangeImport(old_module="typing", old_name="ItemsView", new_module="collections.abc"),
|
|
110
|
-
ChangeImport(old_module="typing", old_name="ValuesView", new_module="collections.abc"),
|
|
111
|
-
ChangeImport(old_module="typing", old_name="Hashable", new_module="collections.abc"),
|
|
112
|
-
ChangeImport(old_module="typing", old_name="Sized", new_module="collections.abc"),
|
|
113
|
-
# XML Element.getiterator() deprecated in 3.9, use iter()
|
|
114
|
-
ReplaceElementGetiterator(),
|
|
115
|
-
# XML Element.getchildren() -> list(element) (3.9)
|
|
116
|
-
ReplaceElementGetchildren(),
|
|
117
|
-
# fractions.gcd() removed in 3.9, use math.gcd()
|
|
118
|
-
ChangeImport(old_module="fractions", old_name="gcd", new_module="math"),
|
|
119
|
-
# sys.getcheckinterval/setcheckinterval removed in 3.9
|
|
120
|
-
ChangeImport(old_module="sys", old_name="getcheckinterval", new_module="sys", new_name="getswitchinterval"),
|
|
121
|
-
ChangeImport(old_module="sys", old_name="setcheckinterval", new_module="sys", new_name="setswitchinterval"),
|
|
122
|
-
# Thread.isAlive() removed in 3.9
|
|
123
|
-
ReplaceThreadIsAlive(),
|
|
124
|
-
# HTMLParser.unescape() -> html.unescape() (removed in 3.9)
|
|
125
|
-
ReplaceHtmlParserUnescape(),
|
|
126
|
-
# Update project metadata, packaging, Dockerfiles, CloudFormation templates, and .whitesource files to the target version
|
|
127
|
-
RpcRecipe("org.openrewrite.python.migrate.UpgradePythonVersionTo39"),
|
|
128
|
-
]
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"""Tests for typing.Callable migration recipe."""
|
|
2
|
-
|
|
3
|
-
from rewrite.test import RecipeSpec, python
|
|
4
|
-
from openrewrite_migrate_python.migrate.typing_callable import (
|
|
5
|
-
ReplaceTypingCallableWithCollectionsAbcCallable,
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TestReplaceTypingCallableWithCollectionsAbcCallable:
|
|
10
|
-
def test_replaces_from_typing_import_callable(self):
|
|
11
|
-
spec = RecipeSpec(recipe=ReplaceTypingCallableWithCollectionsAbcCallable())
|
|
12
|
-
spec.rewrite_run(
|
|
13
|
-
python(
|
|
14
|
-
"""
|
|
15
|
-
from typing import Callable
|
|
16
|
-
handler: Callable[[int], str] = lambda x: str(x)
|
|
17
|
-
""",
|
|
18
|
-
"""
|
|
19
|
-
from collections.abc import Callable
|
|
20
|
-
handler: Callable[[int], str] = lambda x: str(x)
|
|
21
|
-
""",
|
|
22
|
-
)
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
def test_no_change_when_collections_abc_callable(self):
|
|
26
|
-
spec = RecipeSpec(recipe=ReplaceTypingCallableWithCollectionsAbcCallable())
|
|
27
|
-
spec.rewrite_run(
|
|
28
|
-
python(
|
|
29
|
-
"""
|
|
30
|
-
from collections.abc import Callable
|
|
31
|
-
handler: Callable[[int], str] = lambda x: str(x)
|
|
32
|
-
"""
|
|
33
|
-
)
|
|
34
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|