Package list
f65d08dd-33f7-4441-80b9-2a33edc8df47/main

 ``` 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92``` ```Author: Andreas Tille Last-Update: Fri, 24 Apr 2020 12:49:17 +0200 Description: Test script somehow remained at Python2 -> fix this using 2to3 --- a/pauvre/lsi/test.py +++ b/pauvre/lsi/test.py @@ -3,10 +3,10 @@ # Email: splichte@princeton.edu # Date: 09/02/2013 -from lsi import intersection +from .lsi import intersection import random import time, sys -from helper import * +from .helper import * ev = 0.00000001 @@ -42,20 +42,20 @@ es = False now = time.time() for seg1 in S: if approx_equal(seg1[0][0], seg1[1][0], ev): - print 'VERTICAL SEG' - print '' - print '' + print('VERTICAL SEG') + print('') + print('') vs = True if approx_equal(seg1[0][1], seg1[1][1], ev): - print 'HORIZONTAL SEG' - print '' - print '' + print('HORIZONTAL SEG') + print('') + print('') hs = True for seg2 in S: if seg1 is not seg2 and segs_equal(seg1, seg2): - print 'EQUAL SEGS' - print '' - print '' + print('EQUAL SEGS') + print('') + print('') es = True if seg1 is not seg2 and (seg2, seg1) not in seen: i = intersect(seg1, seg2) @@ -68,17 +68,17 @@ for seg1 in S: seen.append((seg1, seg2)) later = time.time() n2time = later-now -print "Line sweep results:" +print("Line sweep results:") now = time.time() lsinters = intersection(S) inters = [] -for k, v in lsinters.iteritems(): +for k, v in lsinters.items(): #print '{0}: {1}'.format(k, v) inters.append(k) # inters.append(v) later = time.time() -print 'TIME ELAPSED: {0}'.format(later-now) -print "N^2 comparison results:" +print('TIME ELAPSED: {0}'.format(later-now)) +print("N^2 comparison results:") pts_seen = [] highestseen = 0 for i in intersections: @@ -97,14 +97,14 @@ for i in intersections: if approx_equal(k[0], i[0][0], ev) and approx_equal(k[1], i[0][1], ev): in_k = True if in_k == False: - print 'Not in K: {0}: {1}'.format(i[0], i[1]) + print('Not in K: {0}: {1}'.format(i[0], i[1])) # print i -print highestseen -print 'TIME ELAPSED: {0}'.format(n2time) +print(highestseen) +print('TIME ELAPSED: {0}'.format(n2time)) #print 'Missing from line sweep but in N^2:' #for i in seen: # matched = False -print len(lsinters) -print len(pts_seen) +print(len(lsinters)) +print(len(pts_seen)) if len(lsinters) != len(pts_seen): - print 'uh oh!' + print('uh oh!') ```