Skip to content

Commit 7f6e973

Browse files
authored
Merge pull request #1617 from zm711/fix-dep-error
Improve `copy` deprecation message
2 parents d722b0b + ea8e7fc commit 7f6e973

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

neo/core/analogsignal.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ def __new__(
200200
"""
201201
if copy is not None:
202202
raise ValueError(
203-
"`copy` is now deprecated in Neo due to removal in NumPy 2.0 and will be removed in 0.15.0."
203+
"`copy` is now deprecated in Neo due to removal in Quantites to support Numpy 2.0. "
204+
"In order to facilitate the deprecation copy can be set to None but will raise an "
205+
"error if set to True/False since this will silently do nothing. This argument will be completely "
206+
"removed in Neo 0.15.0. Please update your code base as necessary."
204207
)
205208

206209
signal = cls._rescale(signal, units=units)
@@ -210,7 +213,7 @@ def __new__(
210213
obj.shape = (-1, 1)
211214

212215
if t_start is None:
213-
raise ValueError("t_start cannot be None")
216+
raise ValueError("`t_start` cannot be None")
214217
obj._t_start = t_start
215218

216219
obj._sampling_rate = _get_sampling_rate(sampling_rate, sampling_period)

neo/core/imagesequence.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ def __new__(
124124

125125
if copy is not None:
126126
raise ValueError(
127-
"`copy` is now deprecated in Neo due to removal in NumPy 2.0 and will be removed in 0.15.0."
127+
"`copy` is now deprecated in Neo due to removal in Quantites to support Numpy 2.0. "
128+
"In order to facilitate the deprecation copy can be set to None but will raise an "
129+
"error if set to True/False since this will silently do nothing. This argument will be completely "
130+
"removed in Neo 0.15.0. Please update your code base as necessary."
128131
)
129132

130133
if spatial_scale is None:

neo/core/irregularlysampledsignal.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def __new__(
174174

175175
if copy is not None:
176176
raise ValueError(
177-
"`copy` is now deprecated in Neo due to removal in NumPy 2.0 and will be removed in 0.15.0."
177+
"`copy` is now deprecated in Neo due to removal in Quantites to support Numpy 2.0. "
178+
"In order to facilitate the deprecation copy can be set to None but will raise an "
179+
"error if set to True/False since this will silently do nothing. This argument will be completely "
180+
"removed in Neo 0.15.0. Please update your code base as necessary."
178181
)
179182

180183
signal = cls._rescale(signal, units=units)

neo/core/spiketrain.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,12 @@ def normalize_times_array(times, units=None, dtype=None, copy=None):
194194
"""
195195

196196
if copy is not None:
197-
raise ValueError("`copy` is now deprecated in Neo due to removal in NumPy 2.0 and will be removed in 0.15.0.")
197+
raise ValueError(
198+
"`copy` is now deprecated in Neo due to removal in Quantites to support Numpy 2.0. "
199+
"In order to facilitate the deprecation copy can be set to None but will raise an "
200+
"error if set to True/False since this will silently do nothing. This argument will be completely "
201+
"removed in Neo 0.15.0. Please update your code base as necessary."
202+
)
198203

199204
if dtype is None:
200205
if not hasattr(times, "dtype"):
@@ -352,7 +357,10 @@ def __new__(
352357
"""
353358
if copy is not None:
354359
raise ValueError(
355-
"`copy` is now deprecated in Neo due to removal in NumPy 2.0 and will be removed in 0.15.0."
360+
"`copy` is now deprecated in Neo due to removal in Quantites to support Numpy 2.0. "
361+
"In order to facilitate the deprecation copy can be set to None but will raise an "
362+
"error if set to True/False since this will silently do nothing. This argument will be completely "
363+
"removed in Neo 0.15.0. Please update your code base as necessary."
356364
)
357365

358366
if len(times) != 0 and waveforms is not None and len(times) != waveforms.shape[0]:

0 commit comments

Comments
 (0)