Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/babel/__pycache__/util.cpython-311.pyc



]jdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddl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.6.3/opt/imunify360/venv/lib/python3.11/site-packages/babel/util.pydistinctrsT55DXtJJJ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|dd}|dkrtd|d	||dS|r=|dd||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_rematchastparsedecodeImportErrorSyntaxErrorUnicodeEncodeErrorgroup)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}	||}tjdd|}tjdd|}tjdd|}t|D]V}d	|	d

dD}|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
<listcomp>z&parse_future_flags.<locals>.<listcomp>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%|drdg}|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!""+rxW==>>((	T7	(JJwt}%%%%
	(JJry'''H''')9)9"&#)F)FGGErc.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	ZddZdd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<FixedOffset "z" >)rrrs r__repr__zFixedOffsetTimezone.__repr__s<	<<T\<<<<rdtdatetime.datetimedatetime.timedeltac|jSr)rrrs  r	utcoffsetzFixedOffsetTimezone.utcoffsets
|rc|jSrrrs  rtznamezFixedOffsetTimezone.tznamerrctSr)ZEROrs  rdstzFixedOffsetTimezone.dstsrr)r|r}rMrrr~)rr7)rrrr)rrrr7)
rirjrk__doc__rrrrrrrnrrr{r{s00====rr{arbc||k||kz
Srrn)rrs  r_cmprs
Ea!er)rr
rr)rrrr)r)rrr6r7rr8)rPr7rQr7rrR)rorXrX)
rpr7rqr8rrr7rsr7rrt)rrrr),rrArr#collectionsrr`rCtextwrapcollections.abcrrtypingrrrbabelr	r
objectmissingrrrlVERBOSEr&r5rErOrfrhryOrderedDictodicttzinfor{UTCLOCALTZ
get_localzone	STDOFFSET	DSTOFFSETDSTDIFFrrrnrr<module>rs!#"""""



								////////##########""""""""
&((WT]]*%"*0"*>>----`%"*.00@>>>>B(&$	(/:i
-'
		

~r
Back to Directory File Manager