def _dict_pprinter_factory(start, end, basetype=None):
def inner(obj, p, cycle):<EOL><INDENT>typ = type(obj)<EOL>if basetype is not None and typ is not basetype and typ.__repr__ != basetype.__repr__:<EOL><INDENT>return p.text(typ.__repr__(obj))<EOL><DEDENT>if cycle:<EOL><INDENT>return p.text('<STR_LIT>')<EOL><DEDENT>p.begin_group(<NUM_LIT:1>, start)<EOL>keys = list(obj.keys())<EOL>try:<EOL><INDENT>keys.sort()<EOL><DEDENT>except Exception as e:<EOL><INDENT>pass<EOL><DEDENT>for idx, key in enumerate(keys):<EOL><INDENT>if idx:<EOL><INDENT>p.text('<STR_LIT:U+002C>')<EOL>p.breakable()<EOL><DEDENT>p.pretty(key)<EOL>p.text('<STR_LIT>')<EOL>p.pretty(obj[key])<EOL><DEDENT>p.end_group(<NUM_LIT:1>, end)<EOL><DEDENT>return inner<EOL>
Factory that returns a pprint function used by the default pprint of
dicts and dict proxies.