%PDF- %PDF-
| Direktori : /opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/ |
| Current File : //opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/utils.cpython-37.pyc |
B
`�1b�m � @ s( d dl mZ d dl mZ d dl mZ d dlZd dlZd dlZd dlZd dlZd dl Z d dl
Z
d dlZd dlZd dl
Z
d dlZd dlmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZmZ d dlZd Zd
ZdZ G dd
� d
e!�Z"dd� Z#dodd�Z$dd� Z%dd� Z&dpdd�Z'dd� Z(dd� Z)dd� Z*d d!� Z+dqd"d#�Z,d$d%� Z-ee. d&�d'd(�Z/d)d*� Z0e1d&�d+d,�Z2ee. d&�d-d.�Z3edd/�ee d&�d0d1��Z4e5d2�d3d4�Z6e.e1d5�d6d7�Z7d8d9� Z8e1d&�d:d;�Z9d<d=� Z:d>d?� Z;d@dA� Z<dBdC� Z=dDdE� Z>ee1dF�dGdH�Z?e5e1dI�dJdK�Z@eee1 dL�dMdN�ZAe5d&�dOdP�ZBe.ee1e1f dQ�dRdS�ZCe.ee1e1f dQ�dTdU�ZDe.ee1e1f dQ�dVdW�ZEe.e1e1dX�dYdZ�ZFeejejGf e.d[�d\d]�ZHdreeee5ee5ef d^�d_d`�ZIe.d&�dadb�ZJe1d&�dcdd�ZKe.ee5 de�dfdg�ZLe.dh�didj�ZMe.dh�dkdl�ZNdmdn� ZOdS )s� )�print_function)�absolute_import)�divisionN)�Dict�AnyStr�Optional�Tuple�Union�List)�etree)� lru_cache)�ConfigParser�Errorz/etc/sysconfig/rhn/systemid)ZMonZTueZWedZThuZFriZSatZSunz /opt/cloudlinux/litespeed_statusc @ s e Zd Zdd� ZdS )�ExternalProgramFailedc C s t �| |� d S )N)� Exception�__init__)�self�message� r �?/opt/alt/python37/lib/python3.7/site-packages/clcommon/utils.pyr % s zExternalProgramFailed.__init__N)�__name__�
__module__�__qualname__r r r r r r $ s r c C sp d}t j�|�r4yt �|�}W n tk
r2 Y nX | |krlyt �|� W n tk
r^ Y nX t �| |� 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)Z
link_valueZ link_pathZlink_tor r r �create_symlink) s r c C s6 g }t j�| �r2t| d|d��}|�� }W dQ R X |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)�errorsN)r r �isfile�open� readlines)r Zunicode_errors_handle�content�fr r r �get_file_lines@ s
r( c C s$ t | |��}|�|� W dQ R X 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
N)r$ �
writelines)r r&