Skip to content

Commit 2c8ac93

Browse files
committed
style: auto-format with ruff [skip ci]
1 parent 3d6a38a commit 2c8ac93

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/knowledge/graph.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from src import config
1111
from src.models import select_embedding_model
12-
from src.storage.minio.client import get_minio_client, StorageError
12+
from src.storage.minio.client import get_minio_client
1313
from src.utils import logger
1414
from src.utils.datetime_utils import utc_isoformat
1515

@@ -355,12 +355,12 @@ async def jsonl_file_add_entity(self, file_path, kgdb_name="neo4j"):
355355
temp_file_path = None
356356

357357
try:
358-
if parsed_url.scheme in ('http', 'https'): # 如果是 URL
358+
if parsed_url.scheme in ("http", "https"): # 如果是 URL
359359
logger.info(f"检测到 URL,正在从 MinIO 下载文件: {file_path}")
360360

361361
# 从 URL 解析 bucket_name 和 object_name
362362
# URL 格式: http://host:port/bucket_name/object_name
363-
path_parts = parsed_url.path.lstrip('/').split('/', 1)
363+
path_parts = parsed_url.path.lstrip("/").split("/", 1)
364364
if len(path_parts) < 2:
365365
raise ValueError(f"无法解析 MinIO URL: {file_path}")
366366

@@ -372,8 +372,10 @@ async def jsonl_file_add_entity(self, file_path, kgdb_name="neo4j"):
372372
file_data = await minio_client.adownload_file(bucket_name, object_name)
373373

374374
# 创建临时文件保存下载的内容
375-
with tempfile.NamedTemporaryFile(mode='w', suffix='.jsonl', delete=False, encoding='utf-8') as temp_file:
376-
temp_file.write(file_data.decode('utf-8'))
375+
with tempfile.NamedTemporaryFile(
376+
mode="w", suffix=".jsonl", delete=False, encoding="utf-8"
377+
) as temp_file:
378+
temp_file.write(file_data.decode("utf-8"))
377379
temp_file_path = temp_file.name
378380

379381
logger.info(f"文件已下载到临时路径: {temp_file_path}")

0 commit comments

Comments
 (0)