U ‹¼Ý`ì*ã@sÌddlmZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZGdd„deƒZGdd„deƒZdS)é)Ú xform_name)Úget_official_service_name)ÚBaseDocumenter)ÚActionDocumenter)ÚWaiterResourceDocumenter)ÚCollectionDocumenter)ÚSubResourceDocumenter)Údocument_attribute)Údocument_identifier)Údocument_reference)Ú!get_identifier_args_for_signature)Ú!get_identifier_values_for_example)Úget_identifier_description)Úadd_resource_type_overviewcsŒeZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Z‡ZS)ÚResourceDocumentercstt|ƒ |¡||_dS©N)ÚsuperrÚ__init__Ú_botocore_session)ÚselfÚresourceZbotocore_session©Ú __class__©ú7/tmp/pip-unpacked-wheel-shglt7_u/boto3/docs/resource.pyrszResourceDocumenter.__init__cCsr| |¡| |¡| d¡}| |¡| |¡| |¡| |¡| |¡| |¡|  |¡|  |¡dS)Nzmember-overview) Ú _add_titleÚ _add_introÚadd_new_sectionÚ_add_identifiersÚ_add_attributesÚ_add_referencesÚ _add_actionsÚ_add_sub_resourcesÚ_add_collectionsÚ _add_waitersÚ_add_overview_of_members)rÚsectionZoverview_sectionrrrÚdocument_resource#s          z$ResourceDocumenter.document_resourcecCs|j |j¡dSr)ÚstyleÚh2Ú_resource_name©rr&rrrr0szResourceDocumenter._add_titlecCsŠg}|jjr&|jjD]}| |j¡qt|ƒ}|jjd|j|fd| d¡}|  |¡| d¡}|  ||¡| d¡}|  ||¡dS)Nz%s(%s))Ú class_nameÚ descriptionZexampleÚparams) Z_resource_modelÚ identifiersÚappendÚnamer r(Zstart_sphinx_py_classr,rÚ_add_descriptionÚ _add_exampleÚ_add_params_description)rr&Úidentifier_namesÚ identifierZ class_argsZdescription_sectionZexample_sectionZ param_sectionrrrr3s  ÿ     zResourceDocumenter._add_introcCs"t|jƒ}| d||jf¡dS)Nz A resource representing an %s %s)rÚ_service_modelÚwriter*©rr&Zofficial_service_namerrrr2Ksÿÿÿz#ResourceDocumenter._add_descriptioncCsˆ|j ¡|j ¡| d¡|j ¡|j ¡| d|j|jf¡|j ¡t|ƒ}| dt|jƒ|j|j|f¡|j ¡dS)Nú import boto3ú%s = boto3.resource('%s')z%s = %s.%s(%s)) r(Ústart_codeblockÚnew_liner8Ú _service_namer rr*Ú end_codeblock)rr&r5Zexample_valuesrrrr3Rs,     ÿÿ þÿzResourceDocumenter._add_examplecCsN|D]D}t|j|ƒ}| d|¡|j ¡| d||f¡|j ¡qdS)Nz:type %s: stringz :param %s: %s)rr*r8r(r=)rr&r5Zidentifier_namer-rrrr4dsÿ ÿz*ResourceDocumenter._add_params_descriptioncCsl|jD]`}|j ¡| d|¡|j ¡|j|D].}|dkrT|j d|¡q6|j d|¡q6qdS)Nz&These are the resource's available %s:)r/Ú attributesÚ referencesÚ collectionsz :py:attr:`%s`z:py:meth:`%s()`)Ú member_mapr(r=r8Úli)rr&Zresource_member_typeÚmemberrrrr%ns  ÿ z+ResourceDocumenter._add_overview_of_memberscCsn|jjjj}| d¡}g}|r8||jd<t|dddd|D],}| |j¡}| |j¡t ||j |dqr*Úevents) rr&rNr@rOZattribute_listrLÚ_Z attr_shapeZattribute_sectionrrrr‘s>  ÿ ÿ ø      úz"ResourceDocumenter._add_attributescCsj| d¡}|jjjj}g}|r8t|dddd||jd<|D](}| |j¡}| |j¡t ||dqrrCZdocument_resource_waiters)rr&rVZservice_waiter_modelrUrrrr$às  ÿÿzResourceDocumenter._add_waiters)Ú__name__Ú __module__Ú __qualname__rr'rrr2r3r4r%rrr r!r"r#r$Ú __classcell__rrrrrs    "rc@s0eZdZedd„ƒZdd„Zdd„Zdd„Zd S) ÚServiceResourceDocumentercCs d|jS)Nz%s.ServiceResource)Z_service_docs_name)rrrrr,ísz$ServiceResourceDocumenter.class_namecCs|j d¡dS)NzService Resource)r(r)r+rrrrñsz$ServiceResourceDocumenter._add_titlecCst|jƒ}| d|¡dS)NzA resource representing %s)rr7r8r9rrrr2ôs ÿÿz*ServiceResourceDocumenter._add_descriptioncCsV|j ¡|j ¡| d¡|j ¡|j ¡| d|j|jf¡|j ¡dS)Nr:r;)r(r<r=r8r>r?)rr&r5rrrr3ús     ÿÿz&ServiceResourceDocumenter._add_exampleN)rWrXrYÚpropertyr,rr2r3rrrrr[ìs  r[N)ZbotocorerZbotocore.docs.utilsrZboto3.docs.baserZboto3.docs.actionrZboto3.docs.waiterrZboto3.docs.collectionrZboto3.docs.subresourcerZboto3.docs.attrr r r Zboto3.docs.utilsr r rrrr[rrrrÚ s              O