Пример #1
0
class TestObject(object):
    
    inner = vproperty(instance=InnerObject)
    x = inner.x
    y = inner.y

    nix = vproperty(type=int, fdefault=lambda self: 0)
    niy = vproperty(type=int, fdefault=lambda self: 0)
Пример #2
0
 class Obj(object):
     p = vproperty()
     
     @p.getter
     def p(self):
         return self.__dict__.get('_q', 1)
     
     @p.setter
     def p(self, value):
         self.__dict__['_q'] = value
Пример #3
0
 class Obj2(object):
     p = vproperty()
     
     @p.type
     def ptype(self, value):
         return self.ty(value)
Пример #4
0
 class Obj(object):
     p = vproperty(type=int)
Пример #5
0
 class Obj(object):
     p = vproperty(instance=int)
Пример #6
0
class NotPicklable(object):
    p = vproperty()
Пример #7
0
 class Obj(object):
     p = vproperty()
Пример #8
0
 class Obj(object):
     p = vproperty()
     
     @p.default
     def p_default(self):
         return 12
Пример #9
0
 class Obj(object):
     p = vproperty(type=int)
     
     with self.assertRaises(ValueError):
         p.delegates_to('x')
Пример #10
0
class InnerObject(object):
    
    x = vproperty(fdefault=lambda self: 99)
    y = vproperty()
    nx = vproperty(type=int, fdefault=lambda self: 0)
Пример #11
0
 class Outer(object):
     def __init__(self, i): self.i = i
     i = vproperty(instance=Inner)
     y = i.ii
     nx = y.nx
     x = i.ii.x
Пример #12
0
 class Inner(object):
     def __init__(self, ii): self.ii = ii
     ii = vproperty(instance=InnerInner)
     nx = ii.nx
     x = ii.x
Пример #13
0
 class InnerInner(object):
     def __init__(self, x): self.x = x
     x = vproperty()
     nx = vproperty(fdefault=lambda self:0, type=int)