MCPcopy Index your code
hub / github.com/python/cpython / get_string

Method get_string

Lib/profiling/sampling/string_table.py:30–41  ·  view source on GitHub ↗

Get a string by its index. Args: index: The index of the string Returns: str: The string at the given index, or empty string if invalid

(self, index)

Source from the content-addressed store, hash-verified

28 return index
29
30 def get_string(self, index):
31 """Get a string by its index.
32
33 Args:
34 index: The index of the string
35
36 Returns:
37 str: The string at the given index, or empty string if invalid
38 """
39 if 0 <= index < len(self._strings):
40 return self._strings[index]
41 return ""
42
43 def get_strings(self):
44 """Get the list of all strings in the table.

Callers 15

_extract_func_keyMethod · 0.45
test_addMethod · 0.45
test_get_stringMethod · 0.45
test_set_itemMethod · 0.45
test_clearMethod · 0.45
test_updateMethod · 0.45
_test_flush_or_closeMethod · 0.45
test_get_folderMethod · 0.45

Calls

no outgoing calls

Tested by 13

test_addMethod · 0.36
test_get_stringMethod · 0.36
test_set_itemMethod · 0.36
test_clearMethod · 0.36
test_updateMethod · 0.36
_test_flush_or_closeMethod · 0.36
test_get_folderMethod · 0.36
test_get_string_fromMethod · 0.36
test_open_close_openMethod · 0.36