creditrating/BM02_指标计算/Schemas/IndexSchemas.py

33 lines
722 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from enum import Enum
from typing import List
import pydantic
from pydantic import BaseModel
ENameRegex = pydantic.constr(regex="^[a-z_]{1,}$")
CNameRegex = pydantic.constr(regex="^[\u4e00-\u9fa5a-zA-Z0-9]+$")
class Parameter(BaseModel):
ename: ENameRegex = "example_param"
cname: str = "示例参数"
description: str = "参数介绍文字"
class NatureEnum(Enum):
quantity = "定量"
quality = "定性"
class IndicatorDescription(BaseModel):
ename: ENameRegex = "example_indicator"
cname: str = "示例指标"
description: str = "指标介绍文字"
nature: NatureEnum
category: str
parameters: List[Parameter]
class Config:
use_enum_values = True