403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.37
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/docutils/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/docutils/utils/__pycache__/error_reporting.cpython-311.pyc
�

��b����dZddlZddlZddlmZejded���ejdkre	Z
Gd�d	��ZGd
�de��ZGd�d
��Z
dS)u9
Deprecated module to handle Exceptions across Python versions.

.. warning::
   This module is deprecated with the end of support for Python 2.7
   and will be removed in Docutils 0.21 or later.

   Replacements:
     | SafeString  -> str
     | ErrorString -> docutils.io.error_string()
     | ErrorOutput -> docutils.io.ErrorOutput

Error reporting should be safe from encoding/decoding errors.
However, implicit conversions of strings and exceptions like

>>> u'%s world: %s' % ('Hällo', Exception(u'Hällo'))

fail in some Python versions:

* In Python <= 2.6, ``unicode(<exception instance>)`` uses
  `__str__` and fails with non-ASCII chars in`unicode` arguments.
  (work around http://bugs.python.org/issue2517):

* In Python 2, unicode(<exception instance>) fails, with non-ASCII
  chars in arguments. (Use case: in some locales, the errstr
  argument of IOError contains non-ASCII chars.)

* In Python 2, str(<exception instance>) fails, with non-ASCII chars
  in `unicode` arguments.

The `SafeString`, `ErrorString` and `ErrorOutput` classes handle
common exceptions.
�N)�_locale_encodingz�The `docutils.utils.error_reporting` module is deprecated and will be removed in Docutils 0.21 or later.
Details with help("docutils.utils.error_reporting").�)�
stacklevel��rc�*�eZdZdZ		dd�Zd�Zd�ZdS)	�
SafeStringzG
    A wrapper providing robust conversion to `str` and `unicode`.
    N�backslashreplace�replacec�r�||_|pt|dd��ptpd|_||_||_dS)N�encoding�ascii)�data�getattr�locale_encodingr
�encoding_errors�decoding_errors)�selfrr
rrs     �@/usr/lib/python3/dist-packages/docutils/utils/error_reporting.py�__init__zSafeString.__init__CsL����	�!�7�W�T�:�t�%D�%D�7�+�7�/6�	
�
�.���.�����c���	t�j��S#t$r�t�jt��r/�fd��jjD��}d�|��cYSt�jt��r@tj	dkr	�jcYS�j�
�j�j��cYS�wxYw)Nc	�`��g|]*}tt|�j�j������+S�)�strr	r
r��.0�argrs  �r�
<listcomp>z&SafeString.__str__.<locals>.<listcomp>PsK���3�3�3���J�s�D�M�'+�';�=�=�>�>�3�3�3r�, r)
rr�UnicodeEncodeError�
isinstance�	Exception�args�join�unicode�sys�version_info�encoder
r)rr$s` r�__str__zSafeString.__str__Ks����	��t�y�>�>�!��!�	�	�	��$�)�Y�/�/�
'�3�3�3�3�#'�9�>�3�3�3���y�y����&�&�&��$�)�W�-�-�
B��#�f�,�,��9�$�$�$��9�+�+�D�M�,0�,@�B�B�B�B�B��	���s��AC�*1C�%C�Cc���	t�j��}t�jt��r|�dd��}|S#t
$�r}t�jt��rad�jj�dt�jj�j	�j
���dt�jj�j	�j
���d�cYd}~St�jt��r2�fd��jj
D��}d�|��cYd}~St|t��r%t�j�j	�j
��cYd}~S�d}~wwxYw)	af
        Return unicode representation of `self.data`.

        Try ``unicode(self.data)``, catch `UnicodeError` and

        * if `self.data` is an Exception instance, work around
          http://bugs.python.org/issue2517 with an emulation of
          Exception.__unicode__,

        * else decode with `self.encoding` and `self.decoding_errors`.
        z: u'z: 'z[Errno z] �'Nc	�b��g|]+}tt|�j�j�������,S))r)r&r	r
rrs  �rrz*SafeString.__unicode__.<locals>.<listcomp>vsX���3�3�3� � �
�$'���48�4H�!J�!J�!J�K�K�3�3�3rr )r&rr"�EnvironmentErrorr�UnicodeError�errnor	�strerrorr
r�filenamer#r$r%�UnicodeDecodeError)r�u�errorr$s`   r�__unicode__zSafeString.__unicode__\s����	���	�"�"�A��$�)�%5�6�6�
-��I�I�f�e�,�,���H���	�	�	��$�)�%5�6�6�
6�
6��I�O�O�O��t�y�1�4�=�#�3�5�5�5�5��t�y�1�4�=�#�3�5�5�5�5�	6�6�6�6�6�6�6��$�)�Y�/�/�
(�3�3�3�3�$(�9�>�3�3�3���z�z�$�'�'�'�'�'�'�'�'��%�!3�4�4�
O��t�y�$�-��9M�N�N�N�N�N�N�N�N������!	���s>�AA	�	E�A5E�	E�AE�E�4E�E�E�E)Nr
r)�__name__�
__module__�__qualname__�__doc__rr*r6rrrr	r	>sY��������=O�!*�/�/�/�/����"!�!�!�!�!rr	c�,��eZdZdZ�fd�Z�fd�Z�xZS)�ErrorStringz3
    Safely report exception type and message.
    c�z��|jjj�dtt|�������S�Nz: )r�	__class__r7�superr<r*�rr?s �rr*zErrorString.__str__�s:����9�.�7�7�7� ��d�3�3�;�;�=�=�=�?�	?rc�z��|jjj�dtt|�������Sr>)rr?r7r@r<r6rAs �rr6zErrorString.__unicode__�s<��� �I�/�8�8�8�!�+�t�4�4�@�@�B�B�B�D�	Dr)r7r8r9r:r*r6�
__classcell__)r?s@rr<r<�sd���������?�?�?�?�?�D�D�D�D�D�D�D�D�Drr<c�,�eZdZdZ			dd�Zd�Zd�ZdS)	�ErrorOutputz�
    Wrapper class for file-like error streams with
    failsafe de- and encoding of `str`, `bytes`, `unicode` and
    `Exception` instances.
    Nr
rc�~�|�
tj}nt|sd}not|t��rt	|d��}nIt|t
��r4t	|�tj����d��}||_	|pt|dd��ptpd|_	||_	||_
dS)a�
        :Parameters:
            - `stream`: 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`: `stream` text encoding. Guessed if None.
            - `encoding_errors`: how to treat encoding errors.
        NF�wr
r)r'�stderrr"r�openr&r)�getfilesystemencoding�streamrrr
rr)rrKr
rrs     rrzErrorOutput.__init__�s����>��Z�F�F��	K��F�F�
���
$�
$�	K��&�#�&�&�F�F�
���
(�
(�	K��&�-�-��(A�(C�(C�D�D�c�J�J�F����+�!�7�W�V�Z��%F�%F�7�+�7�/6�	
�
�,�.���%�.���%�%rc�
�|jdurdSt|t��r.tt	||j|j|j����}	|j�|��dS#t$r<|j�|�
|j|j����YdSt$r�t|t��r;|j�|�
|j|j����YdS|jtj
tjfvr"|jj�|��YdS|j�t||j|j����YdSwxYw)z�
        Write `data` to self.stream. Ignore, if self.stream is False.

        `data` can be a `string`, `unicode`, or `Exception` instance.
        FN)rKr"r#r&r	r
rr�writer!r)�	TypeErrorr'rH�stdout�buffer)rrs  rrMzErrorOutput.write�s����;�%����F��d�I�&�&�	=��:�d�D�M�&*�&:�&*�&:�<�<�=�=�D�
	A��K���d�#�#�#�#�#��!�	P�	P�	P��K���d�k�k�$�-��9M�N�N�O�O�O�O�O�O��		A�		A�		A��$��(�(�
���!�!�$�+�+�d�m�.2�.B�#D�#D�E�E�E�����{�s�z�3�:�6�6�6���"�(�(��.�.�.�.�.�.���!�!�'�$��
�*.�*>�#@�#@�A�A�A�A�A�A�		A���s&�A,�,AF�1AF�
>F�3F�Fc��|jtjtjfvrdS	|j���dS#t
$rYdSwxYw)z�
        Close the error-output stream.

        Ignored if the stream is` sys.stderr` or `sys.stdout` or has no
        close() method.
        N)rKr'rOrH�close�AttributeError)rs rrRzErrorOutput.close�s`���;�3�:�s�z�2�2�2��F�	��K����������	�	�	��D�D�	���s�>�
A�A)NNr
r)r7r8r9r:rrMrRrrrrErE�s_��������.2�!3�!*�!&�!&�!&�!&�FA�A�A�6����rrE)r:r'�warnings�docutils.iorr�warn�DeprecationWarningr(rr&r	r<rErrr�<module>rXs
�� � �D�
�
�
�����;�;�;�;�;�;�
��
�E�!�Q�0�0�0�0���v����G�?�?�?�?�?�?�?�?�D
D�
D�
D�
D�
D�*�
D�
D�
D�Q�Q�Q�Q�Q�Q�Q�Q�Q�Qr

Youez - 2016 - github.com/yon3zu
LinuXploit