HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/722141/root/lib/python3.6/site-packages/botocore/docs/__pycache__/client.cpython-36.pyc
3

�T_[-�@s�ddlZddlmZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZdd	lm
Z
dd
lmZGdd�de�ZGd
d�de�ZdS)�N)�get_official_service_name)�document_custom_method)�document_model_driven_method)�get_instance_public_methods)�document_shared_examples)�ResponseExampleDocumenter)�ResponseParamsDocumenter)�DocumentedShape)�OrderedDictc@sneZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�ClientDocumenterNcCs.||_||_|jdkri|_|jjjj|_dS)N)�_client�_shared_examples�meta�
service_model�service_name�
_service_name)�self�client�shared_examples�r�/usr/lib/python3.6/client.py�__init__s

zClientDocumenter.__init__cCs:|j|�|j|�t|j�}|j||�|j||�dS)z]Documents a client and its methods

        :param section: The section to write to.
        N)�
_add_title�_add_class_signaturerr�_add_client_intro�_add_client_methods)r�section�client_methodsrrr�document_client"s



z ClientDocumenter.document_clientcCs|jjd�dS)NZClient)�style�h2)rrrrrr-szClientDocumenter._add_titlecCs�|jd�}t|jjj�}|jd|�|j|�|jj�|jd�|jj�|jj	j
}x$t|�D]}|jjd||f�qbWdS)NZintroz"A low-level client representing %sz These are the available methods:z:py:meth:`~%s.Client.%s`)
�add_new_sectionrrrr�write�_add_client_creation_exampler�new_line�	__class__�__name__�sorted�li)rrrZofficial_service_name�
class_name�method_namerrrr0s






z"ClientDocumenter._add_client_introcCs|jjd|jjjd�dS)Nz	%s.Client)r))r�start_sphinx_py_classrr%r&)rrrrrrDsz%ClientDocumenter._add_class_signaturecCs6|jj�|jj�|jdj|jd��|jj�dS)Nz+client = session.create_client('{service}'))Zservice)r�start_codeblockr$r"�formatr�
end_codeblock)rrrrrr#Hs

z-ClientDocumenter._add_client_creation_examplecCs2|jd�}x"t|�D]}|j||||�qWdS)N�methods)r!r'�_add_client_method)rrrr*rrrrQs
z$ClientDocumenter._add_client_methodscCs4|j|�}|j|�r$|j|||�n|j||�dS)N)r!�_is_custom_method�_add_custom_method�_add_model_driven_method)rrr*�methodrrrr0Ws

z#ClientDocumenter._add_client_methodcCs||jjjkS)N)rr�method_to_api_mapping)rr*rrrr1^sz"ClientDocumenter._is_custom_methodcCst|||�dS)N)r)rrr*r4rrrr2asz#ClientDocumenter._add_custom_methodcCsf|jd�}|jj�|jjd�|jj�|jjj}x,|jD]"}d||jf}|jj	d|�q<WdS)N�
exceptionsZ
Exceptionsz%s.Client.exceptions.%sz:py:class:`%s`)
r!rr$�boldrr%r&�error_shapes�namer()rr�operation_modelZ
error_sectionZclient_name�errorr)rrr�_add_method_exceptions_listds



z,ClientDocumenter._add_method_exceptions_listcCsz|jjj}|jjj|}|j|�}d|}t||||jjj|j|d�|jrX|j	||�|j
j|�}|rvt||||�dS)Nzresponse = client.%s)�
event_emitterZmethod_description�example_prefix)
rrrr5r:r�events�
documentationr8r<r
�getr)rrr*r�operation_namer:r>rrrrr3ns

z)ClientDocumenter._add_model_driven_method)N)r&�
__module__�__qualname__rrrrrr#rr0r1r2r<r3rrrrrs
	
rc@s�eZdZdZedddededddd�fd	ed	dd
d�fg�d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(S))�ClientExceptionsDocumenterzQhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.html�ErrorZ	structurez1Normalized access to common exception attributes.ZCode�stringz,An identifier specifying the exception type.)r9�	type_namer@ZMessagez;A descriptive message explaining why the exception occured.)r9rHr@�memberscCs||_|jjjj|_dS)N)rrrrr)rrrrrr�sz#ClientExceptionsDocumenter.__init__cCs,|j|�|j|�|j|�|j|�dS)N)r�
_add_overview�_add_exceptions_list�_add_exception_classes)rrrrr�document_exceptions�s


z.ClientExceptionsDocumenter.document_exceptionscCs|jjd�dS)NzClient Exceptions)rr )rrrrrr�sz%ClientExceptionsDocumenter._add_titlecCs>|jj�|jd�|jjd|jd�|jd�|jj�dS)Nz�Client exceptions are available on a client instance via the ``exceptions`` property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling z
user guide)�title�link�.)rr$r"Z
external_link�_USER_GUIDE_LINK)rrrrrrJ�s


z(ClientExceptionsDocumenter._add_overviewcCs|jjj}d||jfS)Nz%s.Client.exceptions.%s)rr%r&r9)r�shapeZcls_namerrr�_exception_class_name�s
z0ClientExceptionsDocumenter._exception_class_namecCs||jjjj}|s2|jj�|jd�|jj�dS|jj�|jd�|jj�x&|D]}|j|�}|jjd|�qVWdS)Nz-This client has no modeled exception classes.z$The available client exceptions are:z:py:class:`%s`)	rrrr8rr$r"rSr()rrr8rRr)rrrrK�s







z/ClientExceptionsDocumenter._add_exceptions_listcCs&x |jjjjD]}|j||�qWdS)N)rrrr8�_add_exception_class)rrrRrrrrL�sz1ClientExceptionsDocumenter._add_exception_classescCsV|j|j�}|j|�}|jj|d�|j||�|j||�|j||�|jj�dS)N)r))	r!r9rSrr+�_add_top_level_documentation�_add_exception_catch_example�_add_response_attrZend_sphinx_py_class)rrrRZ
class_sectionr)rrrrT�s
z/ClientExceptionsDocumenter._add_exception_classcCs*|jr&|jj�|j|j�|jj�dS)N)r@rr$�include_doc_string)rrrRrrrrU�s
z7ClientExceptionsDocumenter._add_top_level_documentationcCs�|jj�|jjd�|jj�|jd�|jj�|jj�|jd�|jj�|jj�|jd|j�|jj�|jj�|jd�|jj�|jj�dS)NZExampleztry:z...z!except client.exceptions.%s as e:zprint(e.response))	rr$r7r,r"�indent�dedentr9r.)rrrRrrrrV�s











z7ClientExceptionsDocumenter._add_exception_catch_examplecCsF|jd�}|jjd�|j|�|j||�|j||�|jj�dS)NZresponse)r!rZstart_sphinx_py_attr�_add_response_attr_description�_add_response_example�_add_response_paramsZend_sphinx_py_attr)rrrRZresponse_sectionrrrrW�s

z-ClientExceptionsDocumenter._add_response_attrcCs"|jj�|jd�|jj�dS)Nz�The parsed error response. All exceptions have a top level ``Error`` key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.)rr$rX)rrrrrr[�s
z9ClientExceptionsDocumenter._add_response_attr_descriptioncCsX|jd�}|jj�|jjd�|jj�t|jd|jjj	d�}|j
|||jgd�dS)NZsyntaxZSyntax)rrBr=)�include)r!rr$r7�
new_paragraphrrrrr?Zdocument_example�_GENERIC_ERROR_SHAPE)rrrRZexample_section�
documenterrrrr\s


z0ClientExceptionsDocumenter._add_response_examplecCsX|jd�}|jj�|jjd�|jj�t|jd|jjj	d�}|j
|||jgd�dS)NZ	Structure)rrBr=)r^)r!rr$r7r_rrrrr?Zdocument_paramsr`)rrrRZparams_sectionrarrrr]s


z/ClientExceptionsDocumenter._add_response_paramsN)r&rCrDrQr	r
r`rrMrrJrSrKrLrTrUrVrWr[r\r]rrrrrE�s8	
rE)�inspectZbotocore.docs.utilsrZbotocore.docs.methodrrrZbotocore.docs.sharedexamplerZbotocore.docs.examplerZbotocore.docs.paramsrr	Zbotocore.compatr
�objectrrErrrr�<module>
sl