ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/__pycache__/clfunc.cpython-311.pyc

�

I/�f�����ddlZddlZddlZddlZddlZdZd�Zddddd�Zd	�Zdej	fd
�Z
dej	fd�Zd�Zd
�Z
dd�Zdd�Zdd�Zd�Zd�Zd�Zd�Zdedefd�ZdS)�Nz/proc/lve/listc�z�	ttd���5}|�d��}ddd��n#1swxYwYt|�dd��d��dg}nJ#t
$rdd	t��g}Yn2t$rdd
t��g}Ynt$rddt��g}YnwxYw|S)z/
    Obtain lve process filesystem version
    �utf-8��encoding�N�:�r�OKz+clcommon: get_lve_version: Can`t open file z/clcommon: get_lve_version: Can`t get data from z'clcommon: get_lve_version: Can`t parse )�open�LVE_FILE�read�int�rsplit�IOError�
IndexError�
ValueError)�f�line�lve_procfs_versions   ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.11-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/clfunc.py�get_lve_versionrsF��	Z�
�(�W�
-�
-�
-�	���6�6�!�9�9�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�!�$�+�+�c�1�"5�"5�a�"8�9�9�4�@�����^�^�^�"�$\�RZ�$\�$\�]�����b�b�b�"�$`�V^�$`�$`�a�����Z�Z�Z�"�$X�h�$X�$X�Y����Z�����s:�A1�:�A1�>�A1�>�.A1�1B8�	B8� B8�7B8r	��i@)�K�M�G�Tc�l�t|��}tjd��}tjd��}tjdtj��}|�|��}|�|��}|�|��}td�|||fD����r|SdS)zp
    check that val is a valid CPU limit (0-100 int or speed (% or MHZ\GHZ))  # noqa
    return val if ok a
    z^([1-9]|[1-9][0-9]|100)$z^([1-9]|[1-9][0-9]*)%$z^([1-9]|[1-9][0-9]*)(mhz|ghz)+$c3�K�|]}|duV��	dS�N�)�.0�ps  r�	<genexpr>zvalidate_cpu.<locals>.<genexpr>9s&����
/�
/�Q�1�D�=�
/�
/�
/�
/�
/�
/�N)�str�re�compile�
IGNORECASE�match�any)�val�data�
regexp_int�
regexp_speedp�
regexp_speedf�p1�p2�p3s        r�validate_cpur4-s���
�s�8�8�D���7�8�8�J��J�8�9�9�M��J�A�2�=�Q�Q�M�	�	�	�$�	�	�B�	�	�	�T�	"�	"�B�	�	�	�T�	"�	"�B�
�
/�
/�2�r�2�,�
/�
/�
/�/�/���
��4r%c�p�	t|��}n#t$rYdSwxYw||cxkr|krndS|SdS)zH
    Check that val - is a string number
    return val as a string
    N)rr)r,�min_val�max_val�dig_vals    r�validate_intr9>sh��
��c�(�(���������t�t������'�$�$�$�$�W�$�$�$�$�$�$��
�%�$s��
 � c�<�	|d}|���rd}||z}tt|dd���t|���zdz��}||cxkr|krnn|Sn#t
ttf$rYnwxYwdS)N���r�)�isdigitr�float�BYTES_CONVERSION_TABLE�upperrr�KeyError)r,r6r7�suffix�results     r�memory_to_pagerDKs���	
��R����>�>���	��F���,�C��U�3�s��s�8�_�_�'=�f�l�l�n�n�'M�M�PQ�Q�R�R���f�'�'�'�'��'�'�'�'�'��M����
�H�-�
�
�
���
�����4s�A;A?�?B�Bc��|dkrt|dz��dzS|dkr3ttt|��dzdzd����dzSttt|��dzdzd����d	zS)
N�r<rir�rrr)r&�roundr>)�pagess r�page_to_memoryrJYs����s�{�{��5�1�9�~�~��#�#��v�~�~��5��u����)�D�0�!�4�4�5�5��;�;��u�U�5�\�\�A�%��5�q�9�9�:�:�S�@�@r%c�*�tjdd|d|gtj���5}|���d�d��}ddd��n#1swxYwY|D]�}|������}	|d�|�����tj	t|d��tj����#tttf$rY��wxYwdS)Nz/bin/psz-Uz-u)�stdoutr�
r;)�
subprocess�Popen�PIPE�communicate�split�rstrip�index�encode�os�killr�signal�SIGHUPrr�OSError)�item�username�proc�lines�row�partss      r�reload_processesraasE��	�	�	�D�(�D�(�3���
�
�
�3�
�� � �"�"�1�%�+�+�E�2�2��	3�3�3�3�3�3�3�3�3�3�3����3�3�3�3�
�����
�
���"�"�$�$��	��"�I�O�O�D�K�K�M�M�*�*�*��G�C��a��M�M�6�=�1�1�1�1���J��0�	�	�	��H�	�����s$�.A � A$�'A$�AC6�6D�D�/etc/login.defsc�Z�t|d���5}|D]}}|�d��r�|�dd��d}|���}t|��dkr"|d|kr|dccddd��S�~	ddd��n#1swxYwY|S)Nrr�#r	rrG)r�
startswithrR�len)�key�default�_path�
login_defs�raw_liner�line_spliteds       rrjrjps��	
�e�g�	&�	&�	&�'�*�"�	'�	'�H��"�"�3�'�'�
���>�>�#�q�)�)�!�,�D��:�:�<�<�L��<� � �A�%�%�,�q�/�S�*@�*@�#�A��&�&�'�'�'�'�'�'�'�'��	'�'�'�'�'�'�'�'�'�'�'�'����'�'�'�'��Ns�A3B �B � B$�'B$�`�c��	ttd����}n#tttf$r|}YnwxYw|S)N�UID_MAX)rrjrr�	TypeError)rh�uid_max_s  r�uid_maxrr|sN����z�)�,�,�-�-�����Z��+�������������Os��;�;c�r�tj�|�d���tj|��dS)N�
)�sys�stderr�write�exit)�message�statuss  r�exit_with_errorr{�s4���J����^�^�^�$�$�$��H�V�����r%c��d|vr:	|�d���d��}n#t$rYnwxYw|S)Nz\u�unicode_escaper)�decoderU�UnicodeDecodeError��ss r�safe_escaped_unicode_to_utfr��sW����z�z�	����)�*�*�1�1�'�:�:�A�A��!�	�	�	��D�	�����Hs�(/�
<�<c�\�t|t��rd�|���D��St|t��rd�|D��St|t��rt	d�|D����St|t
��r|���S|S)Nc�N�i|]"\}}t|��t|����#Sr!��byteify�r"rg�values   r�
<dictcomp>zbyteify.<locals>.<dictcomp>�s:��0�0�0��C������g�e�n�n�0�0�0r%c�,�g|]}t|����Sr!r��r"�elements  r�
<listcomp>zbyteify.<locals>.<listcomp>�s ��5�5�5�W��� � �5�5�5r%c3�4K�|]}t|��V��dSr r�r�s  rr$zbyteify.<locals>.<genexpr>�s*����:�:�'�W�W�%�%�:�:�:�:�:�:r%)�
isinstance�dict�items�list�tupler&rU�r-s rr�r��s����$����
�0�0�"&�*�*�,�,�0�0�0�	0�	�D�$�	�	��5�5��5�5�5�5�	�D�%�	 �	 ���:�:�T�:�:�:�:�:�:�	�D�#�	�	���{�{�}�}���r%c�\�t|t��rd�|���D��St|t��rd�|D��St|t��rt	d�|D����St|t
��r|���S|S)Nc�N�i|]"\}}t|��t|����#Sr!��
unicodeifyr�s   rr�zunicodeify.<locals>.<dictcomp>�s<��0�0�0��C���3����E�!2�!2�0�0�0r%c�,�g|]}t|����Sr!r�r�s  rr�zunicodeify.<locals>.<listcomp>�s ��8�8�8��
�7�#�#�8�8�8r%c3�4K�|]}t|��V��dSr r�r�s  rr$zunicodeify.<locals>.<genexpr>�s*����=�=�W�Z��(�(�=�=�=�=�=�=r%)r�r�r�r�r��bytesr~r�s rr�r��s����$����
�0�0�"&�*�*�,�,�0�0�0�	0�	�D�$�	�	��8�8�4�8�8�8�8�	�D�%�	 �	 ���=�=��=�=�=�=�=�=�	�D�%�	 �	 ���{�{�}�}���r%c�|�	|�d����d��dS#t$rYdSwxYw)z�
    Check is string contains only ASCII characters
    :param s: string to check
    :return: True - string contains only ASCII characters
    rr�asciiTF)rUr~rr�s r�is_ascii_stringr��sT���	���'��"�"�)�)�'�2�2�2��t�������u�u����s�)-�
;�;�text�returnc�d�d�}tjd||��}tjdd|��}|S)zG
    Escape '%' characters inside text, except '%' followed by '('
    c�v�|���dd�dz|���dzS)zo
        Generate string to replace from matched string
        '% ' -> '%% '
        '%%c' -> '%%%%c'
        Nr;rG)�group)�	match_objs r�replacez(escape_formatting_chars.<locals>.replace�s6����� � ��"��%��)�I�O�O�,=�,=�b�,A�A�Ar%z%+([^(])z%$z%%)r'�sub)r�r�s  r�escape_formatting_charsr��sA��B�B�B��6�+�w��-�-�D�
�6�%���%�%�D��Kr%)Nrb)rm)r	)rVr'rXrNrurrr?r4�maxsizer9rDrJrarjrrr{r�r�r�r�r&r�r!r%r�<module>r�st��
�	�	�	�	�	�	�	�
�
�
�
�����
�
�
�
������&
�	
�	�	�	������" ���
�
�
�
�!"�3�;�����A�A�A����	�	�	�	���������

�
�
�����������#��#������r%

Zerion Mini Shell 1.0