# Path: wtframework/wtf/config.py
# WTF_TIMEOUT_MANAGER = TimeOutManager()


from datetime import datetime, timedelta
from six import u
from wtframework.wtf.config import WTF_TIMEOUT_MANAGER
import time

    Args:
        condition (lambda) - Lambda expression to wait for to evaluate to True.

    Kwargs:
        timeout (number) : Maximum number of seconds to wait.
        sleep (number) : Sleep time to wait between iterations.

    Example::

        wait_and_ignore(lambda: driver.find_element_by_id("success").is_displayed(), 
                       timeout=30,
                       sleep=0.5)

    is equivalent to::

        end_time = datetime.now() + timedelta(seconds=30)
        while datetime.now() < end_time:
            try:
                if driver.find_element_by_id("success").is_displayed():
                    break;
            except:
                pass
            time.sleep(0.5)
    '''
    try:
        return wait_until(condition, timeout, sleep)
    except:
        pass


# Path: wtframework/wtf/config.py
# WTF_TIMEOUT_MANAGER = TimeOutManager()


# Path: wtframework/wtf/utils/wait_utils.py
from datetime import datetime, timedelta
from six import u
from wtframework.wtf.config import WTF_TIMEOUT_MANAGER
import time


    Args:
        condition (lambda) - Lambda expression to wait for to evaluate to True.

    Kwargs:
        timeout (number) : Maximum number of seconds to wait.
        sleep (number) : Sleep time to wait between iterations.

    Example::

        wait_and_ignore(lambda: driver.find_element_by_id("success").is_displayed(), 
                       timeout=30,
                       sleep=0.5)

    is equivalent to::

        end_time = datetime.now() + timedelta(seconds=30)
        while datetime.now() < end_time:
            try:
                if driver.find_element_by_id("success").is_displayed():
                    break;
            except:
                pass
            time.sleep(0.5)
    '''
    try:
        return wait_until(condition, timeout, sleep)
    except:
        pass


def wait_until(condition, timeout=WTF_TIMEOUT_MANAGER.NORMAL, sleep=0.5, pass_exceptions=False, message=None):