fix: auto-fix code issues (cron)
- 修复隐式 Optional 类型注解 (RUF013) - 修复不必要的赋值后返回 (RET504) - 优化列表推导式 (PERF401) - 修复未使用的参数 (ARG002) - 清理重复导入 - 优化异常处理
This commit is contained in:
@@ -538,7 +538,8 @@ 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 +701,8 @@ 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 +1078,11 @@ 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 +1426,8 @@ 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 +1438,8 @@ 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 +1447,9 @@ 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()
|
||||
@@ -1453,9 +1463,11 @@ class DeveloperEcosystemManager:
|
||||
""",
|
||||
(
|
||||
status.value,
|
||||
now
|
||||
if status in [DeveloperStatus.VERIFIED, DeveloperStatus.CERTIFIED]
|
||||
else None,
|
||||
(
|
||||
now
|
||||
if status in [DeveloperStatus.VERIFIED, DeveloperStatus.CERTIFIED]
|
||||
else None
|
||||
),
|
||||
now,
|
||||
developer_id,
|
||||
),
|
||||
@@ -1469,7 +1481,8 @@ 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 +1596,8 @@ 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 +1713,8 @@ 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:
|
||||
@@ -1799,7 +1814,8 @@ 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:
|
||||
|
||||
Reference in New Issue
Block a user