File: python3-compat.patch

package info (click to toggle)
python-nxs 4.4.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 888 kB
  • sloc: python: 2,752; makefile: 152; sh: 10
file content (49 lines) | stat: -rw-r--r-- 1,549 bytes parent folder | download | duplicates (3)
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
Description: Python 3 print statements
 Fix up the print statements for Python 3.
Author: https://github.com/jkrueger1
Origin: https://github.com/nexusformat/python-nxs/pull/12
--- a/nxs/tree.py
+++ b/nxs/tree.py
@@ -236,12 +236,12 @@
 signal sample points, entry is file/path within the file to the data group and
 title is the title of the group or the parent NXentry, if available.
 """
-from __future__ import with_statement
+from __future__ import absolute_import, with_statement, print_function
 from copy import copy, deepcopy
 
 import numpy as np
-import napi
-from napi import NeXusError
+import nxs.napi as napi
+from nxs.napi import NeXusError
 
 #Memory in MB
 NX_MEMORY = 500
@@ -792,7 +792,7 @@
         displayed. If 'recursive' is True, the contents of child groups are
         also displayed.
         """
-        print self._str_tree(attrs=attrs,recursive=recursive)
+        print(self._str_tree(attrs=attrs,recursive=recursive))
 
     @property
     def tree(self):
@@ -1823,7 +1823,7 @@
                 for _dim in data.shape[2:]:
                     slab.append(0)
                 data = data[slab].view().reshape(data.shape[:2])
-                print "Warning: Only the top 2D slice of the data is plotted"
+                print("Warning: Only the top 2D slice of the data is plotted")
 
             x = axis_data[0]
             y = axis_data[1]
@@ -3240,7 +3240,7 @@
     ls *.nxs
     plot file.nxs entry.data
         """%(argv[0],)
-        print usage
+        print(usage)
 
 
 if __name__ == "__main__":