module documentation

Python 3.X compatibility tools.

While this file was originally intended for Python 2 -> 3 transition, it is now used to create a compatibility layer between different minor versions of Python 3.

While the active version of numpy may not support a given version of python, we allow downstream libraries to continue to use these shims for forward compatibility with numpy while they transition their code to newer versions of Python.

Class contextlib_nullcontext Context manager that does no additional processing.
Function asbytes Undocumented
Function asbytes_nested Undocumented
Function asstr Undocumented
Function asunicode Undocumented
Function asunicode_nested Undocumented
Function getexception Undocumented
Function is_pathlib_path Check whether obj is a pathlib.Path object.
Function isfileobj Undocumented
Function npy_load_module Load a module. Uses load_module which will be deprecated in python 3.12. An alternative that uses exec_module is in numpy.distutils.misc_util.exec_mod_from_location
Function open_latin1 Undocumented
Function sixu Undocumented
Variable integer_types Undocumented
Variable strchar Undocumented
def asbytes(s): (source)

Undocumented

def asbytes_nested(x): (source)

Undocumented

def asstr(s): (source)

Undocumented

def asunicode(s): (source)

Undocumented

def asunicode_nested(x): (source)

Undocumented

def getexception(): (source)

Undocumented

def is_pathlib_path(obj): (source)

Check whether obj is a pathlib.Path object.

Prefer using isinstance(obj, os.PathLike) instead of this function.

def isfileobj(f): (source)

Undocumented

def npy_load_module(name, fn, info=None): (source)

Load a module. Uses load_module which will be deprecated in python 3.12. An alternative that uses exec_module is in numpy.distutils.misc_util.exec_mod_from_location

New in version 1.11.2.
Parameters
name:strFull module name.
fn:strPath to module file.
info:tuple, optionalOnly here for backward compatibility with Python 2.*.
Returns
modulemod
def open_latin1(filename, mode='r'): (source)

Undocumented

def sixu(s): (source)

Undocumented

integer_types = (source)

Undocumented

Undocumented