/usr/lib/python2.6/site-packages/oslo_utils
Edit: /usr/lib/python2.6/site-packages/oslo_utils/encodeutils.pyc (3462B)
Ñò
zDVc @ sF d d k Z d d k Z d d d „ Z d d d d „ Z d „ Z d S( iÿÿÿÿNt strictc C s t | t i t i f ƒ p t d t | ƒ ƒ ‚ n t | t i ƒ o | S| p t i i p
t i
ƒ } n y | i | | ƒ SWn t j
o | i d | ƒ SXd S( s™ Decodes incoming text/bytes string using `incoming` if they're not
already unicode.
:param incoming: Text's current encoding
:param errors: Errors handling policy. See here for valid
values http://docs.python.org/2/library/codecs.html
:returns: text or a unicode `incoming` encoded
representation of it.
:raises TypeError: If text is not an instance of str
s %s can't be decodeds utf-8N(
t
isinstancet sixt string_typest binary_typet TypeErrort typet text_typet syst stdint encodingt getdefaultencodingt decodet UnicodeDecodeError( t textt incomingt errors( ( s: /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/encodeutils.pyt safe_decode s
s utf-8c C sý t | t i t i f ƒ p t d t | ƒ ƒ ‚ n | p t i i p
t i ƒ } n t
| d ƒ o | i ƒ } n t
| d ƒ o | i ƒ } n t | t i ƒ o | i
| | ƒ S| o0 | | j o# t | | | ƒ } | i
| | ƒ S| Sd S( s? Encodes incoming text/bytes string using `encoding`.
If incoming is not specified, text is expected to be encoded with
current python's default encoding. (`sys.getdefaultencoding`)
:param incoming: Text's current encoding
:param encoding: Expected encoding for text (Default UTF-8)
:param errors: Errors handling policy. See here for valid
values http://docs.python.org/2/library/codecs.html
:returns: text or a bytestring `encoding` encoded
representation of it.
:raises TypeError: If text is not an instance of str
s %s can't be encodedt lowerN( R R R R R R R R R
R t hasattrR R t encodeR ( R R R
R ( ( s: /tmp/pip-build-lt8jXN/oslo.utils/oslo_utils/encodeutils.pyt safe_encode<