Skip to content

Commit e07c149

Browse files
authored
Merge pull request #285 from Javran/py3-migration
Migrating scripts to Python 3.
2 parents 536fa1c + dc43032 commit e07c149

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
/GNUmakefile
99
/.ghc.environment.*
1010
/cabal.project.local
11+
12+
# Test data repo ignored. Please see instruction in tests-and-benchmarks.markdown
13+
/tests/text-test-data/

benchmarks/python/cut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import utils, sys, codecs
44

benchmarks/python/multilang.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import math
44
import sys
@@ -12,23 +12,22 @@ def timer(f, count=100):
1212
a = 1e300
1313
def g():
1414
return
15-
for i in xrange(3):
15+
for i in range(3):
1616
start = time.time()
17-
for j in xrange(count):
17+
for j in range(count):
1818
g()
1919
a = min(a, (time.time() - start) / count)
2020

2121
b = 1e300
22-
for i in xrange(3):
22+
for i in range(3):
2323
start = time.time()
24-
for j in xrange(count):
24+
for j in range(count):
2525
f()
2626
b = min(b, (time.time() - start) / count)
2727

2828
return round(b - a, int(round(math.log(count, 10) - math.log(b - a, 10))))
2929

3030
contents = open('../../tests/text-test-data/yiwiki.xml', 'r').read()
31-
contents = contents.decode('utf-8')
3231

3332
benchmarks = (
3433
find_first,
@@ -47,4 +46,4 @@ def g():
4746
for b in bms:
4847
sys.stdout.write(b.__name__ + ' ')
4948
sys.stdout.flush()
50-
print b()
49+
print(b())

benchmarks/python/sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import utils, sys, codecs
44

benchmarks/python/strip_tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import utils, sys
44

benchmarks/python/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import sys, time
44

0 commit comments

Comments
 (0)