Return value converted from Tcl object to Python object.
(val)
| 309 | return x |
| 310 | |
| 311 | def _tclobj_to_py(val): |
| 312 | """Return value converted from Tcl object to Python object.""" |
| 313 | if val and hasattr(val, '__len__') and not isinstance(val, str): |
| 314 | if getattr(val[0], 'typename', None) == 'StateSpec': |
| 315 | val = _list_from_statespec(val) |
| 316 | else: |
| 317 | val = list(map(_convert_stringval, val)) |
| 318 | |
| 319 | elif hasattr(val, 'typename'): # some other (single) Tcl object |
| 320 | val = _convert_stringval(val) |
| 321 | |
| 322 | if isinstance(val, tuple) and len(val) == 0: |
| 323 | return '' |
| 324 | return val |
| 325 | |
| 326 | def tclobjs_to_py(adict): |
| 327 | """Returns adict with its values converted from Tcl objects to Python |
no test coverage detected
searching dependent graphs…