o
    .&ßa  ã                   @   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eƒZ	G dd„ deƒZ
G dd„ deƒ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   ú5/usr/lib/python3/dist-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   sl   | j  d¡}| j  dd¡}| d¡r|dd… }| d¡r#|dd… }|r4| ¡ | ¡ vr4|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 ({0}))Úmetadatar   Ú
startswithÚlowerÚformat)Ú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 t| ƒ | ||||||¡S ©N)Úsuperr*   Ú__new__)Úclsr+   r   r,   r"   r-   r.   ©Ú	__class__r   r   r1   W   s   
þzDocumentedShape.__new__)NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r1   Ú__classcell__r   r   r3   r   r*   U   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__e   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.
        zdocs.request-paramszis-requiredúparam-documentationz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_paramn   s    


ÿú

ýz0AutoPopulatedParam.document_auto_populated_paramr/   )r5   r6   r7   r=   rI   r   r   r   r   r:   d   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 )Nr?   )rO   rA   rN   rL   r@   rB   )r<   rE   rF   rG   r   r   r   Ú
hide_paramŸ   s   

ÿz"HideParamFromOperations.hide_paramN)r5   r6   r7   r8   r=   rV   r   r   r   r   rK   ƒ   s    rK   c                   @   rJ   )ÚAppendParamDocumentationz-Appends documentation to a specific parameterc                 C   s   || _ || _d S r/   )rL   Ú_doc_string)r<   rR   Ú
doc_stringr   r   r   r=   «   s   
z!AppendParamDocumentation.__init__c                 K   s6   | j |jv r| | j ¡}| d¡}| | j¡ d S d S )Nr>   )rL   r@   rA   rC   rX   rD   r   r   r   Úappend_documentation¯   s   ÿüz-AppendParamDocumentation.append_documentationN)r5   r6   r7   r8   r=   rZ   r   r   r   r   rW   ©   s    rW   z\nz\rz\tz\bz\f)Ú
úú	úúú|c                 C   s   t |  d¡ S )Nr   )Ú	_CONTROLSÚgroup)Úmatchr   r   r   Ú<lambda>Á   s    rd   c                 C   s   t  t| ¡S r/   )Ú_ESCAPE_CONTROLS_REÚsubÚ_CONTROLS_MATCH_HANDLER)Úvaluer   r   r   Úescape_controlsÄ   s   ri   )ÚreÚcollectionsr   r   r   r)   Ú_DocumentedShaper*   Úobjectr:   rK   rW   ra   ÚcompileÚjoinr   Úescapere   rg   ri   r   r   r   r   Ú<module>   s*   ÿ&û