From bf77195c637f63e4e642918c33d860e58a4c48ad Mon Sep 17 00:00:00 2001 From: zhangyongchao Date: Thu, 19 Dec 2024 20:20:03 +0800 Subject: [PATCH] fix lint error --- lazyllm/tools/rag/doc_impl.py | 2 +- lazyllm/tools/rag/utils.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lazyllm/tools/rag/doc_impl.py b/lazyllm/tools/rag/doc_impl.py index 5ea593d5..ecdf7215 100644 --- a/lazyllm/tools/rag/doc_impl.py +++ b/lazyllm/tools/rag/doc_impl.py @@ -250,7 +250,7 @@ def _add_files(self, input_files: List[str], ids: Optional[List[str]] = None, root_nodes = self._reader.load_data(input_files) for idx, node in enumerate(root_nodes): node.global_metadata = metadatas[idx].copy() if metadatas else {} - node.global_metadata[RAG_DOC_ID] = ids[idx] if ids else gen_docid(input_files[idx]) + node.global_metadata[RAG_DOC_ID] = ids[idx] if ids else gen_docid(input_files[idx]) node.global_metadata[RAG_DOC_PATH] = input_files[idx] temp_store = self._create_store({"type": "map"}) temp_store.update_nodes(root_nodes) diff --git a/lazyllm/tools/rag/utils.py b/lazyllm/tools/rag/utils.py index b6c54e7a..673ffac6 100644 --- a/lazyllm/tools/rag/utils.py +++ b/lazyllm/tools/rag/utils.py @@ -11,9 +11,8 @@ from lazyllm.common.queue import sqlite3_check_threadsafety import sqlalchemy from sqlalchemy.orm import DeclarativeBase -from sqlalchemy import Column, insert, update, select, delete +from sqlalchemy import Column, insert, update from sqlalchemy.orm import sessionmaker -import uuid import pydantic import sqlite3 @@ -101,6 +100,7 @@ class Status: deleted = 'deleted' DELETE_SAFE_STATUS_LIST = [Status.waiting, Status.success, Status.failed] + def __init__(self, path, name): self._path = path self._name = name @@ -480,7 +480,7 @@ def update_file_status(self, file_ids: List[str], status: str, batch_size: int = updated_files = [] for i in range(0, len(file_ids), batch_size): - batch = file_ids[i : i + batch_size] + batch = file_ids[i: i + batch_size] placeholders = ', '.join('?' for _ in batch) sql = f'UPDATE documents SET status = ? WHERE doc_id IN ({placeholders}) RETURNING doc_id, path'