def _recursive_repr()

in chz/data_model.py [0:0]


def _recursive_repr(user_function):
    import threading

    repr_running = set()

    @functools.wraps(user_function)
    def wrapper(self):
        key = id(self), threading.get_ident()
        if key in repr_running:
            return "..."
        repr_running.add(key)
        try:
            result = user_function(self)
        finally:
            repr_running.discard(key)
        return result

    return wrapper