§
    ÆªbŠ  ã                   ó�  — d Z ddlZddlZddlmZmZ ddlZddlZddlZddl	Z
ddlmZ  e¦   «         Zd„ Z ej        dej        ¦  «        Zd„ Z ej        d¦  «        Zdd
„Zd„ Z G d„ dej        ¦  «        Zdd„Zej        Z G d„ de¦  «        Ze
j        Zej        Zej        Zej         Z ej!        Z!ej"        Z"ej#        Z#d„ Z$dS )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              #   ó„   K  — t          ¦   «         }t          | ¦  «        D ]}||vr|V — |                     |¦  «         Œ dS )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Údistinctr      sT   è è € õ ‰5Œ5€DÝ�X‘”ð ð ˆØ�tÐÐØˆJˆJˆJØ�HŠH�T‰NŒNˆNøðð ó    s(   [ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)c                 óæ  — |                       ¦   «         }|                      d¦  «         	 |                      ¦   «         }|                     t          j        ¦  «        }|r!|t          t          j        ¦  «        d…         }t                               |¦  «        }|sy	 ddl	}| 
                    |                     d¦  «        ¦  «         |                      ¦   «         }t                               |¦  «        }n# t          t          t          f$ r Y nw xY w|rj|rP|                     d¦  «                             d¦  «        }|dk    r"t          d                     |¦  «        ¦  «        ‚	 |                      |¦  «         dS |r=|                     d¦  «                             d¦  «        |                      |¦  «         S 	 |                      |¦  «         dS # |                      |¦  «         w xY w)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)
    r   Núlatin-1é   zutf-8zencoding 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„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ð ð ð ð
 �ðøøøð ð 	Øð 5Ø)*¯ª°©¬×):Ò):¸9Ñ)EÔ)EÐ&Ø)¨WÒ4Ð4Ý%Ø8×?Ò?Ø2ñ4ô 4ñ5ô 5ð 5ð ð 	�Š�‰Œˆˆˆð ð 	Ø—7’7˜1‘:”:×$Ò$ YÑ/Ô/ð 	�Š�‰Œˆˆð à
�Š�‰Œˆˆˆøˆ�Š�‰Œˆˆøøøs7   «A2G Â,C9 Ã
/G Ã9DÄG ÄDÄAG Æ)G ÇG0z'from\s+__future__\s+import\s+\(*(.+)\)*r   c                 ó|  — ddl }|                      ¦   «         }|                      d¦  «         d}	 |                      ¦   «                              |¦  «        }t          j        dd|¦  «        }t          j        dd|¦  «        }t          j        dd|¦  «        }t                               |¦  «        D ]V}d	„ | 	                    d
¦  «         
                    d¦  «        D ¦   «         }|D ]}t          ||d¦  «        }	|	r
||	j        z  }Œ ŒW	 |                      |¦  «         n# |                      |¦  «         w xY w|S )zRParse the compiler flags by :mod:`__future__` from the given Python
    code.
    r   Nzimport\s*\([\r\n]+zimport (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ÐJr   r   ú,)Ú
__future__r   r   Úreadr   ÚreÚsubÚPYTHON_FUTURE_IMPORT_reÚfinditerr"   ÚsplitÚgetattrÚcompiler_flag)
r$   Úencodingr4   r%   ÚflagsÚbodyr(   ÚnamesÚnameÚfeatures
             r   Úparse_future_flagsrC   e   sA  € ð ÐÐÐØ
�'Š'‰)Œ)€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   ±CD" Ä"D9c                 ó"  — dddddddœ}|                       d¦  «        rdg}| d	d
…         } n%|                       d¦  «        rdg}| dd
…         } ng }t          t          j        d| ¦  «        ¦  «        D ]O\  }}|dz  r|                     ||         ¦  «         Œ&|r'|                     t          j        |¦  «        ¦  «         ŒPt          j        d                     |¦  «        dz   |                     t          j
        d¦  «        ¦  «        }|d
uS )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**ú^r   Nz./é   z	([?*]+/?)Ú ú$ú/)r   Ú	enumerater6   r:   ÚappendÚescaper   ÚjoinÚreplaceÚosÚsep)ÚpatternÚfilenameÚsymbolsÚbufÚidxÚpartr   s          r   Ú	pathmatchrY   …   s.  € ðN ØØØØØðð €Gð ×Ò˜#ÑÔð ØˆeˆØ˜!˜"˜"”+ˆˆØ	×	Ò	˜DÑ	!Ô	!ð ØˆeˆØ˜!˜"˜"”+ˆˆàˆå�rœx¨°WÑ=Ô=Ñ>Ô>ð (ð (‰	ˆˆTØ�‰7ð 	(Ø�JŠJ�w˜t”}Ñ%Ô%Ð%Ð%Øð 	(Ø�JŠJ•r”y ‘”Ñ'Ô'Ð'øÝŒH�R—W’W˜S‘\”\ CÑ'¨×)9Ò)9½"¼&À#Ñ)FÔ)FÑGÔG€EØ˜ÐÐr   c                   ó.   — e Zd Z ej        d¦  «        ZdS )ÚTextWrapperz((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))N)Ú__name__Ú
__module__Ú__qualname__r6   ÚcompileÚ
wordsep_re© r   r   r[   r[   Æ   s&   € € € € € Ø�”ð	/ñô €J€J€Jr   r[   éF   rI   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)ÚwidthÚinitial_indentÚsubsequent_indentÚbreak_long_words)r[   Úwrap)Útextrd   re   rf   Úwrappers        r   Úwraptextrk   Í   s6   € õ  °nØ,=Ø+0ð2ñ 2ô 2€Gð �<Š<˜ÑÔÐr   c                   ó8   — e Zd ZdZd	d„Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )
ÚFixedOffsetTimezonez&Fixed offset in minutes east from UTC.Nc                 óL   — t          |¬¦  «        | _        |€d|z  }|| _        d S )N)Úminutesz
Etc/GMT%+d)r   Ú_offsetÚzone)ÚselfÚoffsetrA   s      r   Ú__init__zFixedOffsetTimezone.__init__å   s.   € Ý ¨Ð0Ñ0Ô0ˆŒØˆ<Ø &Ñ(ˆDØˆŒ	ˆ	ˆ	r   c                 ó   — | j         S ©N©rq   ©rr   s    r   Ú__str__zFixedOffsetTimezone.__str__ë   ó
   € ØŒyÐr   c                 ó(   — d| j         ›d| j        ›d�S )Nz<FixedOffset "z" ú>)rq   rp   rx   s    r   Ú__repr__zFixedOffsetTimezone.__repr__î   s   € € Ø*.¬)¨)¨)°T´\°\°\ÐBÐBr   c                 ó   — | j         S rv   )rp   ©rr   Údts     r   Ú	utcoffsetzFixedOffsetTimezone.utcoffsetñ   s
   € ØŒ|Ðr   c                 ó   — | j         S rv   rw   r   s     r   ÚtznamezFixedOffsetTimezone.tznameô   rz   r   c                 ó   — t           S rv   )ÚZEROr   s     r   ÚdstzFixedOffsetTimezone.dst÷   s   € Ýˆr   rv   )
r\   r]   r^   Ú__doc__rt   ry   r}   r�   rƒ   r†   ra   r   r   rm   rm   â   s|   € € € € € Ø0Ð0ðð ð ð ðð ð ðCð Cð Cðð ð ðð ð ðð ð ð ð r   rm   c                 ó   — | |k    | |k     z
  S rv   ra   )ÚaÚbs     r   Ú_cmpr‹     s   € Ø�ŠE�a˜!’eÑÐr   )r   )rb   rI   rI   )%r‡   r   ÚcollectionsÚdatetimer   r   rQ   r6   ÚtextwrapÚpytzÚ_pytzÚbabelr   ÚobjectÚmissingr   r_   ÚVERBOSEr   r+   r8   rC   rY   r[   rk   ÚOrderedDictÚodictrm   ÚutcÚUTCÚLOCALTZÚget_localzoneÚ	STDOFFSETÚ	DSTOFFSETÚDSTDIFFr…   r‹   ra   r   r   ú<module>rž      sÂ  ððð ð €€€Ø Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &Ð &Ð &Ø 	€	€	€	Ø 	€	€	€	Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð à
ˆ&‰(Œ(€ðð ð ð( %˜"œ*Ø0°"´*ñ>ô >Ð ð/ð /ð /ðd %˜"œ*Ø.ñ0ô 0Ð ðð ð ð ð@>ð >ð >ðBð ð ð ð �(Ô&ñ ô ð ðð ð ð ð$ 	Ô€ðð ð ð ð ˜&ñ ô ð ð6 „i€Ø
Ô
€ØÔ'€àÔ€	ØÔ€	Ø
Ô
€Ø„~€ðð ð ð ð r   