MCPcopy Index your code
hub / github.com/RustPython/RustPython / _format_mapdict

Function _format_mapdict

Lib/tkinter/ttk.py:79–94  ·  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

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