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

Method handler1

Lib/test/test_codeccallbacks.py:228–236  ·  view source on GitHub ↗
(exc)

Source from the content-addressed store, hash-verified

226
227 def test_callbacks(self):
228 def handler1(exc):
229 r = range(exc.start, exc.end)
230 if isinstance(exc, UnicodeEncodeError):
231 l = ["<%d>" % ord(exc.object[pos]) for pos in r]
232 elif isinstance(exc, UnicodeDecodeError):
233 l = ["<%d>" % exc.object[pos] for pos in r]
234 else:
235 raise TypeError("don't know how to handle %r" % exc)
236 return ("[%s]" % "".join(l), exc.end)
237
238 codecs.register_error("test.handler1", handler1)
239

Callers

nothing calls this directly

Calls 3

isinstanceFunction · 0.85
ordFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected