mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-07 18:06:52 +08:00
chore: apply ruff's pyupgrade linter rules to modernize Python code with targeted version (#2419)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Cipher/PKCS1_OAEP.py : PKCS#1 OAEP
|
||||
#
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
@@ -57,7 +56,7 @@ def timestamp_value(timestamp):
|
||||
raise ValueError(error)
|
||||
|
||||
|
||||
class str_len(object):
|
||||
class str_len:
|
||||
""" Restrict input to an integer in a range (inclusive) """
|
||||
|
||||
def __init__(self, max_length, argument='argument'):
|
||||
@@ -74,7 +73,7 @@ class str_len(object):
|
||||
return value
|
||||
|
||||
|
||||
class float_range(object):
|
||||
class float_range:
|
||||
""" Restrict input to an float in a range (inclusive) """
|
||||
def __init__(self, low, high, argument='argument'):
|
||||
self.low = low
|
||||
@@ -91,7 +90,7 @@ class float_range(object):
|
||||
return value
|
||||
|
||||
|
||||
class datetime_string(object):
|
||||
class datetime_string:
|
||||
def __init__(self, format, argument='argument'):
|
||||
self.format = format
|
||||
self.argument = argument
|
||||
@@ -111,7 +110,7 @@ def _get_float(value):
|
||||
try:
|
||||
return float(value)
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError('{0} is not a valid float'.format(value))
|
||||
raise ValueError('{} is not a valid float'.format(value))
|
||||
|
||||
def timezone(timezone_string):
|
||||
if timezone_string and timezone_string in available_timezones():
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
class InfiniteScrollPagination:
|
||||
def __init__(self, data, limit, has_more):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
from typing import List
|
||||
|
||||
from langchain.schema import OutputParserException
|
||||
|
||||
@@ -30,7 +29,7 @@ def parse_json_markdown(json_string: str) -> dict:
|
||||
return parsed
|
||||
|
||||
|
||||
def parse_and_check_json_markdown(text: str, expected_keys: List[str]) -> dict:
|
||||
def parse_and_check_json_markdown(text: str, expected_keys: list[str]) -> dict:
|
||||
try:
|
||||
json_obj = parse_json_markdown(text)
|
||||
except json.JSONDecodeError as e:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
import jwt
|
||||
from flask import current_app
|
||||
from werkzeug.exceptions import Unauthorized
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
import base64
|
||||
import binascii
|
||||
import hashlib
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
import hashlib
|
||||
|
||||
from Crypto.Cipher import AES
|
||||
|
||||
Reference in New Issue
Block a user