U
    d<  ã                   @   s\   d dl Z d dlZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zddd„ZG dd„ dƒZ	dS )é    Nc                 C   sT   g }| D ]F}t  |j¡}|j}|d r4|d d }q|d dkr| |d ¡ q|S )zÕHelper method to determine which parameters to ignore for actions

    :returns: A list of the parameter names that does not need to be
        included in a resource's method call for documentation purposes.
    Úchildrenr   ÚtypeÚfieldÚvalue)ÚjmespathÚcompileÚtargetÚparsedÚappend)ÚparamsZignore_paramsÚparamÚresultÚcurrent© r   ú4/tmp/pip-unpacked-wheel-vyj7p4na/boto3/docs/utils.pyÚget_resource_ignore_params   s    r   c                 C   s
   t  | ¡S ©N)ÚinspectÚ
isfunction)Zaction_handler   r   r   Úis_resource_action'   s    r   c                 C   sP   t  | ¡}i }|D ]8\}}| d¡s|d  ¡ s| d¡st|ƒr|||< q|S )NÚ_r   Z
wait_until)r   Ú
getmembersÚ
startswithÚisupperr   )Zresource_classZresource_class_membersZresource_methodsÚnameÚmemberr   r   r   Úget_resource_public_actions+   s    



r   c                 C   s   d  dd„ | D ƒ¡S )Nú,c                 S   s   g | ]}d |› d ‘qS )ú'r   )Ú.0Ú
identifierr   r   r   Ú
<listcomp>8   s     z5get_identifier_values_for_example.<locals>.<listcomp>©Újoin©Zidentifier_namesr   r   r   Ú!get_identifier_values_for_example7   s    r%   c                 C   s
   d  | ¡S )Nr   r"   r$   r   r   r   Ú!get_identifier_args_for_signature;   s    r&   c                 C   s   d| › d|› dS )NzThe z's z" identifier. This **must** be set.r   )Úresource_nameZidentifier_namer   r   r   Úget_identifier_description?   s    ÿr(   c                 C   sp   | j  ¡  | j  |¡ | j  ¡  | j  ¡  |  |¡ | j  ¡  |d k	rl|  d| ¡ › d|› d¡ | j  ¡  d S )NzFor more information about z1 refer to the :ref:`Resources Introduction Guide<z>`.)ÚstyleÚnew_lineÚh3ÚwriteÚlower)ÚsectionZresource_typeÚdescriptionZ
intro_linkr   r   r   Úadd_resource_type_overviewF   s    




ÿr0   c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚDocumentModifiedShapec                 C   s   || _ || _|| _|| _d S r   )Ú_shape_nameÚ	_new_typeÚ_new_descriptionÚ_new_example_value)ÚselfZ
shape_nameÚnew_typeZnew_descriptionZnew_example_valuer   r   r   Ú__init__X   s    zDocumentModifiedShape.__init__c                 K   sd   | j |j d¡kr|  ||¡ |jD ]:}| |¡}| j |j d¡krR|  ||¡ q$|  ||¡ q$d S )NÚshape)r2   ÚcontextÚgetÚ_replace_documentationÚavailable_sectionsÚget_sectionÚ(replace_documentation_for_matching_shape)r6   Ú
event_namer.   ÚkwargsÚsection_nameZsub_sectionr   r   r   r?   `   s    

 ÿz>DocumentModifiedShape.replace_documentation_for_matching_shapec                 C   sè   |  d¡s|  d¡r0| ¡  | ¡  | | j¡ |  d¡sD|  d¡räd}|jD ]}||krN| |¡ qN| d¡}| ¡  | | j¡ | d¡}| 	¡  
d¡  d	¡rÆ| ¡  | d
|j› d| j› ¡ n| ¡  |j d| j› d¡ d S )Nzdocs.request-examplezdocs.response-examplezdocs.request-paramszdocs.response-params)z
param-nameúparam-documentationzend-structureú
param-typez	end-paramrC   rD   zutf-8z:typez:type z: ú(z) -- )r   Zremove_all_sectionsZ
clear_textr,   r5   r=   Zdelete_sectionr>   r4   ÚgetvalueÚdecoder   r3   r)   Zitalics)r6   r@   r.   Zallowed_sectionsrB   Zdescription_sectionZtype_sectionr   r   r   r<   n   s4    ÿþÿþ


z,DocumentModifiedShape._replace_documentationN)Ú__name__Ú
__module__Ú__qualname__r8   r?   r<   r   r   r   r   r1   W   s   r1   )N)
r   r   r   r   r   r%   r&   r(   r0   r1   r   r   r   r   Ú<module>   s    ÿ
