
    `2f`!                     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d	 Z xZS )
r   examplesc                 T   t         |   ||j                  |       || _        | j                  j	                  |      | _        d | _        | j                  | j                  j                         v r | j                  j                  |      | _        g d| _
        || _        d| _        y )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       R/var/www/highfloat_scraper/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                 B   t        | j                  | j                  d      }| j                  |j	                  d             | j                  |j	                  d             | j                  |j	                  d             | j                  |j	                  d             | j                  r | j                  |j	                  d             | j                  |j	                  d             |j	                  d	      }| j                  |       |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   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   s    
 *dmmF
 	

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

/'
" ! 		s   A 	AAc                 6   |j                   j                  d       |j                   j                          |j                  d       |j                   j	                  d| j
                         |j                  d       |j                   j                          |j                   j                          |j                  d       |j                   j                          |j                   j                          | j                  |       | j                  |       y )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 ''0  )r%   c                    t        dd      }|j                  d      }|j                  j                  | j                  j
                  j                  d| j                          |j                  d       t        | j                  | j                  | j                        j                  |       | j                  j                  j                  j                   }|| j                  k(  rd}t"        j$                  j'                  | j                  | j                   |j)                                }|j+                  |d       |j                  j-                  | j                   d| d	       y )
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   s:   0v 
 2AA,O  $$LL""++vd6H6H5I-J	
 	  !@A!""DMM43G3G	


0
1 ..33BBGGD....M$&GGLL  !!"""$%%
!
 	**+DgN!3!3 4Am_FKLr%   c                 N   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}|j
                  j                  j                   j#                         }t%        |d	      }|j'                  d
      }|j(                  j+                  | j                  j,                  j.                  d| j                          |j1                  d|j
                  j                  j                           t3        || j                   | j4                        j7                  |j'                  |j
                  j                  j                                t8        j:                  j=                  | j4                  | j                   |       }|j?                  |d       |j(                  jA                  | j                   d| d       2 y )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   si    %,,];$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$MM88==CCEM,]6JL!-!=!=l!K$$((&&//6$:L:L9M1N $$ !=!=!B!B CD $--)=)=,,X]]-I-I-N-NO
 )+$$%%& /)%
 &&'@'JMM!!%%&af=Y.	r%   c                     t         j                  j                  t         j                  j                  | j                  | j
                  dz               S )Nz.rst)rS   rT   realpathrU   EXAMPLE_PATHr   )r"   s    r$   _get_example_filez#ServiceDocumenter._get_example_file   s<    wwGGLL**D,>,>,GH
 	
r%   c                 L   | j                         }t        j                  j                  |      ri|j                  j                  d       |j                  j                          t        |      5 }|j                  |j                                d d d        y y # 1 sw Y   y xY w)NExamples)
ru   rS   rT   isfiler=   r>   r?   openr@   read)r"   r8   examples_filefs       r$   r/   z$ServiceDocumenter._document_examples   s}    ..077>>-(MMZ(MM""$m$ (affh'( ( )( (s   0 B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      sR    77<< ?LL
8/(	#*,M45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 L 1  3 M &q(- q(r%   