Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../usr/lib64/python3....
File: pprint.py
return "{...}", False, objid in context
[500] Fix | Delete
if objid in context:
[501] Fix | Delete
return _recursion(object), False, True
[502] Fix | Delete
context[objid] = 1
[503] Fix | Delete
readable = True
[504] Fix | Delete
recursive = False
[505] Fix | Delete
components = []
[506] Fix | Delete
append = components.append
[507] Fix | Delete
level += 1
[508] Fix | Delete
saferepr = _safe_repr
[509] Fix | Delete
items = sorted(object.items(), key=_safe_tuple)
[510] Fix | Delete
for k, v in items:
[511] Fix | Delete
krepr, kreadable, krecur = saferepr(k, context, maxlevels, level)
[512] Fix | Delete
vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level)
[513] Fix | Delete
append("%s: %s" % (krepr, vrepr))
[514] Fix | Delete
readable = readable and kreadable and vreadable
[515] Fix | Delete
if krecur or vrecur:
[516] Fix | Delete
recursive = True
[517] Fix | Delete
del context[objid]
[518] Fix | Delete
return "{%s}" % ", ".join(components), readable, recursive
[519] Fix | Delete
[520] Fix | Delete
if (issubclass(typ, list) and r is list.__repr__) or \
[521] Fix | Delete
(issubclass(typ, tuple) and r is tuple.__repr__):
[522] Fix | Delete
if issubclass(typ, list):
[523] Fix | Delete
if not object:
[524] Fix | Delete
return "[]", True, False
[525] Fix | Delete
format = "[%s]"
[526] Fix | Delete
elif len(object) == 1:
[527] Fix | Delete
format = "(%s,)"
[528] Fix | Delete
else:
[529] Fix | Delete
if not object:
[530] Fix | Delete
return "()", True, False
[531] Fix | Delete
format = "(%s)"
[532] Fix | Delete
objid = id(object)
[533] Fix | Delete
if maxlevels and level >= maxlevels:
[534] Fix | Delete
return format % "...", False, objid in context
[535] Fix | Delete
if objid in context:
[536] Fix | Delete
return _recursion(object), False, True
[537] Fix | Delete
context[objid] = 1
[538] Fix | Delete
readable = True
[539] Fix | Delete
recursive = False
[540] Fix | Delete
components = []
[541] Fix | Delete
append = components.append
[542] Fix | Delete
level += 1
[543] Fix | Delete
for o in object:
[544] Fix | Delete
orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level)
[545] Fix | Delete
append(orepr)
[546] Fix | Delete
if not oreadable:
[547] Fix | Delete
readable = False
[548] Fix | Delete
if orecur:
[549] Fix | Delete
recursive = True
[550] Fix | Delete
del context[objid]
[551] Fix | Delete
return format % ", ".join(components), readable, recursive
[552] Fix | Delete
[553] Fix | Delete
rep = repr(object)
[554] Fix | Delete
return rep, (rep and not rep.startswith('<')), False
[555] Fix | Delete
[556] Fix | Delete
_builtin_scalars = frozenset({str, bytes, bytearray, int, float, complex,
[557] Fix | Delete
bool, type(None)})
[558] Fix | Delete
[559] Fix | Delete
def _recursion(object):
[560] Fix | Delete
return ("<Recursion on %s with id=%s>"
[561] Fix | Delete
% (type(object).__name__, id(object)))
[562] Fix | Delete
[563] Fix | Delete
[564] Fix | Delete
def _perfcheck(object=None):
[565] Fix | Delete
import time
[566] Fix | Delete
if object is None:
[567] Fix | Delete
object = [("string", (1, 2), [3, 4], {5: 6, 7: 8})] * 100000
[568] Fix | Delete
p = PrettyPrinter()
[569] Fix | Delete
t1 = time.time()
[570] Fix | Delete
_safe_repr(object, {}, None, 0)
[571] Fix | Delete
t2 = time.time()
[572] Fix | Delete
p.pformat(object)
[573] Fix | Delete
t3 = time.time()
[574] Fix | Delete
print("_safe_repr:", t2 - t1)
[575] Fix | Delete
print("pformat:", t3 - t2)
[576] Fix | Delete
[577] Fix | Delete
def _wrap_bytes_repr(object, width, allowance):
[578] Fix | Delete
current = b''
[579] Fix | Delete
last = len(object) // 4 * 4
[580] Fix | Delete
for i in range(0, len(object), 4):
[581] Fix | Delete
part = object[i: i+4]
[582] Fix | Delete
candidate = current + part
[583] Fix | Delete
if i == last:
[584] Fix | Delete
width -= allowance
[585] Fix | Delete
if len(repr(candidate)) > width:
[586] Fix | Delete
if current:
[587] Fix | Delete
yield repr(current)
[588] Fix | Delete
current = part
[589] Fix | Delete
else:
[590] Fix | Delete
current = candidate
[591] Fix | Delete
if current:
[592] Fix | Delete
yield repr(current)
[593] Fix | Delete
[594] Fix | Delete
if __name__ == "__main__":
[595] Fix | Delete
_perfcheck()
[596] Fix | Delete
[597] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function