U
    ´.¬bù  ã                   @   sZ   d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	m
Z
 G dd„ deƒZddd	„Zd
S )é    )Ú
xform_name)Úget_service_module_name)ÚBaseDocumenter)Úadd_resource_type_overviewÚ!get_identifier_args_for_signatureÚget_identifier_descriptionÚ!get_identifier_values_for_examplec                   @   s   e Zd Zdd„ ZdS )ÚSubResourceDocumenterc                 C   sp   t |dddd� t| jjjjdd„ d�}g }|| jd< |D ]0}| |j¡}| 	|j¡ t
|| j|| jd	� q:d S )
NzSub-resourcesz„Sub-resources are methods that create a new instance of a child resource. This resource's identifiers get passed along to the child.Zsubresources_intro)ÚsectionZresource_typeÚdescriptionZ
intro_linkc                 S   s   | j S )N)Úname)Úsub_resource© r   ú:/tmp/pip-unpacked-wheel-7h_bjh9e/boto3/docs/subresource.pyÚ<lambda>'   ó    z>SubResourceDocumenter.document_sub_resources.<locals>.<lambda>)Úkeyzsub-resources)r
   Úresource_nameÚsub_resource_modelÚservice_model)r   ÚsortedZ	_resourceÚmetaZresource_modelZsubresourcesÚ
member_mapÚadd_new_sectionr   ÚappendÚdocument_sub_resourceZ_resource_nameZ_service_model)Úselfr
   Zsub_resourcesZsub_resources_listr   Zsub_resource_sectionr   r   r   Údocument_sub_resources   s*    ø

þ
üz,SubResourceDocumenter.document_sub_resourcesN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r	      s   r	   Tc                 C   s„  g }|j jD ]}|jdkr| t|jƒ¡ q|rHt|ƒ}| j |j	|¡ |  
d¡}d|j j› d�}	| |	¡ |  
d¡}
t|ƒ}t|ƒ}|j|kr”|}d t|j jƒ||j	|¡}|
j ¡  |
 |¡ |
j ¡  |  
d¡}|D ]L}t|j	|ƒ}	| d|› d	�¡ |j ¡  | d
|› d|	› �¡ |j ¡  qÚ|  
d¡}|j ¡  | d t|ƒ|j j¡¡ |j ¡  | d|j j› d�¡ |j ¡  dS )aj  Documents a resource action

    :param section: The section to write to

    :param resource_name: The name of the resource

    :param sub_resource_model: The model of the subresource

    :param service_model: The model of the service

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    Úinputzmethod-introz
Creates a z
 resource.Úexamplez{} = {}.{}({})Úparamsz:type z: stringz:param z: Úreturnz:rtype: :py:class:`{}.{}`z:returns: A z	 resourceN)ÚresourceZidentifiersÚsourcer   r   Útargetr   ÚstyleZstart_sphinx_py_methodr   r   ÚtypeZinclude_doc_stringr   Zservice_nameÚformatZstart_codeblockÚwriteZend_codeblockr   Únew_liner   )r
   r   r   r   Zinclude_signatureZidentifiers_neededÚ
identifierZsignature_argsZmethod_intro_sectionr   Zexample_sectionZexample_valuesZexample_resource_namer"   Zparam_sectionZreturn_sectionr   r   r   r   6   sd    
 ÿ




ü



 ÿ


þÿ
ÿr   N)T)Zbotocorer   Zbotocore.utilsr   Zboto3.docs.baser   Zboto3.docs.utilsr   r   r   r   r	   r   r   r   r   r   Ú<module>   s   " û