def apply_style_declarations(declarations, box, render_device):
    for declaration in declarations:
        if declaration.property in _properties:
            attr, inheritable, multivalue, parse_func = \
                _properties[declaration.property]
            if not multivalue:
                if len(declaration.values) != 1:
                    continue
                value = declaration.values[0]
            else:
                value = declaration.values

            if (inheritable and 
                isinstance(value, Ident) and
                value == 'inherit' and
                box.parent):
                if type(attr) in (list, tuple):
                    for a in attr:
                        setattr(box, a, getattr(box.parent, a))
                else:
                    setattr(box, attr, getattr(box.parent, attr))
            else:
                try:
                    value = parse_func(value, render_device)
                    if type(attr) in (list, tuple):
                        for a, v in zip(attr, value):
                            setattr(box, a, v)
                    else:
                        setattr(box, attr, value)
                except ValidationException:
                    warnings.warn(
                        'CSS validation error in %s' % declaration.property)
Apply the given list of declarations to the given box.
dataset/ETHPy150Open ardekantur/pyglet/contrib/layout/layout/properties.py/apply_style_declarations