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

Class PosReturn

Lib/test/test_codeccallbacks.py:10–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class PosReturn:
11 # this can be used for configurable callbacks
12
13 def __init__(self):
14 self.pos = 0
15
16 def handle(self, exc):
17 oldpos = self.pos
18 realpos = oldpos
19 if realpos<0:
20 realpos = len(exc.object) + realpos
21 # if we don't advance this time, terminate on the next call
22 # otherwise we'd get an endless loop
23 if realpos <= exc.start:
24 self.pos = len(exc.object)
25 return ("<?>", oldpos)
26
27class RepeatedPosReturn:
28 def __init__(self, repl="<?>"):

Callers 2

test_decodehelperMethod · 0.85
test_encodehelperMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_decodehelperMethod · 0.68
test_encodehelperMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…