diff --git a/wafo/dctpack.py b/wafo/dctpack.py index aa38bcc..4640fbd 100644 --- a/wafo/dctpack.py +++ b/wafo/dctpack.py @@ -334,19 +334,19 @@ def shiftdim(x, n=None): def test_shiftdim(): a = np.arange(6).reshape((1, 1, 3, 1, 2)) - print a.shape - print a.ndim + print(a.shape) + print(a.ndim) - print range(a.ndim) + print(range(a.ndim)) # move items 2 places to the left so that x0 <- x2, x1 <- x3, etc - print np.roll(range(a.ndim), -2) - print a.transpose(np.roll(range(a.ndim), -2)) # transposition of the axes + print(np.roll(range(a.ndim), -2)) + print(a.transpose(np.roll(range(a.ndim), -2))) # transposition of the axes # with a matrix 2x2, A.transpose((1,0)) would be the transpose of A b = shiftdim(a) - print b.shape + print(b.shape) c = shiftdim(b, -2) - print c.shape + print(c.shape) print(c == a) diff --git a/wafo/f2py_tools.py b/wafo/f2py_tools.py index ab591d8..74b0e97 100644 --- a/wafo/f2py_tools.py +++ b/wafo/f2py_tools.py @@ -58,7 +58,7 @@ def f2py_call_str(): break try: - print 'found f2py in:', f2py_path + print('found f2py in:', f2py_path) return f2py_call except NameError: raise UserWarning('Couldn\'t locate f2py. ' diff --git a/wafo/graphutil.py b/wafo/graphutil.py index 977d1f0..9a7eba5 100644 --- a/wafo/graphutil.py +++ b/wafo/graphutil.py @@ -39,7 +39,10 @@ def delete_text_object(gidtxt, figure=None, axis=None, verbose=False): figure = plotbackend.gcf() if axis is None: axis = figure.gca() - lmatchfun = lambda x: _matchfun(x, gidtxt) + + def lmatchfun(x): + return _matchfun(x, gidtxt) + objs = axis.findobj(lmatchfun) for obj in objs: try: diff --git a/wafo/integrate.py b/wafo/integrate.py index d1cb26d..08aeae2 100644 --- a/wafo/integrate.py +++ b/wafo/integrate.py @@ -1415,7 +1415,7 @@ def main(): x = np.linspace(0, np.pi / 2) _q0 = np.trapz(humps(x), x) [q, err] = romberg(humps, 0, np.pi / 2, 1e-4) - print q, err + print(q, err) def test_docstrings(): diff --git a/wafo/kdetools.py b/wafo/kdetools.py index ef4ae86..0d9cc06 100644 --- a/wafo/kdetools.py +++ b/wafo/kdetools.py @@ -26,7 +26,7 @@ from wafo.plotbackend import plotbackend as plt try: from wafo import fig except ImportError: - print 'fig import only supported on Windows' + warnings.warn('fig import only supported on Windows') def _invnorm(q): diff --git a/wafo/misc.py b/wafo/misc.py index c088aaa..3c18c4d 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -597,7 +597,7 @@ def parse_kwargs(options, **kwargs): Example >>> opt = dict(arg1=2, arg2=3) >>> opt = parse_kwargs(opt,arg2=100) - >>> print opt + >>> print(opt) {'arg1': 2, 'arg2': 100} >>> opt2 = dict(arg2=101) >>> opt = parse_kwargs(opt,**opt2) diff --git a/wafo/namedtuple.py b/wafo/namedtuple.py index ad070cd..857bd30 100644 --- a/wafo/namedtuple.py +++ b/wafo/namedtuple.py @@ -126,7 +126,7 @@ if __name__ == '__main__': self.hypot) for p in Point(3, 4), Point(14, 5), Point(9. / 7, 6): - print p + print(p) class Point(namedtuple('Point', 'x y')): '''Point class with optimized _make() and _replace() @@ -137,8 +137,8 @@ if __name__ == '__main__': def _replace(self, _map=map, **kwds): return self._make(_map(kwds.get, ('x', 'y'), self)) - print Point(11, 22)._replace(x=100) + print(Point(11, 22)._replace(x=100)) import doctest TestResults = namedtuple('TestResults', 'failed attempted') - print TestResults(*doctest.testmod()) + print(TestResults(*doctest.testmod())) diff --git a/wafo/wafodata.py b/wafo/wafodata.py index 5faea07..defde98 100644 --- a/wafo/wafodata.py +++ b/wafo/wafodata.py @@ -491,7 +491,7 @@ def plot2d(axis, wdata, plotflag, *args, **kwds): 'Only the first 12 levels will be listed in table.') clvals = PL[:ncl] if isPL else clvec[:ncl] - # print contour level text + # print(contour level text) unused_axcl = cltext(clvals, percent=isPL) elif any(plotflag == [7, 9]): axis.clabel(h) diff --git a/wafo/win32_utils.py b/wafo/win32_utils.py index 3e53b1c..44cf945 100644 --- a/wafo/win32_utils.py +++ b/wafo/win32_utils.py @@ -251,7 +251,7 @@ if __name__ == '__main__': wb = Waitbar('Waitbar example') # wb2 = Waitbar2('Waitbar example') for i in xrange(20): - print wb.update(i * 5) + print(wb.update(i * 5)) # wb2.update(i) sleep(0.1) wb.close()