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



]jJOddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddlmZejrddlZejdZejdZdedefdZdJdZ dej!defdZ"dKdede#defdZ$Gd d!Z%Gd"d#Z&					dLd&ej'ej!d'ej'ej(ej!d(e)d)e)d*ej'e)ddfd+Z*dd,dej+fd-Z,		dMdd,d/ej'ed0ej'edej-fd1Z.					dNd3ed4ed/ej'ed0ej'ed5e)d6e)dej(ej!fd7Z/	dOd3d8d9e)defd:Z0dPd;ed<e)d=e)defd>Z1Gd?d@Z2	dQdAej'edBej'edefdCZ3d$d$d$dDdEej4edFe)dGe)dHe)dej5ef
dIZ6dS)RN)update_wrapper)
ModuleType)
TracebackType)_default_text_stderr)_default_text_stdout)_find_binary_writer)auto_wrap_for_ansi)binary_streams)open_stream)should_strip_ansi)
strip_ansi)text_streams)WIN)resolve_color_defaultPRnamereturnctd|S)N-)joinsplitlower)rs k/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/click/utils.py	_posixifyrs(88DJJLL!!'')))funct.Callable[P, R]t.Callable[P, t.Optional[R]]cfdddddtjtffd}t|S)z0Wraps a function so that it swallows exceptions.argszP.argskwargszP.kwargsrc:	|i|S#t$rYnwxYwdSN)	Exception)r"r#rs  rwrapperzsafecall.<locals>.wrapper$sB	4((((			D	ts
)tOptionalrr)rr's` rsafecallr*!sNx:!*Q-'4(((rvaluect|trM	|tjS#t
$r|ddcYSwxYwt
|S)z%Converts a value into a valid string.utf-8replace)
isinstancebytesdecodesysgetfilesystemencodingUnicodeErrorstr)r+s rmake_strr6.su%4	4<< 9 ; ;<<<	4	4	4<<33333	4u::s%= A A -help
max_lengthc|d}|dkr
|d|}|}|sdS|ddkr
|dd}d}t|dz
}t|D]b\}}|t||dkzz
}||krnR|ddkr"d	|d|dzcS||kr||krncd	|S|td
z
}|dkr1|t|||dkzz}||krn|dz}|dk1d	|d|d
zS)z+Returns a condensed version of help string.z

Nrr. z...)findrlen	enumerater)r8r9
paragraph_endwordstotal_length
last_indexiwords        rmake_default_short_helprI8sIIf%%MN]N#
JJLLEr
Qx4abb	LUaJU##4D		QU++*$$E8s??88E'AE'N+++++:%%!z//ExxCJJLa%%E!H

Q//:%%	Q
a%%88E"1"I&&rceZdZdZ				ddejedfded	ejed
ejedef
dZ	d
edej
fdZdefdZdej
ej
fdZddZddZddZdejejedejedejeddfdZdejejfdZdS)LazyFilezA lazy file works like a regular file but it does not fully open
    the file but it does perform some basic checks early to see if the
    filename parameter does make sense.  This is useful for safely opening
    files for writing.
    rNstrictFfilenamezos.PathLike[str]modeencodingerrorsatomicc8tj||_||_||_||_||_|||jdkr!t||||\|_|_	dSd|vr"t||d|_d|_	dS)NrrLT)osfspathrrOrPrQrRr_fshould_closeopenclose)selfrNrOrPrQrRs      r__init__zLazyFile.__init__qs8,,		 
(9)4XtXv)V)V&DGT&&&d{{Xt$$**,,,DG $DrrrcFt||Sr%)getattrrXrZrs  r__getattr__zLazyFile.__getattr__styy{{D)))rcx|jt|jSdt|jd|jdS)Nz<unopened file 'z' >)rVreprformat_filenamerrOrZs r__repr__zLazyFile.__repr__s=7== L/$)"<"<LL	LLLLrc|j|jS	t|j|j|j|j|j\}|_n0#t$r#}ddl	m
}||j|j|d}~wwxYw||_|S)zOpens the file if it's not yet open.  This call might fail with
        a :exc:`FileError`.  Not handling this error will produce an error
        that Click shows.
        NrRr)	FileError)hint)rVrrrOrPrQrRrWOSError
exceptionsrhstrerror)rZrverhs    rrXz
LazyFile.opens
77N	?$/	49dmT[%%%!B!!	?	?	?------)DIAJ777Q>	?	s5A
A3A..A3cJ|j|jdSdS)z+Closes the underlying file, no matter what.N)rVrYrds rrYzLazyFile.closes%7GMMOOOOOrc@|jr|dSdS)zThis function only closes the file if it was opened by the lazy
        file wrapper.  For instance this will never close stdin.
        N)rWrYrds rclose_intelligentlyzLazyFile.close_intelligentlys*	JJLLLLL		rc|Sr%rds r	__enter__zLazyFile.__enter__rexc_type	exc_valuetbc.|dSr%)rqrZrvrwrxs    r__exit__zLazyFile.__exit__s	
  """""rcR|t|jSr%)rXiterrVrds r__iter__zLazyFile.__iter__s		DG}}r)rLNrMFrN)rrK)__name__
__module____qualname____doc__r(Unionr5r)boolr[Anyr_reIOrXrYrqrtType
BaseExceptionrr{IteratorAnyStrr~rsrrrKrKjs$("*
%%'#112%%*S/	%

3%
%%%%6******M#MMMM
ad15k$
#*QVM23#:m,#
J}%	#

####!*QX.rrKceZdZdejejddfdZdedejfdZddZ	dej
ejed	ej
ed
ej
e
ddfdZdefdZdejejfd
ZdS)KeepOpenFilefilerNc||_dSr%)_file)rZrs  rr[zKeepOpenFile.__init__s
"&


rrc,t|j|Sr%)r]rr^s  rr_zKeepOpenFile.__getattr__stz4(((rc|Sr%rsrds rrtzKeepOpenFile.__enter__rurrvrwrxcdSr%rsrzs    rr{zKeepOpenFile.__exit__s		
rc*t|jSr%)rbrrds rrezKeepOpenFile.__repr__DJrc*t|jSr%)r}rrds rr~zKeepOpenFile.__iter__rr)rr)rrrr(rrr[r5r_rtr)rrrr{rerrr~rsrrrrs'QT!%['T''''))))))
*QVM23
:m,

J}%	





 #     !*QX.      rrTFmessagernlerrcolorc |#|rt}nt}|dS|2t|ttt
fst|}n|}|r$|pd}t|tr|dz
}n|dz
}|s|dSt|tt
frQt|}|?||||dSn^t|}t||rt|}n/tr(tt|}n|st|}|||dS)aPrint a message and newline to stdout or a file. This should be
    used instead of :func:`print` because it provides better support
    for different data, files, and environments.

    Compared to :func:`print`, this does the following:

    -   Ensures that the output encoding is not misconfigured on Linux.
    -   Supports Unicode in the Windows console.
    -   Supports writing to binary outputs, and supports writing bytes
        to text outputs.
    -   Supports colors and styles on Windows.
    -   Removes ANSI color and style codes if the output does not look
        like an interactive terminal.
    -   Always flushes the output.

    :param message: The string or bytes to output. Other objects are
        converted to strings.
    :param file: The file to write to. Defaults to ``stdout``.
    :param err: Write to ``stderr`` instead of ``stdout``.
    :param nl: Print a newline after the message. Enabled by default.
    :param color: Force showing or hiding colors and other styles. By
        default Click will remove color if the output does not look like
        an interactive terminal.

    .. versionchanged:: 6.0
        Support Unicode output on the Windows console. Click does not
        modify ``sys.stdout``, so ``sys.stdout.write()`` and ``print()``
        will still not support Unicode.

    .. versionchanged:: 4.0
        Added the ``color`` parameter.

    .. versionadded:: 3.0
        Added the ``err`` parameter.

    .. versionchanged:: 2.0
        Support colors on Windows if colorama is installed.
    Nr<

)rrr/r5r0	bytearrayflushr	writerr
rrr
)rrrrroutbinary_files       rechorsZ|	*'))DD'))D<F:gUI7N#O#O/27||	iRc3	4KCC5LC

#y)**&)$//"JJLLLc"""F	#&e,,T5))	&S//CC
	&!-)$//
& ooJJsOOOJJLLLLLrz'te.Literal['stdin', 'stdout', 'stderr']chtj|}|td|d|S)zReturns a system stream for byte processing.

    :param name: the name of the stream to open.  Valid names are ``'stdin'``,
                 ``'stdout'`` and ``'stderr'``
    NUnknown standard stream '')rget	TypeError)ropeners  rget_binary_streamrBs>

%
%F
~;D;;;<<<688OrrMrPrQcltj|}|td|d|||S)aReturns a system stream for text processing.  This usually returns
    a wrapped stream around a binary stream returned from
    :func:`get_binary_stream` but it also can take shortcuts for already
    correctly configured streams.

    :param name: the name of the stream to open.  Valid names are ``'stdin'``,
                 ``'stdout'`` and ``'stderr'``
    :param encoding: overrides the detected default encoding.
    :param errors: overrides the default error mode.
    Nrr)rrr)rrPrQrs    rget_text_streamrNsE
d
#
#F
~;D;;;<<<6(F###rrLrNrOlazyrRc
6|rAtjtjtjt	|||||St|||||\}}|s<tjtjtjt
|}|S)aVOpen a file, with extra behavior to handle ``'-'`` to indicate
    a standard stream, lazy open on write, and atomic write. Similar to
    the behavior of the :class:`~click.File` param type.

    If ``'-'`` is given to open ``stdout`` or ``stdin``, the stream is
    wrapped so that using it in a context manager will not close it.
    This makes it possible to use the function without accidentally
    closing a standard stream:

    .. code-block:: python

        with open_file(filename) as f:
            ...

    :param filename: The name of the file to open, or ``'-'`` for
        ``stdin``/``stdout``.
    :param mode: The mode in which to open the file.
    :param encoding: The encoding to decode or encode a file opened in
        text mode.
    :param errors: The error handling mode.
    :param lazy: Wait to open the file until it is accessed. For read
        mode, the file is temporarily opened to raise access errors
        early, then closed until it is read again.
    :param atomic: Write to a temporary file and replace the given file
        on close.

    .. versionadded:: 3.0
    rg)r(castrrrKrr)rNrOrPrQrrRfrWs        r	open_filercsH
v
DK(D(F6RRR

	
"(D(F6RRROA|1
F14;Q00Hrz9t.Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]shortenc@|r tj|}ntj|}t	|t
r(|tjd}n*|	dddd}|S)uFormat a filename as a string for display. Ensures the filename can be
    displayed by replacing any invalid bytes or surrogate escapes in the name
    with the replacement character ``�``.

    Invalid bytes or surrogate escapes will raise an error when written to a
    stream with ``errors="strict". This will typically happen with ``stdout``
    when the locale is something like ``en_GB.UTF-8``.

    Many scenarios *are* safe to write surrogates though, due to PEP 538 and
    PEP 540, including:

    -   Writing to ``stderr``, which uses ``errors="backslashreplace"``.
    -   The system has ``LANG=C.UTF-8``, ``C``, or ``POSIX``. Python opens
        stdout and stderr with ``errors="surrogateescape"``.
    -   None of ``LANG/LC_*`` are set. Python assumes ``LANG=C.UTF-8``.
    -   Python is started in UTF-8 mode  with  ``PYTHONUTF8=1`` or ``-X utf8``.
        Python opens stdout and stderr with ``errors="surrogateescape"``.

    :param filename: formats a filename for UI display.  This will also convert
                     the filename into unicode without failing.
    :param shorten: this optionally shortens the filename to strip of the
                    path that leads up to it.
    r.r-surrogateescape)
rTpathbasenamerUr/r0r1r2r3encode)rNrs  rrcrcs6'7##H--9X&&(E""
??3#<#>#>	JJ??7,=>>EEY

Orapp_nameroamingforce_posixctrf|rdnd}tj|}|tjd}tj||S|rLtjtjdt|Stj	dkr=tjtjd|Stjtjdtjd	t|S)
aReturns the config folder for the application.  The default behavior
    is to return whatever is most appropriate for the operating system.

    To give you an idea, for an app called ``"Foo Bar"``, something like
    the following folders could be returned:

    Mac OS X:
      ``~/Library/Application Support/Foo Bar``
    Mac OS X (POSIX):
      ``~/.foo-bar``
    Unix:
      ``~/.config/foo-bar``
    Unix (POSIX):
      ``~/.foo-bar``
    Windows (roaming):
      ``C:\Users\<user>\AppData\Roaming\Foo Bar``
    Windows (not roaming):
      ``C:\Users\<user>\AppData\Local\Foo Bar``

    .. versionadded:: 2.0

    :param app_name: the application name.  This should be properly capitalized
                     and can contain whitespace.
    :param roaming: controls if the folder should be roaming or not on Windows.
                    Has no effect otherwise.
    :param force_posix: if this is set to `True` then on any POSIX system the
                        folder will be stored in the home folder with a leading
                        dot instead of the XDG config home or darwin's
                        application support folder.
    APPDATALOCALAPPDATAN~z~/.darwinz~/Library/Application SupportXDG_CONFIG_HOMEz	~/.config)
rrTenvironrr
expanduserrrr2platform)rrrkeyfolders     rget_app_dirrs>."6ii$$>W'',,Fw||FH---Mw||BG../JYx5H5H/J/JKKLLL
|xw||G>??

	
7<<

("'*<*<[*I*IJJ(rcdeZdZdZdejejddfdZd	dZde	dejfdZ
dS)
PacifyFlushWrapperaThis wrapper is used to catch and suppress BrokenPipeErrors resulting
    from ``.flush()`` being called on broken pipe during the shutdown/final-GC
    of the Python interpreter. Notably ``.flush()`` is always called on
    ``sys.stdout`` and ``sys.stderr``. So as to have minimal impact on any
    other cleanup code, and the case where the underlying file is not a broken
    pipe, all calls and attributes are proxied.
    wrappedrNc||_dSr%)r)rZrs  rr[zPacifyFlushWrapper.__init__s
rc	|jdS#t$r }ddl}|j|jkrYd}~dSd}~wwxYw)Nr)rrrjerrnoEPIPE)rZrnrs   rrzPacifyFlushWrapper.flushso	L     			LLLw%+%%&%%%%%	s
AAAattrc,t|j|Sr%)r]r)rZrs  rr_zPacifyFlushWrapper.__getattr__st|T***rr)rrrrr(rrr[rr5r_rsrrrrsQU++++++++rrr_maincz|tjd}|stjd}t|dddvs\tjdkrk|jdkr`tj|sAtj|drtj	|Stjt|j}tj
tj	|d}|dkr|d	|}d
|d	S)a:Determine the command used to run the program, for use in help
    text. If a file or entry point was executed, the file name is
    returned. If ``python -m`` was used to execute a module or package,
    ``python -m name`` is returned.

    This doesn't try to be too precise, the goal is to give a concise
    name for help text. Files are only shown as their name without the
    path. ``python`` is only shown for modules, and the full path to
    ``sys.executable`` is not shown.

    :param path: The Python file being executed. Python puts this in
        ``sys.argv[0]``, which is used by default.
    :param _main: The ``__main__`` module. This should only be passed
        during internal testing.

    .. versionadded:: 8.0
        Based on command args detection in the Werkzeug reloader.

    :meta private:
    N__main__r__package__>Nr<ntr<z.exer>z
python -m )r2modulesargvr]rTrrrexistsrr(rr5splitextlstrip)rr	py_modulers    r_detect_program_namers .
}J'x{umT**j88
4##t$$
$GNNd===))
$
w%%%
sE-..I
7BG,,T2233A6Dz ))4))	/	((--///r)userenvglob_recursiver"rrrcJddlm}g}|D]}|rtj|}|rtj|}	|||}n#t
j$rg}YnwxYw|s|||||S)aSimulate Unix shell expansion with Python functions.

    See :func:`glob.glob`, :func:`os.path.expanduser`, and
    :func:`os.path.expandvars`.

    This is intended for use on Windows, where the shell does not do any
    expansion. It may not exactly match what a Unix shell would do.

    :param args: List of command line arguments to expand.
    :param user: Expand user home directory.
    :param env: Expand environment variables.
    :param glob_recursive: ``**`` matches directories recursively.

    .. versionchanged:: 8.1
        Invalid glob patterns are treated as empty expansions rather
        than raising an error.

    .. versionadded:: 8.0

    :meta private:
    r)glob)	recursive)	rrTrr
expandvarsreerrorappendextend)r"rrrrrargmatchess        r_expand_argsr?s8
C  	*'$$S))C	*'$$S))C	d3.999GGx			GGG		 JJsOOOOJJwJs
AA21A2)rrrr )r7)NNTFN)NrM)rLNrMFF)F)TF)NN)7rTrr2typingr(	functoolsrtypesrr_compatrrr	r
rrr
rrrglobalsr
TYPE_CHECKINGtyping_extensionste	ParamSpecrTypeVarrr5rr*rr6intrIrKrr)rrrBinaryIOrTextIOrrrcrrrIterableListrrsrr<module>rs								



$$$$$$))))))))))))((((((''''''######      &&&&&&!!!!!!******?""""SA
AIcNN*C*C****
)
)
)
)AEc/'/'#/'3/'/'/'/'/'dUUUUUUUUp        4"&$("dd
Z
d
*QT!%[
!d	
d
	d

:dd

ddddN	E	!*				!%&$$
3$jo$
JsO$X	$$$$. $&
.
.
.

.
jo.

JsO	.
.


.
T!%[.
.
.
.
f''I'
'	''''T..#..$.SV....b++++++++4CG4040
*S/40)*J)?4040404040t111
*S/11
	1
1VC[
111111r
Back to Directory File Manager