Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / oslo_utils / encodeutils.pyc
Size: Mime:
ó
MEYc@sXddlZddlZejZddd„Zdddd„Zd„Zd„ZdS(iÿÿÿÿNtstrictcCs¤t|tjtjfƒs4tdt|ƒƒ‚nt|tjƒrJ|S|sktjj	petj
ƒ}ny|j||ƒSWntk
rŸ|jd|ƒSXdS(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 decodedsutf-8N(
t
isinstancetsixtstring_typestbinary_typet	TypeErrorttypet	text_typetsyststdintencodingtgetdefaultencodingtdecodetUnicodeDecodeError(ttexttincomingterrors((sK/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/encodeutils.pytsafe_decodes

sutf-8cCsït|tjtjfƒs4tdt|ƒƒ‚n|sUtjjpOtj	ƒ}nt
|dƒrs|jƒ}nt
|dƒr‘|jƒ}nt|tjƒr³|j
||ƒS|rç||krçt|||ƒ}|j
||ƒS|SdS(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

    See also to_utf8() function which is simpler and don't depend on
    the locale encoding.
    s%s can't be encodedtlowerN(RRRRRRRR	R
RthasattrRRtencodeR(RRR
R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/encodeutils.pytsafe_encodeBscCsOt|tƒr|St|tjƒr2|jdƒStdt|ƒjƒ‚dS(s˜Encode Unicode to UTF-8, return bytes unchanged.

    Raise TypeError if text is not a bytes string or a Unicode string.

    .. versionadded:: 3.5
    sutf-8s!bytes or Unicode expected, got %sN(RtbytesRRRRRt__name__(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/encodeutils.pytto_utf8ks
cCsýd}tjrlyt|ƒ}Wqltk
rht|dƒriy|jƒ}Wqetk
raqeXqiqlXn|dkr‡|jƒ}nt|tj	ƒr|Sy|j
dƒSWntk
rÁnXtƒ}y|j
|ƒSWntk
rïnX|j
dƒS(sªGet the message of an exception as a Unicode string.

    On Python 3, the exception message is always a Unicode string. On
    Python 2, the exception message is a bytes string *most* of the time.

    If the exception message is a bytes strings, try to decode it from UTF-8
    (superset of ASCII), from the locale encoding, or fallback to decoding it
    from ISO-8859-1 (which never fails).

    .. versionadded:: 1.6
    t__unicode__sutf-8tlatin1N(
tNoneRtPY2tunicodetUnicodeErrorRRt__str__RRRR
t_getfilesystemencoding(texctmsgR
((sK/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/encodeutils.pytexception_to_unicode{s0	


	
(	RRtgetfilesystemencodingR RRRRR#(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_utils/encodeutils.pyt<module>s	'(