U
    O8Úc¨  ã                   @   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-hml_76kf/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   sŒ   | j  ¡  |  d¡ | j  ¡  | j  ¡  |  |¡ | j  ¡  | j  ¡  |  |¡ | j  ¡  |d k	rˆ|  d| ¡ › d|› d¡ | j  ¡  d S )Nz.. rst-class:: admonition-titlezFor more information about z1 refer to the :ref:`Resources Introduction Guide<z>`.)ÚstyleÚnew_lineÚwriteÚlower)ÚsectionZresource_typeÚdescriptionZ
intro_linkr   r   r   Úadd_resource_type_overviewF   s    








ÿr/   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__[   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)r1   ÚcontextÚgetÚ_replace_documentationÚavailable_sectionsÚget_sectionÚ(replace_documentation_for_matching_shape)r5   Ú
event_namer-   ÚkwargsÚsection_nameZsub_sectionr   r   r   r>   c   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-paramrB   rC   zutf-8z:typez:type z: ú(z) -- )r   Zremove_all_sectionsZ
clear_textr+   r4   r<   Zdelete_sectionr=   r3   ÚgetvalueÚdecoder   r2   r)   Zitalics)r5   r?   r-   Zallowed_sectionsrA   Zdescription_sectionZtype_sectionr   r   r   r;   q   s4    ÿþÿþ


z,DocumentModifiedShape._replace_documentationN)Ú__name__Ú
__module__Ú__qualname__r7   r>   r;   r   r   r   r   r0   Z   s   r0   )N)
r   r   r   r   r   r%   r&   r(   r/   r0   r   r   r   r   Ú<module>   s    ÿ
