o
    :_Wc|                     @   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
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 )zGet 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   5D:\Flask\env\Lib\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 )zGet the Python default value for a given model type.

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

    :rtype: string
    z123.0Z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
    ZserviceFullNameZserviceAbbreviation ZAmazon   NZAWS   z ())metadatar   
startswithlower)Zservice_modelZofficial_nameZ
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   r)   `   s   	zDocumentedShape.__new__)NNN)__name__
__module____qualname____doc__r)   __classcell__r   r   r+   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#   r3   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 )zDocuments 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writelnr3   r4   
event_namesectionkwargsZdescription_sectionr   r   r   document_auto_populated_param   s    




z0AutoPopulatedParam.document_auto_populated_paramr'   )r-   r.   r/   r5   r@   r   r   r   r   r2   z   s    

r2   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)r4   Zservice_nameparameter_nameZoperation_namesZparam_templateZexample_templater#   r   r   r   r5      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 )Nr7   )rF   r9   rE   rC   r8   r:   )r4   r=   r>   r?   r   r   r   
hide_param   s   

z"HideParamFromOperations.hide_paramN)r-   r.   r/   r0   r5   rI   r   r   r   r   rB      s    rB   c                   @   rA   )AppendParamDocumentationz-Appends documentation to a specific parameterc                 C   s   || _ || _d S r'   )rC   _doc_string)r4   rH   Z
doc_stringr   r   r   r5      s   
z!AppendParamDocumentation.__init__c                 K   s6   | j |jv r|| j }|d}|| j d S d S )Nr6   )rC   r8   r9   r;   rK   r<   r   r   r   append_documentation   s
   
z-AppendParamDocumentation.append_documentationN)r-   r.   r/   r0   r5   rL   r   r   r   r   rJ      s    rJ   z\nz\rz\tz\bz\f)
	|c                 C   s   t | d S )Nr   )	_CONTROLSgroup)matchr   r   r   <lambda>   s    rV   c                 C   s   t t| S r'   )_ESCAPE_CONTROLS_REsub_CONTROLS_MATCH_HANDLER)valuer   r   r   escape_controls   s   r[   )recollectionsr   r   r   r!   Z_DocumentedShaper"   r2   rB   rJ   rS   compilejoinr   escaperW   rY   r[   r   r   r   r   <module>   s,   !'