Ë
    >²Xj  ã            	       óÌ  — d Z ddlZddlZddlZddlZddlmZ ddlm	Z	m
Z
 dej                  dej                  fd„Zdej                  dej                  e   fd	„Zdej                  defd
„Zdej                  dej                  ej&                  eej                  e   ej                  e   f      fd„Z G d„ dej*                  «      Zdej.                  eef   de	ddfd„Zy)zbAttribute docstrings parsing.

.. seealso:: https://peps.python.org/pep-0257/#what-is-a-docstring
é    N)Ú
ModuleTypeé   )Ú	DocstringÚDocstringParamÚnodeÚreturnc                 ó   — t        | d«      S )z<Return the constant's value if the given node is a constant.Úvalue)Úgetattr©r   s    ú^/var/www/html/content_generation/venv/lib/python3.12/site-packages/docstring_parser/attrdoc.pyÚast_get_constant_valuer      s   € ä�4˜Ó!Ð!ó    c                 óö   — t        t        d«      rt        j                  | «      S t        | t        j                  «      rt        t        | «      «      S t        | t        j                  «      r| j                  S y)z0Convert the AST node to source code as a string.ÚunparseN)	ÚhasattrÚastr   Ú
isinstanceÚConstantÚstrr   ÚNameÚidr   s    r   Úast_unparser      sT   € äŒs�IÔÜ�{‰{˜4Ó Ð ä�$œŸ™Ô%ÜÔ)¨$Ó/Ó0Ð0Ü�$œŸ™Ô!Ø�w‰wˆØr   c                 óÌ   — t        | t        j                  «      xrI t        | j                  t        j                  «      xr# t        t        | j                  «      t        «      S )z2Return True if the given node is a literal string.)r   r   ÚExprr
   r   r   r   r   s    r   Úast_is_literal_strr       sI   € ô 	�4œŸ™Ó"ò 	@Ü�t—z‘z¤3§<¡<Ó0ò	@äÔ-¨d¯j©jÓ9¼3Ó?ðr   c                 ó¼  — t        | t        j                  t        j                  f«      r²t        | t        j                  «      r| j                  d   n| j
                  }t        |t        j                  «      rcd}t        | t        j                  «      rt        | j                  «      }d}| j                  rt        | j                  «      }|j                  ||fS y)z@Return name, type and default if the given node is an attribute.r   N)r   r   ÚAssignÚ	AnnAssignÚtargetsÚtargetr   r   Ú
annotationr
   r   )r   r!   Útype_strÚdefaults       r   Úast_get_attributer%   )   s�   € ô �$œŸ™¤S§]¡]Ð3Ô4ä)¨$´·
±
Ô;ˆD�L‰L˜ŠOÀÇÁð 	ô �fœcŸh™hÔ'ØˆHÜ˜$¤§¡Ô.Ü& t§¡Ó7�ØˆGØ�zŠzÜ% d§j¡jÓ1�Ø—9‘9˜h¨Ð/Ð/Ør   c            
       ó´   — e Zd ZdZdZdZd„ Zdej                  dej                  e
ej                  e
ej                  e
   ej                  e
   f   f   fd„Zy)ÚAttributeDocstringsz6An ast.NodeVisitor that collects attribute docstrings.Nc                 ó4  — | j                   r@t        |«      r5| j                   \  }}}t        |j                  «      ||f| j                  |<   t        |«      | _         t        |t        j                  t        j                  f«      r| j                  |«       y y ©N)Ú	prev_attrr   r   r
   Ú	attr_docsr%   r   r   ÚClassDefÚModuleÚgeneric_visit)Úselfr   Ú	attr_nameÚ	attr_typeÚattr_defaults        r   ÚvisitzAttributeDocstrings.visitB   s{   € Ø�>Š>Ô0°Ô6Ø15·±Ñ.ˆI�y ,ä& t§z¡zÓ2ØØð)ˆD�N‰N˜9Ñ%ô
 +¨4Ó0ˆŒÜ�dœSŸ\™\¬3¯:©:Ð6Ô7Ø×Ñ˜tÕ$ð 8r   Ú	componentr   c                 ó  — i | _         d| _        	 t        j                  t	        j
                  |«      «      }t        j                  |«      }t	        j                  |«      r| j                  |«       | j                   S t        |t        j                  «      rEt        |j                  d   t        j                  «      r| j                  |j                  d   «       | j                   S # t        $ r Y | j                   S w xY w)zãGet attribute docstrings from the given component.

        :param component: component to process (class or module)
        :returns: for each attribute docstring, a tuple with (description,
            type, default)
        Nr   )r+   r*   ÚtextwrapÚdedentÚinspectÚ	getsourcer   ÚparseÚismoduler3   r   r-   Úbodyr,   ÚOSError)r/   r4   ÚsourceÚtrees       r   Úget_attr_docsz!AttributeDocstrings.get_attr_docsN   sÎ   € ð ˆŒØˆŒð	)Ü—_‘_¤W×%6Ñ%6°yÓ%AÓBˆFô —9‘9˜VÓ$ˆDÜ×Ñ 	Ô*Ø—
‘
˜4Ô ð
 �~‰~Ðô	 ˜D¤#§*¡*Ô-´*Ø—	‘	˜!‘œcŸl™lô3ð —
‘
˜4Ÿ9™9 Q™<Ô(Ø�~‰~Ðøô ò 	Øð �~‰~Ðð	ús   �(C* Ã*	DÄ D)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r+   r*   r3   ÚTÚAnyÚDictr   ÚTupleÚOptionalr@   © r   r   r'   r'   <   s[   „ Ù@à€IØ€Iò
%ðØŸ™ðà	
�‰��Q—W‘W˜S !§*¡*¨S¡/°1·:±:¸c±?ÐBÑCÐCÑ	Dôr   r'   ÚobjÚ	docstringc           	      ó  — t        d„ |j                  D «       «      }t        «       j                  | «      j	                  «       D ]>  \  }\  }}}||vsŒt        d|g||||du|¬«      }|j                  j                  |«       Œ@ y)zûAdd attribute docstrings found in the object's source code.

    :param obj: object from which to parse attribute docstrings
    :param docstring: Docstring object where found attributes are added
    :returns: list with names of added attributes
    c              3   ó4   K  — | ]  }|j                   –— Œ y ­wr)   )Úarg_name)Ú.0Úps     r   Ú	<genexpr>z+add_attribute_docstrings.<locals>.<genexpr>q   s   è ø€ Ð6Ñ%5 �—•Ñ%5ùs   ‚Ú	attributeN)ÚargsÚdescriptionrO   Ú	type_nameÚis_optionalr$   )ÚsetÚparamsr'   r@   Úitemsr   ÚmetaÚappend)rK   rL   rY   rO   rU   rV   r$   Úparams           r   Úadd_attribute_docstringsr^   h   s�   € ô Ñ6 Y×%5Ò%5Ó6Ó6€FäÓ×+Ñ+¨CÓ0×6Ñ6Ö8ñ 	4ˆÑ3�; 	¨7ð ˜6Ò!Ü"Ø! 8Ð,Ø'Ø!Ø#Ø#¨4Ð/ØôˆEð �N‰N×!Ñ! %Õ(ñ 	9r   )rD   r   r8   r6   ÚtypingrE   Útypesr   Úcommonr   r   ÚASTrF   r   rI   r   r   Úboolr   rH   r%   ÚNodeVisitorr'   ÚUnionÚtyper^   rJ   r   r   Ú<module>rg      sí   ðñó
 Û Û Û Ý ç -ð" §¡ð "¨Q¯U©Uó "ð
	�c—g‘gð 	 !§*¡*¨S¡/ó 	ð˜SŸW™Wð ¨ó ðØ
�'‰'ðà‡Z�Z�—‘˜˜QŸZ™Z¨™_¨a¯j©j¸©oÐ=Ñ>Ñ?óô&)˜#Ÿ/™/ô )ðX)Ø	
�‰��zÐ!Ñ	"ð)Ø/8ð)à	ô)r   