U
    b                     @   s|   d dl mZ erRd dlZejdkr0d dl mZ nd dlmZ G dd deddZnd d	l mZ eee	f ZG d
d dZ
dS )    )TYPE_CHECKINGN)      )	TypedDictc                   @   s&   e Zd ZU eed< eed< eed< dS )JSONTimeoutsimplicitpageLoadscriptN)__name__
__module____qualname__int__annotations__ r   r   F/tmp/pip-unpacked-wheel-3sqd7awy/selenium/webdriver/common/timeouts.pyr      s   
r   F)total)Dictc                   @   s   e Zd ZdeeeddddZeedddZejedd	d
dZeedddZejeddddZeedddZ	e	jeddddZ	ee
dddZedddZdS )Timeoutsr   N)implicit_wait	page_loadr	   returnc                 C   s(   |  || _|  || _|  || _dS )a  
        Create a new Timeout object.

        :Args:
         - implicit_wait - Either an int or a float. The number passed in needs to how many
            seconds the driver will wait.
         - page_load - Either an int or a float. The number passed in needs to how many
            seconds the driver will wait.
         - script - Either an int or a float. The number passed in needs to how many
            seconds the driver will wait.
        N)_convert_implicit_wait
_page_load_script)selfr   r   r	   r   r   r   __init__)   s    zTimeouts.__init__)r   c                 C   s
   | j d S )zj
        Return the value for the implicit wait. This does not return the value on the remote end
          )r   r   r   r   r   r   9   s    zTimeouts.implicit_wait)r   r   c                 C   s   |  || _dS )ze
        Sets the value for the implicit wait. This does not set the value on the remote end
        N)r   r   )r   r   r   r   r   r   @   s    c                 C   s
   | j d S )zk
        Return the value for the page load wait. This does not return the value on the remote end
        r   )r   r   r   r   r   r   G   s    zTimeouts.page_load)r   r   c                 C   s   |  || _dS )zf
        Sets the value for the page load wait. This does not set the value on the remote end
        N)r   r   )r   r   r   r   r   r   N   s    c                 C   s
   | j d S )zh
        Return the value for the script wait. This does not return the value on the remote end
        r   )r   r   r   r   r   r	   U   s    zTimeouts.script)r   r   c                 C   s   |  || _dS )zc
        Sets the value for the script wait. This does not set the value on the remote end
        N)r   r   )r   r   r   r   r   r	   \   s    )timeoutr   c                 C   s*   t |ttfrtt|d S tdd S )Nr   z&Timeouts can only be an int or a float)
isinstancer   float	TypeError)r   r   r   r   r   r   c   s    zTimeouts._convertc                 C   s8   i }| j r| j |d< | jr$| j|d< | jr4| j|d< |S )Nr   r   r	   )r   r   r   )r   Ztimeoutsr   r   r   _to_jsoni   s    


zTimeouts._to_json)r   r   r   )r
   r   r   r!   r   propertyr   setterr   r	   r   r   r   r#   r   r   r   r   r   '   s   r   )typingr   sysversion_infor   Ztyping_extensionsr   r   strr   r   r   r   r   r   <module>   s   
