%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/babel/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/babel/__pycache__/util.cpython-312.pyc

�

ƪb�����dZddlZddlZddlmZmZddlZddlZddlZddl	Z
ddlmZe
�Zd�Zej dej"�Zd�Zej d�Zdd	�Zd
�ZGd�dej.�Zdd
�Zej2ZGd�de�Ze
j8Zej<Zej>Zej@Z ejBZ!ejDZ"ejFZ#d�Z$y)z�
    babel.util
    ~~~~~~~~~~

    Various utility classes and functions.

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�	timedelta�tzinfo)�	localtimec#�tK�t�}t|�D]}||vs�|��|j|��y�w)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)�iterable�seen�items   �,/usr/lib/python3/dist-packages/babel/util.py�distinctrs:�����5�D��X�����t���J��H�H�T�N��s�8�8s([ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)c�:�|j�}|jd�	|j�}|jtj
�}|r|t
tj
�d}tj|�}|sJ	ddl	}|j|jd��|j�}tj|�}|rT|r?|jd�jd�}|dk7rtdj!|���	|j|�y|r1|jd�jd�|j|�S	|j|�y#tttf$rY��wxYw#|j|�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: {0} with BOM)�tell�seek�readline�
startswith�codecs�BOM_UTF8�len�PYTHON_MAGIC_COMMENT_re�match�ast�parse�decode�ImportError�SyntaxError�UnicodeEncodeError�group�format)�fp�pos�line1�has_bom�mr�line2�magic_comment_encodings        r
�parse_encodingr*/s_��
�'�'�)�C��G�G�A�J�"����
���"�"�6�?�?�3����#�f�o�o�.�/�0�E�#�)�)�%�0���
9���	�	�%�,�,�y�1�2����
��+�1�1�%�8����)*�����):�):�9�)E�&�)�W�4�%�8�?�?�2�4�5�5��	�������7�7�1�:�$�$�Y�/�	������
������/ ��.@�A�
�
�
��.	�����s7�A$F�$E-�,A(F�'!F�-F�F�F�F�Fz'from\s+__future__\s+import\s+\(*(.+)\)*c��ddl}|j�}|jd�d}	|j�j	|�}tjdd|�}tjdd|�}tjdd|�}tj|�D]r}|jd	�jd
�D�cgc]!}|j�jd���#}}|D]!}	t||	d�}
|
s�||
jz}�#�t	|j|�|Scc}w#|j|�wxYw)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]+� r�,z())�
__future__rr�readr�re�sub�PYTHON_FUTURE_IMPORT_re�finditerr!�split�strip�getattr�
compiler_flag)r#�encodingr.r$�flags�bodyr'�x�names�name�features           r
�parse_future_flagsr?es���
�'�'�)�C��G�G�A�J�
�E���w�w�y����)���v�v�+�Z��>���v�v�n�d�D�1���v�v�o�s�D�1��(�1�1�$�7�	3�A�45�G�G�A�J�4D�4D�S�4I�J�q�Q�W�W�Y�_�_�T�*�J�E�J��
3��!�*�d�D�9����W�2�2�2�E�
3�	3�	������L��K��	�����s$�BD0�&D+�-D0�D0�+D0�0Ec���ddddddd�}|jd�r	dg}|d	d
}n|jd�r	dg}|dd
}ng}ttjd
|��D]F\}}|dzr|j	||�� |s�#|j	tj
|���Htjdj|�dz|jtjd��}|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�	enumerater0r4�append�escaper�join�replace�os�sep)�pattern�filename�symbols�buf�idx�partrs       r
�	pathmatchrU�s���N��
����
�G����#���e���!�"�+��	�	�	�D�	!��e���!�"�+�����r�x�x��W�=�>�(�	��T���7��J�J�w�t�}�%�
��J�J�r�y�y���'�	(�

�H�H�R�W�W�S�\�C�'��)9�)9�"�&�&�#�)F�G�E�����c�0�eZdZejd�Zy)�TextWrapperz((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))N)�__name__�
__module__�__qualname__r0�compile�
wordsep_re�rVr
rXrX�s������	/��JrVrXc�B�t|||d��}|j|�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)�width�initial_indent�subsequent_indent�break_long_words)rX�wrap)�textr`rarb�wrappers     r
�wraptextrg�s)����n�,=�+0�2�G��<�<���rVc�6�eZdZdZd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�FixedOffsetTimezonez&Fixed offset in minutes east from UTC.Nc�B�t|��|_|�d|z}||_y)N)�minutesz
Etc/GMT%+d)r�_offset�zone)�self�offsetr=s   r
�__init__zFixedOffsetTimezone.__init__�s$�� ��0����<��&�(�D���	rVc��|jS�N�rm�rns r
�__str__zFixedOffsetTimezone.__str__�����y�y�rVc�<�d|j�d|j�d�S)Nz<FixedOffset "z" �>)rmrlrts r
�__repr__zFixedOffsetTimezone.__repr__�s��*.�)�)�T�\�\�B�BrVc��|jSrr)rl�rn�dts  r
�	utcoffsetzFixedOffsetTimezone.utcoffset�s���|�|�rVc��|jSrrrsr{s  r
�tznamezFixedOffsetTimezone.tzname�rvrVc��tSrr)�ZEROr{s  r
�dstzFixedOffsetTimezone.dst�s���rVrr)
rYrZr[�__doc__rpruryr}rr�r^rVr
riri�s$��0���C���rVric��||kD||kz
Srrr^)�a�bs  r
�_cmpr�s��
��E�a�!�e��rV)r)�FrErE)%r�r�collections�datetimerrrMr0�textwrap�pytz�_pytz�babelr�object�missingrr\�VERBOSErr*r2r?rUrXrg�OrderedDict�odictri�utc�UTC�LOCALTZ�
get_localzone�	STDOFFSET�	DSTOFFSET�DSTDIFFr�r�r^rVr
�<module>r�s������&�	�	����
�(���(%�"�*�*�0�"�*�*�>��/�d%�"�*�*�.�0���@>�B�(�&�&���$	�����&��6�i�i��
�
�
���'�'�
����	����	�
�
�
���~�~��rV

Zerion Mini Shell 1.0