
    c                        d dl mZ d dlZd dlZd dlmZ d dlmZmZm	Z	 dd	Z
 G d
 de          Zej        dk    rd dlmZ nd dlmZ  G d de          Zh dZ G d d          ZdS )    )annotationsN)Callable)basenameexistsjoin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     Elib/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         )	TypedDictc                  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>9   s     ???Qqwwyy???r   ,r   ss    r   <lambda>zFunctionalTestFile.<lambda>9   s    ??!''#,,??? r   c                @    d |                      d          D             S )Nc                6    g | ]}|                                 S r   r2   r4   s     r   r6   z/FunctionalTestFile.<lambda>.<locals>.<listcomp>:   s     ,M,M,M1QWWYY,M,M,Mr   r7   r8   r9   s    r   r;   zFunctionalTestFile.<lambda>:   s    ,M,M,M,M,M r   c                @    d |                      d          D             S )Nc                6    g | ]}|                                 S r   r2   r4   s     r   r6   z/FunctionalTestFile.<lambda>.<locals>.<listcomp>;   s     'H'H'Ha		'H'H'Hr   r7   r8   r9   s    r   r;   zFunctionalTestFile.<lambda>;   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   r   F)r%   r&   r'   r(   r)   r*   r,   )
_directoryreplacebaseoptions_parse_options)selfrA   rB   s      r   __init__zFunctionalTestFile.__init__>   s_    #$$UB//	  &,&(!#49)
 )
 	r   c                    d| j          S )NzFunctionalTest:)rL   rO   s    r   __repr__zFunctionalTestFile.__repr__N   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   r;   z3FunctionalTestFile._parse_options.<locals>.<lambda>Z   s     r   z([testoptions]' can only contains one of z
 and had '')configparserConfigParseradd_sectionreadoption_filer   itemsr@   getPOSSIBLE_TEST_OPTIONSrM   )rO   cpnamevalueconvs        r   rN   z!FunctionalTestFile._parse_optionsQ   s    &((
}%%%	GGD$%%%% 	 	 	D	 88M22 	- 	-KD%#''kk::D --c cb:Obb[_bbbc c c "&eDL	- 	-s   A 
AAc                ,    |                      d          S )Nz.rc
_file_typerR   s    r   r]   zFunctionalTestFile.option_filea       u%%%r   c                b    t          | j                  }d                    || j        g          S )Nr   )r   rJ   r   rL   )rO   packages     r   modulezFunctionalTestFile.modulee   s*    4?++xx$),---r   c                0    |                      dd          S )Nz.txtF)check_existsrf   rR   s    r   expected_outputz"FunctionalTestFile.expected_outputj   s    vE:::r   c                ,    |                      d          S )NrE   rf   rR   s    r   sourcezFunctionalTestFile.sourcen   rh   r   Textrm   r+   c                    t          | j        | j        |z             }|rt          |          r|S t	          d| d          )NzCannot find 'z'.)r   rJ   rL   r   r   )rO   rq   rm   rb   s       r   rg   zFunctionalTestFile._file_typer   sM    DOTY_55 	vd|| 	K2$222333r   N)rA   r	   rB   r	   r
   rC   )r
   r	   )r
   rC   )T)rq   r	   rm   r+   r
   r	   )r   r   r   __doc__r   r@   r-   rP   rS   rN   propertyr]   rk   rn   rp   rg   r   r   r   r/   r/   2   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   rY   syscollections.abcr   os.pathr   r   r   r   	Exceptionr   version_infotypingr"   typing_extensionsr$   r`   r/   r   r   r   <module>r}      sM  
 # " " " " "     



 $ $ $ $ $ $ * * * * * * * * * *= = = =
	 	 	 	 	) 	 	 	 v ,       ++++++/ / / / /i / / /   D4 D4 D4 D4 D4 D4 D4 D4 D4 D4r   