MCPcopy Index your code
hub / github.com/RustPython/RustPython / PosReturn

Class PosReturn

Lib/test/test_codeccallbacks.py:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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