예제 #1
0
파일: test_utils.py 프로젝트: sunliwen/poco
def my_safe_repr(object, context, maxlevels, level):
    typ = pprint._type(object)
    if typ is unicode:
        r = 'u"%s"' % (object.encode("utf8").replace('"', r'\"'))
        return (r, True, False)
    else:
        return pprint._safe_repr(object, context, maxlevels, level)
예제 #2
0
def my_safe_repr(object, context, maxlevels, level):
    typ = pprint._type(object)
    if typ is unicode:
        r = 'u"%s"' % (object.encode("utf8").replace('"', r'\"'))
        return (r, True, False)
    else:
        return pprint._safe_repr(object, context, maxlevels, level)
예제 #3
0
파일: utils.py 프로젝트: mkmd/parking-demo
    def ascii_format(object_, context, maxlevels, level):
        typ = pprint._type(object_)
        if typ is unicode:
            object_ = str(object_).replace('"', '\\"')  # replace " to '
            rep = "\"%s\"" % object_  # repr(object_)
            return rep, (rep and not rep.startswith('<')), False

        return pprint._safe_repr(object_, context, maxlevels, level)
예제 #4
0
    def ascii_format(object_, context, maxlevels, level):
        typ = pprint._type(object_)
        if typ is unicode:
            object_ = str(object_).replace('"', '\\"')  # replace " to '
            rep = "\"%s\"" % object_  # repr(object_)
            return rep, (rep and not rep.startswith('<')), False

        return pprint._safe_repr(object_, context, maxlevels, level)
예제 #5
0
def pprintFormatter(thing, context, maxlevels, level):
    typ = pprint._type(thing)
    if typ is unicode:
        thing = str(thing)
    return pprint._safe_repr(thing, context, maxlevels, level)
예제 #6
0
def format_print(object, context, maxlevels, level):
    typ = pprint._type(object)
    if typ is unicode:
        object = str(object)
    return pprint._safe_repr(object, context, maxlevels, level)
예제 #7
0
def my_safe_repr(object, context, maxlevels, level):
	typ = pprint._type(object)
	if typ is unicode:
		object = str(object)
	return pprint._safe_repr(object, context, maxlevels, level)
예제 #8
0
파일: awshelpers.py 프로젝트: RamanaK/aws
def no_unicode(object, context, maxlevels, level):
    """ change unicode u'foo' to string 'foo' when pretty printing"""
    if pprint._type(object) is unicode:
        object = str(object)
    return pprint._safe_repr(object, context, maxlevels, level)
예제 #9
0
파일: helpers.py 프로젝트: Ryan-Holben/OKC
def concat(object, context, maxlevels, level):
    """ Concatenate any string which pprint displays.  This is recursive, so it also should apply to dictionary keys and values, for example."""
    if pprint._type(object) is (unicode or str):
        if len(object) > pprint_concatenation_length:
            object = object[:pprint_concatenation_length] + '...'
    return pprint._safe_repr(object, context, maxlevels, level)
예제 #10
0
def suppress_unicode_repr(object, context, maxlevels, level):
    typ = pprint._type(object)
    if typ is unicode:
        object = str(object)
    return pprint._safe_repr(object, context, maxlevels, level)
예제 #11
0
def my_safe_repr(object, context, maxlevels, level):
    typ = pprint._type(object)
    if typ is unicode:
        object = str(object.encode('utf-8'))
    return pprint._safe_repr(object, context, maxlevels, level)
 def de_unicode(object, context, maxlevels, level):
     if pprint._type(object) is unicode: object = str(object)
     return pprint._safe_repr(object, context, maxlevels, level)
예제 #13
0
def no_unicode(object, context, maxlevels, level):
    """ change unicode u'foo' to string 'foo' when pretty printing"""
    if pprint._type(object) is unicode:
        object = str(object)
    return pprint._safe_repr(object, context, maxlevels, level)