
    yIfL                    l    d dl mZ d dlZd dlmZ d dlmZ d dlmZ dZ		 h dZ
	 h dZ	 e	fddZddZdS )    )annotationsN)Iterator)Path)FunctionalTestFile1   >   ext
regressionregression_02deprecated_relative_import>   r   	docparamsr   	input_dir
Path | strmax_file_per_directoryintreturnlist[FunctionalTestFile]c                |   g }t          t          |           |           t          j        |           D ]\  }}}|                    d          r|                                 |                                 |D ]@}|dk    r8|                    d          r#|                    t          ||                     A|S )z*Get all functional tests in the input_dir.__pycache__z__init__.py.py)!_check_functional_tests_structurer   oswalkendswithsortappendr   )r   r   suitedirpathdirnames	filenamesfilenames          e/var/www/piapp/venv/lib/python3.11/site-packages/pylint/testutils/functional/find_functional_tests.py(get_functional_test_files_from_directoryr"   #   s    
 E%d9oo7MNNN(*	(:(: D D$9M** 	! 	D 	DH=((X->->u-E-E(/BBCCC	D L    	directoryr   Nonec                2  
 t          |           j                            d          rdS t                      }t                      }dfd	
d
fd |           D ]L}|                                r|                    |           ,|j        dk    r|                    |           Mg }g }|D ]}|j        |j                            d          d         z  }|	                                r|
                    ||f           t          |j        j                  dk    sd|j        j        t          vrQ|j        j        j        t          vr9|j                            |j        j                  s|
                    |           |s|rd}	|D ]:\  }}|	d|  d|                    |            d|                    |            dz  }	;|D ]6}|	d|  d|                    |            d|j         d|j        j         d	z  }	7t          |	          dS )zrCheck if test directories follow correct file/folder structure.

    Ignore underscored directories or files.
    _Npathr   
violationslist[tuple[Path, int]]r   
list[Path]c                    t          d |                                 D                       }t          |          k    r$|                    | t          |          f           |S )zEReturn directories and files from a directory and handles violations.c              3  N   K   | ] }|j                             d           |V  !dS )r'   N)stem
startswith).0ps     r!   	<genexpr>zQ_check_functional_tests_structure.<locals>._get_files_from_dir.<locals>.<genexpr>H   sK       0
 0
QV->->s-C-C0
0
 0
 0
 0
 0
 0
r#   )listiterdirlenr   )r(   r)    files_without_leading_underscorer   s      r!   _get_files_from_dirz>_check_functional_tests_structure.<locals>._get_files_from_dirD   sx     ,0 0
 0
||~~0
 0
 0
 ,
 ,
( /003IIItS)I%J%JKLLL//r#   Iterator[Path]c           	   3    K   g }t                      } | |          }d}|D ]}|                                r ||          }|                                V  	  |          E d {V  K# t          $ r@}|                    t          |                              |d                     Y d }~d }~ww xY w|                                V  |s|r2|}|D ]\  }	}
|d|	 d|
 d dz  }|D ]}||z  }t          |          d S )NzBThe following directory contains too many functional tests files:
 z- z: z when the max is 
)setis_dirresolveAssertionErroraddstrreplace)r(   r)   violations_msgsparent_dir_files	error_msg_file_or_dir_filese_msgoffending_filenumberr7   r   r   s              r!   r   z/_check_functional_tests_structure.<locals>.walkO   s     -/
$'EE..tZ@@Q 	 - 		- 		-L""$$ -,,\:FF"**,,,,,G#tL1111111111% G G G#''Ay"(E(EFFFFFFFFG #**,,,,,, 	' 	'D*4 c c&b^bbvbbH^bbbb, " "		! &&&	' 	's   A//
B996B44B9r   r      z1The following functional tests are disorganized:
z- In 'z', 'z' should go in 'z'
z', zA should go in a directory that starts with the first letters of 'z' (not 'z')
)r(   r   r)   r*   r   r+   )r(   r   r   r8   )r   r.   r/   r<   r=   r@   suffixparentsplitexistsr   r5   IGNORED_PARENT_DIRSIGNORED_PARENT_PARENT_DIRSrelative_tor?   )r$   r   filesdirsfile_or_dirdirectory_does_not_existsmisplaced_filefilepossible_dirmsgr7   r   s    `        @@r!   r   r   7   s    I&&s++ uuEeeD	0 	0 	0 	0 	0 	0' ' ' ' ' ' ' '4 tI # # 	#HH[!!!!5((IIk"""9;!#N , ,{TY__S%9%9!%<<   	C%,,dL-ABBB DK$%%** (;;;"'/III9''(899 ,%%d+++  "N "B"; 	 	D,J J J(8(8(C(C J J!-!9!9)!D!DJ J JCC # 	 	DB B Bt'7'7	'B'B B B	B B+/;+;B B BCC
 S!!!" "r#   )r   r   r   r   r   r   )r$   r   r   r   r   r%   )
__future__r   r   collections.abcr   pathlibr   %pylint.testutils.functional.test_filer   !REASONABLY_DISPLAYABLE_VERTICALLYrQ   rR   r"   r    r#   r!   <module>rb      s   
 # " " " " " 				 $ $ $ $ $ $       D D D D D D$& !
    8   
 C
 #D    (T" T" T" T" T" T"r#   