MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / print_dict

Function print_dict

tools/engine/config.py:88–100  ·  view source on GitHub ↗

Recursively visualize a dict and indenting acrrording by the relationship of keys.

(cfg, print_func=print, delimiter=0)

Source from the content-addressed store, hash-verified

86
87
88def print_dict(cfg, print_func=print, delimiter=0):
89 """Recursively visualize a dict and indenting acrrording by the
90 relationship of keys."""
91 for k, v in sorted(cfg.items()):
92 if isinstance(v, dict):
93 print_func('{}{} : '.format(delimiter * ' ', str(k)))
94 print_dict(v, print_func, delimiter + 4)
95 elif isinstance(v, list) and len(v) >= 1 and isinstance(v[0], dict):
96 print_func('{}{} : '.format(delimiter * ' ', str(k)))
97 for value in v:
98 print_dict(value, print_func, delimiter + 4)
99 else:
100 print_func('{}{} : {}'.format(delimiter * ' ', k, v))
101
102
103class Config(object):

Callers 1

print_cfgMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected