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

Function _format_mapdict

Lib/tkinter/ttk.py:77–92  ·  view source on GitHub ↗

Formats mapdict to pass it to tk.call. E.g. (script=False): {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]} returns: ('-expand', '{active selected} grey focus {1, 2, 3, 4}')

(mapdict, script=False)

Source from the content-addressed store, hash-verified

75 return opt_val
76
77def _format_mapdict(mapdict, script=False):
78 """Formats mapdict to pass it to tk.call.
79
80 E.g. (script=False):
81 {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]}
82
83 returns:
84
85 ('-expand', '{active selected} grey focus {1, 2, 3, 4}')"""
86
87 opts = []
88 for opt, value in mapdict.items():
89 opts.extend(("-%s" % opt,
90 _format_optvalue(_mapdict_values(value), script)))
91
92 return _flatten(opts)
93
94def _format_elemcreate(etype, script=False, *args, **kw):
95 """Formats args and kw according to the given element factory etype."""

Callers 2

_script_from_settingsFunction · 0.85
mapMethod · 0.85

Calls 5

_flattenFunction · 0.90
_format_optvalueFunction · 0.85
_mapdict_valuesFunction · 0.85
itemsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…