fix: auto-fix code issues (cron)
- 修复隐式 Optional 类型注解 (RUF013) - 修复不必要的赋值后返回 (RET504) - 优化列表推导式 (PERF401) - 修复未使用的参数 (ARG002) - 清理重复导入 - 优化异常处理
This commit is contained in:
@@ -178,7 +178,10 @@ class EntityAligner:
|
||||
return best_match
|
||||
|
||||
def _fallback_similarity_match(
|
||||
self, entities: list[object], name: str, exclude_id: str | None = None,
|
||||
self,
|
||||
entities: list[object],
|
||||
name: str,
|
||||
exclude_id: str | None = None,
|
||||
) -> object | None:
|
||||
"""
|
||||
回退到简单的相似度匹配(不使用 embedding)
|
||||
@@ -212,7 +215,10 @@ class EntityAligner:
|
||||
return None
|
||||
|
||||
def batch_align_entities(
|
||||
self, project_id: str, new_entities: list[dict], threshold: float | None = None,
|
||||
self,
|
||||
project_id: str,
|
||||
new_entities: list[dict],
|
||||
threshold: float | None = None,
|
||||
) -> list[dict]:
|
||||
"""
|
||||
批量对齐实体
|
||||
@@ -232,7 +238,10 @@ class EntityAligner:
|
||||
|
||||
for new_ent in new_entities:
|
||||
matched = self.find_similar_entity(
|
||||
project_id, new_ent["name"], new_ent.get("definition", ""), threshold=threshold,
|
||||
project_id,
|
||||
new_ent["name"],
|
||||
new_ent.get("definition", ""),
|
||||
threshold=threshold,
|
||||
)
|
||||
|
||||
result = {
|
||||
|
||||
Reference in New Issue
Block a user