Skip to content

Commit 71f10a7

Browse files
author
codegen-bot
committed
Merge branch 'main' of https://github.com/codegen-sh/codegen-examples into organize-dirs
2 parents 2501a60 + b3678f6 commit 71f10a7

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

examples/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
@@ -72,9 +74,7 @@ def run(codebase: Codebase):
7274
continue
7375

7476
# Check for nullable=True
75-
is_nullable = any(
76-
x.name == "nullable" and x.value == "True" for x in db_column_call.args
77-
)
77+
is_nullable = any(x.name == "nullable" and x.value == "True" for x in db_column_call.args)
7878

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

104104
# Add necessary imports
105105
if not cls.file.has_import("Mapped"):
106-
cls.file.add_import_from_import_string(
107-
"from sqlalchemy.orm import Mapped\n"
108-
)
106+
cls.file.add_import_from_import_string("from sqlalchemy.orm import Mapped\n")
109107

110108
if "Optional" in new_type and not cls.file.has_import("Optional"):
111109
cls.file.add_import_from_import_string("from typing import Optional\n")
@@ -114,9 +112,7 @@ def run(codebase: Codebase):
114112
cls.file.add_import_from_import_string("from decimal import Decimal\n")
115113

116114
if "datetime" in new_type and not cls.file.has_import("datetime"):
117-
cls.file.add_import_from_import_string(
118-
"from datetime import datetime\n"
119-
)
115+
cls.file.add_import_from_import_string("from datetime import datetime\n")
120116

121117
if class_modified:
122118
classes_modified += 1

0 commit comments

Comments
 (0)