
    c                       d dl mZ d dlZd dlmZ d dlmZ dZ ej        eej	                  Z
 G d de          Z ed          Z ed	          Zd
                     eeez  ed                    ZddeddfdddgZd
                    d eD                       Zd$dZ G d de          Z G d de          Z G d d e          Zd%d#ZdS )&    )annotationsN)	Generator)
NamedTuplea  
    (?:^\s*\#.*|\s*|               # Comment line, or whitespaces,
       \s*\#.*(?=\#.*?\bpylint:))  # or a beginning of an inline comment
                                   # followed by "pylint:" pragma
    (\#                            # Beginning of comment
    .*?                            # Anything (as little as possible)
    \bpylint:                      # pylint word and column
    \s*                            # Any number of whitespaces
    ([^;#\n]+))                    # Anything except semicolon or hash or
                                   # newline (it is the second matched group)
                                   # and end of the first matched group
    [;#]{0,1}                      # From 0 to 1 repetition of semicolon or hash
c                  $    e Zd ZU ded<   ded<   dS )PragmaRepresenterstraction	list[str]messagesN)__name__
__module____qualname____annotations__     :lib/python3.11/site-packages/pylint/utils/pragma_parser.pyr   r      s'         KKKr   r   )zdisable-allz	skip-file)zdisable-nextzdisable-msgz
enable-msgdisableenable|T)keyreverseKEYWORDz\b(sz)\b)MESSAGE_STRINGz[0-9A-Za-z\-\_]{2,})ASSIGN=)MESSAGE_NUMBERz[CREIWF]{1}\d*c              #  2   K   | ]\  }}d |dd|ddV  dS )z(?P<r   >)Nr   ).0
token_name	token_rgxs      r   	<genexpr>r$   7   sS        
I ):((()((((     r   r	   r   r   r
   returnc                X    |s| t           v rt          d|           t          | |          S )Nz1The keyword is not followed by message identifier)MESSAGE_KEYWORDSInvalidPragmaErrorr   )r	   r   s     r   emit_pragma_representerr)   =   s@     
"22 
 ?
 
 	
 VX...r   c                  $     e Zd ZdZd fdZ xZS )	PragmaParserErrorz6A class for exceptions thrown by pragma_parser module.messager   tokenr%   Nonec                p    || _         || _        t                                          | j                    dS )z:args message: explain the reason why the exception has been thrown
        :args token: token concerned by the exception.
        N)r,   r-   super__init__)selfr,   r-   	__class__s      r   r1   zPragmaParserError.__init__H   s3     
&&&&&r   )r,   r   r-   r   r%   r.   )r   r   r   __doc__r1   __classcell__)r3   s   @r   r+   r+   E   sC        @@' ' ' ' ' ' ' ' ' 'r   r+   c                      e Zd ZdZdS )UnRecognizedOptionErrorz6Thrown in case the of a valid but unrecognized option.Nr   r   r   r4   r   r   r   r7   r7   Q   s        @@@@r   r7   c                      e Zd ZdZdS )r(   z%Thrown in case the pragma is invalid.Nr8   r   r   r   r(   r(   U   s        ////r   r(   pylint_pragma(Generator[PragmaRepresenter, None, None]c              #  "  K   d }g }d}d}t          j        t          |           D ]}|j        }|                                }|dk    r9|s4|rt          d|          |rt          d|          t          dd          d}ng|rt          d|pd          |dk    r"|rt          ||          V  |}g }|t          v }n+|d	v r|	                    |           d}nt          d
          |}|rt          ||          V  d S t          d|          )NF r   z&The keyword doesn't support assignmentzThe keyword is unknownz!Missing keyword before assignmentz'The = sign is missing after the keywordr   >   r   r   zToken not recognized)refinditer	TOK_REGEX	lastgroupgroupr7   r(   r)   r'   appendRuntimeError)r:   r	   r   assignment_requiredprevious_tokenmokindvalues           r   parse_pragmarJ   Y   s     FHNk)]33 # #|

8 	7& R 1@&   " 10.   ))LbQQQ"'  	7$96<R   Y 
	7 @-fh?????FH"(,<"<99 	7OOE""""'5666 P%fh7777777%&>OOOr   )r	   r   r   r
   r%   r   )r:   r   r%   r;   )
__future__r   r>   collections.abcr   typingr   
OPTION_RGXcompileVERBOSE	OPTION_POr   	frozensetATOMIC_KEYWORDSr'   joinsortedlenALL_KEYWORDSTOKEN_SPECIFICATIONr@   r)   	Exceptionr+   r7   r(   rJ   r   r   r   <module>rZ      s  
 # " " " " " 				 % % % % % %      

 BJz2:..	    
   
 )8999F   xx
F?--3EEE  *|****+.)	  HH  !4    	/ / / /	' 	' 	' 	' 	'	 	' 	' 	'A A A A A/ A A A0 0 0 0 0* 0 0 0.P .P .P .P .P .Pr   