o
    è’Oj�(  ã                   @   s¾   d dl Z d dlmZ dd„ Zdd„ Zdd„ Zed	g d
¢ƒZG dd	„ d	eƒZG dd„ dƒZG dd„ dƒZ	G dd„ dƒZ
G dd„ dƒZddddddœZe  d ee jeƒ¡¡Zdd„ Zdd„ ZdS )é    N)Ú
namedtuplec                 C   s   ddddddddœ  | | ¡S )z¯Get the Python type name for a given model type.

        >>> py_type_name('list')
        'list'
        >>> py_type_name('structure')
        'dict'

    :rtype: string
    ÚbytesÚstringÚfloatÚintegerÚdictÚdatetime)ÚblobÚ	characterÚdoubleÚlongÚmapÚ	structureÚ	timestamp©Úget©Ú	type_name© r   úY/var/www/html/pharmsmart-cdr-gen/venv/lib/python3.10/site-packages/botocore/docs/utils.pyÚpy_type_name   s   ùør   c                 C   s"   ddddddddddd	œ
  | d
¡S )záGet the Python default value for a given model type.

        >>> py_default('string')
        ''string''
        >>> py_default('list')
        '[...]'
        >>> py_default('unknown')
        '...'

    :rtype: string
    z123.0Ú123z'string'zb'bytes'z
True|Falsez[...]z{...}zdatetime(2015, 1, 1))
r   r   r   r   r	   ÚbooleanÚlistr   r   r   z...r   r   r   r   r   Ú
py_default&   s   öõr   c                 C   sn   | j  d¡}| j  dd¡}| d¡r|dd… }| d¡r#|dd… }|r5| ¡ | ¡ vr5|d	|› d
�7 }|S )zwGenerate the official name of an AWS Service

    :param service_model: The service model representing the service
    ÚserviceFullNameÚserviceAbbreviationÚ ÚAmazoné   NÚAWSé   z (ú))Úmetadatar   Ú
startswithÚlower)Úservice_modelÚofficial_nameÚ
short_namer   r   r   Úget_official_service_name@   s   

r)   ÚDocumentedShape)Únamer   Údocumentationr#   ÚmembersÚrequired_membersc                       s(   e Zd ZdZ			d‡ fdd„	Z‡  ZS )r*   zBUse this class to inject new shapes into a model for documentationNc              	      s<   |d u rg }|d u rg }|d u rg }t ƒ  | ||||||¡S ©N)ÚsuperÚ__new__)Úclsr+   r   r,   r#   r-   r.   ©Ú	__class__r   r   r1   `   s   	ùzDocumentedShape.__new__)NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r1   Ú__classcell__r   r   r3   r   r*   ]   s    ùc                   @   s   e Zd Zddd„Zdd„ ZdS )ÚAutoPopulatedParamNc                 C   s"   || _ || _|d u rd| _d S d S )Nz{Please note that this parameter is automatically populated if it is not provided. Including this parameter is not required
)r+   Úparam_description)Úselfr+   r;   r   r   r   Ú__init__{   s   ÿÿzAutoPopulatedParam.__init__c                 K   sŒ   |  d¡r*| j|jv r(| | j¡}d|jv r| d¡ | d¡}| | j¡ dS dS |  d¡rB| d¡}| j|jv rD| | j¡ dS dS dS )zïDocuments auto populated parameters

        It will remove any required marks for the parameter, remove the
        parameter from the example, and add a snippet about the parameter
        being autopopulated in the description.
        údocs.request-paramszis-requiredúparam-documentationúdocs.request-exampleústructure-valueN)r$   r+   Úavailable_sectionsÚget_sectionÚdelete_sectionÚwritelnr;   ©r<   Ú
event_nameÚsectionÚkwargsÚdescription_sectionr   r   r   Údocument_auto_populated_param…   s    


ÿù

ýz0AutoPopulatedParam.document_auto_populated_paramr/   )r5   r6   r7   r=   rK   r   r   r   r   r:   z   s    

r:   c                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )ÚHideParamFromOperationsa>  Hides a single parameter from multiple operations.

    This method will remove a parameter from documentation and from
    examples. This method is typically used for things that are
    automatically populated because a user would be unable to provide
    a value (e.g., a checksum of a serialized XML request body).c                 C   sT   || _ tƒ | _tƒ | _d}d}|D ]}| j |||f ¡ | j |||f ¡ qdS )a(  
        :type service_name: str
        :param service_name: Name of the service to modify.

        :type parameter_name: str
        :param parameter_name: Name of the parameter to modify.

        :type operation_names: list
        :param operation_names: Operation names to modify.
        z*docs.request-params.%s.%s.complete-sectionz+docs.request-example.%s.%s.complete-sectionN)Ú_parameter_nameÚsetÚ_params_eventsÚ_example_eventsÚadd)r<   Úservice_nameÚparameter_nameÚoperation_namesÚparam_templateÚexample_templater+   r   r   r   r=   £   s   þz HideParamFromOperations.__init__c                 K   sD   || j v r| d¡}n|| jvrd S | j|jv r | | j¡ d S d S )NrA   )rQ   rC   rP   rN   rB   rD   )r<   rG   rH   rI   r   r   r   Ú
hide_param¸   s   

ÿz"HideParamFromOperations.hide_paramN)r5   r6   r7   r8   r=   rX   r   r   r   r   rM   ›   s    rM   c                   @   rL   )ÚAppendParamDocumentationz-Appends documentation to a specific parameterc                 C   s   || _ || _d S r/   )rN   Ú_doc_string)r<   rT   Ú
doc_stringr   r   r   r=   Å   s   
z!AppendParamDocumentation.__init__c                 K   s6   | j |jv r| | j ¡}| d¡}| | j¡ d S d S )Nr?   )rN   rB   rC   rE   rZ   rF   r   r   r   Úappend_documentationÉ   s
   
ýz-AppendParamDocumentation.append_documentationN)r5   r6   r7   r8   r=   r\   r   r   r   r   rY   Â   s    rY   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚDocumentModifiedShapea2  Modifies the documentation for a shape to reflect runtime transformations.

    This is used when a handler transforms a shape's value at runtime
    (e.g., decoding a JSON string into a dict) and the documentation
    needs to reflect the actual Python type returned rather than the
    modeled type.
    c                 C   s   || _ || _|| _|| _d S r/   )Ú_shape_nameÚ	_new_typeÚ_new_descriptionÚ_new_example_value)r<   Ú
shape_nameÚnew_typeÚnew_descriptionÚnew_example_valuer   r   r   r=   Ù   s   
zDocumentModifiedShape.__init__c                 K   sd   | j |j d¡kr|  ||¡ |jD ]}| |¡}| j |j d¡kr)|  ||¡ q|  ||¡ qd S )NÚshape)r^   Úcontextr   Ú_replace_documentationrB   rC   Ú(replace_documentation_for_matching_shape)r<   rG   rH   rI   Úsection_nameÚsub_sectionr   r   r   ri   å   s   

ÿûz>DocumentModifiedShape.replace_documentation_for_matching_shapec                 C   s  |  d¡s
|  d¡r| ¡  | ¡  | | j¡ |  d¡s"|  d¡r„d}|jD ]}||vr2| |¡ q'| jd urLd|jv rL| d¡}| ¡  | | j¡ | d¡}| 	¡  
d¡  d	¡rn| ¡  | d
|j› d| j› �¡ d S | ¡  |j d| j› d�¡ | d¡ d S d S )Nr@   zdocs.response-exampler>   zdocs.response-params)z
param-namer?   zend-structureú
param-typez	end-paramr?   rl   zutf-8z:typez:type z: ú(z) --ú )r$   Úremove_all_sectionsÚ
clear_textÚwritera   rB   rD   r`   rC   ÚgetvalueÚdecoder+   r_   ÚstyleÚitalics)r<   rG   rH   Úallowed_sectionsrj   rJ   Útype_sectionr   r   r   rh   ó   sF   ÿþÿþ

€ÿþÿ
Ýz,DocumentModifiedShape._replace_documentationN)r5   r6   r7   r8   r=   ri   rh   r   r   r   r   r]   Ð   s
    r]   z\nz\rz\tz\bz\f)Ú
úú	úúú|c                 C   s   t |  d¡ S )Nr   )Ú	_CONTROLSÚgroup)Úmatchr   r   r   Ú_CONTROLS_MATCH_HANDLER-  s   r�   c                 C   s   t  t| ¡S r/   )Ú_ESCAPE_CONTROLS_REÚsubr�   )Úvaluer   r   r   Úescape_controls1  s   r…   )ÚreÚcollectionsr   r   r   r)   Ú_DocumentedShaper*   r:   rM   rY   r]   r~   ÚcompileÚjoinr   Úescaper‚   r�   r…   r   r   r   r   Ú<module>   s.   þ!'Rû