Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pylint/config/_pylint_config/__pycache__/utils.cpython-39.pyc
Ðазад
a n�hN � @ s� d Z ddlmZ ddlZddlmZ ddlmZ ddlm Z m Z ejdkrXddlmZ nddl mZ ed �Ze d ee�Zh d�Zh d�ZG d d� de�Zddd�dd�Zedd�dd��Zedddd�dd��Zdd�dd�Zdd�d d!�ZdS )"z&Utils for the 'pylint-config' command.� )�annotationsN)�Callable)�Path)�Literal�TypeVar)� � )� ParamSpec�_P� _ReturnValueT> �i�toml�ini�t> �y�no�n�yesc s, e Zd ZdZddddd�� fdd�Z� ZS )�InvalidUserInputz(Raised whenever a user input is invalid.�str�object�None)�valid_input�input_value�args�returnc s || _ || _t� j|� d S )N)�valid�input�super�__init__)�selfr r r �� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/pylint/config/_pylint_config/utils.pyr s zInvalidUserInput.__init__)�__name__� __module__�__qualname__�__doc__r � __classcell__r# r# r! r$ r s r zCallable[_P, _ReturnValueT])�funcr c s dddd�� fdd�}|S )z?Decorator that handles InvalidUserInput exceptions and retries.z_P.argsz _P.kwargsr )r �kwargsr c s| d}z� | i |��W S t yt } zH|rB|jdkrBtd� t�� td|j� d�� td� d}W Y d }~qd }~0 0 qd S )NFzexit()zStopping 'pylint-config'.zAnswer should be one of �.z.Type 'exit()' if you want to exit the program.T)r r �print�sys�exitr )r r+ Zcalled_once�exc�r* r# r$ �inner_function( s z8should_retry_after_invalid_input.<locals>.inner_functionr# )r* r2 r# r1 r$ � should_retry_after_invalid_input# s r3 zLiteral['toml', 'ini'])r c C s: t d��� } | tvr(td�tt��| ��| �d�r6dS dS )z9Make sure that the output format is either .toml or .ini.zCPlease choose the format of configuration, (T)oml or (I)ni (.cfg): �, r r r )r �lower�SUPPORTED_FORMATSr �join�sorted� startswith)Zformat_typer# r# r$ �get_and_validate_format8 s � r: r zLiteral['yes', 'no'] | None�bool)�question�defaultr c C s\ | � d�} |r| d|� d�7 } t | ��� }|s6|r6|}|tvrRtd�tt��|��|�d�S )z,Validate that a yes or no answer is correct.z (y)es or (n)o z (default=z) r4 r )r r5 �YES_NO_ANSWERSr r7 r8 r9 )r<