jfdZddlmZddlZddlZddlZddlZddlZddlZddl m Z m Z ddl m Z mZmZddlmZmZeZedZd,d Zejd ejZd-dZejdZd.d/dZd0dZGddejZd1d2d%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) GeneratorIterable)IOAnyTypeVar)dates localtime_Titerable Iterable[_T]returnGenerator[_T, None, None]c#Kt}t|D]}||vr|V|| dS)aYield 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)setiteradd)r seenitems j/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/babel/util.pydistinctrsT 55DX t  JJJ HHTNNNs([ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)fp IO[bytes] str | Nonec|}|d |}|tj}|r!|t tjd}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) rNlatin-1zutf-8zencoding problem: z with BOM)tellseekreadline startswithcodecsBOM_UTF8lenPYTHON_MAGIC_COMMENT_rematchastparsedecode ImportError SyntaxErrorUnicodeEncodeErrorgroup)rposline1has_bommr(line2magic_comment_encodings rparse_encodingr55s ''))CGGAJJJ  ""6?33  1#fo..//0E # ) )% 0 0 9 9  %,,y11222 +11%88 .@A         ^)*):):9)E)E&)W44%&\;Q&\&\&\]]]   771::$$Y//     s7A2G ,C9 /G 9DG DAG 3)G G!z'from\s+__future__\s+import\s+\(*(.+)\)*rencodingstrintc|ddl}|}|dd} ||}t jdd|}t jdd|}t jdd|}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).0xs r z&parse_future_flags..s,JJJqQWWYY__T**JJJrr,) __future__rr readr*resubPYTHON_FUTURE_IMPORT_refinditerr.splitgetattr compiler_flag) rr6rAr/flagsbodyr2namesnamefeatures rparse_future_flagsrOisA ''))CGGAJJJ Ewwyy)) v+Z>>vndD11vosD11(11$77 3 3AJJAGGAJJ4D4DS4I4IJJJE 3 3!*dD993W22E 3 3   Ls CD""D9patternfilenameboolc"ddddddd}|drdg}|d d }n%|d rdg}|d d }ng}ttjd |D]O\}}|d zr|||&|r'|tj|Ptjd|d|tj d}|d uS)aExtended 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" enumeraterCrGappendescaper'joinreplaceossep)rPrQsymbolsbufidxpartr's r pathmatchrfs2N  G#e!""+   D ! !e!""+rx W==>>(( T 7 ( JJwt} % % % %  ( JJry ' ' ' H ''')9)9"&#)F)F G GE  rc.eZdZejdZdS) TextWrapperz((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))N)__name__ __module__ __qualname__rCcompile wordsep_rerrrhrhs& /JJJrrhFrXtextwidthinitial_indentsubsequent_indent list[str]cRt|||d}||S)aSimple 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)rqrrrsbreak_long_words)rhwrap)rprqrrrswrappers rwraptextrys6n,=+0222G <<  rcDeZdZdZddd Zdd Zdd ZddZddZddZ dS)FixedOffsetTimezonez&Fixed offset in minutes east from UTC.NoffsetfloatrMrrNonecVtj||_|d|z}||_dS)N)minutesz Etc/GMT%+d)datetime timedelta_offsetzone)selfr|rMs r__init__zFixedOffsetTimezone.__init__s1)&999 <&(D rr7c|jSNrrs r__str__zFixedOffsetTimezone.__str__ yrc(d|jd|jdS)Nz)rrrs r__repr__zFixedOffsetTimezone.__repr__s< <rs!#"""""  ////////##########"""""""" &(( WT]]*%"*0"*>>----`%"*.00@>>>>B(&$ (/: i -'      ~r