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

@@ -1,6 +1,5 @@
import enum
import json
from typing import List
from flask_login import UserMixin
from sqlalchemy.dialects.postgresql import UUID
@@ -96,7 +95,7 @@ class Account(UserMixin, db.Model):
one_or_none()
return None
def get_integrates(self) -> List[db.Model]:
def get_integrates(self) -> list[db.Model]:
ai = db.Model
return db.session.query(ai).filter(
ai.account_id == self.id
@@ -121,7 +120,7 @@ class Tenant(db.Model):
created_at = db.Column(db.DateTime, nullable=False, server_default=db.text('CURRENT_TIMESTAMP(0)'))
updated_at = db.Column(db.DateTime, nullable=False, server_default=db.text('CURRENT_TIMESTAMP(0)'))
def get_accounts(self) -> List[db.Model]:
def get_accounts(self) -> list[db.Model]:
Account = db.Model
return db.session.query(Account).filter(
Account.id == TenantAccountJoin.account_id,

View File

@@ -1,5 +1,4 @@
import json
from typing import List
from sqlalchemy import ForeignKey
from sqlalchemy.dialects.postgresql import UUID
@@ -117,7 +116,7 @@ class ApiToolProvider(db.Model):
return ApiProviderSchemaType.value_of(self.schema_type_str)
@property
def tools(self) -> List[ApiBasedToolBundle]:
def tools(self) -> list[ApiBasedToolBundle]:
return [ApiBasedToolBundle(**tool) for tool in json.loads(self.tools_str)]
@property