Hacked By AnonymousFox

Current Path : /opt/imunify360/venv/lib/python3.11/site-packages/docutils/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/docutils/__pycache__/io.cpython-311.pyc

�

i��f�]��8�dZdZddlZddlZddlZddlZddlZddlZddlm	Z		ej
��5ejd��ej��dpej
��dZe���Zddd��n#1swxYwYn$#e$rZdejvrdZndZYdZ[ndZ[wdZYnxYw	eje��n#eef$rdZYnwxYwGd	�d
e��ZGd�de��Zd
�Zd�ZGd�de	��ZGd�de	��ZGd�d��ZGd�de��ZGd�de��ZGd�de��Z Gd�de��Z!Gd�de��Z"Gd�d e��Z#Gd!�d"e��Z$Gd#�d$e��Z%dS)%z
I/O classes provide a uniform API for low-level input and output.  Subclasses
exist for a variety of input/output mechanisms.
�reStructuredText�N)�
TransformSpec�ignore�zunknown locale: UTF-8�utf-8c��eZdZdS)�
InputErrorN��__name__�
__module__�__qualname__���k/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/io.pyr	r	3��������rr	c��eZdZdS)�OutputErrorNr
rrrrr4rrrc��	tj|j��tj|��kS#ttt
f$rYdSwxYw)aNTest, whether the encoding of `stream` matches `encoding`.

    Returns

    :None:  if `encoding` or `stream.encoding` are not a valid encoding
            argument (e.g. ``None``) or `stream.encoding is missing.
    :True:  if the encoding argument resolves to the same value as `encoding`,
    :False: if the encodings differ.
    N)�codecs�lookup�encoding�LookupError�AttributeError�	TypeError)�streamrs  r�check_encodingr7sQ����}�V�_�-�-���x�1H�1H�H�H�����3�����t�t����s�.1�A�Ac�$�|jj�d|��S)z5Return string representation of Exception `err`.
    z: )�	__class__r)�errs r�error_stringr Gs���m�$�-�-��-�-�-rc��eZdZdZdZdZ		dd�Zd�Zd�Zd�Z	e
jd	��Z	e
jd
fe
jdfe
jdffZ	d
�Zd�ZdS)�Inputah
    Abstract base class for input wrappers.

    Docutils input objects must provide a `read()` method that
    returns the source, typically as `str` instance.

    Inheriting `TransformSpec` allows input objects to add
    "transforms" and "unknown_reference_resolvers" to the "Transformer".
    (Optional for custom input objects since Docutils 0.19.)
    �inputN�strictc�p�||_	||_	||_	||_	|s|j|_d|_dS�N)r�
error_handler�source�source_path�default_source_path�successful_encoding)�selfr(r)rr's     r�__init__zInput.__init__]sM�� ��
�1�*���*����'�&���-��	8�#�7�D��#'�� �E�Erc�4�|j�d|j�d|j��S)Nz	: source=z, source_path=)rr(r)�r,s r�__repr__zInput.__repr__qs(��26�.�.�.�$�+�+�+�26�2B�2B�D�	Drc��t�)z,Return input as `str`. Define in subclasses.��NotImplementedErrorr/s r�readz
Input.readu���!�!rc���|jr<|j���dkrt|t��s
Jd���t|t��r|S|jr	|jg}n_|�|��}|r|g}nDdg}t
r%t
dkr|�t
��|�d��|D]W}	t|||j��}||_|�	dd��cS#ttf$r}|}Yd}~�Pd}~wwxYwtdd	�d
�|D�����dt|���d����)
a�
        Decode `data` if required.

        Return Unicode `str` instances unchanged (nothing to decode).

        If `self.encoding` is None, determine encoding from data
        or try UTF-8, locale encoding, and (as last ressort) 'latin-1'.
        The client application should call ``locale.setlocale`` at the
        beginning of processing::

            locale.setlocale(locale.LC_ALL, '')

        Raise UnicodeError if unsuccessful.

        Provisional:
          - Raise UnicodeError (instead of falling back to the locale
            encoding) if decoding the source with the default encoding (UTF-8)
            fails and Python is started in `UTF-8 mode`.

            Raise UnicodeError (instead of falling back to "latin1") if both,
            default and locale encoding, fail.

          - Only remove BOM (U+FEFF ZWNBSP at start of data),
            no other ZWNBSPs.
        �unicodez;input encoding is "unicode" but `data` is no `str` instancerzlatin-1u�Nz=Unable to decode input data.  Tried the following encodings: z, c3�4K�|]}t|��V��dSr&)�repr)�.0�encs  r�	<genexpr>zInput.decode.<locals>.<genexpr>�s(����B�B�s��c���B�B�B�B�B�Br�.
(�))r�lower�
isinstance�str�determine_encoding_from_data�_locale_encoding�appendr'r+�replace�UnicodeErrorr�joinr )r,�data�encoding_candidates�
data_encodingr<�decodedr�errors        r�decodezInput.decodeys���4�=�	N�T�]�0�0�2�2�i�?�?��d�C�(�(�
N�
N�,M�
N�
N�(��d�C� � �	��K��=�	6�$(�=�/��� �=�=�d�C�C�M��
6�(5�o�#�#�
(/�i�#�$�A�(8�G�(C�(C�'�.�.�/?�@�@�@�#�*�*�9�5�5�5�&�
	�
	�C�	
��d�C��);�<�<��+.��(����x��4�4�4�4�4�� �+�.�
�
�
������������
�����
'��y�y�B�B�.A�B�B�B�B�B�
'�
'��U�#�#�
'�
'�
'�(�(�	(s�2D�D!�D�D!scoding[:=]\s*([-\w.]+)rz	utf-16-bez	utf-16-lec��|jD]\}}|�|��r|cS�|���dd�D]H}|j�|��}|r*|�d���d��cS�IdS)z�
        Try to determine the encoding of `data` by looking *in* `data`.
        Check for a byte order mark (BOM) or an encoding declaration.
        N�r�ascii)�byte_order_marks�
startswith�
splitlines�coding_slug�search�grouprN)r,rI�start_bytesr�line�matchs      rrCz"Input.determine_encoding_from_data�s���&*�%:�	 �	 �!�K�����{�+�+�
 �����
 ��O�O�%�%�b�q�b�)�	6�	6�D��$�+�+�D�1�1�E��
6��{�{�1�~�~�,�,�W�5�5�5�5�5�
6��trc�X�	|j���S#t$rYdSwxYw)z>Return True, if the input source is connected to a TTY device.F)r(�isattyrr/s rr\zInput.isatty�s=��	��;�%�%�'�'�'���	�	�	��5�5�	������
)�)�NNNr$)rrr
�__doc__�component_typer*r-r0r4rN�re�compilerUr�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LErRrCr\rrrr"r"Ms�������	�	��N���?C�'�F�F�F�F�(D�D�D�"�"�"�D(�D(�D(�L�"�*�7�8�8�K�'���'�2��,�k�:��,�k�:�=��-���� ����rr"c�8�eZdZdZdZdZ		d	d�Zd�Zd�Zd�Z	dS)
�Outputak
    Abstract base class for output wrappers.

    Docutils output objects must provide a `write()` method that
    expects and handles one argument (the output).

    Inheriting `TransformSpec` allows output objects to add
    "transforms" and "unknown_reference_resolvers" to the "Transformer".
    (Optional for custom output objects since Docutils 0.19.)
    �outputNr$c�j�||_	|pd|_	||_	||_	|s|j|_dSdS)Nr$)rr'�destination�destination_path�default_destination_path)r,rjrkrr's     rr-zOutput.__init__�sX�� ��
�7�*�6�h���*�&���.� 0���2��	B�$(�$A�D�!�!�!�	B�	Brc�4�|j�d|j�d|j��S)Nz: destination=z, destination_path=)rrjrkr/s rr0zOutput.__repr__s*���>�>�>�4�#3�#3�#3�T�5J�5J�L�	Mrc��t�)z#Write `data`. Define in subclasses.r2�r,rIs  r�writezOutput.writer5rc��|jr>|j���dkr!t|t��s
Jd���|St|t��s|S|�|j|j��S)a?
        Encode and return `data`.

        If `data` is a `bytes` instance, it is returned unchanged.
        Otherwise it is encoded with `self.encoding`.

        Provisional: If `self.encoding` is set to the pseudo encoding name
        "unicode", `data` must be a `str` instance and is returned unchanged.
        r7z<output encoding is "unicode" but `data` is no `str` instance)rr@rArB�encoder'ros  rrrz
Output.encode
s����=�	�T�]�0�0�2�2�i�?�?��d�C�(�(�
N�
N�,M�
N�
N�(��K��$��$�$�	B��K��;�;�t�}�d�.@�A�A�Arr^)
rrr
r_r`rlr-r0rprrrrrrgrg�s~������	�	��N�#��:>�.6�B�B�B�B�"M�M�M�"�"�"�B�B�B�B�Brrgc�2�eZdZdZ			d	d�Zd�Zd�Zd�ZdS)
�ErrorOutputz�
    Wrapper class for file-like error streams with
    failsafe de- and encoding of `str`, `bytes`, `unicode` and
    `Exception` instances.
    N�backslashreplacerFc���|�
tj}n*|sd}n%t|t��rt	|d��}||_	|pt
|dd��ptpd|_	||_		||_
dS)a�
        :Parameters:
            - `destination`: a file-like object,
                        a string (path to a file),
                        `None` (write to `sys.stderr`, default), or
                        evaluating to `False` (write() requests are ignored).
            - `encoding`: `destination` text encoding. Guessed if None.
            - `encoding_errors`: how to treat encoding errors.
        NF�wrrQ)�sys�stderrrArB�openrj�getattrrDr�encoding_errors�decoding_errors)r,rjrr|r}s     rr-zErrorOutput.__init__&s������*�K�K��	1��K�K�
��S�
)�
)�	1��{�C�0�0�K�&���+�!�8�W�[�*�d�%K�%K�8�,�8�07�	
�
�,�.���%�.���%�%rc���|jsdSt|t��rt|��}	|j�|��dS#t
$r<|j�|�|j|j����YdSt$r�t|t��r;|j�|�|j|j����YdS|jtjtjfvr"|jj
�|��YdS|j�t||j|j����YdSwxYw)z�
        Write `data` to self.destination. Ignore, if self.destination is False.

        `data` can be a `bytes`, `str`, or `Exception` instance.
        N)rjrA�	ExceptionrBrp�UnicodeEncodeErrorrrrr|rrxry�stdout�bufferr}ros  rrpzErrorOutput.writeGs�����	��F��d�I�&�&�	��t�9�9�D�	B���"�"�4�(�(�(�(�(��!�	F�	F�	F���"�"�4�;�;�t�}�/3�/C�$E�$E�
F�
F�
F�
F�
F�
F��		B�		B�		B��$��$�$�
B�� �&�&�t�{�{�4�=�37�3G�(I�(I�J�J�J�J�J�J��!�c�j�#�*�%=�=�=�� �'�-�-�d�3�3�3�3�3�3�� �&�&�s�4���+/�+?�(A�(A�B�B�B�B�B�B�		B���s%�A�AE!�AE!�)>E!�*3E!� E!c��|jtjtjfvrdS	|j���dS#t
$rYdSwxYw)z�
        Close the error-output stream.

        Ignored if the destination is` sys.stderr` or `sys.stdout` or has no
        close() method.
        N)rjrxr�ry�closerr/s rr�zErrorOutput.closeasb�����
�C�J�7�7�7��F�	���"�"�$�$�$�$�$���	�	�	��D�D�	���s�>�
A�Ac�X�	|j���S#t$rYdSwxYw)z=Return True, if the destination is connected to a TTY device.F)rjr\rr/s rr\zErrorOutput.isattyos>��	��#�*�*�,�,�,���	�	�	��5�5�	���r])NNrurF)rrr
r_r-rpr�r\rrrrtrtsn��������37�!3�!*�&�&�&�&�BB�B�B�4�������rrtc�2�eZdZdZ			d
d�Zd�Zd�Zd	�ZdS)�	FileInputz5
    Input for single, simple file-like objects.
    Nr$T�rc��t�|||||��||_t��|_|�g|rS	t|||jpd|j���|_n�#t$r }t|j|j|���d}~wwxYwtj|_nAt|j|j��dur%t!d|j�d|jj�d����|s%	|jj|_dS#t&$rYdSwxYwdS)a�
        :Parameters:
            - `source`: either a file-like object (which is read directly), or
              `None` (which implies `sys.stdin` if no `source_path` given).
            - `source_path`: a path to a file, which is opened and then read.
            - `encoding`: the expected text encoding of the input file.
            - `error_handler`: the encoding error handler to use.
            - `autoclose`: close automatically after read (except when
              `sys.stdin` is the source).
            - `mode`: how the file is to be opened (see standard function
              `open`). The default is read only ('r').
        Nz	utf-8-sig�r�errorsFz#Encoding clash: encoding given is "z&" but source is opened with encoding "z".)r"r-�	autoclosert�_stderrrzrr'r(�OSErrorr	�errno�strerrorrx�stdinrrG�namer)r)r,r(r)rr'r��moderMs        rr-zFileInput.__init__|sT��	���t�V�[�(�M�J�J�J�"���"�}�}����>��
(�O�"&�{�D�04�
�0L��.2�.@�#B�#B�#B�D�K�K���O�O�O�$�U�[�%�.�+�N�N�N�����O����"�i����
�D�K���
7�
7�5�
@�
@��,� $�
�
�
�t�{�/C�/C�/C� E�F�F�
F��	�
�#'�;�#3�� � � ��!�
�
�
����
����	�	s)�$A#�#
B
�-B�B
�&C9�9
D�Dc�^�	|jtjur|jj���}n|j���}nd#t
tf$rP|jsE|jr>t|jd��}|���}|�
��n�YnwxYw|jr|�
��n!#|jr|�
��wwxYw|�|��}d�
|���dgz��S)zU
        Read and decode a single file and return the data (Unicode string).
        �rb�
r8)r(rxr�r�r4rGrrr)rzr�r�rNrHrT)r,rI�b_sources   rr4zFileInput.read�s%��	��{�c�i�'�'��{�)�.�.�0�0����{�'�'�)�)�����k�*�	�	�	��=�
�T�%5�
��� 0�$�7�7���}�}������� � � � ��!� �	�����~�
��
�
�������~�
��
�
�����
�����{�{�4� � ���y�y����*�*�B�4�/�0�0�0s+�AA�
C�AB/�,C�.B/�/C�C,c�P�|����d��S)zK
        Return lines of a single file as list of Unicode strings.
        T)r4rTr/s r�	readlineszFileInput.readlines�s ���y�y�{�{�%�%�d�+�+�+rc�b�|jtjur|j���dSdSr&)r(rxr�r�r/s rr�zFileInput.close�s3���;�c�i�'�'��K��������(�'r)NNNr$Tr�)rrr
r_r-r4r�r�rrrr�r�wsk��������15�.6�&)�&�&�&�&�P1�1�1�2,�,�,� � � � � rr�c�<�eZdZdZdZdZ				dd�Zd�Zd	�Zd
�Z	dS)�
FileOutputz,Output for single, simple file-like objects.z<file>rwNr$Tc��t�|||||��d|_||_|�t	jdtd���|�||_t��|_	|�|rd|_n`tj|_nN|rLt|jd��r7||jjkr'td|jj�d	|�d
�|j	���|s%	|jj|_dS#t"$rYdSwxYwdS)aA
        :Parameters:
            - `destination`: either a file-like object (which is written
              directly) or `None` (which implies `sys.stdout` if no
              `destination_path` given).
            - `destination_path`: a path to a file, which is opened and then
              written.
            - `encoding`: the text encoding of the output file.
            - `error_handler`: the encoding error handler to use.
            - `autoclose`: close automatically after write (except when
              `sys.stdout` or `sys.stderr` is the destination).
            - `handle_io_errors`: ignored, deprecated, will be removed.
            - `mode`: how the file is to be opened (see standard function
              `open`). The default is 'w', providing universal newline
              support for text files.
        TNz_io.FileOutput: init argument "handle_io_errors" is ignored and will be removed in Docutils 2.0.rP)�
stacklevelFr�zWarning: Destination mode "z" differs from specified mode "�")�file)rgr-�openedr��warnings�warn�DeprecationWarningr�rtr�rxr�rj�hasattr�printr�rkr)r,rjrkrr'r��handle_io_errorsr�s        rr-zFileOutput.__init__�sT��&	����k�+;� �-�	1�	1�	1����"����'��M�*�+=�!�
M�
M�
M�
M����D�I�"�}�}������
.�#����#&�:�� � ��	%��t�/��8�8�	%��$�*�/�/�/��E�!%�!1�!6�!6�!6����>��|�
%�
%�
%�
%� �	�
�(,�(8�(=��%�%�%��!�
�
�
����
����	�	s�C)�)
C7�6C7c���d|jvr|j|jd�}ni}	t|j|jfi|��|_n2#t$r%}t|j|j	|j���d}~wwxYwd|_
dS)N�br�T)r�rr'rzrkrjr�rr�r�r�)r,�kwargsrMs   rrzzFileOutput.opens����d�i���"&�-� $� 2�4�4�F�F��F�	5�#�D�$9�4�9�O�O��O�O�D�����	5�	5�	5��e�k�5�>�"�3�5�5�
5�����	5��������s�;�
A*� A%�%A*c��|js|���t|t��rat	|j|j��durEtjdkr |�	dtj��}|�
|��}	|j�|��n�#t$r�}t|t��rz	|jj�|��nY#t$rLt	|j|j��dur-t!d|j�d|jj�d|j�d����|�wxYwYd}~nDd}~wt$t&f$r-}t%d|j�d	t)|���d����d}~wwxYw|jr|���n!#|jr|���wwxYw|S)
aBWrite `data` to a single file, also return it.

        `data` can be a `str` or `bytes` instance.
        If writing `bytes` fails, an attempt is made to write to
        the low-level interface ``self.destination.buffer``.

        If `data` is a `str` instance and `self.encoding` and
        `self.destination.encoding` are  set to different values, `data`
        is encoded to a `bytes` instance using `self.encoding`.

        Provisional: future versions may raise an error if `self.encoding`
        and `self.destination.encoding` are set to different values.
        Fr�zEncoding of z (z&) differs 
  from specified encoding (r?Nz2Unable to encode output data. output-encoding is: r>)r�rzrArBrrjr�os�lineseprFrrrpr�bytesr�r�
ValueErrorrkrGrr r�r�)r,rIrs   rrpzFileOutput.writes/���{�	��I�I�K�K�K��t�S�!�!�	%��t�/���?�?�5�H�H��z�T�!�!��|�|�D�"�*�5�5���;�;�t�$�$�D�	���"�"�4�(�(�(�(���	"�	"�	"��$��&�&�
"�
"��$�+�1�1�$�7�7�7�7��%�"�"�"�%�d�&6�&*�m�5�5�8=�>�>�(�K�4�+@�K�K� $� 0� 9�K�K�:>�-�K�K�K�L�L�L�
"�	�"��������������k�*�	<�	<�	<��;��=�;�;�&2�3�&7�&7�;�;�;�<�<�
<�����	<����
�~�
��
�
�������~�
��
�
�����
�����sU�B.�-F,�.
F
�8E�C.�-E�.AE�E�F,�F
� (F�F
�
F,�,G
c��|jtjtjfvr"|j���d|_dSdS)NF)rjrxr�ryr�r�r/s rr�zFileOutput.close?sA����C�J��
�#;�;�;���"�"�$�$�$��D�K�K�K�<�;r)NNNr$TNN)
rrr
r_rlr�r-rzrpr�rrrr�r��sv������6�6�'���D�)�
;?�BF�-1�-�-�-�-�^���,�,�,�\ � � � � rr�c��eZdZdZdZdS)�BinaryFileOutputzL
    A version of docutils.io.FileOutput which writes to a binary file.
    �wbN)rrr
r_r�rrrr�r�Es��������
�D�D�Drr�c��eZdZdZdZd�ZdS)�StringInputz'Input from a `str` or `bytes` instance.�<string>c�6�|�|j��S)z`Return the source as `str` instance.

        Decode, if required (see `Input.decode`).
        )rNr(r/s rr4zStringInput.readSs��
�{�{�4�;�'�'�'rN�rrr
r_r*r4rrrr�r�Ns/������1�1�$��(�(�(�(�(rr�c��eZdZdZdZd�ZdS)�StringOutputz=Output to a `bytes` or `str` instance.

    Provisional.
    r�c�D�|�|��|_|jS)avStore `data` in `self.destination`, and return it.

        If `self.encoding` is set to the pseudo encoding name "unicode",
        `data` must be a `str` instance and is stored/returned unchanged
        (cf. `Output.encode`).

        Otherwise, `data` can be a `bytes` or `str` instance and is
        stored/returned as a `bytes` instance
        (`str` data is encoded with `self.encode()`).

        Attention: the `output_encoding`_ setting may affect the content
        of the output (e.g. an encoding declaration in HTML or XML or the
        representation of characters as LaTeX macro vs. literal character).
        )rrrjros  rrpzStringOutput.writecs!�� �;�;�t�,�,�����rN�rrr
r_rlrprrrr�r�[s5��������
 *�� � � � � rr�c��eZdZdZdZd�ZdS)�	NullInputzDegenerate input: read nothing.z
null inputc��dS)zReturn an empty string.r8rr/s rr4zNullInput.read|s���rrNr�rrrr�r�vs/������)�)�&������rr�c��eZdZdZdZd�ZdS)�
NullOutputz!Degenerate output: write nothing.znull outputc��dS)zDo nothing, return None.Nrros  rrpzNullOutput.write�s���rNr�rrrr�r��s/������+�+�,��
�
�
�
�
rr�c��eZdZdZdZd�ZdS)�DocTreeInputzm
    Adapter for document tree input.

    The document tree must be passed in the ``source`` parameter.
    z
doctree inputc��|jS)zReturn the document tree.)r(r/s rr4zDocTreeInput.read�s
���{�rNr�rrrr�r��s5��������*������rr�)&r_�
__docformat__r�localer�rarxr��docutilsr�catch_warnings�simplefilter�	getlocale�getdefaultlocalerDr@r�rM�argsrrrr�r	rrr r"rgrtr�r�r�r�r�r�r�r�rrr�<module>r�s
��
��
#�
�
�
�
�
�
�
�
�
�	�	�	�	�	�	�	�	�
�
�
�
�����"�"�"�"�"�"��	 ��	 �	"�	"�4�4����h�'�'�'�,�F�,�.�.�q�1�<�6�v�6�8�8��;�	�+�1�1�3�3��	4�4�4�4�4�4�4�4�4�4�4����4�4�4�4���
� � � ��%�*�,�,�"������������������������F�M�"�#�#�#�#���Y������������� ��������� � � � � �'� � � �
�
�
� .�.�.�Q�Q�Q�Q�Q�M�Q�Q�Q�h;B�;B�;B�;B�;B�]�;B�;B�;B�|U�U�U�U�U�U�U�U�pN �N �N �N �N ��N �N �N �bz �z �z �z �z ��z �z �z �z�����z����
(�
(�
(�
(�
(�%�
(�
(�
(� � � � � �6� � � �6���������
�
�
�
�
��
�
�
������5�����sM�B�AB�B�B�B�B�B�B;�B2�2B;�?C�	C�C

Hacked By AnonymousFox1.0, Coded By AnonymousFox