fix: auto-fix code issues (cron)

- 修复重复导入/字段
- 修复异常处理
- 修复PEP8格式问题
- 添加类型注解
This commit is contained in:
OpenClaw Bot
2026-02-27 21:12:04 +08:00
parent 17bda3dbce
commit d767f0dddc
27 changed files with 3636 additions and 4158 deletions

View File

@@ -352,7 +352,7 @@ class DeveloperEcosystemManager:
self.db_path = db_path
self.platform_fee_rate = 0.30 # 平台抽成比例 30%
def _get_db(self):
def _get_db(self) -> None:
"""获取数据库连接"""
conn = sqlite3.connect(self.db_path)
conn.row_factory = sqlite3.Row
@@ -515,7 +515,7 @@ class DeveloperEcosystemManager:
return self.get_sdk_release(sdk_id)
def increment_sdk_download(self, sdk_id: str):
def increment_sdk_download(self, sdk_id: str) -> None:
"""增加 SDK 下载计数"""
with self._get_db() as conn:
conn.execute(
@@ -785,7 +785,7 @@ class DeveloperEcosystemManager:
return self.get_template(template_id)
def increment_template_install(self, template_id: str):
def increment_template_install(self, template_id: str) -> None:
"""增加模板安装计数"""
with self._get_db() as conn:
conn.execute(
@@ -852,7 +852,7 @@ class DeveloperEcosystemManager:
return review
def _update_template_rating(self, conn, template_id: str):
def _update_template_rating(self, conn, template_id: str) -> None:
"""更新模板评分"""
row = conn.execute(
"""
@@ -1084,7 +1084,7 @@ class DeveloperEcosystemManager:
return self.get_plugin(plugin_id)
def increment_plugin_install(self, plugin_id: str, active: bool = True):
def increment_plugin_install(self, plugin_id: str, active: bool = True) -> None:
"""增加插件安装计数"""
with self._get_db() as conn:
conn.execute(
@@ -1160,7 +1160,7 @@ class DeveloperEcosystemManager:
return review
def _update_plugin_rating(self, conn, plugin_id: str):
def _update_plugin_rating(self, conn, plugin_id: str) -> None:
"""更新插件评分"""
row = conn.execute(
"""
@@ -1421,7 +1421,7 @@ class DeveloperEcosystemManager:
return self.get_developer_profile(developer_id)
def update_developer_stats(self, developer_id: str):
def update_developer_stats(self, developer_id: str) -> None:
"""更新开发者统计信息"""
with self._get_db() as conn:
# 统计插件数量
@@ -1574,7 +1574,7 @@ class DeveloperEcosystemManager:
rows = conn.execute(query, params).fetchall()
return [self._row_to_code_example(row) for row in rows]
def increment_example_view(self, example_id: str):
def increment_example_view(self, example_id: str) -> None:
"""增加代码示例查看计数"""
with self._get_db() as conn:
conn.execute(
@@ -1587,7 +1587,7 @@ class DeveloperEcosystemManager:
)
conn.commit()
def increment_example_copy(self, example_id: str):
def increment_example_copy(self, example_id: str) -> None:
"""增加代码示例复制计数"""
with self._get_db() as conn:
conn.execute(