chore: apply ruff's pyupgrade linter rules to modernize Python code with targeted version (#2419)

This commit is contained in:
Bowen Liang
2024-02-09 15:21:33 +08:00
committed by GitHub
parent 589099a005
commit 063191889d
246 changed files with 912 additions and 937 deletions

View File

@@ -4,8 +4,9 @@ import hmac
import logging
import os
import time
from collections.abc import Generator
from mimetypes import guess_extension, guess_type
from typing import Generator, Tuple, Union
from typing import Union
from uuid import uuid4
from flask import current_app
@@ -113,7 +114,7 @@ class ToolFileManager:
return tool_file
@staticmethod
def get_file_binary(id: str) -> Union[Tuple[bytes, str], None]:
def get_file_binary(id: str) -> Union[tuple[bytes, str], None]:
"""
get file binary
@@ -133,7 +134,7 @@ class ToolFileManager:
return blob, tool_file.mimetype
@staticmethod
def get_file_binary_by_message_file_id(id: str) -> Union[Tuple[bytes, str], None]:
def get_file_binary_by_message_file_id(id: str) -> Union[tuple[bytes, str], None]:
"""
get file binary
@@ -162,7 +163,7 @@ class ToolFileManager:
return blob, tool_file.mimetype
@staticmethod
def get_file_generator_by_message_file_id(id: str) -> Union[Tuple[Generator, str], None]:
def get_file_generator_by_message_file_id(id: str) -> Union[tuple[Generator, str], None]:
"""
get file binary