o
    g                     @   s   d dl Z d dlmZ d dlmZmZ dZe ee jZ	eddZ
edZedZd	eeeB ed
dZddeddfdddgZd	dd eD Zdd ZG dd deZG dd deZG dd deZdedee
ddf fdd ZdS )!    N)
namedtuple)	GeneratorListun  
    \s*                # Any number of whithespace
    \#?                # One or zero hash
    .*                 # Anything (as much as possible)
    (\s*               # Beginning of first matched group and any number of whitespaces
    \#                 # 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}PragmaRepresenterzaction messages)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                 c   s*    | ]\}}d |dd|ddV  qdS )z(?P<r   >)N ).0
token_name	token_rgxr   r   X/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/pylint/utils/pragma_parser.py	<genexpr>1   s
    
r   c                 C   s    |s| t v rtd| t| |S )Nz1The keyword is not followed by message identifier)MESSAGE_KEYWORDSInvalidPragmaErrorr   )actionmessagesr   r   r   emit_pragma_representer7   s
   
r   c                       s    e Zd ZdZ fddZ  ZS )PragmaParserErrorz?
    A class for exceptions thrown by pragma_parser module
    c                    s   || _ || _t | j  dS )z
        :args message: explain the reason why the exception has been thrown
        :args token: token concerned by the exception
        N)messagetokensuper__init__)selfr   r    	__class__r   r   r"   D   s   zPragmaParserError.__init__)__name__
__module____qualname____doc__r"   __classcell__r   r   r$   r   r   ?   s    r   c                   @      e Zd ZdZdS )UnRecognizedOptionErrorz?
    Thrown in case the of a valid but unrecognized option
    Nr&   r'   r(   r)   r   r   r   r   r,   N       r,   c                   @   r+   )r   z.
    Thrown in case the pragma is invalid
    Nr-   r   r   r   r   r   T   r.   r   pylint_pragmareturnc                 c   s    d }g }d}d}t t| D ]S}|j}| }|dkr4|s1|r%td||r,td|tddd}n,|r;td||dkrP|rGt||V  |}g }|tv }n|d	v r\|	| d}nt
d
|}q|rmt||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groupr,   r   r   r   appendRuntimeError)r/   r   r   assignment_requiredprevious_tokenmokindvaluer   r   r   parse_pragmaZ   sH   




r>   )r2   collectionsr   typingr   r   
OPTION_RGXcompileVERBOSE	OPTION_POr   	frozensetATOMIC_KEYWORDSr   joinsortedlenALL_KEYWORDSTOKEN_SPECIFICATIONr4   r   	Exceptionr   r,   r   strr>   r   r   r   r   <module>   s4   

 