U
    ´.¬b)  ã                   @   s~   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mZ G dd„ deƒZdd
d„Zddd„Zddd„ZdS )é    )Ú
xform_name)Úget_instance_public_methods)ÚDocumentedShape)ÚBaseDocumenter)Ú%document_model_driven_resource_method)Úadd_resource_type_overviewÚget_resource_ignore_paramsc                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚCollectionDocumenterc                 C   s\   | j jjj}g }t|dddd� || jd< |D ](}| |j¡}| |j¡ |  	||¡ q.d S )NZCollectionszUCollections provide an interface to iterate over and manipulate groups of resources. Zguide_collections)ÚsectionZresource_typeÚdescriptionZ
intro_linkÚcollections)
Ú	_resourceÚmetaZresource_modelr   r   Ú
member_mapÚadd_new_sectionÚnameÚappendÚ_document_collection)Úselfr
   r   Zcollections_listÚ
collectionZcollection_section© r   ú9/tmp/pip-unpacked-wheel-7h_bjh9e/boto3/docs/collection.pyÚdocument_collections   s    ù	
z)CollectionDocumenter.document_collectionsc              	   C   s´   t t| j|jƒƒ}t||ƒ i }|jD ]}|||j< q&t|ƒD ]p}| |¡}||kr„t|| j	| jj
jj
j|| || jj
jj
jd� q>t|| j	|| jj
jj
j|| jj
jj
jd� q>d S )N)r
   Úresource_nameÚevent_emitterÚbatch_action_modelÚcollection_modelÚservice_model)r
   r   Úaction_namer   r   r   )r   Úgetattrr   r   Údocument_collection_objectÚbatch_actionsÚsortedr   Údocument_batch_actionZ_resource_namer   ÚclientÚeventsr   Údocument_collection_method)r   r
   r   Úmethodsr!   Zbatch_actionÚmethodZmethod_sectionr   r   r   r   ,   s4    ÿ


ú	úz)CollectionDocumenter._document_collectionN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r	      s   r	   Tc                 C   sB   |r| j  |j¡ |  d|jj› d�¡ |  d|jj› d�¡ dS )a
  Documents a collection resource object

    :param section: The section to write to

    :param collection_model: The model of the collection

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    zA collection of z resources.zA z€ Collection will include all resources by default, and extreme caution should be taken when performing actions on all resources.N)ÚstyleZstart_sphinx_py_attrr   Zinclude_doc_stringÚresourceÚtype)r
   r   Úinclude_signaturer   r   r   r    K   s    ÿÿr    c                 C   s|   |  |jj¡}t|jjƒ}d}	|jr0t|jjƒ}	t|ƒ}
|j|krF|}
d 	|	|
|j
|j
¡}t| |j
|||j||||d�	 dS )ai  Documents a collection's batch action

    :param section: The section to write to

    :param resource_name: The name of the resource

    :param action_name: The name of collection action. Currently only
        can be all, filter, limit, or page_size

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

    :param batch_action_model: The model of the batch action

    :param collection_model: The model of the collection

    :param service_model: The model of the service

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    Úresponsez{} = {}.{}.{})	r
   Úmethod_nameÚoperation_modelr   Úmethod_descriptionÚexample_prefixÚexclude_inputÚresource_action_modelr/   N)r2   ÚrequestÚ	operationr   Úparamsr-   r   r.   Úservice_nameÚformatr   r   Údocumentation)r
   r   r   r   r   r   r/   r2   Zignore_paramsZexample_return_valueÚexample_resource_namer4   r   r   r   r#   c   s:    ÿÿ
ü÷r#   c              
   C   sD  |  |jj¡}g }|jr |jj}t|ƒ}	|j|kr6|}	d|jj› d�d 	t|jjƒ|	|j
¡|dœd|jj› d|jj› d�d 	t|jjƒ|	|j
¡t|jjƒdœd|jj› d�d	 	t|jjƒ|	|j
¡td
ddd�g|dœd|jj› d�d 	t|jjƒ|	|j
¡td
ddd�g|dœdœ}
||
k�r@|
| }tf | |||||dœ|—Ž dS )a#  Documents a collection method

    :param section: The section to write to

    :param resource_name: The name of the resource

    :param action_name: The name of collection action. Currently only
        can be all, filter, limit, or page_size

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

    :param collection_model: The model of the collection

    :param service_model: The model of the service

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    zCreates an iterable of all z resources in the collection.z{}_iterator = {}.{}.all)r3   r4   r5   zD resources in the collection filtered by kwargs passed to method. A z› collection will include all resources by default if no filters are provided, and extreme caution should be taken when performing actions on all resources.z{}_iterator = {}.{}.filterz0Creates an iterable up to a specified amount of z{}_iterator = {}.{}.limitÚcountÚintegerz5The limit to the number of resources in the iterable.)r   Ú	type_namer<   )r3   r4   Zinclude_inputr5   zs resources in the collection, but limits the number of items returned by each service call by the specified amount.z{}_iterator = {}.{}.page_sizez1The number of items returned by each service call)ÚallÚfilterÚlimitZ	page_size)r
   r1   r2   r   r6   r/   N)r2   r7   r8   Zinput_shapeÚmembersr   r:   r-   r.   r;   r   r   r9   r   r   )r
   r   r   r   r   r   r/   r2   Zunderlying_operation_membersr=   Zcustom_action_info_dictZaction_infor   r   r   r&   ¡   sˆ    ÿ

ýö
ýÿò
ýüÿ
ì
ýüÿ	ìËL
úùr&   N)T)T)T)Zbotocorer   Zbotocore.docs.methodr   Zbotocore.docs.utilsr   Zboto3.docs.baser   Zboto3.docs.methodr   Zboto3.docs.utilsr   r   r	   r    r#   r&   r   r   r   r   Ú<module>   s   3 ÿ
 ù
E ù