feat: mypy for all type check (#10921)

This commit is contained in:
yihong
2024-12-24 18:38:51 +08:00
committed by GitHub
parent c91e8b1737
commit 56e15d09a9
584 changed files with 3975 additions and 2826 deletions

View File

@@ -1,4 +1,4 @@
from flask_restful import marshal_with
from flask_restful import marshal_with # type: ignore
from controllers.common import fields
from controllers.common import helpers as controller_helpers

View File

@@ -65,7 +65,7 @@ class AudioApi(WebApiResource):
class TextApi(WebApiResource):
def post(self, app_model: App, end_user):
from flask_restful import reqparse
from flask_restful import reqparse # type: ignore
try:
parser = reqparse.RequestParser()
@@ -82,7 +82,7 @@ class TextApi(WebApiResource):
and app_model.workflow
and app_model.workflow.features_dict
):
text_to_speech = app_model.workflow.features_dict.get("text_to_speech")
text_to_speech = app_model.workflow.features_dict.get("text_to_speech", {})
voice = args.get("voice") or text_to_speech.get("voice")
else:
try:

View File

@@ -1,6 +1,6 @@
import logging
from flask_restful import reqparse
from flask_restful import reqparse # type: ignore
from werkzeug.exceptions import InternalServerError, NotFound
import services

View File

@@ -1,5 +1,5 @@
from flask_restful import marshal_with, reqparse
from flask_restful.inputs import int_range
from flask_restful import marshal_with, reqparse # type: ignore
from flask_restful.inputs import int_range # type: ignore
from sqlalchemy.orm import Session
from werkzeug.exceptions import NotFound

View File

@@ -1,4 +1,4 @@
from flask_restful import Resource
from flask_restful import Resource # type: ignore
from controllers.web import api
from services.feature_service import FeatureService

View File

@@ -1,5 +1,5 @@
from flask import request
from flask_restful import marshal_with
from flask_restful import marshal_with # type: ignore
import services
from controllers.common.errors import FilenameNotExistsError
@@ -33,7 +33,7 @@ class FileApi(WebApiResource):
content=file.read(),
mimetype=file.mimetype,
user=end_user,
source=source,
source="datasets" if source == "datasets" else None,
)
except services.errors.file.FileTooLargeError as file_too_large_error:
raise FileTooLargeError(file_too_large_error.description)

View File

@@ -1,7 +1,7 @@
import logging
from flask_restful import fields, marshal_with, reqparse
from flask_restful.inputs import int_range
from flask_restful import fields, marshal_with, reqparse # type: ignore
from flask_restful.inputs import int_range # type: ignore
from werkzeug.exceptions import InternalServerError, NotFound
import services

View File

@@ -1,7 +1,7 @@
import uuid
from flask import request
from flask_restful import Resource
from flask_restful import Resource # type: ignore
from werkzeug.exceptions import NotFound, Unauthorized
from controllers.web import api

View File

@@ -1,7 +1,7 @@
import urllib.parse
import httpx
from flask_restful import marshal_with, reqparse
from flask_restful import marshal_with, reqparse # type: ignore
import services
from controllers.common import helpers

View File

@@ -1,5 +1,5 @@
from flask_restful import fields, marshal_with, reqparse
from flask_restful.inputs import int_range
from flask_restful import fields, marshal_with, reqparse # type: ignore
from flask_restful.inputs import int_range # type: ignore
from werkzeug.exceptions import NotFound
from controllers.web import api

View File

@@ -1,4 +1,4 @@
from flask_restful import fields, marshal_with
from flask_restful import fields, marshal_with # type: ignore
from werkzeug.exceptions import Forbidden
from configs import dify_config

View File

@@ -1,6 +1,6 @@
import logging
from flask_restful import reqparse
from flask_restful import reqparse # type: ignore
from werkzeug.exceptions import InternalServerError
from controllers.web import api

View File

@@ -1,7 +1,7 @@
from functools import wraps
from flask import request
from flask_restful import Resource
from flask_restful import Resource # type: ignore
from werkzeug.exceptions import BadRequest, NotFound, Unauthorized
from controllers.web.error import WebSSOAuthRequiredError