Package list python-pauvre / 8fb613d
Port remaining Python2 script Andreas Tille 2 years ago
2 changed file(s) with 93 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 Author: Andreas Tille <tille@debian.org>
1 Last-Update: Fri, 24 Apr 2020 12:49:17 +0200
2 Description: Test script somehow remained at Python2 -> fix this using 2to3
3
4 --- a/pauvre/lsi/test.py
5 +++ b/pauvre/lsi/test.py
6 @@ -3,10 +3,10 @@
7 # Email: splichte@princeton.edu
8 # Date: 09/02/2013
9
10 -from lsi import intersection
11 +from .lsi import intersection
12 import random
13 import time, sys
14 -from helper import *
15 +from .helper import *
16
17 ev = 0.00000001
18
19 @@ -42,20 +42,20 @@ es = False
20 now = time.time()
21 for seg1 in S:
22 if approx_equal(seg1[0][0], seg1[1][0], ev):
23 - print 'VERTICAL SEG'
24 - print ''
25 - print ''
26 + print('VERTICAL SEG')
27 + print('')
28 + print('')
29 vs = True
30 if approx_equal(seg1[0][1], seg1[1][1], ev):
31 - print 'HORIZONTAL SEG'
32 - print ''
33 - print ''
34 + print('HORIZONTAL SEG')
35 + print('')
36 + print('')
37 hs = True
38 for seg2 in S:
39 if seg1 is not seg2 and segs_equal(seg1, seg2):
40 - print 'EQUAL SEGS'
41 - print ''
42 - print ''
43 + print('EQUAL SEGS')
44 + print('')
45 + print('')
46 es = True
47 if seg1 is not seg2 and (seg2, seg1) not in seen:
48 i = intersect(seg1, seg2)
49 @@ -68,17 +68,17 @@ for seg1 in S:
50 seen.append((seg1, seg2))
51 later = time.time()
52 n2time = later-now
53 -print "Line sweep results:"
54 +print("Line sweep results:")
55 now = time.time()
56 lsinters = intersection(S)
57 inters = []
58 -for k, v in lsinters.iteritems():
59 +for k, v in lsinters.items():
60 #print '{0}: {1}'.format(k, v)
61 inters.append(k)
62 # inters.append(v)
63 later = time.time()
64 -print 'TIME ELAPSED: {0}'.format(later-now)
65 -print "N^2 comparison results:"
66 +print('TIME ELAPSED: {0}'.format(later-now))
67 +print("N^2 comparison results:")
68 pts_seen = []
69 highestseen = 0
70 for i in intersections:
71 @@ -97,14 +97,14 @@ for i in intersections:
72 if approx_equal(k[0], i[0][0], ev) and approx_equal(k[1], i[0][1], ev):
73 in_k = True
74 if in_k == False:
75 - print 'Not in K: {0}: {1}'.format(i[0], i[1])
76 + print('Not in K: {0}: {1}'.format(i[0], i[1]))
77 # print i
78 -print highestseen
79 -print 'TIME ELAPSED: {0}'.format(n2time)
80 +print(highestseen)
81 +print('TIME ELAPSED: {0}'.format(n2time))
82 #print 'Missing from line sweep but in N^2:'
83 #for i in seen:
84 # matched = False
85 -print len(lsinters)
86 -print len(pts_seen)
87 +print(len(lsinters))
88 +print(len(pts_seen))
89 if len(lsinters) != len(pts_seen):
90 - print 'uh oh!'
91 + print('uh oh!')