(c)
| 23705 | |
| 23706 | |
| 23707 | def canon(c): |
| 23708 | assert isinstance(c, int) |
| 23709 | # TODO: proper unicode case folding |
| 23710 | # TODO: character equivalence (a matches ä, etc) |
| 23711 | if c == 0xA0 or c == 0x2028 or c == 0x2029: |
| 23712 | return ord(' ') |
| 23713 | if c == ord('\r') or c == ord('\n') or c == ord('\t'): |
| 23714 | return ord(' ') |
| 23715 | if c >= ord('A') and c <= ord('Z'): |
| 23716 | return c - ord('A') + ord('a') |
| 23717 | return c |
| 23718 | |
| 23719 | |
| 23720 | def chartocanon(s): |
no outgoing calls
no test coverage detected
searching dependent graphs…