| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/docutils/utils/__pycache__/ |
Upload File : |
a
OԼa�! �
@ s d Z ddlZddlZzddlZW n ey6 dZY n�0 ze�� d pPe�� d ZW nF ey� Z z de j
v rtdZndZW Y dZ [ ndZ [ 0 dZY n0 ze�ep�d� W n ey� dZY n0 ej
dkr�eZG dd � d e�ZG d
d� de�ZG dd
� d
e�ZdS )u�
Provisional module to handle Exceptions across Python versions.
This module will be deprecated with the end of support for Python 2.7
and be removed in Docutils 1.2.
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� zunknown locale: UTF-8zUTF-8� �� r c @ s* e Zd ZdZddd�Zdd� Zd d
� ZdS )�
SafeStringzG
A wrapper providing robust conversion to `str` and `unicode`.
N�backslashreplace�replacec C s0 || _ |pt|dd �ptpd| _|| _|| _d S )N�encoding�ascii)�data�getattr�locale_encodingr �encoding_errors�decoding_errors)�selfr r r r � r �B/usr/lib/python3.9/site-packages/docutils/utils/error_reporting.py�__init__R s ��zSafeString.__init__c s� zt � j�W S ty� t� jt�rJ� fdd�� jjD �}d�|� Y S t� jt�r�tj dkrj� j Y S � j�
� j� j� Y S � Y n0 d S )Nc s g | ]}t t|� j� j���qS r )�strr r r ��.0�arg�r r r �
<listcomp>` s �
�z&SafeString.__str__.<locals>.<listcomp>�, r )
r r �UnicodeEncodeError�
isinstance� Exception�args�join�unicode�sys�version_info�encoder r )r r r r r �__str__[ s
�
�zSafeString.__str__c
s� z(t � j�}t� jt�r$|�dd�}|W S ty� } z�t� jt�r�d� jjt� jj� j � j
�t� jj� j � j
�f W Y d}~S t� jt�r�� fdd�� jj
D �}d�|�W Y d}~S t|t�r�t � j� j � j
�W Y d}~S � W Y d}~n
d}~0 0 dS )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 %s] %s: '%s'Nc s"