Apply English case rules to convert ASCII strings to all lower case. This is an internal utility function to replace calls to str.lower() such that we can avoid changing behavior with changing locales. In particular, Turkish has distinct dotted and dotless variants of the Latin letter
(s)
| 14 | |
| 15 | |
| 16 | def english_lower(s): |
| 17 | """ Apply English case rules to convert ASCII strings to all lower case. |
| 18 | |
| 19 | This is an internal utility function to replace calls to str.lower() such |
| 20 | that we can avoid changing behavior with changing locales. In particular, |
| 21 | Turkish has distinct dotted and dotless variants of the Latin letter "I" in |
| 22 | both lowercase and uppercase. Thus, "I".lower() != "i" in a "tr" locale. |
| 23 | |
| 24 | Parameters |
| 25 | ---------- |
| 26 | s : str |
| 27 | |
| 28 | Returns |
| 29 | ------- |
| 30 | lowered : str |
| 31 | |
| 32 | Examples |
| 33 | -------- |
| 34 | >>> from numpy._core.numerictypes import english_lower |
| 35 | >>> english_lower('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_') |
| 36 | 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789_' |
| 37 | >>> english_lower('') |
| 38 | '' |
| 39 | """ |
| 40 | lowered = s.translate(LOWER_TABLE) |
| 41 | return lowered |
| 42 | |
| 43 | |
| 44 | def english_upper(s): |
nothing calls this directly
no test coverage detected
searching dependent graphs…