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

Function _byte_offset_to_character_offset

Lib/traceback.py:810–812  ·  view source on GitHub ↗
(str, offset)

Source from the content-addressed store, hash-verified

808
809
810def _byte_offset_to_character_offset(str, offset):
811 as_utf8 = str.encode('utf-8')
812 return len(as_utf8[:offset].decode("utf-8", errors="replace"))
813
814
815_Anchors = collections.namedtuple(

Callers 2

format_frame_summaryMethod · 0.85
normalizeFunction · 0.85

Calls 2

encodeMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…