summaryrefslogtreecommitdiff
blob: 153b984f1fe75ed1a2659568d80fcebe36939c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 787d6daa292ef013efb2ce93f100079457330363 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Thu, 9 May 2024 20:27:16 +0200
Subject: [PATCH 3/3] Replace np.array(a, copy=False) with np.asarray(a)

See https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword
---
 bottleneck/slow/move.py           | 8 ++++----
 bottleneck/slow/nonreduce_axis.py | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bottleneck/slow/move.py b/bottleneck/slow/move.py
index 0aa06f141..76a54a24e 100644
--- a/bottleneck/slow/move.py
+++ b/bottleneck/slow/move.py
@@ -52,7 +52,7 @@ def move_argmin(a, window, min_count=None, axis=-1):
     "Slow move_argmin for unaccelerated dtype"
 
     def argmin(a, axis):
-        a = np.array(a, copy=False)
+        a = np.asarray(a)
         flip = [slice(None)] * a.ndim
         flip[axis] = slice(None, None, -1)
         a = a[tuple(flip)]  # if tie, pick index of rightmost tie
@@ -78,7 +78,7 @@ def move_argmax(a, window, min_count=None, axis=-1):
     "Slow move_argmax for unaccelerated dtype"
 
     def argmax(a, axis):
-        a = np.array(a, copy=False)
+        a = np.asarray(a)
         flip = [slice(None)] * a.ndim
         flip[axis] = slice(None, None, -1)
         a = a[tuple(flip)]  # if tie, pick index of rightmost tie
@@ -115,7 +115,7 @@ def move_rank(a, window, min_count=None, axis=-1):
 
 def move_func(func, a, window, min_count=None, axis=-1, **kwargs):
     "Generic moving window function implemented with a python loop."
-    a = np.array(a, copy=False)
+    a = np.asarray(a)
     if min_count is None:
         mc = window
     else:
@@ -226,7 +226,7 @@ def lastrank(a, axis=-1):
     -0.5
 
     """
-    a = np.array(a, copy=False)
+    a = np.asarray(a)
     ndim = a.ndim
     if a.size == 0:
         # At least one dimension has length 0
diff --git a/bottleneck/slow/nonreduce_axis.py b/bottleneck/slow/nonreduce_axis.py
index f09dfa739..1dd67529a 100644
--- a/bottleneck/slow/nonreduce_axis.py
+++ b/bottleneck/slow/nonreduce_axis.py
@@ -15,7 +15,7 @@ def nanrankdata(a, axis=None):
 
 
 def _rank(func1d, a, axis):
-    a = np.array(a, copy=False)
+    a = np.asarray(a)
     if axis is None:
         a = a.ravel()
         axis = 0