/usr/local/lib64/python3.6/site-packages/numpy/core
NameSizeModeActions
include/-0755rm
lib/-0755rm
tests/-0755rm
__pycache__/-0755rm
arrayprint.py591140644editdlrm
cversions.py3470644editdlrm
defchararray.py700410644editdlrm
einsumfunc.py506890644editdlrm
fromnumeric.py1192160644editdlrm
function_base.py180340644editdlrm
generate_numpy_api.py70220644editdlrm
getlimits.py190760644editdlrm
machar.py107860644editdlrm
memmap.py115620644editdlrm
multiarray.py544100644editdlrm
numeric.py746150644editdlrm
numerictypes.py165630644editdlrm
overrides.py74810644editdlrm
records.py350830644editdlrm
setup.py424090644editdlrm
setup_common.py184100644editdlrm
shape_base.py290140644editdlrm
umath.py20400644editdlrm
umath_tests.py3890644editdlrm
_add_newdocs.py2027410644editdlrm
_asarray.py98740644editdlrm
_dtype.py98200644editdlrm
_dtype_ctypes.py36730644editdlrm
_exceptions.py61450644editdlrm
_internal.py262930644editdlrm
_methods.py91480644editdlrm
_multiarray_tests.cpython-36m-x86_64-linux-gnu.so1671120755editdlrm
_multiarray_umath.cpython-36m-x86_64-linux-gnu.so41692480755editdlrm
_operand_flag_tests.cpython-36m-x86_64-linux-gnu.so131680755editdlrm
_rational_tests.cpython-36m-x86_64-linux-gnu.so598560755editdlrm
_string_helpers.py28550644editdlrm
_struct_ufunc_tests.cpython-36m-x86_64-linux-gnu.so132720755editdlrm
_type_aliases.py88460644editdlrm
_ufunc_config.py138210644editdlrm
_umath_tests.cpython-36m-x86_64-linux-gnu.so277680755editdlrm
__init__.py43350644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/numpy/core/_string_helpers.py (2855B)
""" String-handling utilities to avoid locale-dependence. Used primarily to generate type name aliases. """ # "import string" is costly to import! # Construct the translation tables directly # "A" = chr(65), "a" = chr(97) _all_chars = [chr(_m) for _m in range(256)] _ascii_upper = _all_chars[65:65+26] _ascii_lower = _all_chars[97:97+26] LOWER_TABLE = "".join(_all_chars[:65] + _ascii_lower + _all_chars[65+26:]) UPPER_TABLE = "".join(_all_chars[:97] + _ascii_upper + _all_chars[97+26:]) def english_lower(s): """ 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. Parameters ---------- s : str Returns ------- lowered : str Examples -------- >>> from numpy.core.numerictypes import english_lower >>> english_lower('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_') 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789_' >>> english_lower('') '' """ lowered = s.translate(LOWER_TABLE) return lowered def english_upper(s): """ 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. Parameters ---------- s : str Returns ------- uppered : str Examples -------- >>> from numpy.core.numerictypes import english_upper >>> english_upper('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_') 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' >>> english_upper('') '' """ uppered = s.translate(UPPER_TABLE) return uppered def english_capitalize(s): """ 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 ------- capitalized : str Examples -------- >>> from numpy.core.numerictypes import english_capitalize >>> english_capitalize('int8') 'Int8' >>> english_capitalize('Int8') 'Int8' >>> english_capitalize('') '' """ if s: return english_upper(s[0]) + s[1:] else: return s