U
    EZh~                     @   sV   d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	 d dl
mZ G dd dZdS )	    )DocumentStructure)ClientContextParamsDocumenterClientDocumenterClientExceptionsDocumenter)PaginatorDocumenter)WaiterDocumenter)DataNotFoundErrorc                   @   s^   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dddZdd ZdS )ServiceDocumenterc                 C   sJ   || _ || _|| _| j j|dddd| _| jjj| _ddddd	d
g| _d S )Nz	us-east-1Zfoobar)Zregion_nameZaws_access_key_idZaws_secret_access_keytitle
client-apiclient-exceptionspaginator-api
waiter-apiclient-context-params)	_session_service_name_root_docs_pathZcreate_client_clientmetaevents_event_emittersections)selfservice_namesessionZroot_docs_path r   \/home/aprabhat/apps/x.techxrdev.in/venv/lib/python3.8/site-packages/botocore/docs/service.py__init__   s"    zServiceDocumenter.__init__c                 C   s~   t | j| jdd}| |d | |d | |d | |d | |d |d}| 	| |
 S )	ziDocuments an entire service.

        :returns: The reStructured text of the documented service.
        html)Zsection_namestargetr   r   r   r   r   r   )r   r   r   r   Zget_section
client_apiclient_exceptionspaginator_api
waiter_apiclient_context_paramsZflush_structure)r   Zdoc_structureZcontext_params_sectionr   r   r   document_service/   s      
z"ServiceDocumenter.document_servicec                 C   s.   |j | jjj | jjd| j |d d S )Nzdocs.title.)section)styleZh1r   	__class____name__r   emitr   r   r'   r   r   r   r   B   s
    
 zServiceDocumenter.titlec                 C   s   |j jddd d S )NzTable of Contents   )r   depth)r(   table_of_contentsr,   r   r   r   r/   H   s    z#ServiceDocumenter.table_of_contentsc                 C   sD   d }z|  | j}W n tk
r(   Y nX t| j| j|| d S N)get_examplesr   r   r   r   r   Zdocument_client)r   r'   examplesr   r   r   r!   K   s      zServiceDocumenter.client_apic                 C   s   t | j| j| d S r0   )r   r   r   Zdocument_exceptionsr,   r   r   r   r"   V   s     z#ServiceDocumenter.client_exceptionsc                 C   sN   z| j | j}W n tk
r(   Y d S X |jrJt| j|| j}|| d S r0   )	r   Zget_paginator_modelr   r   Z_paginator_configr   r   r   Zdocument_paginators)r   r'   Zservice_paginator_modelZpaginator_documenterr   r   r   r#   [   s      zServiceDocumenter.paginator_apic                 C   s4   | j jr0| j| j}t| j || j}|| d S r0   )r   Zwaiter_namesr   Zget_waiter_modelr   r   r   Zdocument_waiters)r   r'   Zservice_waiter_modelZwaiter_documenterr   r   r   r$   h   s      zServiceDocumenter.waiter_apiNc                 C   s"   | j d}||d|}|d S )NZdata_loaderz
examples-1r2   )r   Zget_componentZload_service_model)r   r   api_versionloaderr2   r   r   r   r1   r   s      zServiceDocumenter.get_examplesc                    sT   t j}|| jg  | jjj}|j} fdd|D }|rPt | j|}|| d S )Nc                    s   g | ]}|j  kr|qS r   )name).0pZparams_to_omitr   r   
<listcomp>~   s    
 z;ServiceDocumenter.client_context_params.<locals>.<listcomp>)	r   ZOMITTED_CONTEXT_PARAMSgetr   r   r   service_modelZclient_context_parametersZdocument_context_params)r   r'   Zomitted_paramsr;   Zraw_context_paramsZcontext_paramsZcontext_param_documenterr   r8   r   r%   y   s    

 z'ServiceDocumenter.client_context_params)N)r*   
__module____qualname__r   r&   r   r/   r!   r"   r#   r$   r1   r%   r   r   r   r   r	      s   

r	   N)Zbotocore.docs.bcdoc.restdocr   Zbotocore.docs.clientr   r   r   Zbotocore.docs.paginatorr   Zbotocore.docs.waiterr   Zbotocore.exceptionsr   r	   r   r   r   r   <module>   s
   