
    c{0                     n
   d 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mZ ddlmZ ddlmZ d	Z ed
g d          Z G d d          Z G d d          Ze                    dd          Ze                    dd          Ze                    dd          Ze                    dd          Ze                    dd          Ze                    dd          Ze                    dd          Ze                    dd          Ze                    d d!          Ze                    d"d#          Z e                     d$d%d&          Z!e                     d'd(d&          Z"e                     d)d*d&          Z#e                     d+d,d&          Z$e                     d-d.d&          Z%e                     d/d0d&          Z&e                     d1d2          Z'e                     d3d4          Z(e                     d5d6          Z)e                     d7d8          Z*e                     d9d:          Z+e                     d;d<d&          Z,e                     d=d>          Z-e                     d?d@          Z.e                     dAdBdC          Z/e                     dDdEdF          Z0e                    dGdH          Z1e1                    dIdJdK          Z2e1                    dLdM          Z3e1                    dNdO          Z4e                    dPdQ          Z5e5                    dRdSdT          Z6e5                    dUdVdW          Z7e5                    dUdXdY          Z8e5                    dZd[          Z9e5                    d\d]d^          Z:e5                    d_d`          Z;e5                    dadbd^          Z<e5                    dcddd^          Z=e5                    dedfdC          Z>e5                    dgdhdC          Z?e5                    didjdk          Z@e5                    dldmdC          ZAe5                    dndodC          ZBe5                    dpdqdC          ZCe5                    drdsdC          ZDe5                    dtdudC          ZEe5                    dvdwdT          ZFe5                    dxdyd^          ZGe5                    dzd{d|          ZHe5                    d}d~          ZIe5                    dd          ZJ G d deK          ZL eMeN                                          ZO eLeOh dz
  eOh dz
  eOh dz
  d          ZPdS )zDocstring violation definition.    )
namedtuple)partial)	dropwhile)AnyCallableIterableListOptional   )
Definitionis_blank)ErrorErrorRegistryconventionsErrorParams)code
short_desccontextc            
           e Zd ZdZdZdZdedededee         ddf
d	Zd
e	deddfdZ
 ed           Z ed           Zedefd            Zedefd            ZdefdZdefdZdd defdZdS )r   zError in docstring style.Fr   r   r   
parametersreturnNc                 Z    || _         || _        || _        || _        d| _        d| _        dS )zYInitialize the object.

        `parameters` are specific to the created error.

        N)r   r   r   r   
definitionexplanation)selfr   r   r   r   s        5lib/python3.11/site-packages/pydocstyle/violations.py__init__zError.__init__   s5     	$$    r   r   c                 "    || _         || _        dS )z+Set the source code context for this error.N)r   r   )r   r   r   s      r   set_contextzError.set_context+   s    $&r   c                 $    | j         j        j        S N)r   modulenamer   s    r   <lambda>zError.<lambda>0   s    T_%;%@ r   c                     | j         j        S r#   )r   error_linenor&   s    r   r'   zError.<lambda>1   s    != r   c                 p    | j          d| j         }| j         | j        j        | j         }|d| dz  }|S )z(Return the message to print to the user.z: Nz ())r   r   r   formatr   )r   retspecific_error_msgs      r   messagezError.message3   sU     //do//< 	.!4!4do!F-*----C
r   c                    | j         dS d}| j         j                            d          }| j         j        }t	          t          t	          t          t          t          |                                                  }t          t          |t          |          z                       }d| d}t          |          D ]5\  }}|rd|z   }||                    ||z   |          z  }|dk    r|d	z  } n6|S )
z,Return the source code lines for this error.N T)keependsz{:z}:{}    z        ...
)r   source
splitlinesstartlistreversedr   r   lenstr	enumerater,   )	r   r5   linesoffsetlines_strippednumbers_widthline_formatnlines	            r   r=   zError.lines<   s    ? 	2&1141@@&T)Hhuoo>>??@@
 
 C^)<)< <==>>2M222 00 	 	GAt "Tzk((VT:::F1u /) r   c                 6     j         r<d                    d  j                             d          D                        _         d} j        r j        r|dz  }n' j        r j        s|dz  }n j        r j        s|dz  } |j        d	i  fddD             S )
N
c              3   8   K   | ]}t          |          |V  d S r#   r   ).0ls     r   	<genexpr>z Error.__str__.<locals>.<genexpr>T   sA       ) )x{{)) ) ) ) ) )r   z1{filename}:{line} {definition}:
        {message}z

{explanation}

{lines}
z


{lines}
z

{explanation}

c                 2    i | ]}|t          |          S  )getattr)rG   r%   r   s     r   
<dictcomp>z!Error.__str__.<locals>.<dictcomp>_   s5     
 
 
 gdD))
 
 
r   )filenamerC   r   r/   r   r=   rK   )r   joinsplitr5   explainr,   )r   templates   ` r   __str__zError.__str__R   s     	#yy ) )+11$77) ) )    D H; 	04< 	088HH[ 	0 	0'HH\ 	0$+ 	0//Hx 
 

 
 
 

 
 

 
 	
r   c                      t          |           S r#   )r;   r&   s    r   __repr__zError.__repr__l   s    4yyr   otherc                 >    | j         | j        f|j         |j        fk     S r#   )rN   rC   )r   rV   s     r   __lt__zError.__lt__o   s    ty)U^UZ,HHHr   )__name__
__module____qualname____doc__rQ   r5   r;   r   r   r   r!   propertyrN   rC   r/   r=   rS   rU   boolrX   rK   r   r   r   r      sk       ## GF     	 
 c]  
       &'j 's 't ' ' ' '
 x@@AAH8==>>D    X s    X*
 
 
 
 
4#    IG I I I I I I Ir   r   c                       e Zd ZdZg Z G d d          Zedededefd            Zede	e         fd            Z
edefd	            Zd
S )r   z1A registry of all error codes, divided to groups.c                   l    e Zd ZdZdededdfdZ	 ddeded	ee         deee         ge	f         fd
Z
dS )ErrorRegistry.ErrorGroupz#A group of similarly themed errors.prefixr%   r   Nc                 0    || _         || _        g | _        dS )zInitialize the object.

            `Prefix` should be the common prefix for errors in this group,
            e.g., "D1".
            `name` is the name of the group (its subject).

            N)rb   r%   errors)r   rb   r%   s      r   r   z!ErrorRegistry.ErrorGroup.__init__{   s     !DKDIDKKKr   
error_code
error_descerror_contextc                     t          |||          }t          t          g|R  }| j                            |           |S )z9Create an error, register it to this group and return it.)r   r   r   rd   append)r   re   rf   rg   error_paramsfactorys         r   create_errorz%ErrorRegistry.ErrorGroup.create_error   sE     'z:}MMLe3l333GK|,,,Nr   r#   )rY   rZ   r[   r\   r;   r   r
   r   r   r   rl   rK   r   r   
ErrorGroupra   x   s        11
	3 
	c 
	d 
	 
	 
	 
	  ,0		 		 	 $C=		
 x}ou,-	 	 	 	 	 	r   rm   rb   r%   r   c                 f    |                      ||          }| j                            |           |S )z'Create a new error group and return it.)rm   groupsri   )clsrb   r%   groups       r   create_groupzErrorRegistry.create_group   s2     vt,,
%   r   c              #   D   K   | j         D ]}|j        D ]}|j        V  dS )zYield all registered codes.N)ro   rd   r   )rp   rq   errors      r   get_error_codeszErrorRegistry.get_error_codes   sJ       Z 	! 	!E ! !j    !	! 	!r   c                    t          d | j        D                       }dd|dz   z  z   dz   }d|dz   dz  z   d	z   }d
}| j        D ]}||z  }||z  }|dd|j         d                    |dz             z   d	z   z  }||z  }|j        D ]K}||z  }|d|j                            d          z   dz   |j                            |dz             z   d	z   z  }L||z  }|S )z;Output the registry as reStructuredText, for documentation.c              3   R   K   | ]"}|j         D ]}t          |j                  V  #d S r#   )rd   r:   r   )rG   rq   rt   s      r   rI   z'ErrorRegistry.to_rst.<locals>.<genexpr>   sZ       
 

 
   !!
 
 
 
 
 
 
r   z+------+-   z+
|	   r3   z|
r1   z**   z| r   )maxro   r%   centerrd   r   r   ljust)rp   max_lensep_line
blank_linetablerq   rt   s          r   to_rstzErrorRegistry.to_rst   sT     
 

 
 
 
 

 '!)<<uDGaK3..6
Z 	 	EXEZES.
...55gkBBBUJJEZE  !j''**+ &,,Wq[99: 	 	r   N)rY   rZ   r[   r\   ro   rm   classmethodr;   rr   r   ru   r   rK   r   r   r   r   s   s        ;;F       : # S Z    [ ! ! ! ! [! s    [  r   r   D1zMissing DocstringsD100z"Missing docstring in public moduleD101z!Missing docstring in public classD102z"Missing docstring in public methodD103z$Missing docstring in public functionD104z#Missing docstring in public packageD105z!Missing docstring in magic methodD106z(Missing docstring in public nested classD107zMissing docstring in __init__D2zWhitespace IssuesD200z5One-line docstring should fit on one line with quotesz	found {0}D201z0No blank lines allowed before function docstringD202z/No blank lines allowed after function docstringD203z,1 blank line required before class docstringD204z+1 blank line required after class docstringD205z:1 blank line required between summary line and descriptionD206z2Docstring should be indented with spaces, not tabsD207zDocstring is under-indentedD208zDocstring is over-indentedD209z@Multi-line docstring closing quotes should be on a separate lineD210z1No whitespaces allowed surrounding docstring textD211z-No blank lines allowed before class docstringD212z;Multi-line docstring summary should start at the first lineD213z<Multi-line docstring summary should start at the second lineD214zSection is over-indentedz{0!r}D215z"Section underline is over-indentedzin section {0!r}D3zQuotes IssuesD300zUse """triple double quotes"""zfound {0}-quotesD301z*Use r""" if any backslashes in a docstringD302z+Deprecated: Use u""" for Unicode docstringsD4zDocstring Content IssuesD400z#First line should end with a periodz	not {0!r}D401z'First line should be in imperative moodzperhaps '{0}', not '{1}'z7First line should be in imperative mood; try rephrasingzfound '{0}'D402z3First line should not be the function's "signature"D403z;First word of the first line should be properly capitalizedz{0!r}, not {1!r}D404z0First word of the docstring should not be `This`D405z+Section name should be properly capitalizedD406z&Section name should end with a newlineD407z&Missing dashed underline after sectionD408zDSection underline should be in the line following the section's nameD409z5Section underline should match the length of its namez1Expected {0!r} dashes in section {1!r}, got {2!r}D410z Missing blank line after sectionD411z!Missing blank line before sectionD412z?No blank lines allowed between a section header and its contentD413z%Missing blank line after last sectionD414zSection has no contentD415zHFirst line should end with a period, question mark, or exclamation pointD416z$Section name should end with a colonD417z.Missing argument descriptions in the docstringz;argument(s) {0} are missing descriptions in {1!r} docstringD418zGFunction/ Method decorated with @overload shouldn't contain a docstringD419zDocstring is emptyc                       e Zd ZdedefdZdS )AttrDictitemr   c                     | |         S r#   rK   )r   r   s     r   __getattr__zAttrDict.__getattr__  s    Dzr   N)rY   rZ   r[   r;   r   r   rK   r   r   r   r     s6               r   r   >   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   >	   r   r   r   r   r   r   r   r   r   >   r   r   r   r   r   r   r   r   r   r   r   r   )pep257numpygoogleN)Qr\   collectionsr   	functoolsr   	itertoolsr   typingr   r   r   r	   r
   parserr   utilsr   __all__r   r   r   rr   D1xxrl   r   r   r   r   r   r   r   r   D2xxr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   D3xxr   r   r   D4xxr   r   D401br   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   dictr   setru   
all_errorsr   rK   r   r   <module>r      s   % % " " " " " "             : : : : : : : : : : : : : :            
3 j(I(I(IJJ_I _I _I _I _I _I _I _IDJ J J J J J J JZ !!$(<==
(  
'  
(  
*  
)  
'  
.  
# 
 !!$(;<<
> 
 
6 
 
5 
 
2 
 
1 
 
@ 
 
8  
!  
   
F  
7  
3 
 
A  
B  
 
 
(  !!$88
$ 
 
0  
1 
 !!$(BCC
) 
 
- 
 	
=	 	
 
:  
A 
 
6  
1 
 
, 
 
, 
 
K 
 
;7 
 
& 
 
' 
 
E 
 
+ 
 
 
 
	%   
* 
 
4A  
N  
     t   
 S..0011
 h
 
 

* 

 

 


 
 
 

E1 13 3r   