pgcontents/api_utils.py
def _decode_unknown_from_base64(path, bcontent):
    """
    Decode base64 data of unknown format.

    Attempts to interpret data as utf-8, falling back to ascii on failure.
    """
    content = b64decode(bcontent)
    try:
        return (content.decode('utf-8'), 'text')
    except UnicodeError:
        pass
    return bcontent.decode('ascii'), 'base64'
def _decode_unknown_from_base64(path, bcontent):
    """
    Decode base64 data of unknown format.

    Attempts to interpret data as utf-8, falling back to ascii on failure.
    """
    content = b64decode(bcontent)
    try:
        return (content.decode('utf-8'), 'text')
    except UnicodeError:
        pass
    return bcontent.decode('ascii'), 'base64'
def _decode_unknown_from_base64 ( path , bcontent ) : content = b64decode ( bcontent ) try : return ( content . decode ( 'utf-8' ) , 'text' ) except UnicodeError : pass return bcontent . decode ( 'ascii' ) , 'base64'
Decode base64 data of unknown format.

    Attempts to interpret data as utf-8, falling back to ascii on failure.
Decode base64 data of unknown format .