U
    N8c                     @   sX   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 G dd dZ
dd	d
ZdS )    )
xform_name)OrderedDict)document_model_driven_method)DocumentedShape)get_service_module_namec                   @   s$   e Zd Zdd Zdd Zdd ZdS )WaiterDocumenterc                 C   s   || _ | j jjj| _|| _d S )N)_clientmetaservice_modelZservice_nameZ_service_name_service_waiter_model)selfclientservice_waiter_model r   8/tmp/pip-unpacked-wheel-ozje0y8b/botocore/docs/waiter.py__init__   s    zWaiterDocumenter.__init__c                 C   s^   |j d |j   |d | jjD ]0}|j d| jjj	 d| d | 
|| q(dS )zgDocuments the various waiters for a service.

        :param section: The section to write to.
        ZWaiterszThe available waiters are:z:py:class:`.Waiter.`N)styleh2new_linewritelnr   Zwaiter_nameslir   	__class____name___add_single_waiterr   sectionwaiter_namer   r   r   document_waiters   s    

z!WaiterDocumenter.document_waitersc                 C   s   | |}|jj| jjj d| d |j  |j  |dt	|  |j
  |j  t||| jjj| jjj| jd d S )Nr   )
class_namez waiter = client.get_waiter('%s'))r   r   event_emitterr
   r   )Zadd_new_sectionr   Zstart_sphinx_py_classr   r   r   Zstart_codeblockr   writer   Zend_codeblockdocument_wait_methodr	   eventsr
   r   r   r   r   r   r   (   s$    





z#WaiterDocumenter._add_single_waiterN)r   
__module____qualname__r   r   r   r   r   r   r   r      s   r   Tc                 C   s   | |}||j}t }tddd|jd|d< tddd|jd|d< tddd	|d
g}	dt|t	|j|j|j}
t
| d|||
d|	d|d	 dS )a  Documents a the wait method of a waiter

    :param section: The section to write to

    :param waiter_name: The name of the waiter

    :param event_emitter: The event emitter to use to emit events

    :param service_model: The service model

    :param service_waiter_model: The waiter model associated to the service

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    ZDelayintegerzJ<p>The amount of time in seconds to wait between attempts. Default: {}</p>)name	type_namedocumentationZMaxAttemptsz=<p>The maximum number of attempts to be made. Default: {}</p>ZWaiterConfigZ	structurezI<p>A dictionary that provides parameters to control waiting behavior.</p>)r(   r)   r*   memberszPolls :py:meth:`{}.Client.{}` every {} seconds until a successful state is reached. An error is returned after {} failed checks.waitzwaiter.waitF)r!   Zmethod_descriptionZexample_prefixZinclude_inputZdocument_outputinclude_signatureN)Z
get_waiteroperation_modelZ	operationr   r   formatdelayZmax_attemptsr   r   r   )r   r   r!   r
   r   r-   Zwaiter_modelr.   Zwaiter_config_membersZbotocore_waiter_paramsZwait_descriptionr   r   r   r#   A   sT    

	

r#   N)T)Zbotocorer   Zbotocore.compatr   Zbotocore.docs.methodr   Zbotocore.docs.utilsr   Zbotocore.utilsr   r   r#   r   r   r   r   <module>   s   3 