U
    m/e<#                     @   sl   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 )
PaginatorDocumenterc                 C   s6   || _ | j jj| _| j jjj| _|| _|| _	d| _
d S )NzMhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/paginators.html)_client	__class____name___client_class_namemetaservice_modelZservice_name_service_name_service_paginator_model_root_docs_path_USER_GUIDE_LINK)selfclientZservice_paginator_modelZroot_docs_path r   ;/tmp/pip-unpacked-wheel-3gylhwtm/botocore/docs/paginator.py__init__   s    zPaginatorDocumenter.__init__c                 C   s   |j d | | |j   |d |j   t| jj}|D ]T}|j 	| j
 d|  t|dd}| || tj| j| j
d}||| qDdS )zhDocuments the various paginators for a service

        param section: The section to write to.
        Z
PaginatorszThe available paginators are:z/paginator/html)targetZ	paginatorN)styleh2_add_overviewnew_linewritelnZtoctreesortedr   Z_paginator_configZtocitemr   r   _add_paginatorospathjoinr   Zwrite_to_file)r   sectionZpaginator_namespaginator_nameZpaginator_doc_structureZpaginator_dir_pathr   r   r   document_paginators#   s4    



    z'PaginatorDocumenter.document_paginatorsc                 C   s   | d}|j| jd| j  |d|  || | |}|jj| j d| d |j  |j	  |dt
| d |j  |j	  | j|}t||| jjj| jjj|d d S )	NZ
breadcrumbz../../z / Paginator / z.Paginator.)
class_namez"paginator = client.get_paginator('z'))r$   r%   event_emitterr   paginator_config)Zadd_new_sectionr   refr   r   writeZadd_title_sectionZstart_sphinx_py_classZstart_codeblockr   r   Zend_codeblockr   Zget_paginatordocument_paginate_methodr	   r   eventsr   )r   r$   r%   Zbreadcrumb_sectionZpaginator_sectionr)   r   r   r   r    E   s8    
 






z"PaginatorDocumenter._add_paginatorc                 C   s>   |j   |d |j jd| jd |d |j   d S )NzPaginators are available on a client instance via the ``get_paginator`` method. For more detailed instructions and examples on the usage of paginators, see the paginators z
user guide)titlelink.)r   r   r+   Zexternal_linkr   )r   r$   r   r   r   r   i   s    

z!PaginatorDocumenter._add_overviewN)r   
__module____qualname__r   r&   r    r   r   r   r   r   r      s   "$r   Tc                 C   s   | |}t }tdddd|d< |ddr@tdddd|d< td	d
dd|d	< tddd|dg}tdd
ddg}	g }
t|d tr|
|d 7 }
n|
|d  |ddr|
|d  g }t|d tr||d 7 }n||d  dt|t	|}t
| d|||d||	|
||d dS )a  Documents the paginate method of a paginator

    :param section: The section to write to

    :param paginator_name: The name of the paginator. It is snake cased.

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

    :param service_model: The service model

    :param paginator_config: The paginator config associated to a particular
        paginator.

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    ZMaxItemsintegerz<p>The total number of items to return. If the total number of items available is more than the value specified in max-items then a <code>NextToken</code> will be provided in the output that you can use to resume pagination.</p>)name	type_namedocumentationZ	limit_keyNZPageSizez<p>The size of each page.<p>ZStartingTokenstringzq<p>A token to specify where to start paginating. This is the <code>NextToken</code> from a previous response.</p>ZPaginationConfigZ	structurezC<p>A dictionary that provides parameters to control pagination.</p>)r4   r5   r6   membersZ	NextTokenz$<p>A token to resume pagination.</p>Zinput_tokenZoutput_tokenzVCreates an iterator that will paginate through responses from :py:meth:`{}.Client.{}`.Zpaginatez&response_iterator = paginator.paginate)r(   Zmethod_descriptionZexample_prefixZinclude_inputZinclude_outputZexclude_inputZexclude_outputinclude_signature)operation_modelr   r   get
isinstancelistappendformatr   r   r   )r$   r%   r(   r   r)   r9   r:   Zpagination_config_membersZbotocore_pagination_paramsZ#botocore_pagination_response_paramsZservice_pagination_paramsZ"service_pagination_response_paramsZpaginate_descriptionr   r   r   r,   y   sz    



 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   h 