(self, tokens: list[int])
| 36 | return [ord(char) for char in content] |
| 37 | |
| 38 | def decode(self, tokens: list[int]) -> str: |
| 39 | chars: list[str] = [] |
| 40 | for token in tokens: |
| 41 | try: |
| 42 | value = int(token) |
| 43 | except (TypeError, ValueError): |
| 44 | continue |
| 45 | if 0 <= value <= 0x10FFFF: |
| 46 | chars.append(chr(value)) |
| 47 | return "".join(chars) |
| 48 | |
| 49 | |
| 50 | class KnowledgeIndex(Protocol): |
no outgoing calls