https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/docutils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/docutils/__pycache__/io.cpython-310.pyc
o

!5p`�A�@s.dZddlmZdZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ejdkr1eZGdd	�d	e�ZGd
d�de�Zdd
�ZGdd�de	�ZGdd�de	�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZdS)"z
I/O classes provide a uniform API for low-level input and output.  Subclasses
exist for a variety of input/output mechanisms.
�)�print_function�reStructuredTextN)�
TransformSpec)�locale_encoding�ErrorString�ErrorOutput��rc@�eZdZdS)�
InputErrorN��__name__�
__module__�__qualname__�rr�-/usr/lib/python3/dist-packages/docutils/io.pyr�rc@r
)�OutputErrorNrrrrrrrrc
Cs4zt�|j�t�|�kWStttfyYdSw)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)�streamrrrr�check_encodings

�rc@speZdZdZdZdZ		ddd�Zdd�Zd	d
�Zdd�Z	e
�d
�Z	e
jdfe
jdfe
jdffZ	dd�ZdS)�Inputz1
    Abstract base class for input wrappers.
    �inputN�strictcCs6||_	||_	||_	||_	|s|j|_d|_dS�N)r�
error_handler�source�source_path�default_source_path�successful_encoding)�selfr!r"rr rrr�__init__5szInput.__init__cC�d|j|j|jfS)Nz%s: source=%r, source_path=%r)�	__class__r!r"�r%rrr�__repr__Is
�zInput.__repr__cC�t�r��NotImplementedErrorr)rrr�readMsz
Input.readcCs�|jr|j��dkrt|t�sJd��t|t�r|S|jr"|jg}n|�|�}|r-|g}nddg}tr9|�dt�|D]+}zt|||j�}||_|�	dd�WSt
tfyf}z|}WYd}~q;d}~wwt
d	d
�dd�|D��t
|�f��)
a
        Decode a string, `data`, heuristically.
        Raise UnicodeError if unsuccessful.

        The client application should call ``locale.setlocale`` at the
        beginning of processing::

            locale.setlocale(locale.LC_ALL, '')
        �unicodez=input encoding is "unicode" but input is not a unicode object�utf-8zlatin-1�u�NzEUnable to decode input data.  Tried the following encodings: %s.
(%s)z, cSsg|]}t|��qSr)�repr)�.0�encrrr�
<listcomp>}sz Input.decode.<locals>.<listcomp>)r�lower�
isinstancer/�determine_encoding_from_datar�insertr r$�replace�UnicodeErrorr�joinr)r%�data�	encodings�
data_encodingr5�decoded�err�errorrrr�decodePs<
�


�����zInput.decodescoding[:=]\s*([-\w.]+)r0z	utf-16-bez	utf-16-lecCs`|jD]
\}}|�|�r|Sq|��dd�D]}|j�|�}|r-|�d��d�SqdS)z�
        Try to determine the encoding of `data` by looking *in* `data`.
        Check for a byte order mark (BOM) or an encoding declaration.
        N�r1�ascii)�byte_order_marks�
startswith�
splitlines�coding_slug�search�grouprD)r%r>�start_bytesr�line�matchrrrr9�s
��z"Input.determine_encoding_from_data�NNNr)r
rr�__doc__�component_typer#r&r*r.rD�re�compilerJr�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LErGr9rrrrr+s$
�
0�rc@s>eZdZdZdZdZ		d
dd�Zdd�Zd	d
�Zdd�Z	dS)�Outputz2
    Abstract base class for output wrappers.
    �outputNrcCs8||_	|pd|_	||_	||_	|s|j|_dSdS)Nr)rr �destination�destination_path�default_destination_path)r%rZr[rr rrrr&�s
�zOutput.__init__cCr')Nz'%s: destination=%r, destination_path=%r)r(rZr[r)rrrr*�s�zOutput.__repr__cCr+)z;`data` is a Unicode string, to be encoded by `self.encode`.r,�r%r>rrr�write��zOutput.writecCsH|jr|j��dkrt|t�sJd��|St|t�s|S|�|j|j�S)Nr/zFthe encoding given is "unicode" but the output is not a Unicode string)rr7r8r/�encoder r]rrrr`�s�
z
Output.encoderP)
r
rrrQrRr\r&r*r^r`rrrrrX�s
�rXc@sLeZdZdZdddddejdkrdndfdd	�Zd
d�Zdd
�Zdd�Z	dS)�	FileInputz5
    Input for single, simple file-like objects.
    NrTr�r�rUc	
Cs�t�|||||�||_t�|_|durK|rFtjdkr#|j|jd�}ni}zt	||fi|��|_
Wn2tyE}zt|j
|j|��d}~wwtj|_
ntjdkrdt|j
|j�durdtd|j|j
jf��|syz|j
j|_WdStyxYdSwdS)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 'rU' provides universal newline support
              for text files with Python 2.x.
        Nr�r�errorsFzOEncoding clash: encoding given is "%s" but source is opened with encoding "%s".)rr&�	autocloser�_stderr�sys�version_inforr �openr!�IOErrorr�errno�strerror�stdinrr<�namer"r)	r%r!r"rr rf�mode�kwargsrCrrrr&�s:
���

���zFileInput.__init__c
Cs�z_z"|jtjurtjdkr|jj��}d�|���d}n|j��}Wn3tt	fyV}z%|j
sK|jrKt|jd�}|��}|�
�d�|���d}n�WYd}~nd}~wwW|jr_|�
�n	|jrh|�
�ww|�|�S)zU
        Read and decode a single file and return the data (Unicode string).
        r�
�rbN)r!rhrnri�bufferr.r=rIr<rrr"rj�closerfrD)r%r>rB�b_sourcerrrr.�s0
�������
�
zFileInput.readcCs|���d�S)zK
        Return lines of a single file as list of Unicode strings.
        T)r.rIr)rrr�	readlinesszFileInput.readlinescCs|jtjur
|j��dSdSr)r!rhrnrur)rrrru s�zFileInput.close)
r
rrrQrhrir&r.rwrurrrrra�s
�/rac@s>eZdZdZdZ				ddd�Zdd	�Zd
d�Zdd
�ZdS)�
FileOutputz6
    Output for single, simple file-like objects.
    �wNrTcCs�t�|||||�d|_||_|dur||_t�|_|dur)|r$d|_n tj|_	n|rDt
|j	d�rD||j	jkrDtd|j	j|f|jd�|sYz|j	j|_
WdStyXYdSwdS)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.
        TNFrpz?Warning: Destination mode "%s" differs from specified mode "%s")�file)rXr&�openedrfrprrgrh�stdoutrZ�hasattr�printror[r)r%rZr[rr rf�handle_io_errorsrprrrr&1s:
�
�
�
����zFileOutput.__init__c
Csztjdkrd|jvr|j|jd�}ni}zt|j|jfi|��|_Wnty7}z	t	|j
|j|j��d}~wwd|_dS)Nr�brdT)
rhrirprr rjr[rZrkrrlrmr{)r%rqrCrrrrj\s�
���
zFileOutput.opencCs^|js|��d|jvrtjdkst|j|j�dur3|�|�}tjdkr3t	j
dkr3|�dtt	j
d��}zrz|j�
|�Wn_ty�}z;tjdkryt|t�ryz	|jj�
|�Wn!tyxt|j|j�durvtd|jpmd|jj|jf��|�wWYd	}~nd	}~wttfy�}ztd
|jt|�f��d	}~wwW|jr�|��|S|jr�|��ww)z�Encode `data`, write it to a single file, and return it.

        With Python 3 or binary output mode, `data` is returned unchanged,
        except when specified encoding and output encoding differ.
        r�rF�
rrrFz;Encoding of %s (%s) differs 
  from specified encoding (%s)rZNz:Unable to encode output data. output-encoding is: %s.
(%s))r{rjrprhrirrZrr`�os�linesepr;�bytesr^rr8rtr�
ValueErrorr[r<rrrfru)r%r>rBrrrr^jsT
��
����	������
�zFileOutput.writecCs*|jtjtjfvr|j��d|_dSdS)NF)rZrhr|�stderrrur{r)rrrru�s

�zFileOutput.close)NNNrTNN)	r
rrrQrpr&rjr^rurrrrrx%s
�+'rxc@seZdZdZdZdS)�BinaryFileOutputzL
    A version of docutils.io.FileOutput which writes to a binary file.
    �wbN)r
rrrQrprrrrr��sr�c@�eZdZdZdZdd�ZdS)�StringInputz
    Direct string input.
    �<string>cCs|�|j�S)z$Decode and return the source string.)rDr!r)rrrr.�szStringInput.readN�r
rrrQr#r.rrrrr���r�c@r�)�StringOutputz
    Direct string output.
    r�cCs|�|�|_|jS)z=Encode `data`, store it in `self.destination`, and return it.)r`rZr]rrrr^�szStringOutput.writeN�r
rrrQr\r^rrrrr��r�r�c@r�)�	NullInputz)
    Degenerate input: read nothing.
    z
null inputcC�dS)zReturn a null string.r2rr)rrrr.�r_zNullInput.readNr�rrrrr��r�r�c@r�)�
NullOutputz+
    Degenerate output: write nothing.
    znull outputcCr�)z6Do nothing ([don't even] send data to the bit bucket).Nrr]rrrr^�r_zNullOutput.writeNr�rrrrr��r�r�c@r�)�DocTreeInputzm
    Adapter for document tree input.

    The document tree must be passed in the ``source`` parameter.
    z
doctree inputcCs|jS)zReturn the document tree.)r!r)rrrr.�szDocTreeInput.readNr�rrrrr��sr�)rQ�
__future__r�
__docformat__rhr�rSr�docutilsr�docutils.utils.error_reportingrrrri�strr/rkrrrrrXrarxr�r�r�r�r�r�rrrr�<module>s0
p0Zr	



https://t.me/RX1948 - 2025