

def auto_decorate(decorator, predicate=(lambda name, value: isinstance(predicate, types.FunctionType))):

    def maybe_decorate(attribute, value):
        if predicate(attribute, value):
            value = decorator(value)
        return value

    class DecorateAll(type):

        def __setattr__(cls, attribute, value):
            return super(DecorateAll, cls).__setattr__(attribute, maybe_decorate(attribute, value))

        def __new__(cls, name, bases, attributes_dict):
            new_attributes_dict = dict(((attribute, maybe_decorate(attribute, value)) for (attribute, value) in attributes_dict.items()))
            return super(DecorateAll, cls).__new__(cls, name, bases, new_attributes_dict)
    return DecorateAll

dataset/ETHPy150Open kevin1024/vcrpy/vcr/util.py auto_decorate/VarMisuse@17/19 `value`->`predicate`