
    c	                        d dl mZ d dlZd dlmZ d dlmZmZmZ d dl	m
Z
 d dlmZ d dlmZmZ d dlmZ d d	lmZ  ed
          Z G d de          Z G d de          ZdS )    )annotationsN)Sequence)Any
NamedTupleTypeVar)nodes)	PY38_PLUS)	UNDEFINED
Confidence)Message)UPDATE_OPTION_Tc                  |    e Zd ZU ded<   dZded<   dZded<   dZded	<   eZd
ed<   dZ	ded<   dZ
ded<   dZded<   dS )MessageTeststrmsg_idN
int | Nonelineznodes.NodeNG | Nonenodez
Any | NoneargszConfidence | None
confidence
col_offsetend_lineend_col_offset)__name__
__module____qualname____annotations__r   r   r   r
   r   r   r   r        <lib/python3.11/site-packages/pylint/testutils/output_line.pyr   r      s         KKKD $D$$$$D$-J----!J!!!!H!%N%%%% r    r   c                      e Zd ZU ded<   ded<   ded<   ded<   ded<   ded	<   ded
<   ded<   ed d!d            Zed"d            Zed#d            Ze	 d d$d            Z	d%dZ
ed&d            ZdS )'
OutputLiner   symbolintlinenocolumnr   
end_lineno
end_columnobjectmsgr   Tr   check_endlineboolreturnc                .   |                      |j                  }|                     |j        |          }|                     |j        |          } | |j        |j        ||||j        pd|j        	                    dd          |j
        j                  S )z+Create an OutputLine from a Pylint Message. z

)_get_columnr'   _get_py38_none_valuer   r)   r$   r   objr+   replacer   name)clsr+   r,   r'   r   r)   s         r!   from_msgzOutputLine.from_msg.   s     ,,++CL-HH--cnmLL
sJHGMrGOOFD))N	
 	
 		
r    	str | intc                2    t           sdS t          |           S )zvHandle column numbers except for python < 3.8.

        The ast parser in those versions doesn't return them.
        r   )r	   r%   )r'   s    r!   r2   zOutputLine._get_column?   s      	16{{r    valuer   	_T | Nonec                    |sdS | S )z|Used to make end_line and end_column None as indicated by our version
        compared to `min_pyver_end_position`.
        Nr   )r;   r,   s     r!   r3   zOutputLine._get_py38_none_valueJ   s    
  	4r    rowSequence[str] | strc                d   t          |t                    r|                    d          }	 |                     |d                   }t	          |          dk    r]t          j        dt          d            | |d         t          |d                   |dd|d	         |d
         t          j
                  S t	          |          dk    rYt          j        dt          d            | |d         t          |d                   |dd|d	         |d
         |d                   S t	          |          dk    r|                     |d	         |          }|                     |d
         |          } | |d         t          |d                   ||                     |          |                     |          |d         |d         |d                   S t          # t          $ rM t          j        dd                    |           dt            t"                      | dddddddd          cY S w xY w)ztCreate an OutputLine from a comma separated list (the functional tests
        expected output .txt files).
        ,      zIn pylint 3.0 functional tests expected output should always include the expected confidence level, expected end_line and expected end_column. An OutputLine should thus have a length of 8.)
stacklevelr      N         zIn pylint 3.0 functional tests expected output should always include the expected end_line and expected end_column. An OutputLine should thus have a length of 8.      zZExpected 'msg-symbolic-name:42:27:MyClass.my_function:The message:CONFIDENCE' but we got ':zJ'. Try updating the expected output with:
python tests/test_functional.py r0   )
isinstancer   splitr2   lenwarningswarnDeprecationWarningr%   r
   r6   r3   _value_to_optional_int
IndexError	Exceptionjoinr   UserWarning)r7   r>   r,   r'   r   r)   s         r!   from_csvzOutputLine.from_csvS   sr    c3 	!))C..C4	9__SV,,F3xx1} D '     sFAKKFFN	 	 	 3xx1} 
% '     sFCAKKtSVSVSQRV   3xx1} 33CFMJJ 55c!fmLL
sFAKK..x88..z::FFF	 	 	  	9 	9 	9MR+.88C==R RBOR R 	   3r1atRR88888	9s'   B
G 7A+G #B-G G AH/.H/-tuple[str, str, str, str, str, str, str, str]c           
     6   t          | j                  t          | j                  t          | j                  t          | j                  t          | j                  t          | j                  t          | j                  t          | j                  fS )zZConvert an OutputLine to a tuple of string to be written by a
        csv-writer.
        )	r   r$   r&   r'   r(   r)   r*   r+   r   )selfs    r!   to_csvzOutputLine.to_csv   st    
     MM  	
 		
r    
str | Nonec                4    | dk    s| sdS t          |           S )zCChecks if a (stringified) value should be None or a Python integer.NoneN)r%   )r;   s    r!   rR   z!OutputLine._value_to_optional_int   s(     F? 	% 	45zzr    N)T)r+   r   r,   r-   r.   r#   )r'   r9   r.   r%   )r;   r   r,   r-   r.   r<   )r>   r?   r,   r-   r.   r#   )r.   rX   )r;   r\   r.   r   )r   r   r   r   classmethodr8   staticmethodr2   r3   rW   r[   rR   r   r    r!   r#   r#   $   s$        KKKKKKKKKKKKHHHOOO
 
 
 
 [
     \    \ =A>9 >9 >9 >9 [>9@
 
 
 
    \  r    r#   )
__future__r   rO   collections.abcr   typingr   r   r   astroidr   pylint.constantsr	   pylint.interfacesr
   r   pylint.message.messager   pylint.testutils.constantsr   r   r   r#   r   r    r!   <module>ri      s'  
 # " " " " "  $ $ $ $ $ $ + + + + + + + + + +       & & & & & & 3 3 3 3 3 3 3 3 * * * * * * 4 4 4 4 4 4WT]]    *   D D D D D D D D D Dr    