From d5f33212ac611a1ac4ec54032ed3e86b6cfb640d Mon Sep 17 00:00:00 2001 From: -LAN- Date: Wed, 25 Dec 2024 21:24:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20add=20type=20ignore=20comments=20for=20s?= =?UTF-8?q?hared=5Ftask=20imports=20and=20clean=20up=20re=E2=80=A6=20(#120?= =?UTF-8?q?99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: -LAN- --- api/controllers/console/datasets/datasets_document.py | 3 +-- api/models/dataset.py | 4 ++-- api/schedule/mail_clean_document_notify_task.py | 2 +- api/tasks/batch_clean_document_task.py | 2 +- api/tasks/disable_segments_from_index_task.py | 2 +- api/tasks/enable_segments_to_index_task.py | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/api/controllers/console/datasets/datasets_document.py b/api/controllers/console/datasets/datasets_document.py index 552a2ab3ff819d..3ea77fadb23344 100644 --- a/api/controllers/console/datasets/datasets_document.py +++ b/api/controllers/console/datasets/datasets_document.py @@ -442,9 +442,8 @@ def get(self, dataset_id, batch): dataset_id = str(dataset_id) batch = str(batch) documents = self.get_batch_documents(dataset_id, batch) - response = {"tokens": 0, "total_price": 0, "currency": "USD", "total_segments": 0, "preview": []} if not documents: - return response, 200 + return {"tokens": 0, "total_price": 0, "currency": "USD", "total_segments": 0, "preview": []}, 200 data_process_rule = documents[0].dataset_process_rule data_process_rule_dict = data_process_rule.to_dict() info_list = [] diff --git a/api/models/dataset.py b/api/models/dataset.py index f6c8a4511bb774..567f7db4329158 100644 --- a/api/models/dataset.py +++ b/api/models/dataset.py @@ -628,7 +628,7 @@ def get_sign_content(self): return text -class ChildChunk(db.Model): +class ChildChunk(db.Model): # type: ignore[name-defined] __tablename__ = "child_chunks" __table_args__ = ( db.PrimaryKeyConstraint("id", name="child_chunk_pkey"), @@ -910,7 +910,7 @@ class ExternalKnowledgeBindings(db.Model): # type: ignore[name-defined] updated_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp()) -class DatasetAutoDisableLog(db.Model): +class DatasetAutoDisableLog(db.Model): # type: ignore[name-defined] __tablename__ = "dataset_auto_disable_logs" __table_args__ = ( db.PrimaryKeyConstraint("id", name="dataset_auto_disable_log_pkey"), diff --git a/api/schedule/mail_clean_document_notify_task.py b/api/schedule/mail_clean_document_notify_task.py index 080e78113150f7..4861e33d585781 100644 --- a/api/schedule/mail_clean_document_notify_task.py +++ b/api/schedule/mail_clean_document_notify_task.py @@ -2,7 +2,7 @@ import time import click -from celery import shared_task +from celery import shared_task # type: ignore from flask import render_template from extensions.ext_mail import mail diff --git a/api/tasks/batch_clean_document_task.py b/api/tasks/batch_clean_document_task.py index 9e81fefaa75d0e..f52440e6438ad0 100644 --- a/api/tasks/batch_clean_document_task.py +++ b/api/tasks/batch_clean_document_task.py @@ -2,7 +2,7 @@ import time import click -from celery import shared_task +from celery import shared_task # type: ignore from core.rag.index_processor.index_processor_factory import IndexProcessorFactory from core.tools.utils.web_reader_tool import get_image_upload_file_ids diff --git a/api/tasks/disable_segments_from_index_task.py b/api/tasks/disable_segments_from_index_task.py index 97eb9a40e71834..67112666e7b538 100644 --- a/api/tasks/disable_segments_from_index_task.py +++ b/api/tasks/disable_segments_from_index_task.py @@ -2,7 +2,7 @@ import time import click -from celery import shared_task +from celery import shared_task # type: ignore from core.rag.index_processor.index_processor_factory import IndexProcessorFactory from extensions.ext_database import db diff --git a/api/tasks/enable_segments_to_index_task.py b/api/tasks/enable_segments_to_index_task.py index ecafc99a94b433..0864e05e25f5a6 100644 --- a/api/tasks/enable_segments_to_index_task.py +++ b/api/tasks/enable_segments_to_index_task.py @@ -3,7 +3,7 @@ import time import click -from celery import shared_task +from celery import shared_task # type: ignore from core.rag.index_processor.constant.index_type import IndexType from core.rag.index_processor.index_processor_factory import IndexProcessorFactory