
    `2f;                         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 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 d dlmZ  G d de      Z G d de      Zy)    N)
xform_name)DocumentStructure)get_official_service_name)ActionDocumenter)document_attributedocument_identifierdocument_reference)BaseDocumenter)CollectionDocumenter)SubResourceDocumenter)add_resource_type_overview!get_identifier_args_for_signatureget_identifier_description!get_identifier_values_for_example)WaiterResourceDocumenterc                   x     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Z xZS )ResourceDocumenterc                     t         |   |       || _        || _        | j                  j                         | _        | j                  | j                  k(  rd| _        y y )Nzservice-resource)super__init___botocore_session_root_docs_path_resource_namelower_resource_sub_path_service_name)selfresourcebotocore_sessionroot_docs_path	__class__s       S/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/boto3/docs/resource.pyr   zResourceDocumenter.__init__&   sX    "!1-"&"5"5";";"=$"4"44&8D# 5    c                 X   | j                  |       | j                  |       | j                  |       | j                  |       | j	                  |       | j                  |       | j                  |       | j                  |       | j                  |       | j                  |       y )N)

_add_title_add_resource_note
_add_intro_add_identifiers_add_attributes_add_references_add_actions_add_sub_resources_add_collections_add_waitersr   sections     r"   document_resourcez$ResourceDocumenter.document_resource.   s     ( g&W%W%'"(g&'"r#   c                 p    |j                  d      }|j                  j                  | j                         y )Ntitle)add_new_sectionstyleh2r   r   r0   title_sections      r"   r%   zResourceDocumenter._add_title:   s,    //8t223r#   c                 V   g }| j                   j                  r6| j                   j                  D ]  }|j                  |j                          t	        |      }|j                  d      }|j                  j                  | j                   d| d       |j                  d      }| j                  |       |j                  d      }| j                  ||       |j                  d      }| j                  ||       |j                  d      }	|	j                  j                          y )	Nstart_class())
class_namedescriptionexampleparams	end_class)_resource_modelidentifiersappendnamer   r4   r5   start_sphinx_py_classr=   _add_description_add_example_add_params_descriptionend_sphinx_py_class)
r   r0   identifier_names
identifier
class_argsr:   description_sectionexample_sectionparam_sectionrA   s
             r"   r'   zResourceDocumenter._add_intro>   s   ++"22>> 9
 ''
89 77GH
--m<////*!J<q9 	0 	

 *99-H12 &55i@/+;< $33H=$$]4DE++K8	++-r#   c                     t        | j                        }|j                  dj                  || j                               y )Nz A resource representing an {} {})r   _service_modelwriteformatr   r   r0   official_service_names      r"   rG   z#ResourceDocumenter._add_description[   s8     9$:M:M N.55%t':':	
r#   c                 r   |j                   j                          |j                   j                          |j                  d       |j                   j                          |j                   j                          |j                  dj	                  | j
                  | j
                               |j                   j                          t        |      }|j                  dj	                  t        | j                        | j
                  | j                  |             |j                   j                          y )Nimport boto3z{} = boto3.resource('{}')z{} = {}.{}({}))
r5   start_codeblocknew_linerS   rT   r   r   r   r   end_codeblock)r   r0   rK   example_valuess       r"   rH   zResourceDocumenter._add_examplec   s    %%' n%  )00""D$6$6	

 	 :;KL##4../""##		
 	##%r#   c                     |D ]x  }t        | j                  |      }|j                  d| d       |j                  j	                          |j                  d| d|        |j                  j	                          z y )Nz:type z: stringz:param z: )r   r   rS   r5   rZ   )r   r0   rK   identifier_namer>   s        r"   rI   z*ResourceDocumenter._add_params_descriptionz   sx    / 	%O4##_K MMF?"38<=MM""$MMGO#4B{mDEMM""$	%r#   c                 *   |j                   j                          |j                  d| d       |j                   j                          |j                   j                          | j                  |   D ]  }|j                   j                  |          y )Nz#These are the resource's available :)r5   rZ   rS   toctree
member_maptocitem)r   r0   resource_member_typemembers       r"   _add_overview_of_member_typez/ResourceDocumenter._add_overview_of_member_type   s{     23G2HJ	
 	 oo&:; 	/FMM!!VH.	/r#   c                    | j                   j                  j                  j                  }|j	                  d      }g }|r|| j
                  d<   t        |ddd       |D ]F  }|j                  |j                         t        |j                  d      }|j	                  d      }|j                  j                  | j                  d	       |j                  d
|j                          |j                  |j                         |j	                  |j                  d| j                   di      }t!        || j"                  |       t$        j&                  j)                  | j*                  | j,                   | j.                         }|j1                  ||j                         I |r| j3                  |d       y y )NrC   IdentifierszYIdentifiers are properties of a resource that are set upon instantiation of the resource.identifiers_attributes_intror0   resource_typer>   
intro_linkhtmltarget
breadcrumbindexz / Identifier / 	qualifier.context)r0   resource_nameidentifier_model)	_resourcemetaresource_modelrC   r4   rb   r   rD   rE   r   r5   ref_resource_class_namerS   add_title_sectionr=   r   r   ospathjoinr   r   r   write_to_filerf   )	r   r0   rC   member_listrL   identifier_docbreadcrumb_sectionidentifier_sectionidentifiers_dir_paths	            r"   r(   z#ResourceDocumenter._add_identifiers   s   nn))88DD))-8-8DOOM*&+> : & 	PJz/.zvNN!/!?!?!M$$(()B)BGL$$'7
7H%IJ,,Z__=!/!?!?$(9&;< "@ "  *"11!+ $&77<<$$%%&**+$ 
 (()=zO1	P4 --g}E r#   c           	         | j                   j                  j                  j                  j                  }i }| j                   j                  j                  j
                  rh|j                  | j                   j                  j                  j
                        }| j                   j                  j                  j                  |      }|j                  d      }g }|rt        |ddd       || j                  d<   t        |      D ]Q  }||   \  }}|j                  |       t        |d      }	|	j                  d      }
|
j                  j                  | j                   d	       |
j#                  d
|        |	j%                  |       |	j                  |d| j&                   di      }t)        || j*                  | j,                  || j                   j                  j                  j                  j.                  |       t0        j2                  j5                  | j6                  | j*                   | j8                         }|	j;                  ||       T |r| j=                  |d       y y )N
attributes
AttributeszAttributes provide access to the properties of a resource. Attributes are lazy-loaded the first time one is accessed via the :py:meth:`load` method.ri   rj   rm   rn   rp   rq   z / Attribute / rr   rs   rt   )r0   service_namerv   	attr_nameevent_emitter
attr_model)rx   ry   clientservice_modelrz   shape	shape_forget_attributesr4   r   rb   sortedrD   r   r5   r{   r|   rS   r}   r=   r   r   r   eventsr~   r   r   r   r   r   rf   )r   r0   r   r   r   attribute_listr   _
attr_shapeattribute_docr   attribute_sectionattributes_dir_paths                r"   r)   z"ResourceDocumenter._add_attributes   s3   ++2277EE
>>--33!++##2288E ,,;;JJJ )),7&*/
 :
 -;DOOL)
+ 	HI&y1MAz!!),-iGM!.!>!>|!L$$(()B)BGL$$yk%BC++I6 - = =$(9&;< !> ! )!//"11#"nn1188==DD% #%'',,$$%%&**+#
 ''(;YG9	H: --g|D r#   c                 j   |j                  d      }| j                  j                  j                  j                  }g }|rt        |ddd       || j                  d<   |D ];  }|j                  |j                         t        |j                  d      }|j                  d      }|j                  j                  | j                  d	       |j                  d
|j                          |j                  |j                         |j                  |j                  d| j                   di      }t!        ||       t"        j$                  j'                  | j(                  | j*                   | j,                         }|j/                  ||j                         > |r| j1                  |d       y y )N
references
ReferenceszNReferences are related resource instances that have a belongs-to relationship.references_introrj   rm   rn   rp   rq   z / Reference / rr   rs   rt   )r0   reference_model)r4   rx   ry   rz   r   r   rb   rD   rE   r   r5   r{   r|   rS   r}   r=   r	   r~   r   r   r   r   r   r   rf   )	r   r0   r   reference_list	referencereference_docr   reference_sectionreferences_dir_paths	            r"   r*   z"ResourceDocumenter._add_references   s   )),7^^((77BB
&*1 . -;DOOL)# 	MI!!)..1-innVLM!.!>!>|!L$$(()B)BGL$$y~~6F%GH++INN; - = =$(9&;< !> ! ) ) #%'',,$$%%&**+#
 ''(;Y^^L/	M0 --g|D r#   c                 (   |j                  d      }| j                  j                  j                  j                  }|rUt        | j                  | j                        }| j                  |_        |j                  |       | j                  |d       y y )Nactions)
r4   rx   ry   rz   r   r   r   rb   document_actionsrf   )r   r0   r   
documenters       r"   r+   zResourceDocumenter._add_actions  su    )))4..%%44<<)$..$:N:NOJ$(OOJ!''0--gyA	 r#   c                 (   |j                  d      }| j                  j                  j                  j                  }|rUt        | j                  | j                        }| j                  |_        |j                  |       | j                  |d       y y )Nzsub-resources)
r4   rx   ry   rz   subresourcesr   r   rb   document_sub_resourcesrf   )r   r0   sub_resourcesr   s       r"   r,   z%ResourceDocumenter._add_sub_resources&  sz    ))/:++::GG. 4 4J %)OOJ!--g6--gG r#   c                 (   |j                  d      }| j                  j                  j                  j                  }|rUt        | j                  | j                        }| j                  |_        |j                  |       | j                  |d       y y )Ncollections)
r4   rx   ry   rz   r   r   r   rb   document_collectionsrf   )r   r0   r   r   s       r"   r-   z#ResourceDocumenter._add_collections1  sz    ))-8nn))88DD- 4 4J %)OOJ!++G4--g}E r#   c                 t   |j                  d      }| j                  j                  j                  j                  }|r{| j
                  j                  | j                        }t        | j                  || j                        }| j                  |_
        |j                  |       | j                  |d       y y )Nwaiters)r4   rx   ry   rz   r   r   get_waiter_modelr   r   r   rb   document_resource_waitersrf   )r   r0   r   service_waiter_modelr   s        r"   r.   zResourceDocumenter._add_waiters<  s    )))4..%%44<<#'#9#9#J#J""$  2 4d6J6JJ %)OOJ!009--gyA r#   c                     |j                  d      }|j                  j                          |j                  d       |j                  j	                          y )Nzfeature-freezezBefore using anything on this page, please refer to the resources :doc:`user guide <../../../../guide/resources>` for the most recent guidance on using resources.)r4   r5   
start_noterS   end_noter/   s     r"   r&   z%ResourceDocumenter._add_resource_noteJ  sF    ))*:;  "+	

 	 r#   )__name__
__module____qualname__r   r1   r%   r'   rG   rH   rI   rf   r(   r)   r*   r+   r,   r-   r.   r&   __classcell__)r!   s   @r"   r   r   %   s]    9
#4.:
&.%/*FX7Er(ETB	H	FB!r#   r   c                   .    e Zd Zed        Zd Zd Zd Zy)ServiceResourceDocumenterc                      | j                    dS )Nz.ServiceResource)_service_docs_name)r   s    r"   r=   z$ServiceResourceDocumenter.class_nameV  s    ))**:;;r#   c                 \    |j                  d      }|j                  j                  d       y )Nr3   zService Resource)r4   r5   r6   r7   s      r"   r%   z$ServiceResourceDocumenter._add_titleZ  s'    //812r#   c                 V    t        | j                        }|j                  d|        y )NzA resource representing )r   rR   rS   rU   s      r"   rG   z*ServiceResourceDocumenter._add_description^  s)     9$:M:M N01F0GHIr#   c                    |j                   j                          |j                   j                          |j                  d       |j                   j                          |j                   j                          |j                  | j                   d| j                   d       |j                   j                          y )NrX   z = boto3.resource('z'))r5   rY   rZ   rS   r   r[   )r   r0   rK   s      r"   rH   z&ServiceResourceDocumenter._add_exampleb  s    %%' n%  !!""6t7I7I6J#N	
 	##%r#   N)r   r   r   propertyr=   r%   rG   rH    r#   r"   r   r   U  s$    < <3J	&r#   r   )r~   botocorer   botocore.docs.bcdoc.restdocr   botocore.docs.utilsr   boto3.docs.actionr   boto3.docs.attrr   r   r	   boto3.docs.baser
   boto3.docs.collectionr   boto3.docs.subresourcer   boto3.docs.utilsr   r   r   r   boto3.docs.waiterr   r   r   r   r#   r"   <module>r      sV    
  9 9 . 
 + 6 8  7m! m!`	& 2 &r#   