Apply English case rules to convert ASCII strings to all upper case. This is an internal utility function to replace calls to str.upper() such that we can avoid changing behavior with changing locales. In particular, Turkish has distinct dotted and dotless variants of the Latin letter
(s)
| 42 | |
| 43 | |
| 44 | def english_upper(s): |
| 45 | """ Apply English case rules to convert ASCII strings to all upper case. |
| 46 | |
| 47 | This is an internal utility function to replace calls to str.upper() such |
| 48 | that we can avoid changing behavior with changing locales. In particular, |
| 49 | Turkish has distinct dotted and dotless variants of the Latin letter "I" in |
| 50 | both lowercase and uppercase. Thus, "i".upper() != "I" in a "tr" locale. |
| 51 | |
| 52 | Parameters |
| 53 | ---------- |
| 54 | s : str |
| 55 | |
| 56 | Returns |
| 57 | ------- |
| 58 | uppered : str |
| 59 | |
| 60 | Examples |
| 61 | -------- |
| 62 | >>> from numpy._core.numerictypes import english_upper |
| 63 | >>> english_upper('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_') |
| 64 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' |
| 65 | >>> english_upper('') |
| 66 | '' |
| 67 | """ |
| 68 | uppered = s.translate(UPPER_TABLE) |
| 69 | return uppered |
| 70 | |
| 71 | |
| 72 | def english_capitalize(s): |
no test coverage detected
searching dependent graphs…