MCPcopy Index your code
hub / github.com/python/cpython / dump_dict

Function dump_dict

Lib/test/test_getpath.py:1246–1262  ·  view source on GitHub ↗
(before, after, prefix="global")

Source from the content-addressed store, hash-verified

1244
1245
1246def dump_dict(before, after, prefix="global"):
1247 if not verbose or not after:
1248 return
1249 max_k = max(len(k) for k in after)
1250 for k, v in sorted(after.items(), key=lambda i: i[0]):
1251 if k[:2] == "__":
1252 continue
1253 if k == "config":
1254 dump_dict(before[k], after[k], prefix="config")
1255 continue
1256 try:
1257 if v != before[k]:
1258 print("{}.{} {!r} (was {!r})".format(prefix, k.ljust(max_k), v, before[k]))
1259 continue
1260 except KeyError:
1261 pass
1262 print("{}.{} {!r}".format(prefix, k.ljust(max_k), v))
1263
1264
1265def getpath(ns, keys):

Callers 1

getpathFunction · 0.85

Calls 3

itemsMethod · 0.45
formatMethod · 0.45
ljustMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…