MCPcopy Create free account
hub / github.com/apache/arrow / string_literal

Function string_literal

cpp/gdb_arrow.py:173–184  ·  view source on GitHub ↗

Format a Python string or gdb.Value for display as a literal.

(s)

Source from the content-addressed store, hash-verified

171
172
173def string_literal(s):
174 """
175 Format a Python string or gdb.Value for display as a literal.
176 """
177 max_len = 50
178 if isinstance(s, gdb.Value):
179 s = s.string()
180 if len(s) > max_len:
181 s = s[:max_len]
182 return '"' + s.translate(_string_literal_mapping) + '" [continued]'
183 else:
184 return '"' + s.translate(_string_literal_mapping) + '"'
185
186
187def bytes_literal(val, size=None):

Callers 3

utf8_literalFunction · 0.85
string_literalMethod · 0.85
string_literalMethod · 0.85

Calls 2

lenFunction · 0.85
stringMethod · 0.45

Tested by

no test coverage detected