
    DhJ                     v    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y)
    N)DocumentStructure)ServiceDocumenter)DataNotFoundError)Boto3ClientDocumenter)ResourceDocumenterServiceResourceDocumenter)ServiceContextc                        e Zd Zej                  j                  ej                  j                  ej                        d      Z	 fdZ
d Zd Zd Zd Zd Zd Z xZS )	r   examplesc                 6   t         |   ||j                         || _        | j                  j	                  |      | _        d | _        | j                  | j                  j                         v r | j                  j                  |      | _        g d| _
        y )N)service_namesession)titletable-of-contentsclient
paginatorswaitersservice-resource	resourcesr   )super__init___session_boto3_sessionr   _client_service_resource_service_nameget_available_resourcesresourcesections)selfr   r   	__class__s      t/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/boto3/docs/service.pyr   zServiceDocumenter.__init__   s    % $$	 	 	
 &**11,?!%!4!4!L!L!NN%)%8%8%A%A,%OD"	
    c                 ~   t        | j                  | j                  d      }| j                  |j	                  d             | j                  |j	                  d             | j                  |j	                  d             | j                  |j	                  d             | j                  |j	                  d             | j                  r@| j                  |j	                  d             | j                  |j	                  d	             | j                  |j	                  d
             |j                         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   r   get_sectiontable_of_contents
client_apipaginator_api
waiter_apir   _document_service_resource_document_resources_document_examplesflush_structure)r    doc_structures     r"   document_servicez"ServiceDocumenter.document_service4   s   
 *dmmF
 	

=,,W56}889LMN11(;<=44\BC11)<=!!++))*<= $$]%>%>{%KL 9 9* EF,,..r#   c                     d }	 | j                  | j                        }t        | j                  |      j                  |       y # t        $ r Y 1w xY wN)get_examplesr   r   r   r   document_client)r    sectionr   s      r"   r*   zServiceDocumenter.client_apiJ   sQ    	((););<H 	dllH5EEgN ! 		s   A 	AAc                 b    t        | j                  | j                        j                  |       y r4   )r   r   r   document_resource)r    r7   s     r"   r-   z,ServiceDocumenter._document_service_resourceS   s$    !""DMM	


G
$r#   c                    d}| j                   j                  d      }|j                  | j                  d      }| j                  j
                  j                  j
                  j                  }|d   D ]  }|d   |   }| j                  j                  j                  ||t        | j                  |d   |d             }|j
                  j                  j                  }	g }
|	D ]  }|
j                  |         ||
d| j                  i}t!        || j                         j#                  |j%                  |j
                  j                  j&                                y )Nfoodata_loaderzresources-1r   )r   resource_json_definitionsservice_modelservice_waiter_model)resource_namesingle_resource_json_definitionservice_contextr   )r   get_componentload_service_modelr   r   metar   r>   r   resource_factoryload_from_definitionr	   resource_modelidentifiersappendr   r   r9   add_new_sectionname)r    r7   temp_identifier_valueloaderjson_resource_modelr>   r@   rH   resource_clsrI   args_r   s                r"   r.   z%ServiceDocumenter._document_resourcesX   sS    %,,];$77
 ..33::??MM0= 	M0=mLN##44II"/4B$2%)%7%72E'3 '4-1% J   '++::FFKD  3123#T?$,,?Hx7II''(D(D(I(IJ+	r#   c                     t         j                  j                  t         j                  j                  | j                  | j
                  dz               S )Nz.rst)ospathrealpathjoinEXAMPLE_PATHr   )r    s    r"   _get_example_filez#ServiceDocumenter._get_example_filex   s<    wwGGLL**D,>,>,GH
 	
r#   c                    | j                         }t        j                  j                  |      r|j                  j                  d       |j                  j                          |j                  d       |j                  j                          |j                  j                          t        |      5 }|j                  |j                                d d d        y y # 1 sw Y   y xY w)NExamplesz'.. contents::
    :local:
    :depth: 1)
rY   rT   rU   isfilestyleh2new_linewriteopenread)r    r7   examples_filefs       r"   r/   z$ServiceDocumenter._document_examples}   s    ..077>>-(MMZ(MM""$MMEFMM""$MM""$m$ (affh'( ( )( (s   5 CC()__name__
__module____qualname__rT   rU   rW   dirnameboto3__file__rX   r   r2   r*   r-   r.   rY   r/   __classcell__)r!   s   @r"   r   r      sM    77<< ?LL
./,O%
@

	(r#   r   )rT   botocore.docs.bcdoc.restdocr   botocore.docs.servicer   BaseServiceDocumenterbotocore.exceptionsr   ri   boto3.docs.clientr   boto3.docs.resourcer   r   boto3.utilsr	    r#   r"   <module>rt      s.    
 9 L 1  3 M &m(- m(r#   