ok

Mini Shell

Direktori : /opt/imunify360/venv/lib64/python3.11/site-packages/click/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/click/__pycache__/utils.cpython-311.pyc

�

j��fJO���ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddl
mZddl
m
Z
dd	l
mZdd
l
mZddl
mZddl
mZdd
l
mZddl
mZddl
mZddlmZejrddlZejd��Zejd��Zdedefd�ZdJd�Z dej!defd�Z"dKdede#defd�Z$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-fd1�Z.					dNd3ed4ed/ej'ed0ej'ed5e)d6e)dej(ej!fd7�Z/	dOd3d8d9e)defd:�Z0dPd;ed<e)d=e)defd>�Z1Gd?�d@��Z2	dQdAej'edBej'edefdC�Z3d$d$d$dD�dEej4edFe)dGe)dHe)dej5ef
dI�Z6dS)R�N)�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_default�P�R�name�returnc�t�d�|��������S)N�-)�join�split�lower)rs �k/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/click/utils.py�	_posixifyrs(���8�8�D�J�J�L�L�!�!�'�'�)�)�)��func�t.Callable[P, R]�t.Callable[P, t.Optional[R]]c�f��dddddtjtf�fd�}t|���S)z0Wraps a function so that it swallows exceptions.�argszP.args�kwargszP.kwargsrc�:��	�|i|��S#t$rYnwxYwdS�N)�	Exception)r"r#rs  �r�wrapperzsafecall.<locals>.wrapper$sB���	��4��(��(�(�(���	�	�	��D�	�����ts��
�)�t�Optionalrr)rr's` r�safecallr*!sN����x��:��!�*�Q�-��������'�4�(�(�(r�valuec���t|t��rM	|�tj����S#t
$r|�dd��cYSwxYwt
|��S)z%Converts a value into a valid string.�utf-8�replace)�
isinstance�bytes�decode�sys�getfilesystemencoding�UnicodeError�str)r+s r�make_strr6.su���%����4�	4��<�<�� 9� ;� ;�<�<�<���	4�	4�	4��<�<���3�3�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|dz���cS||kr||krn�cd	�|��S|td
��z
}|dkr1|t||��|dkzz}||krn|dz}|dk�1d	�|d|���d
zS)z+Returns a condensed version of help string.z

���N�r�r�.� z...)�findr�len�	enumerater)r8r9�
paragraph_end�words�total_length�
last_index�i�words        r�make_default_short_helprI8s����I�I�f�%�%�M������N�]�N�#��
�J�J�L�L�E����r�
�Q�x�4����a�b�b�	���L��U���a��J��U�#�#�����4���D�	�	�Q��U�+�+���*�$�$��E���8�s�?�?��8�8�E�'�A��E�'�N�+�+�+�+�+��:�%�%�!�z�/�/��E���x�x������C��J�J��L��a�%�%���E�!�H�
�
��Q��/�/���:�%�%��	�Q���
�a�%�%��8�8�E�"�1�"�I����&�&rc��eZdZdZ				ddejedfded	ejed
ejedef
d�Z	d
edej
fd�Zdefd�Zdej
ej
fd�Zdd�Zdd�Zdd�Zdejejedejedejeddfd�Zdejejfd�ZdS)�LazyFilez�A 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.
    �rN�strictF�filenamezos.PathLike[str]�mode�encoding�errors�atomicc�8�tj|��|_||_||_||_||_|||jdkr!t||||��\|_|_	dSd|vr"t||�����d|_d|_	dS)NrrLT)�os�fspathrrOrPrQrRr�_f�should_close�open�close)�selfrNrOrPrQrRs      r�__init__zLazyFile.__init__qs�����8�,�,��	���	� ��
��������(����9����)4�X�t�X�v�)V�)V�&�D�G�T�&�&�&��d�{�{��X�t�$�$�*�*�,�,�,��D�G� $�D���rrrc�F�t|���|��Sr%)�getattrrX�rZrs  r�__getattr__zLazyFile.__getattr__�s���t�y�y�{�{�D�)�)�)rc�x�|j�t|j��Sdt|j���d|j�d�S)Nz<unopened file 'z' �>)rV�repr�format_filenamerrO�rZs r�__repr__zLazyFile.__repr__�s=���7�����=�=� �L�/�$�)�"<�"<�L�L��	�L�L�L�Lrc��|j�|jS	t|j|j|j|j|j���\}|_n0#t$r#}ddl	m
}||j|j���|�d}~wwxYw||_|S)z�Opens 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.
        N�rRr)�	FileError)�hint)rVrrrOrPrQrRrW�OSError�
exceptionsrh�strerror)rZ�rv�erhs    rrXz
LazyFile.open�s���
�7���7�N�	?�$/��	�4�9�d�m�T�[���%�%�%�!�B��!�!���	?�	?�	?�-�-�-�-�-�-��)�D�I�A�J�7�7�7�Q�>�����	?��������	s�5A�
A3�A.�.A3c�J�|j�|j���dSdS)z+Closes the underlying file, no matter what.N)rVrYrds rrYzLazyFile.close�s%���7���G�M�M�O�O�O�O�O��rc�@�|jr|���dSdS)z�This function only closes the file if it was opened by the lazy
        file wrapper.  For instance this will never close stdin.
        N)rWrYrds r�close_intelligentlyzLazyFile.close_intelligently�s*����	��J�J�L�L�L�L�L�	�	rc��|Sr%�rds r�	__enter__zLazyFile.__enter__�����r�exc_type�	exc_value�tbc�.�|���dSr%)rq�rZrvrwrxs    r�__exit__zLazyFile.__exit__�s��	
� � �"�"�"�"�"rc�R�|���t|j��Sr%)rX�iterrVrds r�__iter__zLazyFile.__iter__�s���	�	�����D�G�}�}�r)rLNrMF�rN)rrK)�__name__�
__module__�__qualname__�__doc__r(�Unionr5r)�boolr[�Anyr_re�IOrXrYrqrt�Type�
BaseExceptionrr{�Iterator�AnyStrr~rsrrrKrKjs����������$(�"*��
%�%��'�#�1�1�2�%��%��*�S�/�	%�
�
�3��%��
%�%�%�%�6*��*���*�*�*�*�M�#�M�M�M�M�
�a�d�1�5�k�����$����
��������#��*�Q�V�M�2�3�#��:�m�,�#�
�J�}�%�	#�

�#�#�#�#��!�*�Q�X�.������rrKc��eZdZdejejddfd�Zdedejfd�Zdd�Z	dej
ejed	ej
ed
ej
e
ddfd�Zdefd�Zdejejfd
�ZdS)�KeepOpenFile�filerNc��||_dSr%)�_file)rZr�s  rr[zKeepOpenFile.__init__�s
��"&��
�
�
rrc�,�t|j|��Sr%)r]r�r^s  rr_zKeepOpenFile.__getattr__�s���t�z�4�(�(�(rc��|Sr%rsrds rrtzKeepOpenFile.__enter__�rurrvrwrxc��dSr%rsrzs    rr{zKeepOpenFile.__exit__�s	��	
�rc�*�t|j��Sr%)rbr�rds rrezKeepOpenFile.__repr__�����D�J���rc�*�t|j��Sr%)r}r�rds rr~zKeepOpenFile.__iter__�r�r)rr�)r�r�r�r(r�r�r[r5r_rtr)r�r�rr{rer�r�r~rsrrr�r��s������'�Q�T�!�%�[�'�T�'�'�'�'�)��)���)�)�)�)�����
��*�Q�V�M�2�3�
��:�m�,�
�
�J�}�%�	
�

�
�
�
�
� �#� � � � � �!�*�Q�X�.� � � � � � rr�TF�messager��nl�err�colorc� �|�#|rt��}nt��}|�dS|�2t|ttt
f��st|��}n|}|r$|pd}t|t��r|dz
}n|dz
}|s|���dSt|tt
f��rQt|��}|�?|���|�|��|���dSn^t|��}t||��rt|��}n/tr(t�t|��}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�	bytearray�flushr	�writerr
rrr
)r�r�r�r�r��out�binary_files       r�echor��s���Z�|��	*�'�)�)�D�D�'�)�)�D��<��F���:�g��U�I�7N�#O�#O��/2�7�|�|�����	���i�R���c�3���	��4�K�C�C��5�L�C����
�
�������#��y�)�*�*�&�)�$�/�/���"��J�J�L�L�L����c�"�"�"��������F�	#�&�e�,�,���T�5�)�)�	&��S�/�/�C�C�
�	&�!�-�)�$�/�/����
&� ��o�o���J�J�s�O�O�O��J�J�L�L�L�L�Lrz'te.Literal['stdin', 'stdout', 'stderr']c�h�tj|��}|�td|�d����|��S)z�Returns a system stream for byte processing.

    :param name: the name of the stream to open.  Valid names are ``'stdin'``,
                 ``'stdout'`` and ``'stderr'``
    N�Unknown standard stream '�')r�get�	TypeError)r�openers  r�get_binary_streamr�Bs>���
��
%�
%�F�
�~��;�D�;�;�;�<�<�<��6�8�8�OrrMrPrQc�l�tj|��}|�td|�d����|||��S)a�Returns 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.
    Nr�r�)rr�r�)rrPrQr�s    r�get_text_streamr�NsE���
�d�
#�
#�F�
�~��;�D�;�;�;�<�<�<��6�(�F�#�#�#rrLrNrO�lazyrRc
�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(�castr�r�rKrr�)rNrOrPrQr�rR�frWs        r�	open_filer�cs���H�
��v�
�D���K��(�D�(�F�6�R�R�R�
�
�	
�"�(�D�(�F�6�R�R�R�O�A�|��1�
�F�1�4���;��Q���0�0���Hrz9t.Union[str, bytes, os.PathLike[str], os.PathLike[bytes]]�shortenc�@�|r tj�|��}ntj|��}t	|t
��r(|�tj��d��}n*|�	dd���dd��}|S)u�Format 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)
rT�path�basenamerUr/r0r1r2r3�encode)rNr�s  rrcrc�s���6�'��7�#�#�H�-�-����9�X�&�&���(�E�"�"�
��?�?�3�#<�#>�#>�	�J�J����?�?�7�,=�>�>�E�E��Y�
�
���Or�app_name�roaming�force_posixc���trf|rdnd}tj�|��}|�tj�d��}tj�||��S|rLtj�tj�dt|��������Stj	dkr=tj�tj�d��|��Stj�tj�dtj�d	����t|����S)
a�Returns 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 Support�XDG_CONFIG_HOMEz	~/.config)
rrT�environr�r��
expanduserrrr2�platform)r�r�r��key�folders     r�get_app_dirr��s��>�.�"�6�i�i��������$�$���>��W�'�'��,�,�F��w�|�|�F�H�-�-�-��M��w�|�|�B�G�.�.�/J�Y�x�5H�5H�/J�/J�K�K�L�L�L�
�|�x����w�|�|��G���>�?�?��
�
�	
��7�<�<�
�
���(�"�'�*<�*<�[�*I�*I�J�J��(�����rc�d�eZdZdZdejejddfd�Zd	d�Zde	dejfd�Z
dS)
�PacifyFlushWrappera�This 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�)rZr�s  rr[zPacifyFlushWrapper.__init__�s
������rc��	|j���dS#t$r }ddl}|j|jkr�Yd}~dSd}~wwxYw)Nr)r�r�rj�errno�EPIPE)rZrnr�s   rr�zPacifyFlushWrapper.flush�so��	��L��� � � � � ���	�	�	��L�L�L��w�%�+�%�%��&�%�%�%�%�%�����	���s��
A�A�A�attrc�,�t|j|��Sr%)r]r�)rZr�s  rr_zPacifyFlushWrapper.__getattr__s���t�|�T�*�*�*rr)r�r�r�r�r(r�r�r[r�r5r_rsrrr�r��s������������Q�U������������+��+���+�+�+�+�+�+rr�r��_mainc�z�|�tjd}|stjd}t|dd��dvs\tjdkrk|jdkr`tj�|��sAtj�|�d���rtj�	|��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 )r2�modules�argvr]rTrr�r��existsr�r(r�r5�splitext�lstrip)r�r��	py_modulers    r�_detect_program_namer�s ��.
�}���J�'�����x��{���u�m�T�*�*�j�8�8�
��4������#�#�����t�$�$�
$��G�N�N�d�=�=�=�)�)�
$�
�w����%�%�%�
��s�E�-�.�.�I�
�7���B�G�,�,�T�2�2�3�3�A�6�D��z��� �)�)�4�)�)�	�/�	�(�(��-�-�/�/�/r)�user�env�glob_recursiver"r�r�r�c�J�ddlm}g}|D]�}|rtj�|��}|rtj�|��}	|||���}n#t
j$rg}YnwxYw|s|�|����|�|����|S)a�Simulate 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)	r�rTr�r��
expandvars�re�error�append�extend)r"r�r�r�r�r��arg�matchess        r�_expand_argsr�?s���8������
�C�� � ���	*��'�$�$�S�)�)�C��	*��'�$�$�S�)�)�C�	��d�3�.�9�9�9�G�G���x�	�	�	��G�G�G�	�����	 ��J�J�s�O�O�O�O��J�J�w������Js�
A�A2�1A2)rrrr )r7)NNTFN)NrM)rLNrMFF)F)TF)NN)7rTr�r2�typingr(�	functoolsr�typesrr�_compatrrr	r
rrr
rrr�globalsr�
TYPE_CHECKING�typing_extensions�te�	ParamSpecr�TypeVarrr5rr*r�r6�intrIrKr�r)r�r�r��BinaryIOr��TextIOr�r�rcr�r�r��Iterable�Listr�rsrr�<module>r�s��	�	�	�	�	�	�	�	�
�
�
�
�����$�$�$�$�$�$�������������)�)�)�)�)�)�)�)�)�)�)�)�(�(�(�(�(�(�'�'�'�'�'�'�#�#�#�#�#�#� � � � � � �&�&�&�&�&�&�������!�!�!�!�!�!�������*�*�*�*�*�*��?��"�"�"�"����S���A�
�A�I�c�N�N��*�C�*�C�*�*�*�*�
)�
)�
)�
)��A�E��c�����/'�/'�#�/'�3�/'��/'�/'�/'�/'�dU�U�U�U�U�U�U�U�p � � � � � � � �4"&�$(���"�d�d�
�Z���
�d�
�*�Q�T�!�%�[�
!�d�	
�d�
�	d�

�:�d��d�
�
d�d�d�d�N	�E�	�!�*�	�	�	�	�!%�&�$�$�
3�$��j��o�$�
�J�s�O�$��X�	$�$�$�$�.� $�&���
.
�.
��.
�

�.
��j��o�.
�
�J�s�O�	.
�
�.
�
�
.
��T�!�%�[�.
�.
�.
�.
�f�'�'�I�'�
�'�	�'�'�'�'�T.�.�#�.��.�$�.�SV�.�.�.�.�b+�+�+�+�+�+�+�+�4CG�40�40�
�*�S�/�40�)*��J�)?�40��40�40�40�40�t���1�1�1�
�*�S�/�1��1�
�	1�
�1��V�C�[�
1�1�1�1�1�1r

Zerion Mini Shell 1.0