import numba.unittest_support as unittest from numba.runtime import rtsys from numba.six import PY2 enable_pyobj_flags = Flags() enable_pyobj_flags.set("enable_pyobject") force_pyobj_flags = Flags() force_pyobj_flags.set("force_pyobject") no_pyobj_flags = Flags() nrt_flags = Flags() nrt_flags.set("nrt") tag = testing.make_tag_decorator(['important', 'long_running']) _windows_py27 = (sys.platform.startswith('win32') and sys.version_info[:2] == (2, 7)) _32bit = sys.maxsize <= 2**32 _reason = 'parfors not supported' skip_parfors_unsupported = unittest.skipIf(_32bit or _windows_py27, _reason) class CompilationCache(object): """ A cache of compilation results for various signatures and flags. This can make tests significantly faster (or less slow). """ def __init__(self): self.typingctx = typing.Context()
enable_pyobj_flags = Flags() enable_pyobj_flags.set("enable_pyobject") force_pyobj_flags = Flags() force_pyobj_flags.set("force_pyobject") no_pyobj_flags = Flags() is_on_numpy_16 = numpy_support.version == (1, 6) skip_on_numpy_16 = unittest.skipIf(is_on_numpy_16, "test requires Numpy 1.7 or later") tag = testing.make_tag_decorator(['important']) class CompilationCache(object): """ A cache of compilation results for various signatures and flags. This can make tests significantly faster (or less slow). """ def __init__(self): self.typingctx = typing.Context() self.targetctx = cpu.CPUContext(self.typingctx) self.cr_cache = {} def compile(self, func, args, return_type=None, flags=DEFAULT_FLAGS): """
import scipy except ImportError: scipy = None enable_pyobj_flags = Flags() enable_pyobj_flags.set("enable_pyobject") force_pyobj_flags = Flags() force_pyobj_flags.set("force_pyobject") no_pyobj_flags = Flags() nrt_flags = Flags() nrt_flags.set("nrt") tag = testing.make_tag_decorator(["important", "long_running"]) _32bit = sys.maxsize <= 2**32 is_parfors_unsupported = _32bit skip_parfors_unsupported = unittest.skipIf( is_parfors_unsupported, "parfors not supported", ) skip_py38_or_later = unittest.skipIf(utils.PYVERSION >= (3, 8), "unsupported on py3.8 or later") skip_tryexcept_unsupported = unittest.skipIf( utils.PYVERSION < (3, 7), "try-except unsupported on py3.6 or earlier") skip_tryexcept_supported = unittest.skipIf( utils.PYVERSION >= (3, 7), "try-except supported on py3.7 or later") _msg = "SciPy needed for test"
from numba.targets import cpu import numba.unittest_support as unittest from numba.runtime import rtsys enable_pyobj_flags = Flags() enable_pyobj_flags.set("enable_pyobject") force_pyobj_flags = Flags() force_pyobj_flags.set("force_pyobject") no_pyobj_flags = Flags() nrt_flags = Flags() nrt_flags.set("nrt") tag = testing.make_tag_decorator(['important']) class CompilationCache(object): """ A cache of compilation results for various signatures and flags. This can make tests significantly faster (or less slow). """ def __init__(self): self.typingctx = typing.Context() self.targetctx = cpu.CPUContext(self.typingctx) self.cr_cache = {} def compile(self, func, args, return_type=None, flags=DEFAULT_FLAGS): """ Compile the function or retrieve an already compiled result
from numba.runtime import rtsys enable_pyobj_flags = Flags() enable_pyobj_flags.set("enable_pyobject") force_pyobj_flags = Flags() force_pyobj_flags.set("force_pyobject") no_pyobj_flags = Flags() nrt_flags = Flags() nrt_flags.set("nrt") tag = testing.make_tag_decorator(['important', 'long_running']) _windows_py27 = (sys.platform.startswith('win32') and sys.version_info[:2] == (2, 7)) _32bit = sys.maxsize <= 2 ** 32 _reason = 'parfors not supported' skip_parfors_unsupported = unittest.skipIf(_32bit or _windows_py27, _reason) class CompilationCache(object): """ A cache of compilation results for various signatures and flags. This can make tests significantly faster (or less slow). """ def __init__(self):