(cls)
return cls
Class decorator that adds a ForeignValue-compatible __init__ method

    Use this on classes with `ForeignValue` attributes that want to
    accept values for those attributes passed to their constructor.
Class decorator that adds a ForeignValue-compatible __init__ method
Class decorator that adds a ForeignValue - compatible __init__ method
def foreign_value_init(cls):
    """Class decorator that adds a ForeignValue-compatible __init__ method

    Use this on classes with `ForeignValue` attributes that want to
    accept values for those attributes passed to their constructor.
    """
    def __init__(self, *args, **kw):
        values = {n: kw.pop(n) for n in names if n in kw}
        super_init(self, *args, **kw)
        for name, value in values.items():
            setattr(self, name, value)

    names = ForeignValue.get_names(cls)
    super_init = cls.__init__
    cls.__init__ = __init__
    return cls
def foreign_value_init ( cls ) : def __init__ ( self , * args , * * kw ) : values = { n : kw . pop ( n ) for n in names if n in kw } super_init ( self , * args , * * kw ) for name , value in values . items ( ) : setattr ( self , name , value ) names = ForeignValue . get_names ( cls ) super_init = cls . __init__ cls . __init__ = __init__ return cls