feat: mypy for all type check (#10921)

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

No files matched your search

+4 -4
View File
@@ -1,9 +1,9 @@
import logging
from collections.abc import Generator
import boto3
from botocore.client import Config
from botocore.exceptions import ClientError
import boto3 # type: ignore
from botocore.client import Config # type: ignore
from botocore.exceptions import ClientError # type: ignore
from configs import dify_config
from extensions.storage.base_storage import BaseStorage
@@ -53,7 +53,7 @@ class AwsS3Storage(BaseStorage):
def load_once(self, filename: str) -> bytes:
try:
data = self.client.get_object(Bucket=self.bucket_name, Key=filename)["Body"].read()
data: bytes = self.client.get_object(Bucket=self.bucket_name, Key=filename)["Body"].read()
except ClientError as ex:
if ex.response["Error"]["Code"] == "NoSuchKey":
raise FileNotFoundError("File not found")