GeezerVison is showing github.com — refactor: switch to python 3 · pilleye/boost-python@d30c1bb
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/numpy/conf.py +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 40 | 40 | master_doc = 'index' | 41 | 41 |
| 42 | 42 | # 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' | 45 | 45 |
| 46 | 46 | # The version info for the project you're documenting, acts as replacement for | 47 | 47 | # |version| and |release|, also used in various other places throughout the | | 181 | 181 | # Grouping the document tree into LaTeX files. List of tuples | 182 | 182 | # (source start file, target name, title, author, documentclass [howto/manual]). | 183 | 183 | 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'), | 186 | 186 | ] | 187 | 187 |
| 188 | 188 | # The name of an image file (relative to this directory) to place at the top of | | 214 | 214 | # One entry per manual page. List of tuples | 215 | 215 | # (source start file, name, description, authors, manual section). | 216 | 216 | 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) | 219 | 219 | ] |
Collapse file Copy file name to clipboardExpand all lines: example/numpy/demo_gaussian.py +7-6Lines changed: 7 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | # (See accompanying file LICENSE_1_0.txt or copy at | 4 | 4 | # http://www.boost.org/LICENSE_1_0.txt) | 5 | 5 |
| | 6 | +from __future__ import print_function | 6 | 7 | import numpy | 7 | 8 | import gaussian | 8 | 9 |
| | 19 | 20 | z = g(x, y) | 20 | 21 |
| 21 | 22 | s = z.sum() * (r[1] - r[0])**2 | 22 | | -print "sum (should be ~ 1):", s | | 23 | +print("sum (should be ~ 1):", s) | 23 | 24 |
| 24 | 25 | 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)) | 26 | 27 |
| 27 | 28 | 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)) | 29 | 30 |
| 30 | 31 | 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)) | 32 | 33 |
| 33 | 34 | 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)) | 35 | 36 |
| 36 | 37 | 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)) |
Collapse file Copy file name to clipboardExpand all lines: example/quickstart/script.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#! /usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 | # Copyright Stefan Seefeld 2006. Distributed under the Boost | 3 | 3 | # Software License, Version 1.0. (See accompanying | 4 | 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
Collapse file Copy file name to clipboardExpand all lines: example/quickstart/test_extending.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#! /usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 | # Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost | 3 | 3 | # Software License, Version 1.0. (See accompanying | 4 | 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
Collapse file Copy file name to clipboardExpand all lines: example/tutorial/hello.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#! /usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 | # Copyright Joel de Guzman 2002-2007. Distributed under the Boost | 3 | 3 | # Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt | 4 | 4 | # or copy at http://www.boost.org/LICENSE_1_0.txt) | |
Collapse file Copy file name to clipboardExpand all lines: test/numpy/dtype.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#!/usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 |
| 3 | 3 | # Copyright Jim Bosch & Ankit Daftery 2010-2012. | 4 | 4 | # Distributed under the Boost Software License, Version 1.0. | | 15 | 15 | class DtypeTestCase(unittest.TestCase): | 16 | 16 |
| 17 | 17 | 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") | 19 | 19 |
| 20 | 20 | def testIntegers(self): | 21 | 21 | for bits in (8, 16, 32, 64): | |
Collapse file Copy file name to clipboardExpand all lines: test/numpy/indexing.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#!/usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 |
| 3 | 3 | # Copyright Jim Bosch & Ankit Daftery 2010-2012. | 4 | 4 | # Distributed under the Boost Software License, Version 1.0. | |
Collapse file Copy file name to clipboardExpand all lines: test/numpy/ndarray.py +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#!/usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 |
| 3 | 3 | # Copyright Jim Bosch & Ankit Daftery 2010-2012. | 4 | 4 | # Distributed under the Boost Software License, Version 1.0. | @@ -19,7 +19,7 @@ def testNdzeros(self): | 19 | 19 | a1 = ndarray_ext.zeros(shape,dt) | 20 | 20 | a2 = v.reshape(a1.shape) | 21 | 21 | self.assertEqual(shape,a1.shape) | 22 | | - self.assert_((a1 == a2).all()) | | 22 | + self.assertTrue((a1 == a2).all()) | 23 | 23 |
| 24 | 24 | def testNdzeros_matrix(self): | 25 | 25 | for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): | @@ -28,7 +28,7 @@ def testNdzeros_matrix(self): | 28 | 28 | a1 = ndarray_ext.zeros_matrix(shape, dt) | 29 | 29 | a2 = numpy.matrix(numpy.zeros(shape, dtype=dtp)) | 30 | 30 | self.assertEqual(shape,a1.shape) | 31 | | - self.assert_((a1 == a2).all()) | | 31 | + self.assertTrue((a1 == a2).all()) | 32 | 32 | self.assertEqual(type(a1), type(a2)) | 33 | 33 |
| 34 | 34 | def testNdarray(self): | @@ -38,8 +38,8 @@ def testNdarray(self): | 38 | 38 | dt = numpy.dtype(dtp) | 39 | 39 | a1 = ndarray_ext.array(a) | 40 | 40 | 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()) | 43 | 43 | for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): | 44 | 44 | a1 = a1.reshape(shape) | 45 | 45 | self.assertEqual(shape,a1.shape) | |
Collapse file Copy file name to clipboardExpand all lines: test/numpy/shapes.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#!/usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 |
| 3 | 3 | # Copyright Jim Bosch & Ankit Daftery 2010-2012. | 4 | 4 | # Distributed under the Boost Software License, Version 1.0. | |
Collapse file Copy file name to clipboardExpand all lines: test/numpy/templates.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#!/usr/bin/env python | | 1 | +#!/usr/bin/env python3 | 2 | 2 |
| 3 | 3 | # Copyright Jim Bosch & Ankit Daftery 2010-2012. | 4 | 4 | # Distributed under the Boost Software License, Version 1.0. | @@ -18,7 +18,7 @@ def testTemplates(self): | 18 | 18 | a1 = numpy.zeros(shape, dtype=dtype) | 19 | 19 | a2 = v.reshape(a1.shape) | 20 | 20 | templates_ext.fill(a1) | 21 | | - self.assert_((a1 == a2).all()) | | 21 | + self.assertTrue((a1 == a2).all()) | 22 | 22 | a1 = numpy.zeros((12,), dtype=numpy.float64) | 23 | 23 | self.assertRaises(TypeError, templates_ext.fill, a1) | 24 | 24 | a1 = numpy.zeros((12,2,3), dtype=numpy.float32) | |
|