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

Function english_capitalize

numpy/_core/_string_helpers.py:72–100  ·  view source on GitHub ↗

Apply English case rules to convert the first character of an ASCII string to upper case. This is an internal utility function to replace calls to str.capitalize() such that we can avoid changing behavior with changing locales. Parameters ---------- s : str Returns

(s)

Source from the content-addressed store, hash-verified

70
71
72def english_capitalize(s):
73 """ Apply English case rules to convert the first character of an ASCII
74 string to upper case.
75
76 This is an internal utility function to replace calls to str.capitalize()
77 such that we can avoid changing behavior with changing locales.
78
79 Parameters
80 ----------
81 s : str
82
83 Returns
84 -------
85 capitalized : str
86
87 Examples
88 --------
89 >>> from numpy._core.numerictypes import english_capitalize
90 >>> english_capitalize('int8')
91 'Int8'
92 >>> english_capitalize('Int8')
93 'Int8'
94 >>> english_capitalize('')
95 ''
96 """
97 if s:
98 return english_upper(s[0]) + s[1:]
99 else:
100 return s

Callers

nothing calls this directly

Calls 1

english_upperFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…