Beispiel #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
Beispiel #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
Beispiel #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")
Beispiel #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")
Beispiel #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")
Beispiel #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)
Beispiel #7
0
 class Person(Declared):
     name = var(str)
     age = var(int)
Beispiel #8
0
 class Item(Declared):
     name = var(str, as_xml_attr=True)
     text = var(str, as_xml_text=True)
Beispiel #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")
Beispiel #10
0
 class Neighbor(Declared):
     name = var(str, as_xml_attr=True)
     direction = var(str, as_xml_attr=True)
Beispiel #11
0
 class Country(Declared):
     rank = var(str)
     year = var(int)
     gdppc = var(int)
     name = var(str, as_xml_attr=True)
     neighbor = var(Neighbor)
Beispiel #12
0
 class Klass1(Declared):
     testVarB = var(int, naming_style=NamingStyle.camelcase)
Beispiel #13
0
 class Example(Declared):
     crcat = var(str)
     crsource = var(str)
     crkw = var(str)
     crint = var(int)
     crfloat = var(float)
Beispiel #14
0
 class Home(Declared):
     location = var(str)
Beispiel #15
0
 class Home(Declared):
     location = var(str)
     furniture = var(Furniture)
Beispiel #16
0
    class Struct(Declared):
        __xml_tag_name__ = "root"

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

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

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

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

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

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