B >@SaÎ-ã@s˜ddlZddlmZddlmZddlmZddlmZddlmZddl m Z ddl m Z dd lm Z dd lmZGd d „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„Z dd„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úl/private/var/folders/fg/1jzmct0d7d72tjkvm_1nhqc5sw67yj/T/pip-unpacked-wheel-ef76ia09/botocore/docs/client.pyÚ__init__s  zClientDocumenter.__init__cCs:| |¡| |¡t|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|j d¡dS)NZClient)ÚstyleÚh2)rrrrrr-szClientDocumenter._add_titlecCsž| d¡}t|jjjƒ}| d|¡|j ¡| |jjjj ¡|  |¡|j ¡| d¡|j ¡|jj j }x$t |ƒD]}|j d||f¡q~WdS)NZintroz"A low-level client representing %sz These are the available methods:z:py:meth:`~%s.Client.%s`)Úadd_new_sectionrr rrÚwriterÚnew_lineÚinclude_doc_stringÚ documentationÚ_add_client_creation_exampleÚ __class__Ú__name__ÚsortedÚli)rrrZofficial_service_nameÚ class_nameÚ method_namerrrr0s         z"ClientDocumenter._add_client_introcCs|jjd|jjjddS)Nz %s.Client)r+)rÚstart_sphinx_py_classr r'r()rrrrrrFsz%ClientDocumenter._add_class_signaturecCs6|j ¡|j ¡| dj|jd¡|j ¡dS)Nz+client = session.create_client('{service}'))Zservice)rÚstart_codeblockr#r"ÚformatrÚ end_codeblock)rrrrrr&Js    z-ClientDocumenter._add_client_creation_examplecCs2| d¡}x"t|ƒD]}| ||||¡qWdS)NÚmethods)r!r)Ú_add_client_method)rrrr,rrrrSs z$ClientDocumenter._add_client_methodscCs4| |¡}| |¡r$| |||¡n | ||¡dS)N)r!Ú_is_custom_methodÚ_add_custom_methodÚ_add_model_driven_method)rrr,Úmethodrrrr2Ys  z#ClientDocumenter._add_client_methodcCs||jjjkS)N)r rÚmethod_to_api_mapping)rr,rrrr3`sz"ClientDocumenter._is_custom_methodcCst|||ƒdS)N)r)rrr,r6rrrr4csz#ClientDocumenter._add_custom_methodcCsf| d¡}|j ¡|j d¡|j ¡|jjj}x,|jD]"}d||jf}|j  d|¡qr Úgetr)rrr,rÚoperation_namer<r@rrrrr5ps    z)ClientDocumenter._add_model_driven_method)N)r(Ú __module__Ú __qualname__rrrrrr&rr2r3r4r>r5rrrrr s    r c @s´eZdZdZedddededdddfd ed dd dfgƒd Zd d „Zdd„Zdd„Z dd„Z dd„Z dd„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.)r;Ú type_namer%ÚMessagez;A descriptive message explaining why the exception occured.)r;rIr%ÚmemberscCs||_|jjjj|_dS)N)r rrrr)rrrrrr¦sz#ClientExceptionsDocumenter.__init__cCs,| |¡| |¡| |¡| |¡dS)N)rÚ _add_overviewÚ_add_exceptions_listÚ_add_exception_classes)rrrrrÚdocument_exceptionsªs   z.ClientExceptionsDocumenter.document_exceptionscCs|j d¡dS)NzClient Exceptions)rr )rrrrrr°sz%ClientExceptionsDocumenter._add_titlecCs>|j ¡| d¡|jjd|jd| d¡|j ¡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)rrrrrrL³s   z(ClientExceptionsDocumenter._add_overviewcCs|jjj}d||jfS)Nz%s.Client.exceptions.%s)r r'r(r;)rÚshapeZcls_namerrrÚ_exception_class_nameÂs z0ClientExceptionsDocumenter._exception_class_namecCs||jjjj}|s2|j ¡| d¡|j ¡dS|j ¡| d¡|j ¡x&|D]}| |¡}|j d|¡qVWdS)Nz-This client has no modeled exception classes.z$The available client exceptions are:z:py:class:`%s`) r rrr:rr#r"rUr*)rrr:rTr+rrrrMÆs         z/ClientExceptionsDocumenter._add_exceptions_listcCs&x |jjjjD]}| ||¡qWdS)N)r rrr:Ú_add_exception_class)rrrTrrrrNÔsz1ClientExceptionsDocumenter._add_exception_classescCsV| |j¡}| |¡}|jj|d| ||¡| ||¡| ||¡|j ¡dS)N)r+) r!r;rUrr-Ú_add_top_level_documentationÚ_add_exception_catch_exampleÚ_add_response_attrZend_sphinx_py_class)rrrTZ class_sectionr+rrrrVØs     z/ClientExceptionsDocumenter._add_exception_classcCs*|jr&|j ¡| |j¡|j ¡dS)N)r%rr#r$)rrrTrrrrWás  z7ClientExceptionsDocumenter._add_top_level_documentationcCs¢|j ¡|j d¡|j ¡| d¡|j ¡|j ¡| d¡|j ¡|j ¡| d|j¡|j ¡|j ¡| d¡|j ¡|j ¡dS)NZExampleztry:z...z!except client.exceptions.%s as e:zprint(e.response)) rr#r9r.r"ÚindentÚdedentr;r0)rrrTrrrrXçs             z7ClientExceptionsDocumenter._add_exception_catch_examplecCsF| d¡}|j d¡| |¡| ||¡| ||¡|j ¡dS)NÚresponse)r!rZstart_sphinx_py_attrÚ_add_response_attr_descriptionÚ_add_response_exampleÚ_add_response_paramsZend_sphinx_py_attr)rrrTZresponse_sectionrrrrYøs      z-ClientExceptionsDocumenter._add_response_attrcCs"|j ¡| d¡|j ¡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#r$)rrrrrr]s z9ClientExceptionsDocumenter._add_response_attr_descriptioncCsX| d¡}|j ¡|j d¡|j ¡t|jd|jjj d}|j |||j gddS)NZsyntaxZSyntax)rrCr?)Úinclude) r!rr#r9Ú new_paragraphrrr rrAZdocument_exampleÚ_GENERIC_ERROR_SHAPE)rrrTZexample_sectionÚ documenterrrrr^ s    z0ClientExceptionsDocumenter._add_response_examplecCsX| d¡}|j ¡|j d¡|j ¡t|jd|jjj d}|j |||j gddS)NÚ Structure)rrCr?)r`) r!rr#r9rarrr rrAZdocument_paramsrb)rrrTZparams_sectionrcrrrr_s    z/ClientExceptionsDocumenter._add_response_paramsN)r(rDrErSr r rbrrOrrLrUrMrNrVrWrXrYr]r^r_rrrrrFˆs8  rF)ÚinspectZbotocore.docs.utilsrZbotocore.docs.methodrrrZbotocore.docs.sharedexamplerZbotocore.docs.examplerZbotocore.docs.paramsrr Zbotocore.compatr Úobjectr rFrrrrÚ s         n