ó
    Ð]j  ã            	       óÖ  • S r SSKrSSKrSSKrSSKrSSKJr  SSKJ	r	J
r
  S\R                  S\R                  4S jrS\R                  S\R                  \   4S	 jrS\R                  S\4S
 jrS\R                  S\R                  \R&                  \\R                  \   \R                  \   4      4S jr " S S\R*                  5      rS\R.                  \\4   S\	SS4S jrg)zbAttribute docstrings parsing.

.. seealso:: https://peps.python.org/pep-0257/#what-is-a-docstring
é    N)Ú
ModuleTypeé   )Ú	DocstringÚDocstringParamÚnodeÚreturnc                 ó   • [        U S5      $ )z<Return the constant's value if the given node is a constant.Úvalue)Úgetattr©r   s    ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/docstring_parser/attrdoc.pyÚast_get_constant_valuer      s   € ä�4˜Ó!Ð!ó    c                 ó  • [        [        S5      (       a  [        R                  " U 5      $ [        U [        R                  5      (       a  [        [        U 5      5      $ [        U [        R                  5      (       a  U R                  $ g)z0Convert the AST node to source code as a string.ÚunparseN)	ÚhasattrÚastr   Ú
isinstanceÚConstantÚstrr   ÚNameÚidr   s    r   Úast_unparser      s]   € äŒs�I×ÑÜ�{Š{˜4Ó Ð ä�$œŸ™×%Ñ%ÜÔ)¨$Ó/Ó0Ð0Ü�$œŸ™×!Ñ!Ø�w‰wˆØr   c                 óà   • [        U [        R                  5      =(       aN    [        U R                  [        R                  5      =(       a#    [        [        U R                  5      [        5      $ )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                 óì  • [        U [        R                  [        R                  45      (       aÅ  [        U [        R                  5      (       a  U R                  S   OU R
                  n[        U[        R                  5      (       al  Sn[        U [        R                  5      (       a  [        U R                  5      nSnU R                  (       a  [        U R                  5      nUR                  X#4$ g)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Ñ4ä)¨$´·
±
×;Ñ;ˆD�L‰L˜ŠOÀÇÁð 	ô �fœcŸh™h×'Ñ'ØˆHÜ˜$¤§¡×.Ñ.Ü& t§¡Ó7�ØˆGØ�z�zÜ% d§j¡jÓ1�Ø—9‘9˜hÐ/Ð/Ør   c            
       ó¾   • \ rS rSrSrSrSrS rS\R                  S\R                  \\R                  \\R                  \   \R                  \   4   4   4S jrSrg)	ÚAttributeDocstringsé<   z6An ast.NodeVisitor that collects attribute docstrings.Nc                 óP  • U R                   (       aD  [        U5      (       a4  U R                   u  p#n[        UR                  5      UU4U R                  U'   [        U5      U l         [        U[        R                  [        R                  45      (       a  U R                  U5        g g ©N)Ú	prev_attrr   r   r
   Ú	attr_docsr%   r   r   ÚClassDefÚModuleÚgeneric_visit)Úselfr   Ú	attr_nameÚ	attr_typeÚattr_defaults        r   ÚvisitÚAttributeDocstrings.visitB   s   € Ø�>�>Ô0°×6Ñ6Ø15·±Ñ.ˆI ,ä& t§z¡zÓ2ØØð)ˆD�N‰N˜9Ñ%ô
 +¨4Ó0ˆŒÜ�dœSŸ\™\¬3¯:©:Ð6×7Ñ7Ø×Ñ˜tÕ$ð 8r   Ú	componentr   c                 ó0  • 0 U l         SU l         [        R                  " [        R
                  " U5      5      n[        R                  " U5      n[        R                  " U5      (       a  U R                  U5        U R                   $ [        U[        R                  5      (       aJ  [        UR                  S   [        R                  5      (       a  U R                  UR                  S   5        U R                   $ ! [         a     U R                   $ f = f)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Úismoduler4   r   r.   Úbodyr-   ÚOSError)r0   r6   ÚsourceÚtrees       r   Úget_attr_docsÚ!AttributeDocstrings.get_attr_docsN   sÙ   € ð ˆŒØˆŒð	)Ü—_’_¤W×%6Ò%6°yÓ%AÓBˆFô —9’9˜VÓ$ˆDÜ×Ò 	×*Ñ*Ø—
‘
˜4Ô ð
 �~‰~Ðô	 ˜D¤#§*¡*×-Ñ-´*Ø—	‘	˜!‘œcŸl™l÷3ñ 3ð —
‘
˜4Ÿ9™9 Q™<Ô(Ø�~‰~Ðøô ó 	Øð �~‰~Ðð	ús   �*C= Ã=
DÄD)r,   r+   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r,   r+   r4   ÚTÚAnyÚDictr   ÚTupleÚOptionalrB   Ú__static_attributes__© r   r   r'   r'   <   s[   † Ù@à€IØ€Iò
%ðØŸ™ðà	
�‰��Q—W‘W˜S !§*¡*¨S¡/°1·:±:¸c±?ÐBÑCÐCÑ	D÷r   r'   ÚobjÚ	docstringc           
      ó  • [        S UR                   5       5      n[        5       R                  U 5      R	                  5        H=  u  nu  pEnX2;  d  M  [        SU/UUUUSLUS9nUR                  R                  U5        M?     g)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   ó8   #   • U  H  oR                   v •  M     g 7fr*   )Úarg_name)Ú.0Úps     r   Ú	<genexpr>Ú+add_attribute_docstrings.<locals>.<genexpr>q   s   é € Ð6Ò%5 —–Ò%5ùs   ‚Ú	attributeN)ÚargsÚdescriptionrT   Ú	type_nameÚis_optionalr$   )ÚsetÚparamsr'   rB   Úitemsr   ÚmetaÚappend)rP   rQ   r_   rT   r[   r\   r$   Úparams           r   Úadd_attribute_docstringsrd   h   s‰   € ô Ñ6 Y×%5Ò%5Ó6Ó6€FäÓ×+Ñ+¨CÓ0×6Ñ6Ö8ñ 	4ˆÑ3�;¨7ð Õ!Ü"Ø! 8Ð,Ø'Ø!Ø#Ø#¨4Ð/ØñˆEð �N‰N×!Ñ! %Ö(ò 	9r   )rH   r   r:   r8   ÚtypingrI   Útypesr   Úcommonr   r   ÚASTrJ   r   rM   r   r   Úboolr   rL   r%   ÚNodeVisitorr'   ÚUnionÚtyperd   rO   r   r   Ú<module>rm      sí   ðñó
 Û Û Û Ý ç -ð" §¡ð "¨Q¯U©Uô "ð
	�c—g‘gð 	 !§*¡*¨S¡/ô 	ð˜SŸW™Wð ¨ô ðØ
�'‰'ðà‡Z�Z�—‘˜˜QŸZ™Z¨™_¨a¯j©j¸©oÐ=Ñ>Ñ?ôô&)˜#Ÿ/™/ô )ðX)Ø	
�‰��zÐ!Ñ	"ð)Ø/8ð)à	õ)r   