B ª`ì*ã@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__©új/private/var/folders/fw/jsxvvqfs4sz4tdnfdvg5typ5vk77qg/T/pip-install-clzde6rb/boto3/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¡dS)N)ÚstyleÚh2Ú_resource_name)rr$rrrr0szResourceDocumenter._add_titlecCsŽg}|jjr*x|jjD]}| |j¡qWt|ƒ}|jjd|j|fd| d¡}|  |¡| d¡}|  ||¡| d¡}|  ||¡dS)Nz%s(%s))Ú class_nameÚ descriptionÚexampleÚ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$Úofficial_service_namerrrr0Ks z#ResourceDocumenter._add_descriptioncCsˆ|j ¡|j ¡| d¡|j ¡|j ¡| d|j|jf¡|j ¡t|ƒ}| dt|jƒ|j|j|f¡|j ¡dS)Nz import boto3z%s = boto3.resource('%s')z%s = %s.%s(%s)) r&Ústart_codeblockÚnew_liner6Ú _service_namer rr(Ú end_codeblock)rr$r3Zexample_valuesrrrr1Rs       zResourceDocumenter._add_examplecCsRxL|D]D}t|j|ƒ}| d|¡|j ¡| d||f¡|j ¡qWdS)Nz:type %s: stringz :param %s: %s)rr(r6r&r9)rr$r3Zidentifier_namer*rrrr2ds    z*ResourceDocumenter._add_params_descriptioncCstxn|jD]d}|j ¡| d|¡|j ¡x<|j|D].}|dkrX|j d|¡q:|j d|¡q:WqWdS)Nz&These are the resource's available %s:)r-Ú attributesÚ referencesÚ collectionsz :py:attr:`%s`z:py:meth:`%s()`)Ú member_mapr&r9r6Úli)rr$Zresource_member_typeÚmemberrrrr#ns   z+ResourceDocumenter._add_overview_of_memberscCsr|jjjj}| d¡}g}|r8||jd<t|ddddx4|D],}| |j¡}| |j¡t ||j |dq>WdS)Nr-Z IdentifierszXIdentifiers are properties of a resource that are set upon instantation of the resource.Úidentifiers_attributes_intro)r$Ú resource_typer*Ú intro_link)r$Ú resource_nameZidentifier_model) Ú _resourceÚmetaÚresource_modelr-rr?rr/r.r r()rr$r-Z member_listr4Zidentifier_sectionrrrr{s"      z#ResourceDocumenter._add_identifiersc CsÄ|jjjjj}i}|jjjjr@| |jjjj¡}|jjj |¡}| d¡}g}|rlt |dddd||j d<xRt |ƒD]F}||\}}| |¡} |  |¡t | |j|j||jjjjj|dqvWdS)Nr<Z 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.rB)r$rCr*rD)r$Z service_namerEÚ attr_nameZ event_emitterZ attr_model)rFrGÚclientÚ service_modelrHÚshapeZ shape_forZget_attributesrrr?Úsortedr.r r:r(Úevents) rr$rKr<rLZattribute_listrIÚ_Z attr_shapeZattribute_sectionrrrr‘s6        z"ResourceDocumenter._add_attributescCsn| d¡}|jjjj}g}|r8t|dddd||jd<x0|D](}| |j¡}| |j¡t ||dq>WdS)Nr=Z ReferenceszNReferences are related resource instances that have a belongs-to relationship.Zreferences_intro)r$rCr*rD)r$Zreference_model) rrFrGrHr=rr?r/r.r )rr$r=Zreference_listÚ referenceZreference_sectionrrrr³s       z"ResourceDocumenter._add_referencescCs:| d¡}|jjjj}|r6t|jƒ}|j|_| |¡dS)NÚactions)rrFrGrHrQrr?Zdocument_actions)rr$rQÚ documenterrrrrÈs    zResourceDocumenter._add_actionscCs:| d¡}|jjjj}|r6t|jƒ}|j|_| |¡dS)Nz sub-resources)rrFrGrHZ subresourcesrr?Zdocument_sub_resources)rr$Z sub_resourcesrRrrrr Ðs    z%ResourceDocumenter._add_sub_resourcescCs:| d¡}|jjjj}|r6t|jƒ}|j|_| |¡dS)Nr>)rrFrGrHr>rr?Zdocument_collections)rr$r>rRrrrr!Øs    z#ResourceDocumenter._add_collectionscCsJ| d¡}|jjjj}|rF|j |j¡}t|j|ƒ}|j |_ |  |¡dS)NÚwaiters) rrFrGrHrSrZget_waiter_modelr:rr?Zdocument_resource_waiters)rr$rSZservice_waiter_modelrRrrrr"às   zResourceDocumenter._add_waiters)Ú__name__Ú __module__Ú __qualname__rr%rrr0r1r2r#rrrrr r!r"Ú __classcell__rr)rrrs    "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')rr$rrrrñsz$ServiceResourceDocumenter._add_titlecCst|jƒ}| d|¡dS)NzA resource representing %s)rr5r6)rr$r7rrrr0ôsz*ServiceResourceDocumenter._add_descriptioncCsV|j ¡|j ¡| d¡|j ¡|j ¡| d|j|jf¡|j ¡dS)Nz import boto3z%s = boto3.resource('%s'))r&r8r9r6r:r;)rr$r3rrrr1ús     z&ServiceResourceDocumenter._add_exampleN)rTrUrVÚpropertyr)rr0r1rrrrrXìs rXN)ZbotocorerZbotocore.docs.utilsrZboto3.docs.baserZboto3.docs.actionrZboto3.docs.waiterrZboto3.docs.collectionrZboto3.docs.subresourcerZboto3.docs.attrr r r Zboto3.docs.utilsr r rrrrXrrrrÚ s              O