Update the ruff rules and format the code (#846)

* Update the ruff rules and format the code

* Update the per-file-ignores

* Update the ci

* Update rules

* Fix codes

* Fix pagination

* Update rules
This commit is contained in:
Wu Clan
2025-10-10 19:02:49 +08:00
committed by GitHub
parent 51354593d0
commit 5762834744
269 changed files with 975 additions and 1198 deletions
@@ -1,2 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Sequence
from collections.abc import Sequence
from sqlalchemy import Select
from sqlalchemy.ext.asyncio import AsyncSession
+14 -16
View File
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Sequence
from collections.abc import Sequence
from sqlalchemy import Row, RowMapping, text
from sqlalchemy.ext.asyncio import AsyncSession
@@ -52,9 +50,9 @@ class CRUDGen:
"""
if settings.DATABASE_TYPE == 'mysql':
sql = """
SELECT table_name AS table_name, table_comment AS table_comment
FROM information_schema.tables
WHERE table_name NOT LIKE 'sys_gen_%'
SELECT table_name AS table_name, table_comment AS table_comment
FROM information_schema.tables
WHERE table_name NOT LIKE 'sys_gen_%'
AND table_name = :table_name;
"""
else:
@@ -83,16 +81,16 @@ class CRUDGen:
"""
if settings.DATABASE_TYPE == 'mysql':
sql = """
SELECT column_name AS column_name,
CASE WHEN column_key = 'PRI' THEN 1 ELSE 0 END AS is_pk,
CASE WHEN is_nullable = 'NO' OR column_key = 'PRI' THEN 0 ELSE 1 END AS is_nullable,
ordinal_position AS sort, column_comment AS column_comment,
column_type AS column_type FROM information_schema.columns
WHERE table_schema = :table_schema
AND table_name = :table_name
AND column_name <> 'id'
AND column_name <> 'created_time'
AND column_name <> 'updated_time'
SELECT column_name AS column_name,
CASE WHEN column_key = 'PRI' THEN 1 ELSE 0 END AS is_pk,
CASE WHEN is_nullable = 'NO' OR column_key = 'PRI' THEN 0 ELSE 1 END AS is_nullable,
ordinal_position AS sort, column_comment AS column_comment,
column_type AS column_type FROM information_schema.columns
WHERE table_schema = :table_schema
AND table_name = :table_name
AND column_name <> 'id'
AND column_name <> 'created_time'
AND column_name <> 'updated_time'
ORDER BY sort;
"""
stmt = text(sql).bindparams(table_schema=table_schema, table_name=table_name)
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Sequence
from collections.abc import Sequence
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy_crud_plus import CRUDPlus