mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-07-30 10:38:07 -07:00
dev-python/numpy: Drop old
obsoletes: Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=450886 Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=463422 Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=469116 Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=519984 Package-Manager: portage-2.2.23 Signed-off-by: Justin Lecher <jlec@gentoo.org>
This commit is contained in:
@@ -1,214 +0,0 @@
|
||||
numpy/core/tests/test_memmap.py | 34 ++++++++++++++++------------------
|
||||
numpy/core/tests/test_multiarray.py | 9 +++------
|
||||
numpy/f2py/__init__.py | 22 +++++++++++-----------
|
||||
numpy/f2py/f2py2e.py | 4 ++--
|
||||
numpy/lib/tests/test_io.py | 24 ++++++++++++++++--------
|
||||
5 files changed, 48 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/numpy/core/tests/test_memmap.py b/numpy/core/tests/test_memmap.py
|
||||
index 6de6319..10e7a08 100644
|
||||
--- a/numpy/core/tests/test_memmap.py
|
||||
+++ b/numpy/core/tests/test_memmap.py
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import sys
|
||||
-from tempfile import NamedTemporaryFile, TemporaryFile, mktemp
|
||||
+from tempfile import NamedTemporaryFile, TemporaryFile
|
||||
import os
|
||||
|
||||
from numpy import memmap
|
||||
@@ -33,12 +33,11 @@ class TestMemmap(TestCase):
|
||||
assert_array_equal(self.data, newfp)
|
||||
|
||||
def test_open_with_filename(self):
|
||||
- tmpname = mktemp('', 'mmap')
|
||||
- fp = memmap(tmpname, dtype=self.dtype, mode='w+',
|
||||
- shape=self.shape)
|
||||
- fp[:] = self.data[:]
|
||||
- del fp
|
||||
- os.unlink(tmpname)
|
||||
+ with NamedTemporaryFile() as tmp:
|
||||
+ fp = memmap(tmp.name, dtype=self.dtype, mode='w+',
|
||||
+ shape=self.shape)
|
||||
+ fp[:] = self.data[:]
|
||||
+ del fp
|
||||
|
||||
def test_unnamed_file(self):
|
||||
with TemporaryFile() as f:
|
||||
@@ -55,17 +54,16 @@ class TestMemmap(TestCase):
|
||||
del fp
|
||||
|
||||
def test_filename(self):
|
||||
- tmpname = mktemp('', 'mmap')
|
||||
- fp = memmap(tmpname, dtype=self.dtype, mode='w+',
|
||||
- shape=self.shape)
|
||||
- abspath = os.path.abspath(tmpname)
|
||||
- fp[:] = self.data[:]
|
||||
- self.assertEqual(abspath, fp.filename)
|
||||
- b = fp[:1]
|
||||
- self.assertEqual(abspath, b.filename)
|
||||
- del b
|
||||
- del fp
|
||||
- os.unlink(tmpname)
|
||||
+ with NamedTemporaryFile() as tmp:
|
||||
+ fp = memmap(tmp.name, dtype=self.dtype, mode='w+',
|
||||
+ shape=self.shape)
|
||||
+ abspath = os.path.abspath(tmp.name)
|
||||
+ fp[:] = self.data[:]
|
||||
+ self.assertEqual(abspath, fp.filename)
|
||||
+ b = fp[:1]
|
||||
+ self.assertEqual(abspath, b.filename)
|
||||
+ del b
|
||||
+ del fp
|
||||
|
||||
def test_filename_fileobj(self):
|
||||
fp = memmap(self.tmpfp, dtype=self.dtype, mode="w+",
|
||||
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
|
||||
index a0c4bcf..37b9931 100644
|
||||
--- a/numpy/core/tests/test_multiarray.py
|
||||
+++ b/numpy/core/tests/test_multiarray.py
|
||||
@@ -2051,12 +2051,11 @@ class TestIO(object):
|
||||
self.x = rand(shape) + rand(shape).astype(np.complex)*1j
|
||||
self.x[0,:, 1] = [nan, inf, -inf, nan]
|
||||
self.dtype = self.x.dtype
|
||||
- self.filename = tempfile.mktemp()
|
||||
+ self.file = tempfile.NamedTemporaryFile()
|
||||
+ self.filename = self.file.name
|
||||
|
||||
def tearDown(self):
|
||||
- if os.path.isfile(self.filename):
|
||||
- os.unlink(self.filename)
|
||||
- #tmp_file.close()
|
||||
+ self.file.close()
|
||||
|
||||
def test_bool_fromstring(self):
|
||||
v = np.array([True, False, True, False], dtype=np.bool_)
|
||||
@@ -2084,7 +2083,6 @@ class TestIO(object):
|
||||
y = np.fromfile(f, dtype=self.dtype)
|
||||
f.close()
|
||||
assert_array_equal(y, self.x.flat)
|
||||
- os.unlink(self.filename)
|
||||
|
||||
def test_roundtrip_filename(self):
|
||||
self.x.tofile(self.filename)
|
||||
@@ -2217,7 +2215,6 @@ class TestIO(object):
|
||||
s = f.read()
|
||||
f.close()
|
||||
assert_equal(s, '1.51,2.0,3.51,4.0')
|
||||
- os.unlink(self.filename)
|
||||
|
||||
def test_tofile_format(self):
|
||||
x = np.array([1.51, 2, 3.51, 4], dtype=float)
|
||||
diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py
|
||||
index ccdbd4e..fcfd185 100644
|
||||
--- a/numpy/f2py/__init__.py
|
||||
+++ b/numpy/f2py/__init__.py
|
||||
@@ -28,20 +28,20 @@ def compile(source,
|
||||
from numpy.distutils.exec_command import exec_command
|
||||
import tempfile
|
||||
if source_fn is None:
|
||||
- fname = os.path.join(tempfile.mktemp()+'.f')
|
||||
+ f = tempfile.NamedTemporaryFile(suffix='.f')
|
||||
else:
|
||||
- fname = source_fn
|
||||
-
|
||||
- f = open(fname, 'w')
|
||||
- f.write(source)
|
||||
- f.close()
|
||||
-
|
||||
- args = ' -c -m %s %s %s'%(modulename, fname, extra_args)
|
||||
- c = '%s -c "import numpy.f2py as f2py2e;f2py2e.main()" %s' %(sys.executable, args)
|
||||
- s, o = exec_command(c)
|
||||
- if source_fn is None:
|
||||
- try: os.remove(fname)
|
||||
- except OSError: pass
|
||||
+ f = open(source_fn, 'w')
|
||||
+
|
||||
+ try:
|
||||
+ f.write(source)
|
||||
+ f.flush()
|
||||
+
|
||||
+ args = ' -c -m %s %s %s'%(modulename, f.name, extra_args)
|
||||
+ c = '%s -c "import numpy.f2py as f2py2e;f2py2e.main()" %s' % \
|
||||
+ (sys.executable, args)
|
||||
+ s, o = exec_command(c)
|
||||
+ finally:
|
||||
+ f.close()
|
||||
return s
|
||||
|
||||
from numpy.testing import Tester
|
||||
diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py
|
||||
old mode 100755
|
||||
new mode 100644
|
||||
index 011b430..b264ea3
|
||||
--- a/numpy/f2py/f2py2e.py
|
||||
+++ b/numpy/f2py/f2py2e.py
|
||||
@@ -91,7 +91,7 @@ Options:
|
||||
--lower is assumed with -h key, and --no-lower without -h key.
|
||||
|
||||
--build-dir <dirname> All f2py generated files are created in <dirname>.
|
||||
- Default is tempfile.mktemp().
|
||||
+ Default is tempfile.mkdtemp().
|
||||
|
||||
--overwrite-signature Overwrite existing signature file.
|
||||
|
||||
@@ -428,7 +428,7 @@ def run_compile():
|
||||
del sys.argv[i]
|
||||
else:
|
||||
remove_build_dir = 1
|
||||
- build_dir = os.path.join(tempfile.mktemp())
|
||||
+ build_dir = tempfile.mkdtemp()
|
||||
|
||||
_reg1 = re.compile(r'[-][-]link[-]')
|
||||
sysinfo_flags = [_m for _m in sys.argv[1:] if _reg1.match(_m)]
|
||||
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
|
||||
index fdd78b2..caffada 100644
|
||||
--- a/numpy/lib/tests/test_io.py
|
||||
+++ b/numpy/lib/tests/test_io.py
|
||||
@@ -4,7 +4,9 @@ import sys
|
||||
import gzip
|
||||
import os
|
||||
import threading
|
||||
-from tempfile import mkstemp, mktemp, NamedTemporaryFile
|
||||
+import shutil
|
||||
+import contextlib
|
||||
+from tempfile import mkstemp, mkdtemp, NamedTemporaryFile
|
||||
import time
|
||||
import warnings
|
||||
import gc
|
||||
@@ -21,6 +23,12 @@ from numpy.ma.testutils import (TestCase, assert_equal, assert_array_equal,
|
||||
assert_raises, run_module_suite)
|
||||
from numpy.testing import assert_warns, assert_, build_err_msg
|
||||
|
||||
+@contextlib.contextmanager
|
||||
+def tempdir(change_dir=False):
|
||||
+ tmpdir = mkdtemp()
|
||||
+ yield tmpdir
|
||||
+ shutil.rmtree(tmpdir)
|
||||
+
|
||||
|
||||
class TextIO(BytesIO):
|
||||
"""Helper IO class.
|
||||
@@ -145,14 +153,14 @@ class TestSavezLoad(RoundtripTest, TestCase):
|
||||
@np.testing.dec.slow
|
||||
def test_big_arrays(self):
|
||||
L = (1 << 31) + 100000
|
||||
- tmp = mktemp(suffix='.npz')
|
||||
a = np.empty(L, dtype=np.uint8)
|
||||
- np.savez(tmp, a=a)
|
||||
- del a
|
||||
- npfile = np.load(tmp)
|
||||
- a = npfile['a']
|
||||
- npfile.close()
|
||||
- os.remove(tmp)
|
||||
+ with tempdir() as tmpdir:
|
||||
+ tmp = os.path.join(tmpdir, "file.npz")
|
||||
+ np.savez(tmp, a=a)
|
||||
+ del a
|
||||
+ npfile = np.load(tmp)
|
||||
+ a = npfile['a']
|
||||
+ npfile.close()
|
||||
|
||||
def test_multiple_arrays(self):
|
||||
a = np.array([[1, 2], [3, 4]], float)
|
||||
@@ -1,91 +0,0 @@
|
||||
From dc453917978e98dcdf3bbc106b080c80f0a1301e Mon Sep 17 00:00:00 2001
|
||||
From: Charles Harris <charlesr.harris@gmail.com>
|
||||
Date: Fri, 3 Oct 2014 20:03:31 -0600
|
||||
Subject: [PATCH] BUG: Make numpy import when run with Python flag '-OO'.
|
||||
|
||||
This consists of checking for a docstring equal to None and skipping two
|
||||
tests that require docstrings.
|
||||
|
||||
Closes #5148.
|
||||
---
|
||||
numpy/lib/tests/test_function_base.py | 6 +++++-
|
||||
numpy/lib/tests/test_utils.py | 3 ++-
|
||||
numpy/ma/extras.py | 8 +++++---
|
||||
3 files changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
|
||||
index ee38b35..a3f8056 100644
|
||||
--- a/numpy/lib/tests/test_function_base.py
|
||||
+++ b/numpy/lib/tests/test_function_base.py
|
||||
@@ -1,12 +1,14 @@
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import warnings
|
||||
+import sys
|
||||
|
||||
import numpy as np
|
||||
from numpy.testing import (
|
||||
run_module_suite, TestCase, assert_, assert_equal, assert_array_equal,
|
||||
assert_almost_equal, assert_array_almost_equal, assert_raises,
|
||||
- assert_allclose, assert_array_max_ulp, assert_warns, assert_raises_regex
|
||||
+ assert_allclose, assert_array_max_ulp, assert_warns,
|
||||
+ assert_raises_regex, dec
|
||||
)
|
||||
from numpy.random import rand
|
||||
from numpy.lib import *
|
||||
@@ -2094,6 +2096,8 @@ def test_string_arg(self):
|
||||
|
||||
|
||||
class TestAdd_newdoc(TestCase):
|
||||
+
|
||||
+ @dec.skipif(sys.flags.optimize == 2)
|
||||
def test_add_doc(self):
|
||||
# test np.add_newdoc
|
||||
tgt = "Current flat index into the array."
|
||||
diff --git a/numpy/lib/tests/test_utils.py b/numpy/lib/tests/test_utils.py
|
||||
index fcb37f9..8fbd1c4 100644
|
||||
--- a/numpy/lib/tests/test_utils.py
|
||||
+++ b/numpy/lib/tests/test_utils.py
|
||||
@@ -3,7 +3,7 @@
|
||||
import sys
|
||||
from numpy.core import arange
|
||||
from numpy.testing import (
|
||||
- run_module_suite, assert_, assert_equal
|
||||
+ run_module_suite, assert_, assert_equal, dec
|
||||
)
|
||||
from numpy.lib import deprecate
|
||||
import numpy.lib.utils as utils
|
||||
@@ -14,6 +14,7 @@
|
||||
from StringIO import StringIO
|
||||
|
||||
|
||||
+@dec.skipif(sys.flags.optimize == 2)
|
||||
def test_lookfor():
|
||||
out = StringIO()
|
||||
utils.lookfor('eigenvalue', module='numpy', output=out,
|
||||
diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py
|
||||
index 82a61a6..a993fd0 100644
|
||||
--- a/numpy/ma/extras.py
|
||||
+++ b/numpy/ma/extras.py
|
||||
@@ -434,8 +434,10 @@ def apply_over_axes(func, a, axes):
|
||||
raise ValueError("function is not returning "
|
||||
"an array of the correct shape")
|
||||
return val
|
||||
-apply_over_axes.__doc__ = np.apply_over_axes.__doc__[
|
||||
- :np.apply_over_axes.__doc__.find('Notes')].rstrip() + \
|
||||
+
|
||||
+if apply_over_axes.__doc__ is not None:
|
||||
+ apply_over_axes.__doc__ = np.apply_over_axes.__doc__[
|
||||
+ :np.apply_over_axes.__doc__.find('Notes')].rstrip() + \
|
||||
"""
|
||||
|
||||
Examples
|
||||
@@ -462,7 +464,7 @@ def apply_over_axes(func, a, axes):
|
||||
[[[46]
|
||||
[--]
|
||||
[124]]]
|
||||
-"""
|
||||
+ """
|
||||
|
||||
|
||||
def average(a, axis=None, weights=None, returned=False):
|
||||
@@ -1,25 +0,0 @@
|
||||
--- numpy/distutils/system_info.py 2014-09-07 08:57:47.000000000 +0000
|
||||
+++ numpy/distutils/system_info.py 2014-10-19 17:57:12.099448481 +0000
|
||||
@@ -296,20 +296,7 @@
|
||||
1 - display warning message
|
||||
2 - raise error
|
||||
"""
|
||||
- cl = {'atlas': atlas_info, # use lapack_opt or blas_opt instead
|
||||
- 'atlas_threads': atlas_threads_info, # ditto
|
||||
- 'atlas_blas': atlas_blas_info,
|
||||
- 'atlas_blas_threads': atlas_blas_threads_info,
|
||||
- 'lapack_atlas': lapack_atlas_info, # use lapack_opt instead
|
||||
- 'lapack_atlas_threads': lapack_atlas_threads_info, # ditto
|
||||
- 'mkl': mkl_info,
|
||||
- # openblas which may or may not have embedded lapack
|
||||
- 'openblas': openblas_info, # use blas_opt instead
|
||||
- # openblas with embedded lapack
|
||||
- 'openblas_lapack': openblas_lapack_info, # use blas_opt instead
|
||||
- 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead
|
||||
- 'blas_mkl': blas_mkl_info, # use blas_opt instead
|
||||
- 'x11': x11_info,
|
||||
+ cl = {'x11': x11_info,
|
||||
'fft_opt': fft_opt_info,
|
||||
'fftw': fftw_info,
|
||||
'fftw2': fftw2_info,
|
||||
|
||||
Reference in New Issue
Block a user