o
    Vf                     @   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   T/home/ubuntu/oakencloud.com/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 )zGet 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 )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writelnr;   r<   
event_namesectionkwargsdescription_sectionr   r   r   document_auto_populated_param   s    




z0AutoPopulatedParam.document_auto_populated_paramr/   )r5   r6   r7   r=   rI   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 )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   _CONTROLS_MATCH_HANDLER   s   rd   c                 C   s   t t| S r/   )_ESCAPE_CONTROLS_REsubrd   )valuer   r   r   escape_controls   s   rh   )recollectionsr   r   r   r)   _DocumentedShaper*   r:   rK   rW   ra   compilejoinr   escapere   rd   rh   r   r   r   r   <module>   s,   !'