mirror of
https://github.com/langgenius/dify.git
synced 2026-10-16 15:35:32 +08:00
ci: enable Ruff SIM113 (#44102)
Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -76,7 +76,6 @@ ignore = [
|
||||
"SIM103", # needless-bool
|
||||
"SIM105", # suppressible-exception
|
||||
"SIM108", # if-else-block-instead-of-if-exp
|
||||
"SIM113", # enumerate-for-loop
|
||||
"SIM117", # multiple-with-statements
|
||||
"TID252", # allow relative imports from parent modules
|
||||
]
|
||||
|
||||
@@ -223,9 +223,7 @@ def transform_datasource_credentials(environment: str):
|
||||
if notion_package_identifier:
|
||||
# install notion plugin
|
||||
PluginService.install_from_marketplace_pkg(tenant_id, [notion_package_identifier])
|
||||
auth_count = 0
|
||||
for notion_tenant_credential in notion_tenant_credentials:
|
||||
auth_count += 1
|
||||
for auth_count, notion_tenant_credential in enumerate(notion_tenant_credentials, start=1):
|
||||
# get credential oauth params
|
||||
access_token = notion_tenant_credential.access_token
|
||||
# notion info
|
||||
|
||||
@@ -188,8 +188,7 @@ class AppRunner:
|
||||
:return:
|
||||
"""
|
||||
if stream:
|
||||
index = 0
|
||||
for token in text:
|
||||
for index, token in enumerate(text):
|
||||
chunk = LLMResultChunk(
|
||||
model=app_generate_entity.model_conf.model,
|
||||
prompt_messages=prompt_messages,
|
||||
@@ -197,7 +196,6 @@ class AppRunner:
|
||||
)
|
||||
|
||||
queue_manager.publish(QueueLLMChunkEvent(chunk=chunk), PublishFrom.APPLICATION_MANAGER)
|
||||
index += 1
|
||||
time.sleep(0.01)
|
||||
|
||||
queue_manager.publish(
|
||||
|
||||
@@ -113,8 +113,7 @@ class DatasetMultiRetrieverTool(DatasetRetrieverBaseTool):
|
||||
document_context_list.append(sign_segment_content(segment, session=session))
|
||||
if self.return_resource:
|
||||
context_list: list[RetrievalSourceMetadata] = []
|
||||
resource_number = 1
|
||||
for segment in sorted_segments:
|
||||
for resource_number, segment in enumerate(sorted_segments, start=1):
|
||||
dataset = session.get(Dataset, segment.dataset_id)
|
||||
document_stmt = select(Document).where(
|
||||
Document.id == segment.document_id,
|
||||
@@ -146,7 +145,6 @@ class DatasetMultiRetrieverTool(DatasetRetrieverBaseTool):
|
||||
else:
|
||||
source.content = segment.content
|
||||
context_list.append(source)
|
||||
resource_number += 1
|
||||
|
||||
for hit_callback in self.hit_callbacks:
|
||||
hit_callback.return_retriever_resource_info(context_list)
|
||||
|
||||
Reference in New Issue
Block a user