ok

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/clconfig.cpython-37.pyc

B

E!wd��@sDddlmZddlmZddlmZddlZdZdd�Zdd	�ZdS)
�)�absolute_import)�division)�print_functionNz/var/cpanel/cpanel.configc	Cshyt|�}|��}Wnttfk
r,dSXx4|D],}|�d|�r4|��|���d�dSq4WdS)z�
    Get param from config file
    :param path: Path to config file
    :type path: str
    :param param: Key for param in config file
    :type param: str
    Fz%s=�=�N)�open�	readlines�OSError�IOError�
startswith�close�strip�split)�path�param�fd�data�line�r�B/opt/alt/python37/lib/python3.7/site-packages/clcommon/clconfig.py�	get_params
rc
Cs�d||f}tj�|�s<t|d��}|�|�WdQRXdSt|��}|��}WdQRXxTt|�D]H\}}|�d|�rb|||<t|d��}|�d�|��WdQRXdSqbWt|d��}|�|�WdQRXdS)a
    Replaces config file with path to config file with line param=value
    :param path: Path to config file
    :type path: str
    :param param: Key for param in config file
    :type key: str
    :param value: Value for param in config file
    :type value: str
    z%s=%s
�wNz%s=��a)	�osr�existsr�writer�	enumerater�join)rr�valueZnew_line�fr�irrrr�
replace_param#s

r")Z
__future__rrrrZCPANEL_CONFIG_PATHrr"rrrr�<module>s

Zerion Mini Shell 1.0