o
    i                     @   sn   d dl Z 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
 d dlmZ G dd	 d	Z	
dddZdS )    N)
xform_name)OrderedDict)DocumentStructure)document_model_driven_method)DocumentedShape)get_service_module_namec                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
WaiterDocumenterc                 C   s6   || _ | j jj| _| j jjj| _|| _|| _	d| _
d S )NzRhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/clients.html#waiters)_client	__class____name___client_class_namemetaservice_modelZservice_name_service_name_service_waiter_model_root_docs_path_USER_GUIDE_LINK)selfclientservice_waiter_modelZroot_docs_path r   K/home/app/Keep/.python/lib/python3.10/site-packages/botocore/docs/waiter.py__init__   s   zWaiterDocumenter.__init__c                 C   s   |j d | | |j   |d |j   | jjD ]*}|j | j	 d|  t
|dd}| || tj| j| j	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/waiter/html)targetwaiterN)styleZh2_add_overviewnew_linewritelnZtoctreer   Zwaiter_namesZtocitemr   r   _add_single_waiterospathjoinr   Zwrite_to_file)r   sectionwaiter_nameZwaiter_doc_structureZwaiter_dir_pathr   r   r   document_waiters#   s    




z!WaiterDocumenter.document_waitersc                 C   s   | d}|j| jd| j  |d|  || | |}|jj| j d| d |j  |j	  |dt
| d |j  |j	  t||| jjj| jjj| jd d S )	NZ
breadcrumbz../../z / Waiter / z.Waiter.)
class_namezwaiter = client.get_waiter('z'))r$   r%   event_emitterr   r   )Zadd_new_sectionr   refr   r   writeZadd_title_sectionZstart_sphinx_py_classZstart_codeblockr   r   Zend_codeblockdocument_wait_methodr	   r   eventsr   r   )r   r$   r%   Zbreadcrumb_sectionZwaiter_sectionr   r   r   r    ;   s0   







z#WaiterDocumenter._add_single_waiterc                 C   s>   |j   |d |j jd| jd |d |j   d S )NzWaiters are available on a client instance via the ``get_waiter`` method. For more detailed instructions and examples on the usage or waiters, see the waiters z
user guide)titlelink.)r   r   r*   Zexternal_linkr   )r   r$   r   r   r   r   Y   s   

zWaiterDocumenter._add_overviewN)r   
__module____qualname__r   r&   r    r   r   r   r   r   r      s
    r   Tc                 C   s   | |}||j}t }tddd|j dd|d< tddd|j dd|d< tdd	d
|dg}	dt| dt|j d|j d|j d	}
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integerzD<p>The amount of time in seconds to wait between attempts. Default: z</p>)name	type_namedocumentationZMaxAttemptsz7<p>The maximum number of attempts to be made. Default: ZWaiterConfigZ	structurezI<p>A dictionary that provides parameters to control waiting behavior.</p>)r3   r4   r5   memberszPolls :py:meth:`z.Client.z` every zG seconds until a successful state is reached. An error is raised after z failed checks.waitzwaiter.waitF)r(   Zmethod_descriptionZexample_prefixZinclude_inputZdocument_outputinclude_signatureN)
Z
get_waiteroperation_modelZ	operationr   r   delayZmax_attemptsr   r   r   )r$   r%   r(   r   r   r8   Zwaiter_modelr9   Zwaiter_config_membersZbotocore_waiter_paramsZwait_descriptionr   r   r   r+   i   sV   

	


r+   )T)r!   Zbotocorer   Zbotocore.compatr   Zbotocore.docs.bcdoc.restdocr   Zbotocore.docs.methodr   Zbotocore.docs.utilsr   Zbotocore.utilsr   r   r+   r   r   r   r   <module>   s   X