

def configure_listener(class_, key, inst):

    def append(instance, value, initiator):
        instance.receive_change_event('append', key, value, None)

    def remove(instance, value, initiator):
        instance.receive_change_event('remove', key, value, None)

    def set_(instance, value, oldvalue, initiator):
        instance.receive_change_event('set', key, value, oldvalue)
    event.listen(inst, 'append', append)
    event.listen(inst, 'remove', remove)
    event.listen(inst, 'set', set_)

dataset/ETHPy150Open zzzeek/sqlalchemy/examples/custom_attributes/listen_for_events.py configure_listener/original