示例#1
0
        class Klass(Declared):
            a = var(int)
            b = var(int)
            c = var(int, init=False, required=False)

            def __post_init__(self, **omits):
                self.c = self.a + self.b
示例#2
0
        class Klass(Declared):
            a = var(int)
            b = var(int)
            c = var(int, init=False, required=False)

            def __post_init__(self, c):
                self.c = c + 1
示例#3
0
class Court(Declared):
    num = var(int, required=False)
    name = var(str, required=False)
    date = var(date, default=date.today(), serializer=DateSerializer())
    start_time = var(timedelta, serializer=_timedelta_serde)
    end_time = var(timedelta, serializer=_timedelta_serde)

    def __post_init__(self, **omits):
        if self.num is None and self.name is None:
            raise ValueError("num or name is required for court")
示例#4
0
        class Mapping(Declared):
            __xml_tag_name__ = "Mapping"

            element_code = pascalcase_var(str, as_xml_attr=True)
            element_type = pascalcase_var(str, as_xml_attr=True)
            element_id = var(str, as_xml_attr=True, field_name="ElementID")
            parent_type = pascalcase_var(str, as_xml_attr=True)
            parent_code = pascalcase_var(str, as_xml_attr=True)
            parent_id = var(str, as_xml_attr=True, field_name="ParentID")
            action = pascalcase_var(str, as_xml_attr=True)

            properties = vec(Property, field_name="Property")
示例#5
0
        class Object(Declared):
            __xml_tag_name__ = "Object"

            action = pascalcase_var(str, as_xml_attr=True)
            code = pascalcase_var(str, as_xml_attr=True)
            id_ = var(str, field_name="ID", as_xml_attr=True)
            element_type = pascalcase_var(str, as_xml_attr=True)

            properties = vec(Property, field_name="Property")
示例#6
0
class JSONTestClass(Declared):
    a = var(int)
    b = var(float)
    c = var(bytes, serializer=BytesSerializer())
    d = var(str)
    e = var(bool)
    f = var(list)
    g = var(dict)
示例#7
0
 class Person(Declared):
     name = var(str)
     age = var(int)
示例#8
0
 class Item(Declared):
     name = var(str, as_xml_attr=True)
     text = var(str, as_xml_text=True)
示例#9
0
 class Style(Declared):
     name = var(str, as_xml_attr=True)
     parent = var(str, as_xml_attr=True, required=False)
     items = vec(Item, field_name="item")
示例#10
0
 class Neighbor(Declared):
     name = var(str, as_xml_attr=True)
     direction = var(str, as_xml_attr=True)
示例#11
0
 class Country(Declared):
     rank = var(str)
     year = var(int)
     gdppc = var(int)
     name = var(str, as_xml_attr=True)
     neighbor = var(Neighbor)
示例#12
0
 class Klass1(Declared):
     testVarB = var(int, naming_style=NamingStyle.camelcase)
示例#13
0
 class Example(Declared):
     crcat = var(str)
     crsource = var(str)
     crkw = var(str)
     crint = var(int)
     crfloat = var(float)
示例#14
0
 class Home(Declared):
     location = var(str)
示例#15
0
 class Home(Declared):
     location = var(str)
     furniture = var(Furniture)
示例#16
0
    class Struct(Declared):
        __xml_tag_name__ = "root"

        p0 = var(str, as_xml_text=True)
示例#17
0
 class Body(Declared):
     field0 = var(Table, field_name="fieldA")
示例#18
0
class Task(Declared):
    run_id = var(UUID, default_factory=uuid4, serializer=UUIDSerializer())
    username = var(str)
    password = var(str)
    courts = vec(Court)
示例#19
0
 class Klass(Declared):
     test_var_a = var(int, naming_style=NamingStyle.camelcase)
示例#20
0
 class Item(Declared):
     a = var(str)
示例#21
0
        class Property(Declared):
            __xml_tag_name__ = "Property"

            name = pascalcase_var(str, as_xml_attr=True)
            value = var(str, as_xml_text=True)
示例#22
0
 class Table(Declared):
     hello_world = var(str, field_name="helloWorld")
示例#23
0
    class Struct(Declared):
        __xml_tag_name__ = "root"

        p0 = var(str, ignore_serialize=True)
示例#24
0
 class Klass3(Declared):
     TestVarD = var(int, naming_style=NamingStyle.camelcase)
示例#25
0
 class Person(Declared):
     valid = var(str, as_xml_attr=True)
     name = var(str)
     age = var(int)
示例#26
0
    class Struct(Declared):
        __xml_tag_name__ = "root"

        p0 = var(str, required=False)
示例#27
0
 class Furniture(Declared):
     name = var(str)
示例#28
0
    class Struct(Declared):
        __xml_tag_name__ = "root"

        p0 = var(str, as_xml_text=True, serializer=S())
示例#29
0
 class Person(Declared):
     name = var(str)
     age = var(int)
     home = vec(Home)
示例#30
0
    class Struct(Declared):
        __xml_tag_name__ = "root"

        p0 = var(int, as_xml_attr=True, required=False)
        p1 = var(str)
        p2 = var(float)