
    h                        S r SSKJr  SSKrSSKrSSKrSSKJr   " S S\R                  5      r	S
S jr
SS jrSSS	 jjrg)z4Utilities related to attribute docstring extraction.    )annotationsN)Anyc                  P   ^  \ rS rSrSU 4S jjrSU 4S jjrS	S jrS
S jrSrU =r	$ )DocstringVisitor   c                L   > [         TU ]  5         S U l        0 U l        S U l        g N)super__init__targetattrsprevious_node_type)self	__class__s    U/var/www/html/env/lib/python3.13/site-packages/pydantic/_internal/_docs_extraction.pyr   DocstringVisitor.__init__   s$    "&%'
8<    c                F   > [         TU ]  U5      n[        U5      U l        U$ r	   )r
   visittyper   )r   nodenode_resultr   s      r   r   DocstringVisitor.visit   s#    gmD)"&t*r   c                    [        UR                  [        R                  5      (       a  UR                  R                  U l        g g r	   )
isinstancer   astNameid)r   r   s     r   visit_AnnAssign DocstringVisitor.visit_AnnAssign   s+    dkk388,,++..DK -r   c                   [        UR                  [        R                  5      (       a  [        UR                  R                  [        5      (       ay  U R
                  [        R                  L a[  [        R                  " UR                  R                  5      nU R                  (       a  X R                  U R                  '   S U l	        g g g g r	   )r   valuer   Constantstrr   	AnnAssigninspectcleandocr   r   )r   r   	docstrings      r   
visit_ExprDocstringVisitor.visit_Expr   s    tzz3<<004::++S11''3==8(()9)9:I{{*3

4;;'DK 9 2 1r   )r   r   r   )returnNone)r   zast.ASTr+   r   )r   zast.AnnAssignr+   r   )r   zast.Exprr+   r   )
__name__
__module____qualname____firstlineno__r   r   r   r)   __static_attributes____classcell__)r   s   @r   r   r      s    =
)	 	r   r   c                    [         R                  " SR                  U 5      5      nUR                  S5      (       a  SU 3nU$ )N ) 	zdef dedent_workaround():
)textwrapdedentjoin
startswith)sourcededent_sources     r   _dedent_source_linesr=   (   s=    OOBGGFO4M,, 5]ODr   c                   [         R                  " 5       nU(       Ga.  [         R                  " U5      [         R                  " U 5      L a  UR                  n [         R                  " U5      u  p4[         R
                  " X2S-
  S  5      n[        U5      n [        R                  " U5      nUR                  S   n[        U[        R                  5      (       a  UR                  S:X  a  UR                  S   n[        U[        R                  5      (       a  UR                  U R                  :X  a  U$ UR"                  nU(       a  GM-  g g ! [         a     N$f = f! [          a     N4f = f)N   r   dedent_workaround)r&   currentframe	getmodulef_lineno
findsourcegetblockr=   r   parsebodyr   FunctionDefnameClassDefr-   SyntaxErrorOSErrorf_back)	clsframelnumlines_block_linesr<   
block_treestmts	            r   _extract_source_from_framerV   3   s"     "E
U#w'8'8'==>>D+"--e4 &..uAXZ/@A 4[ A
+!$=!9J &??1-D!$88TYYJ]=]#yy|!$55$))s||:S**1 % #    s$   E E 
EE
E*)E*c                   U(       a   [         R                  " U 5      u  p#O[        U 5      nU(       d  0 $ [	        U5      n[        5       nUR                  [        R                  " U5      5        UR                  $ ! [         a    0 s $ f = f)a<  Map model attributes and their corresponding docstring.

Args:
    cls: The class of the Pydantic model to inspect.
    use_inspect: Whether to skip usage of frames to find the object and use
        the `inspect` module instead.

Returns:
    A mapping containing attribute names and their corresponding docstring.
)
r&   getsourcelinesrL   rV   r=   r   r   r   rF   r   )rN   use_inspectr;   rR   r<   visitors         r   extract_docstrings_from_clsr[   Q   s{     	..s3IFA ,C0	(0M GMM#))M*+==  	I	s   A< <B
B)r;   z	list[str]r+   r$   )rN   	type[Any]r+   zlist[str] | None)F)rN   r\   rY   boolr+   zdict[str, str])__doc__
__future__r   r   r&   r7   typingr   NodeVisitorr   r=   rV   r[    r   r   <module>rc      s6    : " 
   s :<r   