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

Function _format_optdict

Lib/tkinter/ttk.py:42–56  ·  view source on GitHub ↗

Formats optdict to a tuple to pass it to tk.call. E.g. (script=False): {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns: ('-foreground', 'blue', '-padding', '1 2 3 4')

(optdict, script=False, ignore=None)

Source from the content-addressed store, hash-verified

40 return value
41
42def _format_optdict(optdict, script=False, ignore=None):
43 """Formats optdict to a tuple to pass it to tk.call.
44
45 E.g. (script=False):
46 {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
47 ('-foreground', 'blue', '-padding', '1 2 3 4')"""
48
49 opts = []
50 for opt, value in optdict.items():
51 if not ignore or opt not in ignore:
52 opts.append("-%s" % opt)
53 if value is not None:
54 opts.append(_format_optvalue(value, script))
55
56 return _flatten(opts)
57
58def _mapdict_values(items):
59 # each value in mapdict is expected to be a sequence, where each item

Callers 8

_format_elemcreateFunction · 0.85
_format_layoutlistFunction · 0.85
_script_from_settingsFunction · 0.85
_val_or_dictFunction · 0.85
addMethod · 0.85
insertMethod · 0.85
insertMethod · 0.85
insertMethod · 0.85

Calls 4

_flattenFunction · 0.90
_format_optvalueFunction · 0.85
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected