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

Function string_literal

cpp/gdb_arrow.py:175–186  ·  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

173
174
175def string_literal(s):
176 """
177 Format a Python string or gdb.Value for display as a literal.
178 """
179 max_len = 50
180 if isinstance(s, gdb.Value):
181 s = s.string()
182 if len(s) > max_len:
183 s = s[:max_len]
184 return '"' + s.translate(_string_literal_mapping) + '" [continued]'
185 else:
186 return '"' + s.translate(_string_literal_mapping) + '"'
187
188
189def 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