Your IP : 3.144.105.101


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

�

Q�Dg����dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZddlmZmZe��Zed��Zd,d�Zejd
ej��Zd-d�Zejd��Zd.d/d�Zd0d�ZGd�dej��Zd1d2d%�Zej Z!Gd&�d'ej"��Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*d3d+�Z+dS)4z�
    babel.util
    ~~~~~~~~~~

    Various utility classes and functions.

    :copyright: (c) 2013-2023 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�)�annotationsN)�	Generator�Iterable)�IO�Any�TypeVar)�dates�	localtime�_T�iterable�Iterable[_T]�return�Generator[_T, None, None]c#�K�t��}t|��D]}||vr|V�|�|��� dS)a�Yield all items in an iterable collection that are distinct.

    Unlike when using sets for a similar effect, the original ordering of the
    items in the collection is preserved by this function.

    >>> print(list(distinct([1, 2, 1, 3, 4, 4])))
    [1, 2, 3, 4]
    >>> print(list(distinct('foobar')))
    ['f', 'o', 'b', 'a', 'r']

    :param iterable: the iterable collection providing the data
    N)�set�iter�add)r�seen�items   �j/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/babel/util.py�distinctrsT�����5�5�D��X�������t����J�J�J��H�H�T�N�N�N����s([ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)�fp�	IO[bytes]�
str | Nonec���|���}|�d��	|���}|�tj��}|r!|t
tj��d�}t�|��}|sy	ddl	}|�
|�d����|���}t�|��}n#tttf$rYnwxYw|r[|rA|�d���d��}|dkrtd|�d����	|�|��dS|r=|�d���d��|�|��S	|�|��dS#|�|��wxYw)a/Deduce the encoding of a source file from magic comment.

    It does this in the same way as the `Python interpreter`__

    .. __: https://docs.python.org/3.4/reference/lexical_analysis.html#encoding-declarations

    The ``fp`` argument should be a seekable file object.

    (From Jeff Dairiki)
    rN�latin-1�zutf-8zencoding problem: z	 with BOM)�tell�seek�readline�
startswith�codecs�BOM_UTF8�len�PYTHON_MAGIC_COMMENT_re�match�ast�parse�decode�ImportError�SyntaxError�UnicodeEncodeError�group)r�pos�line1�has_bom�mr(�line2�magic_comment_encodings        r�parse_encodingr55s���
�'�'�)�)�C��G�G�A�J�J�J� ����
�
���"�"�6�?�3�3���	1��#�f�o�.�.�/�/�0�E�#�)�)�%�0�0���	9�
9��
�
�
��	�	�%�,�,�y�1�1�2�2�2����
�
��+�1�1�%�8�8���� ��.@�A�
�
�
�
��
�����		��
^�)*������):�):�9�)E�)E�&�)�W�4�4�%�&\�;Q�&\�&\�&\�]�]�]��	����������	��7�7�1�:�:�$�$�Y�/�/�	���������
��������������������s7�A2G
�,C9�
/G
�9D�G
�D�AG
�3)G
�
G!z'from\s+__future__\s+import\s+\(*(.+)\)*r�encoding�str�intc�|�ddl}|���}|�d��d}	|����|��}tjdd|��}tjdd|��}tjdd|��}t�|��D]V}d	�|�	d
���
d��D��}|D]}t||d��}	|	r
||	jz}� �W	|�|��n#|�|��wxYw|S)zRParse the compiler flags by :mod:`__future__` from the given Python
    code.
    rNzimport\s*\([\r\n]+zimport (z,\s*[\r\n]+z, z\\\s*[\r\n]+� c�\�g|])}|����d����*S)z())�strip)�.0�xs  r�
<listcomp>z&parse_future_flags.<locals>.<listcomp>s,��J�J�J�q�Q�W�W�Y�Y�_�_�T�*�*�J�J�Jrr�,)
�
__future__rr �readr*�re�sub�PYTHON_FUTURE_IMPORT_re�finditerr.�split�getattr�
compiler_flag)
rr6rAr/�flags�bodyr2�names�name�features
          r�parse_future_flagsrOisA������
�'�'�)�)�C��G�G�A�J�J�J�
�E���w�w�y�y����)�)���v�+�Z��>�>���v�n�d�D�1�1���v�o�s�D�1�1��(�1�1�$�7�7�	3�	3�A�J�J�A�G�G�A�J�J�4D�4D�S�4I�4I�J�J�J�E��
3�
3��!�*�d�D�9�9���3��W�2�2�E��
3�	3�	���������������������Ls�CD"�"D9�pattern�filename�boolc�"�ddddddd�}|�d��rdg}|d	d
�}n%|�d��rdg}|dd
�}ng}ttjd
|����D]O\}}|dzr|�||���&|r'|�tj|�����Ptjd�|���d�|�tj
d����}|d
uS)a�Extended pathname pattern matching.

    This function is similar to what is provided by the ``fnmatch`` module in
    the Python standard library, but:

     * can match complete (relative or absolute) path names, and not just file
       names, and
     * also supports a convenience pattern ("**") to match files at any
       directory level.

    Examples:

    >>> pathmatch('**.py', 'bar.py')
    True
    >>> pathmatch('**.py', 'foo/bar/baz.py')
    True
    >>> pathmatch('**.py', 'templates/index.html')
    False

    >>> pathmatch('./foo/**.py', 'foo/bar/baz.py')
    True
    >>> pathmatch('./foo/**.py', 'bar/baz.py')
    False

    >>> pathmatch('^foo/**.py', 'foo/bar/baz.py')
    True
    >>> pathmatch('^foo/**.py', 'bar/baz.py')
    False

    >>> pathmatch('**/templates/*.html', 'templates/index.html')
    True
    >>> pathmatch('**/templates/*.html', 'templates/foo/bar.html')
    False

    :param pattern: the glob pattern
    :param filename: the path name of the file to match against
    z[^/]z[^/]/z[^/]+z[^/]+/z	(?:.+/)*?z(?:.+/)*?[^/]+)�?z?/�*z*/z**/z**�^rNz./�z	([?*]+/?)��$�/)r"�	enumeraterCrG�append�escaper'�join�replace�os�sep)rPrQ�symbols�buf�idx�partr's       r�	pathmatchrf�s2��N��
����
��G����#�����e���!�"�"�+���	�	�	�D�	!�	!���e���!�"�"�+������r�x��W�=�=�>�>�(�(�	��T���7�	(��J�J�w�t�}�%�%�%�%�
�	(��J�J�r�y����'�'�'���H�������'�'�'��)9�)9�"�&�#�)F�)F�G�G�E����rc�.�eZdZejd��ZdS)�TextWrapperz((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))N)�__name__�
__module__�__qualname__rC�compile�
wordsep_re�rrrhrh�s&���������	/���J�J�Jrrh�FrX�text�width�initial_indent�subsequent_indent�	list[str]c�R�t|||d���}|�|��S)a�Simple wrapper around the ``textwrap.wrap`` function in the standard
    library. This version does not wrap lines on hyphens in words.

    :param text: the text to wrap
    :param width: the maximum line width
    :param initial_indent: string that will be prepended to the first line of
                           wrapped output
    :param subsequent_indent: string that will be prepended to all lines save
                              the first of wrapped output
    F)rqrrrs�break_long_words)rh�wrap)rprqrrrs�wrappers     r�wraptextry�s6����n�,=�+0�2�2�2�G��<�<����rc�D�eZdZdZddd	�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dS)�FixedOffsetTimezonez&Fixed offset in minutes east from UTC.N�offset�floatrMrr�Nonec�V�tj|���|_|�d|z}||_dS)N)�minutesz
Etc/GMT%+d)�datetime�	timedelta�_offset�zone)�selfr|rMs   r�__init__zFixedOffsetTimezone.__init__�s1���)�&�9�9�9����<��&�(�D���	�	�	rr7c��|jS�N�r��r�s r�__str__zFixedOffsetTimezone.__str__��
���y�rc�(�d|j�d|j�d�S)Nz<FixedOffset "z" �>)r�r�r�s r�__repr__zFixedOffsetTimezone.__repr__�s��<��	�<�<�T�\�<�<�<�<r�dt�datetime.datetime�datetime.timedeltac��|jSr�)r��r�r�s  r�	utcoffsetzFixedOffsetTimezone.utcoffset�s
���|�rc��|jSr�r�r�s  r�tznamezFixedOffsetTimezone.tzname�r�rc��tSr�)�ZEROr�s  r�dstzFixedOffsetTimezone.dst�s���rr�)r|r}rMrrr~)rr7)r�r�rr�)r�r�rr7)
rirjrk�__doc__r�r�r�r�r�r�rnrrr{r{�s�������0�0����������=�=�=�=��������������rr{�ar�bc��||k||kz
Sr�rn)r�r�s  r�_cmpr�s��
��E�a�!�e��r)rr
rr)rrrr)r)rrr6r7rr8)rPr7rQr7rrR)rorXrX)
rpr7rqr8rrr7rsr7rrt)r�rr�r),r�rArr#�collectionsr�r`rC�textwrap�collections.abcrr�typingrrr�babelr	r
�object�missingrrrl�VERBOSEr&r5rErOrfrhry�OrderedDict�odict�tzinfor{�UTC�LOCALTZ�
get_localzone�	STDOFFSET�	DSTOFFSET�DSTDIFFr�r�rnrr�<module>r�s!����#�"�"�"�"�"�
�
�
�
���������	�	�	�	�	�	�	�	�����/�/�/�/�/�/�/�/�#�#�#�#�#�#�#�#�#�#�"�"�"�"�"�"�"�"�
�&�(�(���W�T�]�]������*%�"�*�0�"�*�>�>��-�-�-�-�`%�"�*�.�0�0�������@>�>�>�>�B�����(�&���������$	��������(�/����:�i��
�-���'�
���	���	�
�
���~�������r

?>