From cbe8ec21182181317230bf1e026132a563f7f363 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Mon, 27 Jan 2025 15:24:34 -0800 Subject: [PATCH 1/4] chore: clean-up pre-commit --- .github/workflows/pre-commit.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 99cb1a4..ee98bdf 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,14 +12,8 @@ jobs: timeout-minutes: 10 steps: - - name: Check out the repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - - - name: Setup backend + - uses: actions/checkout@v4 + - name: Setup id: setup uses: ./.github/actions/setup From b029b7892f37e1e6ff35e598f8d636b48d2ea803 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Mon, 27 Jan 2025 15:26:14 -0800 Subject: [PATCH 2/4] add bakc fetch depth --- .github/workflows/pre-commit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ee98bdf..d7bd731 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,6 +13,9 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup id: setup uses: ./.github/actions/setup From 9185e6a5f8c7727fd33b56f0f2ad7be6b94c7f44 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Mon, 27 Jan 2025 15:26:59 -0800 Subject: [PATCH 3/4] pre-commit break --- sqlalchemy_type_annotations/run.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlalchemy_type_annotations/run.py b/sqlalchemy_type_annotations/run.py index c028b5b..762c5c8 100644 --- a/sqlalchemy_type_annotations/run.py +++ b/sqlalchemy_type_annotations/run.py @@ -1,4 +1,6 @@ import codegen + + from codegen import Codebase from codegen.sdk.core.detached_symbols.function_call import FunctionCall import subprocess From 0cf767923fd82c5d68141d4fe2aa1bfabf3f4402 Mon Sep 17 00:00:00 2001 From: christinewangcw <146775704+christinewangcw@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:27:27 +0000 Subject: [PATCH 4/4] Automated pre-commit update --- sqlalchemy_type_annotations/run.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sqlalchemy_type_annotations/run.py b/sqlalchemy_type_annotations/run.py index 762c5c8..0bcc617 100644 --- a/sqlalchemy_type_annotations/run.py +++ b/sqlalchemy_type_annotations/run.py @@ -72,9 +72,7 @@ def run(codebase: Codebase): continue # Check for nullable=True - is_nullable = any( - x.name == "nullable" and x.value == "True" for x in db_column_call.args - ) + is_nullable = any(x.name == "nullable" and x.value == "True" for x in db_column_call.args) # Extract the first argument for the column type first_argument = db_column_call.args[0].source or "" @@ -103,9 +101,7 @@ def run(codebase: Codebase): # Add necessary imports if not cls.file.has_import("Mapped"): - cls.file.add_import_from_import_string( - "from sqlalchemy.orm import Mapped\n" - ) + cls.file.add_import_from_import_string("from sqlalchemy.orm import Mapped\n") if "Optional" in new_type and not cls.file.has_import("Optional"): cls.file.add_import_from_import_string("from typing import Optional\n") @@ -114,9 +110,7 @@ def run(codebase: Codebase): cls.file.add_import_from_import_string("from decimal import Decimal\n") if "datetime" in new_type and not cls.file.has_import("datetime"): - cls.file.add_import_from_import_string( - "from datetime import datetime\n" - ) + cls.file.add_import_from_import_string("from datetime import datetime\n") if class_modified: classes_modified += 1