From 1d8003c500dfb92fa2958cf12845fafa59aca625 Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Wed, 12 Mar 2025 21:18:41 +0000 Subject: [PATCH 1/2] Update Python version references to 3.13 --- Dockerfile | 2 +- .../canonical/update_union_types/update_union_types.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a71cfdd77..1f8f7e8ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN bash nodesource_setup.sh RUN apt-get update && apt-get install -y jq nodejs RUN corepack enable RUN --mount=type=cache,target=/root/.cache/uv uv pip install --system coverage -RUN --mount=type=cache,target=/root/.cache/uv uv tool install codecov-cli --python 3.10 +RUN --mount=type=cache,target=/root/.cache/uv uv tool install codecov-cli --python 3.13 RUN --mount=type=cache,target=/root/.cache/uv uv tool install pre-commit --with pre-commit-uv WORKDIR /codegen-sdk ENTRYPOINT [ "uv", "run", "--frozen", "/bin/bash"] diff --git a/src/codemods/canonical/update_union_types/update_union_types.py b/src/codemods/canonical/update_union_types/update_union_types.py index 98f7085c9..f3a2b94ee 100644 --- a/src/codemods/canonical/update_union_types/update_union_types.py +++ b/src/codemods/canonical/update_union_types/update_union_types.py @@ -9,14 +9,14 @@ @skill( canonical=True, prompt="""Generate a Python codemod that updates type annotations from the old Union[x, y] syntax to the new x | y syntax for migration from Python 3.9 to -Python 3.10. The codemod should iterate through all files in a codebase, check for imports of Union from typing, and replace occurrences of Union in +Python 3.13. The codemod should iterate through all files in a codebase, check for imports of Union from typing, and replace occurrences of Union in both generic type and subscript forms. Ensure that the new syntax is correctly formatted, handling cases with multiple types and removing any empty strings from trailing commas.""", uid="7637d11a-b907-4716-a09f-07776f81a359", ) @canonical class UpdateUnionTypes(Codemod, Skill): - """This updates the Union [ x , y ] syntax for x | y for migrations for python 3.9 to python 3.10""" + """This updates the Union [ x , y ] syntax for x | y for migrations for python 3.9 to python 3.13""" language = ProgrammingLanguage.PYTHON @@ -38,4 +38,4 @@ def execute(self, codebase: Codebase) -> None: new_type = " | ".join(types) if len(types) > 1: new_type = f"({new_type})" - editable.replace(editable.source, new_type) + editable.replace(editable.source, new_type) \ No newline at end of file From 43dfec5778f696cccce186bf8f608fd786717a04 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 21:19:38 +0000 Subject: [PATCH 2/2] Automated pre-commit update --- src/codemods/canonical/update_union_types/update_union_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codemods/canonical/update_union_types/update_union_types.py b/src/codemods/canonical/update_union_types/update_union_types.py index f3a2b94ee..558a20420 100644 --- a/src/codemods/canonical/update_union_types/update_union_types.py +++ b/src/codemods/canonical/update_union_types/update_union_types.py @@ -38,4 +38,4 @@ def execute(self, codebase: Codebase) -> None: new_type = " | ".join(types) if len(types) > 1: new_type = f"({new_type})" - editable.replace(editable.source, new_type) \ No newline at end of file + editable.replace(editable.source, new_type)