module documentation

String-handling utilities to avoid locale-dependence.

Used primarily to generate type name aliases.

Function english_capitalize Apply English case rules to convert the first character of an ASCII string to upper case.
Function english_lower Apply English case rules to convert ASCII strings to all lower case.
Function english_upper Apply English case rules to convert ASCII strings to all upper case.
Constant LOWER_TABLE Undocumented
Constant UPPER_TABLE Undocumented
Variable _all_chars Undocumented
Variable _ascii_lower Undocumented
Variable _ascii_upper Undocumented
def english_capitalize(s): (source)

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.

Examples

>>> from numpy.core.numerictypes import english_capitalize
>>> english_capitalize('int8')
'Int8'
>>> english_capitalize('Int8')
'Int8'
>>> english_capitalize('')
''
Parameters
s:str
Returns
strcapitalized
def english_lower(s): (source)

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 "I" in both lowercase and uppercase. Thus, "I".lower() != "i" in a "tr" locale.

Examples

>>> from numpy.core.numerictypes import english_lower
>>> english_lower('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_')
'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789_'
>>> english_lower('')
''
Parameters
s:str
Returns
strlowered
def english_upper(s): (source)

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 "I" in both lowercase and uppercase. Thus, "i".upper() != "I" in a "tr" locale.

Examples

>>> from numpy.core.numerictypes import english_upper
>>> english_upper('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_')
'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
>>> english_upper('')
''
Parameters
s:str
Returns
struppered
LOWER_TABLE = (source)

Undocumented

Value
"""""".join((_all_chars[:65]+_ascii_lower)+_all_chars[65 + 26:])
UPPER_TABLE = (source)

Undocumented

Value
"""""".join((_all_chars[:97]+_ascii_upper)+_all_chars[97 + 26:])
_all_chars = (source)

Undocumented

_ascii_lower = (source)

Undocumented

_ascii_upper = (source)

Undocumented