
    yIf                        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
Z G d de          Z G d de
          Zh dZ G d d          ZdS )    )annotationsN)Callable)basenameexistsjoin)	TypedDictver_strstrreturntuple[int, ...]c                Z    t          d |                     d          D                       S )zBConvert python version to a tuple of integers for easy comparison.c              3  4   K   | ]}t          |          V  d S N)int).0digits     Y/var/www/piapp/venv/lib/python3.11/site-packages/pylint/testutils/functional/test_file.py	<genexpr>z'parse_python_version.<locals>.<genexpr>   s(      <<U<<<<<<    .)tuplesplit)r	   s    r   parse_python_versionr      s+    <<s););<<<<<<r   c                      e Zd ZdS )NoFileErrorN)__name__
__module____qualname__ r   r   r   r      s        Dr   r   c                  V    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S )TestFileOptionsr   	min_pyver	max_pyvermin_pyver_end_positionz	list[str]requiresexcept_implementationsexclude_platformsbool$exclude_from_minimal_messages_configN)r   r   r   __annotations__r   r   r   r!   r!      sf         ++++%%%%    ......r   r!   >   r%   r#   r"   r'   r&   r$   r)   c                      e Zd ZU dZeeed d d dZded<   ddZddZddZ	e
dd            Ze
dd            Ze
dd            Ze
dd            ZdddZdS )FunctionalTestFilez0A single functional test case file with options.c                @    d |                      d          D             S )Nc                6    g | ]}|                                 S r   stripr   is     r   
<listcomp>z/FunctionalTestFile.<lambda>.<locals>.<listcomp>3   s     ???Qqwwyy???r   ,r   ss    r   <lambda>zFunctionalTestFile.<lambda>3   s    ??!''#,,??? r   c                @    d |                      d          D             S )Nc                6    g | ]}|                                 S r   r/   r1   s     r   r3   z/FunctionalTestFile.<lambda>.<locals>.<listcomp>4   s     ,M,M,M1QWWYY,M,M,Mr   r4   r5   r6   s    r   r8   zFunctionalTestFile.<lambda>4   s    ,M,M,M,M,M r   c                @    d |                      d          D             S )Nc                6    g | ]}|                                 S r   r/   r1   s     r   r3   z/FunctionalTestFile.<lambda>.<locals>.<listcomp>5   s     'H'H'Ha		'H'H'Hr   r4   r5   r6   s    r   r8   zFunctionalTestFile.<lambda>5   s    'H'H1773<<'H'H'H r   )r"   r#   r$   r%   r&   r'   z7dict[str, Callable[[str], tuple[int, ...] | list[str]]]_CONVERTERS	directoryr
   filenamer   Nonec                    || _         |                    dd          | _        dddg g g dd| _        |                                  d S )N.py )      )   r   )      F)r"   r#   r$   r%   r&   r'   r)   )
_directoryreplacebaseoptions_parse_options)selfr>   r?   s      r   __init__zFunctionalTestFile.__init__8   s_    #$$UB//	  &,&(!#49)
 )
 	r   c                    d| j          S )NzFunctionalTest:)rK   rN   s    r   __repr__zFunctionalTestFile.__repr__H   s    ,,,,r   c                   t          j                    }|                    d           	 |                    | j                   n# t
          $ r Y nw xY w|                    d          D ]S\  }}| j                            |d           }|t          v sJ dt           d| d             ||          | j
        |<   Td S )Ntestoptionsc                    | S r   r   )vs    r   r8   z3FunctionalTestFile._parse_options.<locals>.<lambda>T   s     r   z([testoptions]' can only contains one of z
 and had '')configparserConfigParseradd_sectionreadoption_filer   itemsr=   getPOSSIBLE_TEST_OPTIONSrL   )rN   cpnamevalueconvs        r   rM   z!FunctionalTestFile._parse_optionsK   s    &((
}%%%	GGD$%%%% 	 	 	D	 88M22 	- 	-KD%#''kk::D ----b:Obb[_bbb .--!%eDL	- 	-s   A 
AAc                ,    |                      d          S )Nz.rc
_file_typerQ   s    r   r\   zFunctionalTestFile.option_file[       u%%%r   c                b    t          | j                  }d                    || j        g          S )Nr   )r   rI   r   rK   )rN   packages     r   modulezFunctionalTestFile.module_   s*    4?++xx$),---r   c                0    |                      dd          S )Nz.txtF)check_existsre   rQ   s    r   expected_outputz"FunctionalTestFile.expected_outputd   s    vE:::r   c                ,    |                      d          S )NrB   re   rQ   s    r   sourcezFunctionalTestFile.sourceh   rg   r   Textrl   r(   c                    t          | j        | j        |z             }|rt          |          r|S t	          d| d          )NzCannot find 'z'.)r   rI   rK   r   r   )rN   rp   rl   ra   s       r   rf   zFunctionalTestFile._file_typel   sM    DOTY_55 	vd|| 	K2$222333r   N)r>   r
   r?   r
   r   r@   )r   r
   )r   r@   )T)rp   r
   rl   r(   r   r
   )r   r   r   __doc__r   r=   r*   rO   rR   rM   propertyr\   rj   rm   ro   rf   r   r   r   r,   r,   ,   s0        :: *)"6??"M"MHHL LK        - - - -- - - -  & & & X& . . . X. ; ; ; X; & & & X&4 4 4 4 4 4 4r   r,   )r	   r
   r   r   )
__future__r   rX   collections.abcr   os.pathr   r   r   typingr   r   	Exceptionr   r!   r_   r,   r   r   r   <module>ry      s  
 # " " " " "     $ $ $ $ $ $ * * * * * * * * * *      = = = =
	 	 	 	 	) 	 	 	/ / / / /i / / /   D4 D4 D4 D4 D4 D4 D4 D4 D4 D4r   