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

Function _list_from_statespec

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

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

Callers 2

_tclobj_to_pyFunction · 0.85
mapMethod · 0.85

Calls 6

isinstanceFunction · 0.85
iterFunction · 0.85
hasattrFunction · 0.85
strFunction · 0.85
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected