????
Current Path : /opt/imunify360/venv/lib/python3.11/site-packages/im360/utils/__pycache__/ |
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/im360/utils/__pycache__/__init__.cpython-311.pyc |
� ��g8 � �R � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl m Z mZmZ d dl mZ ej e� � Z G d� de� � Z G d� de� � Zd ee d e defd�Z G d � de� � Zdej ej ej ej ffd�Zdd�d�Zdefd�ZdS )� N)�Path)�Any�Callable�Type)�LazyLockc � � e Zd ZdS )� RulesLockN��__name__� __module__�__qualname__� � �I/opt/imunify360/venv/lib/python3.11/site-packages/im360/utils/__init__.pyr r � � � � � � ��Dr r c � � e Zd ZdS )� ModSecLockNr r r r r r r r r �error�value�returnc � � �� � �fd�}|S )a. Decorator that causes coroutine to return *value* if it raises *error*. For example: return await return_value_on_error(FileNotFoundError, X)(coro)(*args) is equivalent to: try: return await coro(*args) except FileNotFoundError: return X c �L �� � t j � � � � ��fd�� � }|S )Nc � � �K � �| i |��� d {V ��S # �$ r)}t � d|��� � �cY d }~S d }~ww xY w)NzReplacing %s from %s with %s)�logger�info)�args�kwargs�e�coror r s ���r �wrapperz9return_value_on_error.<locals>.decorator.<locals>.wrapper) sz �� � � � �!�T�4�2�6�2�2�2�2�2�2�2�2�2��� � � ����:�A�t�U�K�K�K������������ ���s � �A�<�A�A)� functools�wraps)r r r r s ` ��r � decoratorz(return_value_on_error.<locals>.decorator( sC ��� � ��� � � � � � � � � � � � �r r )r r r# s `` r �return_value_on_errorr$ s* ��� � � � � � � � �r c � � � e Zd Z� fd�Z� xZS )�PasswordChangeErrorc �V �� t � � � d|� d|� �� � d S )Nz)Password change process exited with code z: )�super�__init__)�self�stderr� returncode� __class__s �r r) zPasswordChangeError.__init__7 s<