o
    i                     @   sp   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZ G dd deZ		dd
dZdS )    N)
xform_name)DocumentStructure)get_service_module_name)NestedDocumenter)add_resource_type_overview!get_identifier_args_for_signatureget_identifier_description!get_identifier_values_for_examplec                   @   s   e Zd Zdd ZdS )SubResourceDocumenterc           	      C   s   t |dddd t| jjjjdd d}g }|| jd< |D ]W}||j t	|jd	d
}|
d}|j| jd |d|j  ||j |j
|jd| j did}t|| j|| jd tj| j| j | j }|||j qd S )NzSub-resourceszSub-resources are methods that create a new instance of a child resource. This resource's identifiers get passed along to the child.Zsubresources_intro)sectionZresource_typedescriptionZ
intro_linkc                 S   s   | j S )N)name)sub_resource r   M/home/app/Keep/.python/lib/python3.10/site-packages/boto3/docs/subresource.py<lambda>*   s    z>SubResourceDocumenter.document_sub_resources.<locals>.<lambda>)keyzsub-resourceshtml)targetZ
breadcrumbindexz / Sub-Resource / 	qualifier.)context)r   resource_namesub_resource_modelservice_model)r   sortedZ	_resourcemetaZresource_modelZsubresources
member_mapappendr   r   add_new_sectionstylerefZ_resource_class_namewriteZadd_title_section
class_namedocument_sub_resourceZ_resource_nameZ_service_modelospathjoinZ_root_docs_pathZ_service_nameZ_resource_sub_pathZwrite_to_file)	selfr   Zsub_resourcesZsub_resources_listr   Zsub_resource_docZbreadcrumb_sectionZsub_resource_sectionZsub_resources_dir_pathr   r   r   document_sub_resources   sP   



	z,SubResourceDocumenter.document_sub_resourcesN)__name__
__module____qualname__r*   r   r   r   r   r
      s    r
   Tc                 C   s  g }|j jD ]}|jdkr|t|j q|r/t|}| jdd |j	 }| j
|| | d}	d|j j d}
|	|
 | d}t|}t|}|j|krU|}t|j j d| d	|j	 d
| d}|j
  || |j
  | d}|D ]&}t|j	|}
|d| d |j
  |d| d|
  |j
  q~| d}|j
  |dt| d	|j j d |j
  |d|j j d |j
  dS )aj  Documents a resource action

    :param section: The section to write to

    :param resource_name: The name of the resource

    :param sub_resource_model: The model of the subresource

    :param service_model: The model of the service

    :param include_signature: Whether or not to include the signature.
        It is useful for generating docstrings.
    inputr    zmethod-introz
Creates a z
 resource.examplez = r   ()paramsz:type z: stringz:param z: returnz:rtype: :py:class:``z:returns: A z	 resourceN)resourceZidentifierssourcer   r   r   r   r   getr   r!   Zstart_sphinx_py_methodr    typeZinclude_doc_stringr	   Zservice_nameZstart_codeblockr#   Zend_codeblockr   new_liner   )r   r   r   r   Zinclude_signatureZidentifiers_needed
identifierZsignature_argsZfull_sub_resource_nameZmethod_intro_sectionr   Zexample_sectionZexample_valuesZexample_resource_namer0   Zparam_sectionZreturn_sectionr   r   r   r%   O   sV   




&







r%   )T)r&   Zbotocorer   Zbotocore.docs.bcdoc.restdocr   Zbotocore.utilsr   Zboto3.docs.baser   Zboto3.docs.utilsr   r   r   r	   r
   r%   r   r   r   r   <module>   s   8