MCPcopy Index your code
hub / github.com/numpy/numpy / english_upper

Function english_upper

numpy/_core/_string_helpers.py:44–69  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

42
43
44def 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
72def english_capitalize(s):

Callers 1

english_capitalizeFunction · 0.70

Calls 1

translateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…