Example #1
0
    class C(B, A):
        a = field(default=None)
        c = field(default_factory=copy_field('b'))

        @init_fields(ancestor_fields_first=a_first)
        def __init__(self):
            pass
Example #2
0
    class C(object):
        y = field()
        x = field(default_factory=copy_field(y))

        @init_fields
        def __init__(self):
            pass
Example #3
0
    class Foo(object):
        a = field(default_factory=copy_value([]))
        b = field(default_factory=copy_field('z'))
        c = field()

        @c.default_factory
        def c_default(self):
            return self.a + ['yes']

        z = field()
Example #4
0
class Foo(object):
    a = field(type_hint=int, default=0, check_type=True)
    b = field(type_hint=int, validators={'is positive': lambda x: x > 0})
    c = field(default_factory=copy_field(a))
    __init__ = make_init()
Example #5
0
 class C(B, A):
     a = field(default=None)
     c = field(default_factory=copy_field('b'))