Your IP : 18.226.17.3


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/clcommon/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/clcommon/__pycache__/evr_utils.cpython-311.pyc

�

\�DgN����ddlmZmZmZmZmZdgZdeedeeefd�Zdeeeefdefd�Z	deeeeeefdefd	�Z
d
eedeefd�ZdS)
�)�Union�List�AnyStr�Tuple�Optional�
serialize_evr�intgr�returnc���g}|}|dkr.t|d��\}}|�|��|dk�.|�dt|��z��|���|S)z�
    Encode int in real-numbers segment.
    See http://en.wikipedia.org/wiki/Arithmetic_coding.

    @param intgr:       int for coding in Float an segment [seg_begin, seg_end]
    @return:            list encoding segment
    r��)�divmod�append�len�reverse)r	�lst�number�	remainders    �r/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/evr_utils.py�"encode_int_to_real_numbers_segmentrsx��
�C�
�F�
�1�*�*�"�6�3�/�/���	��
�
�9�����1�*�*��J�J�s�S��X�X�~�����K�K�M�M�M��J��rpm_datac�(�g}|D]�}t|t��r#|�t|����n�t|t��rD|���r0|�tt|������nGt|t��r |�d�|D����nt
d|�����|�d����d�d�|D����S)z�
    Encode List of parts of Version or Epoch or Release in real-numbers segment.
    See http://en.wikipedia.org/wiki/Arithmetic_coding.

    @param rpm_data:    list to convert in double
    @return:            Converted string
    c3�4K�|]}t|��V��dS)N)�ord)�.0�chs  r�	<genexpr>zevr_to_float.<locals>.<genexpr>6s(����.�.�2�s�2�w�w�.�.�.�.�.�.rz
ThisStrange: r�c��g|]}|d���S)�02x�)r�ns  r�
<listcomp>z evr_to_float.<locals>.<listcomp>:s��,�,�,�1�q�J�J�,�,�,r)	�
isinstance�int�extendr�str�isdigit�	NameErrorr�join)r�evr�elems   r�evr_to_floatr.'s��
�C��	�	���d�C� � �	4��J�J�9�$�?�?�@�@�@�@�
��c�
"�
"�	4�t�|�|�~�~�	4��J�J�9�#�d�)�)�D�D�E�E�E�E�
��c�
"�
"�	4��J�J�.�.��.�.�.�.�.�.�.��2�D�2�2�3�3�3��
�
�1�
�
�
�
�
�7�7�,�,��,�,�,�-�-�-rr,c��d}t|ttf��s|g}|D]$}|tt	|����dzz
}�%|S)aw
    Converts epoch, version and release of package to unique string.

    Ex:
    ['1', '2.4.4', '34'] -> '810100008102008104008104000081220000'
    ['0', '2.2.3', '76.el5_9.cloudlinux'] -> 80000081020081020081030000814c00656c00810500810900636c6f75646c696e75780000

    @param evr:         List from epoch, version and release
    @return:            str for given list
    r�00)r%�list�tupler.�split_segments)r,�ret�is   rrr=s[��
�C��c�D�%�=�)�)���e��
�6�6���|�N�1�-�-�.�.��5�5����Jr�stringc���|�gS|d}d}g}t|��D]�\}}t||z�����s$t||z�����r|}�P|||����r|�|||���|}||}��||d����r|�||d���|S)a
    Split str of epoch or version or release to numbers and strings.

    Ex:
    '76.el5_9.cloudlinux.2' -> ['76', 'el', '5', '9', 'cloudlinux', '2']

    @param string:           str of epoch or version or release
    @return:            List strings and numbers from EVR
    Nr)�	enumerater(r)�isalpha�isalnumr)r6�	prev_symb�begin_index�segmentsr5�els      rr3r3Ps���~��	��q�	�I��K��H��6�"�"�(�(���2��y�2�~���&�&�(�(�	�C�	�B��,?�,?�,G�,G�,I�,I�	��I���+�a�-� �(�(�*�*�	3��O�O�F�;�q�=�1�2�2�2����;�'�	�	�
�k�l�l��#�#�%�%�.�����{�|�|�,�-�-�-��OrN)�typingrrrrr�__all__r&rr.rr3r"rr�<module>rAs��8�7�7�7�7�7�7�7�7�7�7�7�7�7����
�e�C�j��T�%��*�=M�����$.�4��c�6�k� 2�3�.��.�.�.�.�,�u�T�&�\�5��=�&�@�A��f�����&�8�F�+���V�������r

?>