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

Function _list_from_statespec

Lib/tkinter/ttk.py:229–247  ·  view source on GitHub ↗

Construct a list from the given statespec tuple according to the accepted statespec accepted by _format_mapdict.

(stuple)

Source from the content-addressed store, hash-verified

227 return '\n'.join(script)
228
229def _list_from_statespec(stuple):
230 """Construct a list from the given statespec tuple according to the
231 accepted statespec accepted by _format_mapdict."""
232 if isinstance(stuple, str):
233 return stuple
234 result = []
235 it = iter(stuple)
236 for state, val in zip(it, it):
237 if hasattr(state, 'typename'): # this is a Tcl object
238 state = str(state).split()
239 elif isinstance(state, str):
240 state = state.split()
241 elif not isinstance(state, (tuple, list)):
242 state = (state,)
243 if hasattr(val, 'typename'):
244 val = str(val)
245 result.append((*state, val))
246
247 return result
248
249def _list_from_layouttuple(tk, ltuple):
250 """Construct a list from the tuple returned by ttk::layout, this is

Callers 2

_tclobj_to_pyFunction · 0.85
mapMethod · 0.85

Calls 3

strFunction · 0.85
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…