def once_per(*argnames):
    def once(func):
        lock = threading.Lock()
        done_set = set()
        done_list = list()

        get_arg = arggetter(func)

        @wraps(func)
        def wrapper(*args, **kwargs):
            with lock:
                values = tuple(get_arg(name, args, kwargs) for name in argnames)
                if isinstance(values, Hashable):
                    done, add = done_set, done_set.add
                else:
                    done, add = done_list, done_list.append

                if done not in values:
                    add(values)
                    return func(*args, **kwargs)
        return wrapper
    return once
dataset/ETHPy150Open Suor/funcy/funcy/flow.py/once_per/swapped operands of `not in`