
    /Jf`!                     ~    d dl Z d dlmZ d dlmZ d dlmZ d dlZd dl	m
Z
 d dlmZmZ d dlmZ  G d d	e          ZdS )
    N)DocumentStructure)ServiceDocumenter)DataNotFoundError)Boto3ClientDocumenter)ResourceDocumenterServiceResourceDocumenter)ServiceContextc                        e Zd Zej                            ej                            ej                  d          Z	 fdZ
d Zd Zd Zd Zd Zd Zd	 Z xZS )
r   examplesc                 `   t                                          ||j        |           || _        | j                            |          | _        d | _        | j        | j                                        v r| j        	                    |          | _        g d| _
        || _        d| _        d S )N)service_namesessionroot_docs_path)titleclient
paginatorswaiters	resourcesr   context-paramszLhttps://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html)super__init___session_boto3_sessionr   _client_service_resource_service_nameget_available_resourcesresourcesections_root_docs_path_USER_GUIDE_LINK)selfr   r   r   	__class__s       U/home/alex/cs2snipeproduction/venv/lib/python3.11/site-packages/boto3/docs/service.pyr   zServiceDocumenter.__init__   s    % $) 	 	
 	
 	
 &*11,??!%!4!L!L!N!NNN%)%8%A%A,%O%OD"
 
 
  .? 	    c                    t          | j        | j        d          }|                     |                    d                     |                     |                    d                     |                     |                    d                     |                     |                    d                     | j        r(| 	                    |                    d                     | 
                    |                    d                     |                    d	          }|                     |           |                                S )
ziDocuments an entire service.

        :returns: The reStructured text of the documented service.
        html)section_namestargetr   r   r   r   r   r   r   )r   r   r   r   get_section
client_apipaginator_api
waiter_apir   resource_section_document_examplesclient_context_paramsflush_structure)r"   doc_structurecontext_params_sections      r$   document_servicez"ServiceDocumenter.document_service9   s4   
 *dmF
 
 
 	

=,,W5566611(;;<<<=44\BBCCC11)<<===! 	J!!-";";K"H"HIII 9 9* E EFFF!.!:!:;K!L!L""#9:::,,...r%   c                     d }	 |                      | j                  }n# t          $ r Y nw xY wt          | j        | j        |                              |           d S )N)get_examplesr   r   r   r   r    document_client)r"   sectionr   s      r$   r+   zServiceDocumenter.client_apiM   su    	(();<<HH  	 	 	D	 	L$.	
 	

/'
"
"
"
"
"s    
,,c                 H   |j                             d           |j                                          |                    d           |j                             d| j                   |                    d           |j                                          |j                                          |                    d           |j                                          |j                                          |                     |           |                     |           d S )N	ResourceszResources are available in boto3 via the ``resource`` method. For more detailed instructions and examples on the usage of resources, see the resources z
user guide)r   link.zThe available resources are:)	styleh2new_linewriteexternal_linkr!   toctree_document_service_resource_document_resources)r"   r8   s     r$   r.   z"ServiceDocumenter.resource_sectionX   s   %%%   	
 	
 	
 	##& 	$ 	
 	
 	
 	c      4555   ''000  )))))r%   c                    t          dd          }|                    d          }|j                            | j        j        j        d| j                    |                    d           t          | j
        | j        | j                                      |           | j
        j        j        j        }|| j        k    rd}t"          j                            | j        | j         |                                           }|                    |d           |j                            | j         d| d	           d S )
Nzservice-resourcer'   r)   
breadcrumb../../z / Resource / ServiceResourceindex//index)r   add_new_sectionr=   refr   r#   __name__r   r@   r   r   r   r    document_resourcemetaresource_modelnameospathjoinlowerwrite_to_filetocitem)r"   r8   service_resource_docbreadcrumb_sectionresource_nameservice_resource_dir_paths         r$   rC   z,ServiceDocumenter._document_service_resourcen   sQ   0v 
  
  
 2AA,OO $$L"+-Jd6H-J-J	
 	
 	
 	  !@AAA!"DM43G	
 	


0
1
1
1 .3BGD....M$&GLL !#""$$&%
 %
!
 	**+DgNNN!3KKmKKKLLLLLr%   c                    d}| j                             d          }|                    | j        d          }| j        j        j        j        j        }|d         D ]}|d         |         }| j        j	        
                    ||t          | j        |d         |d                     }|j        j        j        }	g }
|	D ]}|
                    |            ||
d| j        i}|j        j        j                                        }t%          |d	          }|                    d
          }|j                            | j        j        j        d| j                    |                    d|j        j        j                    t3          || j         | j                                      |                    |j        j        j                             t8          j                            | j        | j         |           }|                    |d           |j                             | j         d| d           d S )Nfoodata_loaderzresources-1r   )r   resource_json_definitionsservice_modelservice_waiter_model)r[   single_resource_json_definitionservice_contextr   r'   rF   rG   rH   z / Resource / rI   rJ   rK   )!r   get_componentload_service_modelr   r   rP   r   ra   r   resource_factoryload_from_definitionr	   rQ   identifiersappendr   rR   rV   r   rL   r=   rM   r#   rN   r@   r   r    rO   rS   rT   rU   rW   rX   )r"   r8   temp_identifier_valueloaderjson_resource_modelra   r[   rQ   resource_clsri   args_r   resource_docrZ   r\   s                   r$   rD   z%ServiceDocumenter._document_resources   s    %,,];;$77
 
 .3:?M0= .	 .	M0=mLN#4II"/4B$2%)%72E'3 '4-1% % % J    '+:FKD  3 312222#|T?$,??H$M8=CCEEM,]6JJJL!-!=!=l!K!K$((&/1N$:L1N1N   $$D!=!BDD   $-)= ,,X]-I-NOO  
 )+$%' ") )%
 &&'@'JJJM!!%=====   Y.	 .	r%   c                     t           j                            t           j                            | j        | j        dz                       S )Nz.rst)rS   rT   realpathrU   EXAMPLE_PATHr   )r"   s    r$   _get_example_filez#ServiceDocumenter._get_example_file   s:    wGLL*D,>,GHH
 
 	
r%   c                 t   |                                  }t          j                            |          r|j                            d           |j                                         t          |          5 }|                    |	                                           d d d            d S # 1 swxY w Y   d S d S )NExamples)
ru   rS   rT   isfiler=   r>   r?   openr@   read)r"   r8   examples_filefs       r$   r/   z$ServiceDocumenter._document_examples   s    ..007>>-(( 	(MZ(((M""$$$m$$ (affhh'''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (	( 	(s   6(B++B/2B/)rN   
__module____qualname__rS   rT   rU   dirnameboto3__file__rt   r   r4   r+   r.   rC   rD   ru   r/   __classcell__)r#   s   @r$   r   r      s        7<< ? ?LLL
 
 
 
 
8/ / /(	# 	# 	#* * *,M M M45 5 5n
 
 

( ( ( ( ( ( (r%   r   )rS   botocore.docs.bcdoc.restdocr   botocore.docs.servicer   BaseServiceDocumenterbotocore.exceptionsr   r   boto3.docs.clientr   boto3.docs.resourcer   r   boto3.utilsr	    r%   r$   <module>r      s    
			 9 9 9 9 9 9 L L L L L L 1 1 1 1 1 1  3 3 3 3 3 3 M M M M M M M M & & & & & &q( q( q( q( q(- q( q( q( q( q(r%   