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.

Variable integer​_types Undocumented
Variable strchar Undocumented
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
integer_types =

Undocumented

strchar: str =

Undocumented

def asbytes(s):

Undocumented

def asbytes_nested(x):

Undocumented

def asstr(s):

Undocumented

def asunicode(s):

Undocumented

def asunicode_nested(x):

Undocumented

def getexception():

Undocumented

def is_pathlib_path(obj):

Check whether obj is a pathlib.Path object.

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

def isfileobj(f):

Undocumented

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

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 : str
Full module name.
fn : str
Path to module file.
info : tuple, optional
Only here for backward compatibility with Python 2.*.

Returns

mod : module

def open_latin1(filename, mode='r'):

Undocumented

def sixu(s):

Undocumented