ok
Direktori : /opt/imunify360/venv/lib/python3.11/site-packages/clcommon/__pycache__/ |
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/clcommon/__pycache__/utils.cpython-311.pyc |
� =�Dg!y � �� � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dl mZmZ d dl mZ d dlmZmZmZmZmZmZ d dlZd dlZd dlmZ d dlmZmZmZmZ dZdZ d Z!d � Z"dMd�Z#d� Z$d � Z%d� Z&d� Z' dNd�Z(d� Z)dee* fd�Z+d� Z,de-fd�Z.dee* fd�Z/ ed�� � dee* fd�� � Z0de1fd�Z2de*de-fd�Z3de-fd�Z4de-fd �Z5d!� Z6d"� Z7d#� Z8d$� Z9d%� Z:d&� Z;d'� Z<d(e*de-fd)�Z=d*e1de-fd+�Z>d,edee- fd-�Z?de1fd.�Z@d/e*dee-e-f fd0�ZAd/e*dee-e-f fd1�ZBd/e*dee-e-f fd2�ZCd3e*d4e-de-fd5�ZDd6eej ejE f de*fd7�ZF dMd8e*d9e*d:e*d;e1dee1e*f f d<�ZGde*fd=�ZHde-fd>�ZId?e*dee1 fd@�ZJd?e*fdA�ZKd?e*fdB�ZLdC� ZMdDe*de*fdE�ZNde-fdF�ZOdGe*de*fdH�ZPdeee* ee* f fdI�ZQde-fdJ�ZRde-fdK�ZSdL� ZTdS )O� N)�ConfigParser�Error)� lru_cache)�Any�AnyStr�Dict�Optional�Tuple�Union)�etree)�ExternalProgramFailed� check_command�exec_utility�run_commandz/etc/sysconfig/rhn/systemid)�Mon�Tue�Wed�Thu�Fri�Sat�Sunz /opt/cloudlinux/litespeed_statusc � � d}t j � |� � r& t j |� � }n# t $ r Y nw xY w| |k r= t j |� � n# t $ r Y nw xY wt j | |� � dS dS )a Create symlink link_path -> link_value if it does not exist or points to different location :param link_value: path that symlink should point to (symlink value) :type link_value: str :param link_path: path where to create symlink :type link_path: str N)�os�path�islink�readlink�OSError�unlink�symlink)� link_value� link_path�link_tos �n/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/utils.py�create_symlinkr$ / s� � � �G� �w�~�~�i� � � � ��k�)�,�,�G�G��� � � ��D� �����W��� ��I�i� � � � ��� � � ��D� ���� � �:�y�)�)�)�)�)� �s! �8 � A�A�A$ �$ A1�0A1c �� � g }t j � | � � r?t | dd|�� � 5 }|� � � }ddd� � n# 1 swxY w Y |S )a Read file and return file's lines errors param may be passed to define how handle unicode errors, errors=None is default value of open() :param path: path to file :param unicode_errors_handle: how to handle unicode errors :return: list of file's lines �r�utf-8)�encoding�errorsN)r r �isfile�open� readlines)r �unicode_errors_handle�content�fs r# �get_file_linesr0 F s� � � �G� �w�~�~�d��� $� �$��g�6K� L� L� L� $�PQ��k�k�m�m�G� $� $� $� $� $� $� $� $� $� $� $���� $� $� $� $��Ns �A�A�Ac � � t | |d�� � 5 }|� |� � ddd� � dS # 1 swxY w Y dS )z� Write lines to file :param content: list of lines for writing to file :param path: path to file :param mode: open mode :return: None r'