enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366)

This commit is contained in:
Bowen Liang
2024-02-06 13:21:13 +08:00
committed by GitHub
parent 42344795cd
commit 843280f82b
333 changed files with 2109 additions and 1050 deletions

View File

@@ -8,23 +8,33 @@ from datetime import datetime, timedelta
from hashlib import sha256
from typing import Any, Dict, Optional
from flask import current_app
from sqlalchemy import func
from werkzeug.exceptions import Forbidden
from constants.languages import language_timezone_mapping, languages
from events.tenant_event import tenant_was_created
from extensions.ext_redis import redis_client
from flask import current_app
from libs.helper import get_remote_ip
from libs.passport import PassportService
from libs.password import compare_password, hash_password
from libs.rsa import generate_key_pair
from models.account import *
from services.errors.account import (AccountAlreadyInTenantError, AccountLoginError, AccountNotLinkTenantError,
AccountRegisterError, CannotOperateSelfError, CurrentPasswordIncorrectError,
InvalidActionError, LinkAccountIntegrateError, MemberNotInTenantError,
NoPermissionError, RoleAlreadyAssignedError, TenantNotFound)
from sqlalchemy import func
from services.errors.account import (
AccountAlreadyInTenantError,
AccountLoginError,
AccountNotLinkTenantError,
AccountRegisterError,
CannotOperateSelfError,
CurrentPasswordIncorrectError,
InvalidActionError,
LinkAccountIntegrateError,
MemberNotInTenantError,
NoPermissionError,
RoleAlreadyAssignedError,
TenantNotFound,
)
from tasks.mail_invite_member_task import send_invite_member_mail_task
from werkzeug.exceptions import Forbidden
from sqlalchemy import exc
def _create_tenant_for_account(account) -> Tenant: