File: numpy-asscalar.patch

package info (click to toggle)
xmds2 3.1.0%2Bdfsg2-11
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,616 kB
  • sloc: python: 64,051; cpp: 4,868; ansic: 1,463; makefile: 144; sh: 54; javascript: 8
file content (23 lines) | stat: -rw-r--r-- 1,039 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: Use numpy.ndarray.item instead of numpy.asscalar
 The method numpy.asscalar() is deprecated since version 1.16 of numpy
 and was removed in version 1.23.
Author: Rafael Laboissière <rafael@debian.org>
Bug-Debian: https://bugs.debian.org/1026350
Forwarded: https://sourceforge.net/p/xmds/mailman/message/37751186/
Applied-Upstream: https://sourceforge.net/p/xmds/code/3131/
Last-Update: 2022-12-18

--- xmds2-3.1.0+dfsg2.orig/xpdeint/XSILFile.py
+++ xmds2-3.1.0+dfsg2/xpdeint/XSILFile.py
@@ -118,7 +118,10 @@ class XSILDataBinary(XSILData):
     
     for independentVariable in self.independentVariables:
       size = numpy.fromfile(fd, dtype=ulongDType, count=1)[0]
-      independentGeometry.append(numpy.asscalar(size))
+      try:
+        independentGeometry.append(numpy.asscalar(size))
+      except AttributeError:
+        independentGeometry.append(size.item())
       assert size == independentVariable['length']
       a = numpy.fromfile(fd, dtype=floatDType, count=size)
       independentVariable['array'] = a