fix: auto-fix code issues (cron)

- 修复重复导入/字段 (llm_client.py 中的重复注释)
- 修复PEP8格式问题 (E501行长度超过100字符)
- 修复多行SQL语句和字符串格式化
- 修复f-string过长问题

涉及文件:
- backend/developer_ecosystem_manager.py
- backend/document_processor.py
- backend/enterprise_manager.py
- backend/export_manager.py
- backend/growth_manager.py
- backend/llm_client.py
- backend/localization_manager.py
- backend/main.py
- backend/neo4j_manager.py
- backend/ops_manager.py
- backend/performance_manager.py
- backend/plugin_manager.py
- backend/search_manager.py
- backend/security_manager.py
- backend/subscription_manager.py
- backend/tenant_manager.py
- backend/test_phase8_task6.py
- backend/test_phase8_task8.py
- backend/tingwu_client.py
- backend/workflow_manager.py
This commit is contained in:
AutoFix Bot
2026-03-04 03:19:02 +08:00
parent e108f83cd9
commit 0869fec587
20 changed files with 222 additions and 115 deletions

View File

@@ -378,7 +378,8 @@ class Neo4jManager:
result = session.run(
"""
MATCH path = shortestPath(
(source:Entity {id: $source_id})-[*1..$max_depth]-(target:Entity {id: $target_id})
(source:Entity {id: $source_id})-[*1..$max_depth]-
(target:Entity {id: $target_id})
)
RETURN path
""",
@@ -440,7 +441,8 @@ class Neo4jManager:
with self._driver.session() as session:
result = session.run(
"""
MATCH path = (source:Entity {id: $source_id})-[*1..$max_depth]-(target:Entity {id: $target_id})
MATCH path = (source:Entity {id: $source_id})-[*1..$max_depth]-
(target:Entity {id: $target_id})
WHERE source <> target
RETURN path
LIMIT $limit
@@ -504,7 +506,9 @@ class Neo4jManager:
if relation_type:
result = session.run(
"""
MATCH (e:Entity {id: $entity_id})-[r:RELATES_TO {relation_type: $relation_type}]-(neighbor:Entity)
MATCH (e:Entity {id: $entity_id})-
[r:RELATES_TO {relation_type: $relation_type}]-
(neighbor:Entity)
RETURN neighbor, r.relation_type as rel_type, r.evidence as evidence
LIMIT $limit
""",
@@ -555,7 +559,8 @@ class Neo4jManager:
with self._driver.session() as session:
result = session.run(
"""
MATCH (e1:Entity {id: $id1})-[:RELATES_TO]-(common:Entity)-[:RELATES_TO]-(e2:Entity {id: $id2})
MATCH (e1:Entity {id: $id1})-[:RELATES_TO]-(common:Entity)-
[:RELATES_TO]-(e2:Entity {id: $id2})
RETURN DISTINCT common
""",
id1=entity_id1,
@@ -593,7 +598,8 @@ class Neo4jManager:
CALL gds.graph.exists('project-graph-$project_id') YIELD exists
WITH exists
CALL apoc.do.when(exists,
'CALL gds.graph.drop("project-graph-$project_id") YIELD graphName RETURN graphName',
'CALL gds.graph.drop("project-graph-$project_id") '
'YIELD graphName RETURN graphName',
'RETURN "none" as graphName',
{}
) YIELD value RETURN value
@@ -1069,7 +1075,8 @@ def sync_project_to_neo4j(
manager.sync_relations_batch(graph_relations)
logger.info(
f"Synced project {project_id} to Neo4j: {len(entities)} entities, {len(relations)} relations",
f"Synced project {project_id} to Neo4j: {len(entities)} entities, "
f"{len(relations)} relations",
)