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

Function english_upper

numpy/_core/code_generators/generate_umath.py:237–264  ·  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

235 bytes(string.ascii_uppercase, "ascii"))
236
237def english_upper(s):
238 """ Apply English case rules to convert ASCII strings to all upper case.
239
240 This is an internal utility function to replace calls to str.upper() such
241 that we can avoid changing behavior with changing locales. In particular,
242 Turkish has distinct dotted and dotless variants of the Latin letter "I" in
243 both lowercase and uppercase. Thus, "i".upper() != "I" in a "tr" locale.
244
245 Parameters
246 ----------
247 s : str
248
249 Returns
250 -------
251 uppered : str
252
253 Examples
254 --------
255 >>> import numpy as np
256 >>> from numpy.lib.utils import english_upper
257 >>> s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_'
258 >>> english_upper(s)
259 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
260 >>> english_upper('')
261 ''
262 """
263 uppered = s.translate(UPPER_TABLE)
264 return uppered
265
266
267# each entry in defdict is a Ufunc object.

Callers 2

make_arraysFunction · 0.70
make_ufuncsFunction · 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…