Converts Unicode code point to hex string. 0x263a => '0x263A'. Args: v: code point to convert Returns: Unicode string Raises: InputError: the argument is not a valid Unicode value.
(v)
| 76 | |
| 77 | |
| 78 | def _UStr(v): |
| 79 | """Converts Unicode code point to hex string. |
| 80 | |
| 81 | 0x263a => '0x263A'. |
| 82 | |
| 83 | Args: |
| 84 | v: code point to convert |
| 85 | |
| 86 | Returns: |
| 87 | Unicode string |
| 88 | |
| 89 | Raises: |
| 90 | InputError: the argument is not a valid Unicode value. |
| 91 | """ |
| 92 | if v < 0 or v > _RUNE_MAX: |
| 93 | raise InputError("invalid Unicode value %s" % (v,)) |
| 94 | return "0x%04X" % (v,) |
| 95 | |
| 96 | |
| 97 | def _ParseContinue(s): |