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

Function charmapencode_output

Lib/_pycodecs.py:1671–1685  ·  view source on GitHub ↗
(c, mapping)

Source from the content-addressed store, hash-verified

1669
1670
1671def charmapencode_output(c, mapping):
1672 rep = mapping[c]
1673 if isinstance(rep, int):
1674 if rep < 256:
1675 return [rep]
1676 else:
1677 raise TypeError("character mapping must be in range(256)")
1678 elif isinstance(rep, str):
1679 return [ord(rep)]
1680 elif isinstance(rep, bytes):
1681 return rep
1682 elif rep == None:
1683 raise KeyError("character maps to <undefined>")
1684 else:
1685 raise TypeError("character mapping must return integer, None or str")
1686
1687
1688def PyUnicode_EncodeCharmap(p, size, mapping="latin-1", errors="strict"):

Callers 1

PyUnicode_EncodeCharmapFunction · 0.85

Calls 2

isinstanceFunction · 0.85
ordFunction · 0.85

Tested by

no test coverage detected