o ‰ü?cU+ã@s¤ddlmZddlmZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZdd lmZGd d „d e ƒZGd d „d eƒZdS)é)Ú xform_name)Úget_official_service_name)ÚActionDocumenter)Údocument_attributeÚdocument_identifierÚdocument_reference)ÚBaseDocumenter)ÚCollectionDocumenter)ÚSubResourceDocumenter)Úadd_resource_type_overviewÚ!get_identifier_args_for_signatureÚget_identifier_descriptionÚ!get_identifier_values_for_example)ÚWaiterResourceDocumentercsŒ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)ÚResourceDocumentercstƒ |¡||_dS©N)ÚsuperÚ__init__Ú_botocore_session)ÚselfÚresourceZbotocore_session©Ú __class__©ún/private/var/folders/cw/wlscbxl13mj6wd668h7l9g9sllkg5j/T/pip-target-b31awkwq/lib/python/boto3/docs/resource.pyr#s  zResourceDocumenter.__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&rrrr4szResourceDocumenter._add_titlecCsŽg}|jjr|jjD]}| |j¡q t|ƒ}|jj|j›d|›dd| d¡}|  |¡| d¡}|  ||¡| d¡}|  ||¡dS)Nú(ú))Ú 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_sectionrrrr7s ÿ     zResourceDocumenter._add_introcCs"t|jƒ}| d ||j¡¡dS)Nz A resource representing an {} {})rÚ_service_modelÚwriteÚformatr*©rr&Zofficial_service_namerrrr4Ps ÿÿz#ResourceDocumenter._add_descriptioncCsˆ|j ¡|j ¡| d¡|j ¡|j ¡| d |j|j¡¡|j ¡t|ƒ}| d t|jƒ|j|j|¡¡|j  ¡dS)Nú import boto3z{} = boto3.resource('{}')z{} = {}.{}({})) r(Ústart_codeblockÚnew_liner:r;Ú _service_namerrr*Ú end_codeblock)rr&r7Zexample_valuesrrrr5Xs*     ÿÿ üÿzResourceDocumenter._add_examplecCsV|D]&}t|j|ƒ}| d|›d¡|j ¡| d|›d|›¡|j ¡qdS)Nz:type z: stringz:param z: )r r*r:r(r?)rr&r7Zidentifier_namer/rrrr6osÿ  ùz*ResourceDocumenter._add_params_descriptioncCsx|jD]6}|j ¡| d|›d¡|j ¡|j|D]}|dvr.|j d|›d¡q|j d|›d¡qqdS)Nz#These are the resource's available ú:)Ú attributesÚ collectionsr1Ú referencesz :py:attr:`ú`z :py:meth:`z()`)Ú member_mapr(r?r:Zli)rr&Zresource_member_typeÚmemberrrrr%ys   ÿ ÷úz+ResourceDocumenter._add_overview_of_memberscCsn|jjjj}| d¡}g}|r||jd<t|dddd|D]}| |j¡}| |j¡t ||j |dqdS)Nr1Z IdentifierszYIdentifiers are properties of a resource that are set upon instantiation of the resource.Úidentifiers_attributes_intro©r&Z resource_typer/Z intro_link)r&Ú resource_nameZidentifier_model) Ú _resourceÚmetaÚresource_modelr1rrGr r3r2rr*)rr&r1Z member_listr8Zidentifier_sectionrrrr‹s(   ù  ýýz#ResourceDocumenter._add_identifiersc CsÀ|jjjjj}i}|jjjjr | |jjjj¡}|jjj |¡}| d¡}g}|r6t |dddd||j d<t |ƒD]#}||\}}| |¡} |  |¡t | |j|j||jjjjj|dq:dS)NrCZ Attributesz”Attributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the :py:meth:`load` method.rIrJ)r&Z service_namerKÚ attr_nameZ event_emitterZ attr_model)rLrMÚclientÚ service_modelrNÚshapeZ shape_forZget_attributesrr rGÚsortedr2rr@r*Úevents) rr&rQrCrRZattribute_listrOÚ_Z attr_shapeZattribute_sectionrrrr£s@  ÿ ÿ ÷     úüz"ResourceDocumenter._add_attributescCsj| d¡}|jjjj}g}|rt|dddd||jd<|D]}| |j¡}| |j¡t ||dqdS)NrEZ ReferenceszNReferences are related resource instances that have a belongs-to relationship.Zreferences_introrJ)r&Zreference_model) rrLrMrNrEr rGr3r2r)rr&rEZreference_listÚ referenceZreference_sectionrrrr És$  ù   ÿýz"ResourceDocumenter._add_referencescCó>| d¡}|jjjj}|rt|jƒ}|j|_| |¡dSdS)NÚactions)rrLrMrNrXrrGZdocument_actions)rr&rXÚ documenterrrrr!ßó   ýzResourceDocumenter._add_actionscCrW)Nz sub-resources)rrLrMrNZ subresourcesr rGZdocument_sub_resources)rr&Z sub_resourcesrYrrrr"çrZz%ResourceDocumenter._add_sub_resourcescCrW)NrD)rrLrMrNrDr rGZdocument_collections)rr&rDrYrrrr#ïrZz#ResourceDocumenter._add_collectionscCsN| d¡}|jjjj}|r%|j |j¡}t|j|ƒ}|j |_ |  |¡dSdS)NÚwaiters) rrLrMrNr[rZget_waiter_modelr@rrGZdocument_resource_waiters)rr&r[Zservice_waiter_modelrYrrrr$÷s  ÿÿøzResourceDocumenter._add_waiters)Ú__name__Ú __module__Ú __qualname__rr'rrr4r5r6r%rrr r!r"r#r$Ú __classcell__rrrrr"s    &rc@s0eZdZedd„ƒZdd„Zdd„Zdd„Zd S) ÚServiceResourceDocumentercCs |j›dS)Nz.ServiceResource)Z_service_docs_name)rrrrr.s z$ServiceResourceDocumenter.class_namecCs|j d¡dS)NzService Resource)r(r)r+rrrr sz$ServiceResourceDocumenter._add_titlecCst|jƒ}| d|›¡dS)NzA resource representing )rr9r:r<rrrr4 s z*ServiceResourceDocumenter._add_descriptioncCsZ|j ¡|j ¡| d¡|j ¡|j ¡| |j›d|j›d¡|j ¡dS)Nr=z = boto3.resource('z'))r(r>r?r:r@rA)rr&r7rrrr5s     ÿz&ServiceResourceDocumenter._add_exampleN)r\r]r^Úpropertyr.rr4r5rrrrr`s   r`N)ZbotocorerZbotocore.docs.utilsrZboto3.docs.actionrZboto3.docs.attrrrrZboto3.docs.baserZboto3.docs.collectionr Zboto3.docs.subresourcer Zboto3.docs.utilsr r r rZboto3.docs.waiterrrr`rrrrÚs      d