fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -495,7 +495,7 @@ class DeveloperEcosystemManager:
|
||||
updates["updated_at"] = datetime.now().isoformat()
|
||||
|
||||
with self._get_db() as conn:
|
||||
set_clause = ", ".join([f"{k} = ?" for k in updates.keys()])
|
||||
set_clause = ", ".join([f"{k} = ?" for k in updates])
|
||||
conn.execute(
|
||||
f"UPDATE sdk_releases SET {set_clause} WHERE id = ?",
|
||||
list(updates.values()) + [sdk_id],
|
||||
@@ -538,7 +538,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取 SDK 版本历史"""
|
||||
with self._get_db() as conn:
|
||||
rows = conn.execute(
|
||||
"SELECT * FROM sdk_versions WHERE sdk_id = ? ORDER BY created_at DESC", (sdk_id,)
|
||||
"SELECT * FROM sdk_versions WHERE sdk_id = ? ORDER BY created_at DESC", (sdk_id,),
|
||||
).fetchall()
|
||||
return [self._row_to_sdk_version(row) for row in rows]
|
||||
|
||||
@@ -700,7 +700,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取模板详情"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM template_market WHERE id = ?", (template_id,)
|
||||
"SELECT * FROM template_market WHERE id = ?", (template_id,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1076,7 +1076,7 @@ class DeveloperEcosystemManager:
|
||||
return [self._row_to_plugin(row) for row in rows]
|
||||
|
||||
def review_plugin(
|
||||
self, plugin_id: str, reviewed_by: str, status: PluginStatus, notes: str = ""
|
||||
self, plugin_id: str, reviewed_by: str, status: PluginStatus, notes: str = "",
|
||||
) -> PluginMarketItem | None:
|
||||
"""审核插件"""
|
||||
now = datetime.now().isoformat()
|
||||
@@ -1420,7 +1420,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取开发者档案"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM developer_profiles WHERE id = ?", (developer_id,)
|
||||
"SELECT * FROM developer_profiles WHERE id = ?", (developer_id,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1431,7 +1431,7 @@ class DeveloperEcosystemManager:
|
||||
"""通过用户 ID 获取开发者档案"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM developer_profiles WHERE user_id = ?", (user_id,)
|
||||
"SELECT * FROM developer_profiles WHERE user_id = ?", (user_id,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1439,7 +1439,7 @@ class DeveloperEcosystemManager:
|
||||
return None
|
||||
|
||||
def verify_developer(
|
||||
self, developer_id: str, status: DeveloperStatus
|
||||
self, developer_id: str, status: DeveloperStatus,
|
||||
) -> DeveloperProfile | None:
|
||||
"""验证开发者"""
|
||||
now = datetime.now().isoformat()
|
||||
@@ -1469,7 +1469,7 @@ class DeveloperEcosystemManager:
|
||||
with self._get_db() as conn:
|
||||
# 统计插件数量
|
||||
plugin_row = conn.execute(
|
||||
"SELECT COUNT(*) as count FROM plugin_market WHERE author_id = ?", (developer_id,)
|
||||
"SELECT COUNT(*) as count FROM plugin_market WHERE author_id = ?", (developer_id,),
|
||||
).fetchone()
|
||||
|
||||
# 统计模板数量
|
||||
@@ -1583,7 +1583,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取代码示例"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM code_examples WHERE id = ?", (example_id,)
|
||||
"SELECT * FROM code_examples WHERE id = ?", (example_id,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1699,7 +1699,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取 API 文档"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM api_documentation WHERE id = ?", (doc_id,)
|
||||
"SELECT * FROM api_documentation WHERE id = ?", (doc_id,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1710,7 +1710,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取最新 API 文档"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM api_documentation ORDER BY generated_at DESC LIMIT 1"
|
||||
"SELECT * FROM api_documentation ORDER BY generated_at DESC LIMIT 1",
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1799,7 +1799,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取开发者门户配置"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM developer_portal_configs WHERE id = ?", (config_id,)
|
||||
"SELECT * FROM developer_portal_configs WHERE id = ?", (config_id,),
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
@@ -1810,7 +1810,7 @@ class DeveloperEcosystemManager:
|
||||
"""获取活跃的开发者门户配置"""
|
||||
with self._get_db() as conn:
|
||||
row = conn.execute(
|
||||
"SELECT * FROM developer_portal_configs WHERE is_active = 1 LIMIT 1"
|
||||
"SELECT * FROM developer_portal_configs WHERE is_active = 1 LIMIT 1",
|
||||
).fetchone()
|
||||
|
||||
if row:
|
||||
|
||||
Reference in New Issue
Block a user