fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 (E302, E305, E501) - 修复行长度超过100字符的问题 - 修复F821未定义名称错误
This commit is contained in:
@@ -35,6 +35,7 @@ except ImportError:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LanguageCode(StrEnum):
|
||||
"""支持的语言代码"""
|
||||
|
||||
@@ -51,6 +52,7 @@ class LanguageCode(StrEnum):
|
||||
AR = "ar"
|
||||
HI = "hi"
|
||||
|
||||
|
||||
class RegionCode(StrEnum):
|
||||
"""区域代码"""
|
||||
|
||||
@@ -62,6 +64,7 @@ class RegionCode(StrEnum):
|
||||
LATIN_AMERICA = "latam"
|
||||
MIDDLE_EAST = "me"
|
||||
|
||||
|
||||
class DataCenterRegion(StrEnum):
|
||||
"""数据中心区域"""
|
||||
|
||||
@@ -75,6 +78,7 @@ class DataCenterRegion(StrEnum):
|
||||
CN_NORTH = "cn-north"
|
||||
CN_EAST = "cn-east"
|
||||
|
||||
|
||||
class PaymentProvider(StrEnum):
|
||||
"""支付提供商"""
|
||||
|
||||
@@ -91,6 +95,7 @@ class PaymentProvider(StrEnum):
|
||||
SEPA = "sepa"
|
||||
UNIONPAY = "unionpay"
|
||||
|
||||
|
||||
class CalendarType(StrEnum):
|
||||
"""日历类型"""
|
||||
|
||||
@@ -102,6 +107,7 @@ class CalendarType(StrEnum):
|
||||
PERSIAN = "persian"
|
||||
BUDDHIST = "buddhist"
|
||||
|
||||
|
||||
@dataclass
|
||||
class Translation:
|
||||
id: str
|
||||
@@ -116,6 +122,7 @@ class Translation:
|
||||
reviewed_by: str | None
|
||||
reviewed_at: datetime | None
|
||||
|
||||
|
||||
@dataclass
|
||||
class LanguageConfig:
|
||||
code: str
|
||||
@@ -133,6 +140,7 @@ class LanguageConfig:
|
||||
first_day_of_week: int
|
||||
calendar_type: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class DataCenter:
|
||||
id: str
|
||||
@@ -147,6 +155,7 @@ class DataCenter:
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class TenantDataCenterMapping:
|
||||
id: str
|
||||
@@ -158,6 +167,7 @@ class TenantDataCenterMapping:
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class LocalizedPaymentMethod:
|
||||
id: str
|
||||
@@ -175,6 +185,7 @@ class LocalizedPaymentMethod:
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class CountryConfig:
|
||||
code: str
|
||||
@@ -196,6 +207,7 @@ class CountryConfig:
|
||||
vat_rate: float | None
|
||||
is_active: bool
|
||||
|
||||
|
||||
@dataclass
|
||||
class TimezoneConfig:
|
||||
id: str
|
||||
@@ -206,6 +218,7 @@ class TimezoneConfig:
|
||||
region: str
|
||||
is_active: bool
|
||||
|
||||
|
||||
@dataclass
|
||||
class CurrencyConfig:
|
||||
code: str
|
||||
@@ -217,6 +230,7 @@ class CurrencyConfig:
|
||||
thousands_separator: str
|
||||
is_active: bool
|
||||
|
||||
|
||||
@dataclass
|
||||
class LocalizationSettings:
|
||||
id: str
|
||||
@@ -236,6 +250,7 @@ class LocalizationSettings:
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class LocalizationManager:
|
||||
DEFAULT_LANGUAGES = {
|
||||
LanguageCode.EN: {
|
||||
@@ -1683,8 +1698,10 @@ class LocalizationManager:
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
_localization_manager = None
|
||||
|
||||
|
||||
def get_localization_manager(db_path: str = "insightflow.db") -> LocalizationManager:
|
||||
global _localization_manager
|
||||
if _localization_manager is None:
|
||||
|
||||
Reference in New Issue
Block a user