Python numexpr.__version__() Examples
The following are 14
code examples of numexpr.__version__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numexpr
, or try the search function
.
Example #1
Source File: test_compat.py From recruit with Apache License 2.0 | 8 votes |
def test_invalid_numexpr_version(engine, parser): def testit(): a, b = 1, 2 # noqa res = pd.eval('a + b', engine=engine, parser=parser) assert res == 3 if engine == 'numexpr': try: import numexpr as ne except ImportError: pytest.skip("no numexpr") else: if (LooseVersion(ne.__version__) < LooseVersion(_MIN_NUMEXPR_VERSION)): with pytest.raises(ImportError): testit() else: testit() else: testit()
Example #2
Source File: test_compat.py From vnpy_crypto with MIT License | 6 votes |
def test_invalid_numexpr_version(engine, parser): def testit(): a, b = 1, 2 # noqa res = pd.eval('a + b', engine=engine, parser=parser) assert res == 3 if engine == 'numexpr': try: import numexpr as ne except ImportError: pytest.skip("no numexpr") else: if (LooseVersion(ne.__version__) < LooseVersion(_MIN_NUMEXPR_VERSION)): with pytest.raises(ImportError): testit() else: testit() else: testit()
Example #3
Source File: test_eval.py From Computable with MIT License | 6 votes |
def check_invalid_numexpr_version(engine, parser): def testit(): a, b = 1, 2 res = pd.eval('a + b', engine=engine, parser=parser) tm.assert_equal(res, 3) if engine == 'numexpr': try: import numexpr as ne except ImportError: raise nose.SkipTest("no numexpr") else: if ne.__version__ < LooseVersion('2.0'): with tm.assertRaisesRegexp(ImportError, "'numexpr' version is " ".+, must be >= 2.0"): testit() else: testit() else: testit()
Example #4
Source File: testing.py From Computable with MIT License | 6 votes |
def skip_if_no_ne(engine='numexpr'): import nose _USE_NUMEXPR = pd.computation.expressions._USE_NUMEXPR if engine == 'numexpr': try: import numexpr as ne except ImportError: raise nose.SkipTest("numexpr not installed") if not _USE_NUMEXPR: raise nose.SkipTest("numexpr disabled") if ne.__version__ < LooseVersion('2.0'): raise nose.SkipTest("numexpr version too low: " "%s" % ne.__version__)
Example #5
Source File: test_compat.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def test_invalid_numexpr_version(engine, parser): def testit(): a, b = 1, 2 # noqa res = pd.eval('a + b', engine=engine, parser=parser) assert res == 3 if engine == 'numexpr': try: import numexpr as ne except ImportError: pytest.skip("no numexpr") else: if (LooseVersion(ne.__version__) < LooseVersion(_MIN_NUMEXPR_VERSION)): with pytest.raises(ImportError): testit() else: testit() else: testit()
Example #6
Source File: test_compat.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def test_invalid_numexpr_version(engine, parser): def testit(): a, b = 1, 2 # noqa res = pd.eval('a + b', engine=engine, parser=parser) assert res == 3 if engine == 'numexpr': try: import numexpr as ne except ImportError: pytest.skip("no numexpr") else: if ne.__version__ < LooseVersion(_MIN_NUMEXPR_VERSION): with pytest.raises(ImportError): testit() else: testit() else: testit()
Example #7
Source File: test_compat.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_invalid_numexpr_version(engine, parser): def testit(): a, b = 1, 2 # noqa res = pd.eval('a + b', engine=engine, parser=parser) assert res == 3 if engine == 'numexpr': try: import numexpr as ne except ImportError: pytest.skip("no numexpr") else: if (LooseVersion(ne.__version__) < LooseVersion(_MIN_NUMEXPR_VERSION)): with pytest.raises(ImportError): testit() else: testit() else: testit()
Example #8
Source File: test_compat.py From recruit with Apache License 2.0 | 5 votes |
def test_compat(): # test we have compat with our version of nu from pandas.core.computation.check import _NUMEXPR_INSTALLED try: import numexpr as ne ver = ne.__version__ if LooseVersion(ver) < LooseVersion(_MIN_NUMEXPR_VERSION): assert not _NUMEXPR_INSTALLED else: assert _NUMEXPR_INSTALLED except ImportError: pytest.skip("not testing numexpr version compat")
Example #9
Source File: test_compat.py From vnpy_crypto with MIT License | 5 votes |
def test_compat(): # test we have compat with our version of nu from pandas.core.computation.check import _NUMEXPR_INSTALLED try: import numexpr as ne ver = ne.__version__ if LooseVersion(ver) < LooseVersion(_MIN_NUMEXPR_VERSION): assert not _NUMEXPR_INSTALLED else: assert _NUMEXPR_INSTALLED except ImportError: pytest.skip("not testing numexpr version compat")
Example #10
Source File: eval.py From Computable with MIT License | 5 votes |
def _check_engine(engine): """Make sure a valid engine is passed. Parameters ---------- engine : str Raises ------ KeyError * If an invalid engine is passed ImportError * If numexpr was requested but doesn't exist """ if engine not in _engines: raise KeyError('Invalid engine {0!r} passed, valid engines are' ' {1}'.format(engine, list(_engines.keys()))) # TODO: validate this in a more general way (thinking of future engines # that won't necessarily be import-able) # Could potentially be done on engine instantiation if engine == 'numexpr': try: import numexpr except ImportError: raise ImportError("'numexpr' not found. Cannot use " "engine='numexpr' for query/eval " "if 'numexpr' is not installed") else: ne_version = numexpr.__version__ if ne_version < LooseVersion('2.0'): raise ImportError("'numexpr' version is %s, " "must be >= 2.0" % ne_version)
Example #11
Source File: test_compat.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_compat(): # test we have compat with our version of nu from pandas.core.computation.check import _NUMEXPR_INSTALLED try: import numexpr as ne ver = ne.__version__ if LooseVersion(ver) < LooseVersion(_MIN_NUMEXPR_VERSION): assert not _NUMEXPR_INSTALLED else: assert _NUMEXPR_INSTALLED except ImportError: pytest.skip("not testing numexpr version compat")
Example #12
Source File: test_compat.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_compat(): # test we have compat with our version of nu from pandas.core.computation.check import _NUMEXPR_INSTALLED try: import numexpr as ne ver = ne.__version__ if ver < LooseVersion(_MIN_NUMEXPR_VERSION): assert not _NUMEXPR_INSTALLED else: assert _NUMEXPR_INSTALLED except ImportError: pytest.skip("not testing numexpr version compat")
Example #13
Source File: test_compat.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_compat(): # test we have compat with our version of nu from pandas.core.computation.check import _NUMEXPR_INSTALLED try: import numexpr as ne ver = ne.__version__ if LooseVersion(ver) < LooseVersion(_MIN_NUMEXPR_VERSION): assert not _NUMEXPR_INSTALLED else: assert _NUMEXPR_INSTALLED except ImportError: pytest.skip("not testing numexpr version compat")
Example #14
Source File: testing.py From Computable with MIT License | 4 votes |
def package_check(pkg_name, version=None, app='pandas', checker=LooseVersion, exc_failed_import=ImportError, exc_failed_check=RuntimeError): """Check that the minimal version of the required package is installed. Parameters ---------- pkg_name : string Name of the required package. version : string, optional Minimal version number for required package. app : string, optional Application that is performing the check. For instance, the name of the tutorial being executed that depends on specific packages. checker : object, optional The class that will perform the version checking. Default is distutils.version.LooseVersion. exc_failed_import : Exception, optional Class of the exception to be thrown if import failed. exc_failed_check : Exception, optional Class of the exception to be thrown if version check failed. Examples -------- package_check('numpy', '1.3') package_check('networkx', '1.0', 'tutorial1') """ if app: msg = '%s requires %s' % (app, pkg_name) else: msg = 'module requires %s' % pkg_name if version: msg += ' with version >= %s' % (version,) try: mod = __import__(pkg_name) except ImportError: raise exc_failed_import(msg) if not version: return try: have_version = mod.__version__ except AttributeError: raise exc_failed_check('Cannot find version for %s' % pkg_name) if checker(have_version) < checker(version): raise exc_failed_check(msg)