from threading import Condition


class NoWaitCondition(Condition):
    def __init__(self, clock):
        self.clock = clock

        super().__init__()

    def wait(self, timeout=None):
        if timeout is not None and self.clock is not None and hasattr(self.clock, "sleep_for"):
            self.clock.sleep_for(seconds=timeout)
            return

        super().wait(timeout=timeout)
