Skip to content

Commit d30c1bb

Browse files
e-kwsmstefanseefeld
authored andcommitted
refactor: switch to python 3
1 parent 3e7be69 commit d30c1bb

File tree

12 files changed

+31
-30
lines changed

12 files changed

+31
-30
lines changed

doc/numpy/conf.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
master_doc = 'index'
4141

4242
# General information about the project.
43-
project = u'Boost.Python NumPy extension'
44-
copyright = u'2011, Stefan Seefeld'
43+
project = 'Boost.Python NumPy extension'
44+
copyright = '2011, Stefan Seefeld'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
@@ -181,8 +181,8 @@
181181
# Grouping the document tree into LaTeX files. List of tuples
182182
# (source start file, target name, title, author, documentclass [howto/manual]).
183183
latex_documents = [
184-
('index', 'BoostPythonNumPy.tex', u'Boost.Python NumPy Documentation',
185-
u'Stefan Seefeld', 'manual'),
184+
('index', 'BoostPythonNumPy.tex', 'Boost.Python NumPy Documentation',
185+
'Stefan Seefeld', 'manual'),
186186
]
187187

188188
# The name of an image file (relative to this directory) to place at the top of
@@ -214,6 +214,6 @@
214214
# One entry per manual page. List of tuples
215215
# (source start file, name, description, authors, manual section).
216216
man_pages = [
217-
('index', 'boostnumpy', u'Boost.Python NumPy Documentation',
218-
[u'Stefan Seefeld'], 1)
217+
('index', 'boostnumpy', 'Boost.Python NumPy Documentation',
218+
['Stefan Seefeld'], 1)
219219
]

example/numpy/demo_gaussian.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6+
from __future__ import print_function
67
import numpy
78
import gaussian
89

@@ -19,19 +20,19 @@
1920
z = g(x, y)
2021

2122
s = z.sum() * (r[1] - r[0])**2
22-
print "sum (should be ~ 1):", s
23+
print("sum (should be ~ 1):", s)
2324

2425
xc = (z * x).sum() / z.sum()
25-
print "x centroid (should be ~ %f): %f" % (mu[0], xc)
26+
print("x centroid (should be ~ %f): %f" % (mu[0], xc))
2627

2728
yc = (z * y).sum() / z.sum()
28-
print "y centroid (should be ~ %f): %f" % (mu[1], yc)
29+
print("y centroid (should be ~ %f): %f" % (mu[1], yc))
2930

3031
xx = (z * (x - xc)**2).sum() / z.sum()
31-
print "xx moment (should be ~ %f): %f" % (sigma[0,0], xx)
32+
print("xx moment (should be ~ %f): %f" % (sigma[0,0], xx))
3233

3334
yy = (z * (y - yc)**2).sum() / z.sum()
34-
print "yy moment (should be ~ %f): %f" % (sigma[1,1], yy)
35+
print("yy moment (should be ~ %f): %f" % (sigma[1,1], yy))
3536

3637
xy = 0.5 * (z * (x - xc) * (y - yc)).sum() / z.sum()
37-
print "xy moment (should be ~ %f): %f" % (sigma[0,1], xy)
38+
print("xy moment (should be ~ %f): %f" % (sigma[0,1], xy))

example/quickstart/script.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python
1+
#!/usr/bin/env python3
22
# Copyright Stefan Seefeld 2006. Distributed under the Boost
33
# Software License, Version 1.0. (See accompanying
44
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

example/quickstart/test_extending.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python
1+
#!/usr/bin/env python3
22
# Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost
33
# Software License, Version 1.0. (See accompanying
44
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

example/tutorial/hello.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python
1+
#!/usr/bin/env python3
22
# Copyright Joel de Guzman 2002-2007. Distributed under the Boost
33
# Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
44
# or copy at http://www.boost.org/LICENSE_1_0.txt)

test/numpy/dtype.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
44
# Distributed under the Boost Software License, Version 1.0.
@@ -15,7 +15,7 @@
1515
class DtypeTestCase(unittest.TestCase):
1616

1717
def assertEquivalent(self, a, b):
18-
return self.assert_(dtype_ext.equivalent(a, b), "%r is not equivalent to %r")
18+
return self.assertTrue(dtype_ext.equivalent(a, b), "%r is not equivalent to %r")
1919

2020
def testIntegers(self):
2121
for bits in (8, 16, 32, 64):

test/numpy/indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
44
# Distributed under the Boost Software License, Version 1.0.

test/numpy/ndarray.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
44
# Distributed under the Boost Software License, Version 1.0.
@@ -19,7 +19,7 @@ def testNdzeros(self):
1919
a1 = ndarray_ext.zeros(shape,dt)
2020
a2 = v.reshape(a1.shape)
2121
self.assertEqual(shape,a1.shape)
22-
self.assert_((a1 == a2).all())
22+
self.assertTrue((a1 == a2).all())
2323

2424
def testNdzeros_matrix(self):
2525
for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128):
@@ -28,7 +28,7 @@ def testNdzeros_matrix(self):
2828
a1 = ndarray_ext.zeros_matrix(shape, dt)
2929
a2 = numpy.matrix(numpy.zeros(shape, dtype=dtp))
3030
self.assertEqual(shape,a1.shape)
31-
self.assert_((a1 == a2).all())
31+
self.assertTrue((a1 == a2).all())
3232
self.assertEqual(type(a1), type(a2))
3333

3434
def testNdarray(self):
@@ -38,8 +38,8 @@ def testNdarray(self):
3838
dt = numpy.dtype(dtp)
3939
a1 = ndarray_ext.array(a)
4040
a2 = ndarray_ext.array(a,dt)
41-
self.assert_((a1 == v).all())
42-
self.assert_((a2 == v).all())
41+
self.assertTrue((a1 == v).all())
42+
self.assertTrue((a2 == v).all())
4343
for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)):
4444
a1 = a1.reshape(shape)
4545
self.assertEqual(shape,a1.shape)

test/numpy/shapes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
44
# Distributed under the Boost Software License, Version 1.0.

test/numpy/templates.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
44
# Distributed under the Boost Software License, Version 1.0.
@@ -18,7 +18,7 @@ def testTemplates(self):
1818
a1 = numpy.zeros(shape, dtype=dtype)
1919
a2 = v.reshape(a1.shape)
2020
templates_ext.fill(a1)
21-
self.assert_((a1 == a2).all())
21+
self.assertTrue((a1 == a2).all())
2222
a1 = numpy.zeros((12,), dtype=numpy.float64)
2323
self.assertRaises(TypeError, templates_ext.fill, a1)
2424
a1 = numpy.zeros((12,2,3), dtype=numpy.float32)

test/numpy/ufunc.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright Jim Bosch & Ankit Daftery 2010-2012.
44
# Distributed under the Boost Software License, Version 1.0.
@@ -24,7 +24,7 @@ def testArray(self):
2424
assert_array_almost_equal(b, a*2.0)
2525
c = numpy.zeros(5, dtype=float)
2626
d = f(a,output=c)
27-
self.assert_(c is d)
27+
self.assertTrue(c is d)
2828
assert_array_almost_equal(d, a*2.0)
2929

3030
def testList(self):
@@ -47,7 +47,7 @@ def testArray(self):
4747
assert_array_almost_equal(f(a,b), (a*2+b*3))
4848
c = numpy.zeros(5, dtype=float)
4949
d = f(a,b,output=c)
50-
self.assert_(c is d)
50+
self.assertTrue(c is d)
5151
assert_array_almost_equal(d, a*2 + b*3)
5252
assert_array_almost_equal(f(a, 2.0), a*2 + 6.0)
5353
assert_array_almost_equal(f(1.0, b), 2.0 + b*3)

test/test_cltree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright David Abrahams 2004. Distributed under the Boost
22
# Software License, Version 1.0. (See accompanying
33
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4-
#!/usr/bin/env python
4+
#!/usr/bin/env python3
55

66
from cltree import basic,symbol,constant,variable
77

0 commit comments

Comments
 (0)