[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

@@ -330,7 +330,7 @@ class AppAnnotationService:
# Skip the first row
df = pd.read_csv(file, dtype=str)
result = []
for index, row in df.iterrows():
for _, row in df.iterrows():
content = {"question": row.iloc[0], "answer": row.iloc[1]}
result.append(content)
if len(result) == 0:

View File

@@ -227,7 +227,7 @@ class AppGenerateService:
# If workflow_id is specified, get the specific workflow version
if workflow_id:
try:
workflow_uuid = uuid.UUID(workflow_id)
_ = uuid.UUID(workflow_id)
except ValueError:
raise WorkflowIdFormatError(f"Invalid workflow_id format: '{workflow_id}'. ")
workflow = workflow_service.get_published_workflow_by_id(app_model=app_model, workflow_id=workflow_id)

View File

@@ -96,7 +96,7 @@ class AppService:
)
except (ProviderTokenNotInitError, LLMBadRequestError):
model_instance = None
except Exception as e:
except Exception:
logger.exception("Get default model instance failed, tenant_id: %s", tenant_id)
model_instance = None
@@ -201,7 +201,7 @@ class AppService:
# override tool parameters
tool["tool_parameters"] = masked_parameter
except Exception as e:
except Exception:
pass
# override agent mode

View File

@@ -89,7 +89,7 @@ class ExternalDatasetService:
raise ValueError(f"invalid endpoint: {endpoint}")
try:
response = httpx.post(endpoint, headers={"Authorization": f"Bearer {api_key}"})
except Exception as e:
except Exception:
raise ValueError(f"failed to connect to the endpoint: {endpoint}")
if response.status_code == 502:
raise ValueError(f"Bad Gateway: failed to connect to the endpoint: {endpoint}")

View File

@@ -175,7 +175,7 @@ limit 1000"""
# update jina to langgenius/jina_tool/jina etc.
updated_value = provider_cls(provider_name).to_string()
batch_updates.append((updated_value, record_id))
except Exception as e:
except Exception:
failed_ids.append(record_id)
click.echo(
click.style(

View File

@@ -128,7 +128,7 @@ class ToolTransformService:
)
}
for name, value in schema.items():
for name in schema:
if result.masked_credentials:
result.masked_credentials[name] = ""