[Chore/Refactor] Switch from MyPy to Basedpyright for type checking (#25047)

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN-
2025-09-03 11:52:26 +08:00
committed by GitHub
parent 1fff4620e6
commit 9d5956cef8
84 changed files with 2380 additions and 2351 deletions

View File

@@ -68,7 +68,7 @@ class AnswerStreamProcessor(StreamProcessor):
def reset(self) -> None:
self.route_position = {}
for answer_node_id, route_chunks in self.generate_routes.answer_generate_route.items():
for answer_node_id, _ in self.generate_routes.answer_generate_route.items():
self.route_position[answer_node_id] = 0
self.rest_node_ids = self.graph.node_ids.copy()
self.current_stream_chunk_generating_node_ids = {}

View File

@@ -5,7 +5,7 @@ import logging
import os
import tempfile
from collections.abc import Mapping, Sequence
from typing import Any, Optional, cast
from typing import Any, Optional
import chardet
import docx
@@ -428,9 +428,9 @@ def _download_file_content(file: File) -> bytes:
raise FileDownloadError("Missing URL for remote file")
response = ssrf_proxy.get(file.remote_url)
response.raise_for_status()
return cast(bytes, response.content)
return response.content
else:
return cast(bytes, file_manager.download(file))
return file_manager.download(file)
except Exception as e:
raise FileDownloadError(f"Error downloading file: {str(e)}") from e

View File

@@ -571,7 +571,7 @@ class KnowledgeRetrievalNode(BaseNode):
"condition": item.get("comparison_operator"),
}
)
except Exception as e:
except Exception:
return []
return automatic_metadata_filters

View File

@@ -324,7 +324,7 @@ class LoopNode(BaseNode):
# Process conditions if at least one variable is available
if available_conditions:
input_conditions, group_result, check_break_result = condition_processor.process_conditions(
_, _, check_break_result = condition_processor.process_conditions(
variable_pool=self.graph_runtime_state.variable_pool,
conditions=available_conditions,
operator=logical_operator,

View File

@@ -43,10 +43,6 @@ def _validate_type(parameter_type: str) -> SegmentType:
return SegmentType(parameter_type)
class _ParameterConfigError(Exception):
pass
class ParameterConfig(BaseModel):
"""
Parameter Config.

View File

@@ -25,7 +25,7 @@ _T = TypeVar("_T", bound=MutableMapping[str, Any])
def variable_to_processed_data(selector: Sequence[str], seg: Segment) -> UpdatedVariable:
if len(selector) < SELECTORS_LENGTH:
raise Exception("selector too short")
node_id, var_name = selector[:2]
_, var_name = selector[:2]
return UpdatedVariable(
name=var_name,
selector=list(selector[:2]),