jfJOddlZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l 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;edZ1Gd?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.3.5/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..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 4 u::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# JJLLE r Qx4abb LUaJU##  4D QU++ * $ $ E 8s??88E'AE'N++ + + + : % %!z// ExxCJJL a%%E!H Q// : % %  Q a%% 88E"1"I   &&rc eZdZdZ ddejedfded ejed ejed ef d Z d edej fdZ defdZ 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)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 7 7N ?$/ 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 ej e d ej e d ej e ddfd Zdefd 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 )rrrrrout binary_files rechorsZ |  *'))DD'))D < F:gUI7N#O#O/27|| iR c3    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 '')r get 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#> JJ??7,=>>EE Y   Orapp_nameroaming force_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\\AppData\Roaming\Foo Bar`` Windows (not roaming): ``C:\Users\\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 r get_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 |Stj t|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 7  BG,,T22 3 3A 6D 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 r r r rrrglobalsr TYPE_CHECKINGtyping_extensionste ParamSpecrTypeVarrr5rr*rr6intrIrKrr)rrrBinaryIOrTextIOrrrcrrrIterableListrrsrrrs $$$$$$))))))))))))((((((''''''###### &&&&&&!!!!!!******?"""" SA AIcNN*C*C**** ) ) ) )AEc/'/'#/'3/'/'/'/'/'dUUUUUUUUp        4"&$(" dd Z d *QT!%[ !d d  d :d  d  ddddN E !*    !%&$$ 3$jo$ JsO$X $$$$. $& . . . . jo.  JsO .  .  . T!%[. . . . f''I' ' ''''T..#..$.SV....b++++++++4CG4040 *S/40)*J)?4040404040t 111 *S/1 1  1  1 VC[ 111111r