Skip to content

Commit ab06237

Browse files
authored
Merge branch 'main' into pujol-cg-10392-advanced-topics-in-importsexports
2 parents 64c3b8f + b3678f6 commit ab06237

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ jobs:
1212
timeout-minutes: 10
1313

1414
steps:
15-
- name: Check out the repo
16-
uses: actions/checkout@v4
15+
- uses: actions/checkout@v4
1716
with:
1817
fetch-depth: 0
19-
repository: ${{ github.event.pull_request.head.repo.full_name }}
20-
ref: ${{ github.event.pull_request.head.ref }}
2118

22-
- name: Setup backend
19+
- name: Setup
2320
id: setup
2421
uses: ./.github/actions/setup
2522

sqlalchemy_type_annotations/run.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import codegen
2+
3+
24
from codegen import Codebase
35
from codegen.sdk.core.detached_symbols.function_call import FunctionCall
46
import subprocess
@@ -70,9 +72,7 @@ def run(codebase: Codebase):
7072
continue
7173

7274
# Check for nullable=True
73-
is_nullable = any(
74-
x.name == "nullable" and x.value == "True" for x in db_column_call.args
75-
)
75+
is_nullable = any(x.name == "nullable" and x.value == "True" for x in db_column_call.args)
7676

7777
# Extract the first argument for the column type
7878
first_argument = db_column_call.args[0].source or ""
@@ -101,9 +101,7 @@ def run(codebase: Codebase):
101101

102102
# Add necessary imports
103103
if not cls.file.has_import("Mapped"):
104-
cls.file.add_import_from_import_string(
105-
"from sqlalchemy.orm import Mapped\n"
106-
)
104+
cls.file.add_import_from_import_string("from sqlalchemy.orm import Mapped\n")
107105

108106
if "Optional" in new_type and not cls.file.has_import("Optional"):
109107
cls.file.add_import_from_import_string("from typing import Optional\n")
@@ -112,9 +110,7 @@ def run(codebase: Codebase):
112110
cls.file.add_import_from_import_string("from decimal import Decimal\n")
113111

114112
if "datetime" in new_type and not cls.file.has_import("datetime"):
115-
cls.file.add_import_from_import_string(
116-
"from datetime import datetime\n"
117-
)
113+
cls.file.add_import_from_import_string("from datetime import datetime\n")
118114

119115
if class_modified:
120116
classes_modified += 1

0 commit comments

Comments
 (0)