Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pylint/testutils/functional/__pycache__/find_functional_tests.cpython-39.pyc
Ðазад
a n�hL � @ sx d dl mZ d dlZd dlmZ d dlmZ d dlmZ dZ h d�Z h d�Ze fd d dd�d d�Zdd dd�dd�Z dS )� )�annotationsN)�Iterator)�Path)�FunctionalTestFile�1 > Z regression_02�deprecated_relative_importZ regression�ext> r Z docparamsr z Path | str�intzlist[FunctionalTestFile])� input_dir�max_file_per_directory�returnc C st g }t t| �|� t�| �D ]R\}}}|�d�r2q|�� |�� |D ]&}|dkrF|�d�rF|�t||�� qFq|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 Zsuite�dirpath�dirnames� filenames�filename� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pylint/testutils/functional/find_functional_tests.py�(get_functional_test_files_from_directory# s r r �None)� directoryr r c s� t | �j�d�rdS t� }t� }dddd��fdd�� dd d �� ��fdd���| �D ],}|�� rn|�|� qV|jd krV|�|� qVg }g }|D ]t}|j|j�d�d }|� � r�|� ||f� t|jj�dks�|jjtvr�|jjjt vr�|j�|jj�s�|� |� q�|�s|�r�d} |D ]2\}}| d| � d|�| �� d|�| �� d�7 } �q|D ]4}| d| � d|�| �� d|j� d|jj� d� 7 } �qRt| ��dS )zrCheck if test directories follow correct file/folder structure. Ignore underscored directories or files. �_Nr zlist[tuple[Path, int]]z list[Path])�path� violationsr c s8 t dd� | �� D ��}t|�� kr4|�| t|�f� |S )zEReturn directories and files from a directory and handles violations.c s s | ]}|j �d �s|V qdS )r N)�stem� startswith)�.0�pr r r � <genexpr>H s zQ_check_functional_tests_structure.<locals>._get_files_from_dir.<locals>.<genexpr>)�list�iterdir�lenr )r r Z files_without_leading_underscore)r r r �_get_files_from_dirD s �z>_check_functional_tests_structure.<locals>._get_files_from_dirzIterator[Path])r r c 3 s� g }t � }� | |�}d}|D ]z}|�� r�� ||�}|�� V z�|�E d H W q� ty� } z"|�t|��|d�� W Y d }~q�d }~0 0 q|�� V q|s�|r�|}|D ]$\} } |d| � d| � d�� d�7 }q�|D ]}||7 }q�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 Zviolations_msgsZparent_dir_files� error_msgZ_file_or_dir�_files�eZ_msgZoffending_file�number�r) r r r r r O s* � . z/_check_functional_tests_structure.<locals>.walkr 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"