chore: apply pep8-naming rules for naming convention (#8261)

This commit is contained in:
Bowen Liang 2024-09-11 16:40:52 +08:00 • committed by GitHub
commit 292220c596
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
95 changed files with 287 additions and 258 deletions

View file

@ -32,7 +32,7 @@ from services.errors.account import (
NoPermissionError,
RateLimitExceededError,
RoleAlreadyAssignedError,
TenantNotFound,
TenantNotFoundError,
)
from tasks.mail_invite_member_task import send_invite_member_mail_task
from tasks.mail_reset_password_task import send_reset_password_mail_task
@ -311,13 +311,13 @@ class TenantService:
"""Get tenant by account and add the role"""
tenant = account.current_tenant
if not tenant:
raise TenantNotFound("Tenant not found.")
raise TenantNotFoundError("Tenant not found.")
ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
if ta:
tenant.role = ta.role
else:
raise TenantNotFound("Tenant not found for the account.")
raise TenantNotFoundError("Tenant not found for the account.")
return tenant
@staticmethod
@ -614,8 +614,8 @@ class RegisterService:
"email": account.email,
"workspace_id": tenant.id,
}
expiryHours = dify_config.INVITE_EXPIRY_HOURS
redis_client.setex(cls._get_invitation_token_key(token), expiryHours * 60 * 60, json.dumps(invitation_data))
expiry_hours = dify_config.INVITE_EXPIRY_HOURS
redis_client.setex(cls._get_invitation_token_key(token), expiry_hours * 60 * 60, json.dumps(invitation_data))
return token
@classmethod

View file

@ -1,7 +1,7 @@
from services.errors.base import BaseServiceError
class AccountNotFound(BaseServiceError):
class AccountNotFoundError(BaseServiceError):
pass
@ -25,7 +25,7 @@ class LinkAccountIntegrateError(BaseServiceError):
pass
class TenantNotFound(BaseServiceError):
class TenantNotFoundError(BaseServiceError):
pass