Submit
Path:
~
/
/
lib
/
python2.7
/
site-packages
/
docutils
/
utils
/
File Content:
error_reporting.pyc
� >��Xc @ s d Z d d l Z d d l Z y d d l Z Wn e k rG d Z n� Xy$ e j � d ph e j � d Z Wn7 e k r� Z d e j k r� d Z q� n d Z n Xy e j e p� d � Wn e k r� d Z n Xd e f d � � YZ d e f d � � YZ d e f d � � YZ d S( s� 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. i����Ni s unknown locale: UTF-8s UTF-8t t SafeStringc B s2 e Z d Z d d d d � Z d � Z d � Z RS( sG A wrapper providing robust conversion to `str` and `unicode`. t backslashreplacet replacec C sF | | _ | p* t | d d � p* t p* d | _ | | _ | | _ d S( Nt encodingt ascii( t datat getattrt Nonet locale_encodingR t encoding_errorst decoding_errors( t selfR R R R ( ( s@ /tmp/pip-build-uEGWVr/docutils/docutils/utils/error_reporting.pyt __init__G s c C s� y t | j � SWn� t k r� t | j t � rw g | j j D]$ } t t | | j | j � � ^ q@ } d j | � St | j t � r� t j d k r� | j S| j j | j | j � Sn � n Xd S( Ns , i i ( i i ( t strR t UnicodeEncodeErrort isinstancet Exceptiont argsR R R t joint unicodet syst version_infot encode( R t argR ( ( s@ /tmp/pip-build-uEGWVr/docutils/docutils/utils/error_reporting.pyt __str__P s 4 c C s5 y>