(c, mapping)
| 1669 | |
| 1670 | |
| 1671 | def 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 | |
| 1688 | def PyUnicode_EncodeCharmap(p, size, mapping="latin-1", errors="strict"): |
no test coverage detected