MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _stringify

Function _stringify

tools/python-3.11.9-amd64/Lib/tkinter/__init__.py:62–84  ·  view source on GitHub ↗

Internal function.

(value)

Source from the content-addressed store, hash-verified

60
61
62def _stringify(value):
63 """Internal function."""
64 if isinstance(value, (list, tuple)):
65 if len(value) == 1:
66 value = _stringify(value[0])
67 if _magic_re.search(value):
68 value = '{%s}' % value
69 else:
70 value = '{%s}' % _join(value)
71 else:
72 value = str(value)
73 if not value:
74 value = '{}'
75 elif _magic_re.search(value):
76 # add '\' before special characters and spaces
77 value = _magic_re.sub(r'\\\1', value)
78 value = value.replace('\n', r'\n')
79 value = _space_re.sub(r'\\\1', value)
80 if value[0] == '"':
81 value = '\\' + value
82 elif value[0] == '"' or _space_re.search(value):
83 value = '{%s}' % value
84 return value
85
86
87def _flatten(seq):

Callers 2

_format_optvalueFunction · 0.90
_optionsMethod · 0.85

Calls 5

strFunction · 0.85
_joinFunction · 0.70
searchMethod · 0.45
subMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected