Пример #1
0
from __future__ import division, absolute_import, print_function

# To get sub-classes
from .info import __doc__

from .fftpack import *
from .helper import *

from numpy.testing import _numpy_tester
test = _numpy_tester().test
bench = _numpy_tester().bench
Пример #2
0
from .numeric import absolute as abs

__all__ = ['char', 'rec', 'memmap']
__all__ += numeric.__all__
__all__ += fromnumeric.__all__
__all__ += rec.__all__
__all__ += ['chararray']
__all__ += function_base.__all__
__all__ += machar.__all__
__all__ += getlimits.__all__
__all__ += shape_base.__all__
__all__ += einsumfunc.__all__

from numpy.testing import _numpy_tester

test = _numpy_tester().test


# Make it possible so that ufuncs can be pickled
#  Here are the loading and unloading functions
# The name numpy.core._ufunc_reconstruct must be
#   available for unpickling to work.
def _ufunc_reconstruct(module, name):
    # The `fromlist` kwarg is required to ensure that `mod` points to the
    # inner-most module rather than the parent package when module name is
    # nested. This makes it possible to pickle non-toplevel ufuncs such as
    # scipy.special.expit for instance.
    mod = __import__(module, fromlist=[name])
    return getattr(mod, name)

Пример #3
0
        The extension tells which fortran standard is used.
        The default is `.f`, which implies F77 standard.

        .. versionadded:: 1.11.0

    """
    from numpy.distutils.exec_command import exec_command
    import tempfile
    if source_fn is None:
        f = tempfile.NamedTemporaryFile(suffix=extension)
    else:
        f = open(source_fn, 'w')

    try:
        f.write(source)
        f.flush()

        args = ' -c -m {} {} {}'.format(modulename, f.name, extra_args)
        c = '{} -c "import numpy.f2py as f2py2e;f2py2e.main()" {}'
        c = c.format(sys.executable, args)
        status, output = exec_command(c)
        if verbose:
            print(output)
    finally:
        f.close()
    return status

from numpy.testing import _numpy_tester
test = _numpy_tester().test
bench = _numpy_tester().bench