Convert from "print ..." to "print(...)"
[hooke.git] / hooke / playlist.py
index 52d8df1352e6077ae77651512a8eab1305ba3718..a25e9d61b9846d7addb3a1fec1e958464aee173a 100644 (file)
@@ -1,20 +1,19 @@
-# Copyright (C) 2010-2011 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
 #
 # This file is part of Hooke.
 #
-# Hooke is free software: you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
 #
-# Hooke is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
-# Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
 #
-# You should have received a copy of the GNU Lesser General Public
-# License along with Hooke.  If not, see
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
 
 """The `playlist` module provides a :class:`Playlist` and its subclass
 :class:`FilePlaylist` for manipulating lists of
@@ -74,7 +73,7 @@ class NoteIndexList (list):
         try:
             self.__dict__.update(state)
         except TypeError, e:
-            print state, type(state), e
+            print(' '.join(str(x) for x in [state, type(state), e]))
         if self.info in [None, {}]:
             self.info = {}
 
@@ -220,11 +219,11 @@ def playlist_path(path, expand=False):
 
     Examples
     --------
-    >>> print playlist_path('playlist')
+    >>> print(playlist_path('playlist'))
     playlist.hkp
-    >>> print playlist_path('playlist.hkp')
+    >>> print(playlist_path('playlist.hkp'))
     playlist.hkp
-    >>> print playlist_path(None)
+    >>> print(playlist_path(None))
     None
     """
     if path == None:
@@ -253,10 +252,10 @@ class FilePlaylist (Playlist):
     >>> s = pickle.dumps(p)
     >>> z = pickle.loads(s)
     >>> for curve in z:
-    ...     print curve
+    ...     print(curve)
     <Curve A>
     <Curve B>
-    >>> print z.drivers
+    >>> print(z.drivers)
     ['Driver A', 'Driver B']
 
     The data-type is also YAMLable (see :mod:`hooke.util.yaml`).
@@ -264,10 +263,10 @@ class FilePlaylist (Playlist):
     >>> s = yaml.dump(p)
     >>> z = yaml.load(s)
     >>> for curve in z:
-    ...     print curve
+    ...     print(curve)
     <Curve A>
     <Curve B>
-    >>> print z.drivers
+    >>> print(z.drivers)
     ['Driver A', 'Driver B']
     """
     version = '0.2'
@@ -396,7 +395,7 @@ class FilePlaylist (Playlist):
         ...         CommandMessage('command B', {'arg 0':1, 'curve':c}),
         ...         ])
         >>> p.append_curve(c)
-        >>> print p.flatten()  # doctest: +REPORT_UDIFF
+        >>> print(p.flatten())  # doctest: +REPORT_UDIFF
         # Hooke playlist version 0.2
         !!python/object/new:hooke.playlist.FilePlaylist
         listitems:
@@ -430,7 +429,7 @@ class FilePlaylist (Playlist):
           version: '0.2'
         <BLANKLINE>
         >>> p.relative_curve_paths = False
-        >>> print p.flatten()  # doctest: +REPORT_UDIFF
+        >>> print(p.flatten())  # doctest: +REPORT_UDIFF
         # Hooke playlist version 0.2
         !!python/object/new:hooke.playlist.FilePlaylist
         listitems:
@@ -509,7 +508,7 @@ def from_string(string):
     >>> p = from_string(string)
     >>> p.set_path('/path/to/playlist')
     >>> for curve in p:
-    ...     print curve.name, curve.path
+    ...     print('{} {}'.format(curve.name, curve.path))
     one /path/to/curve/one
     two /path/to/curve/two
 
@@ -553,7 +552,7 @@ def from_string(string):
     >>> p.info
     {'note': 'An example playlist'}
     >>> for curve in p:
-    ...     print curve.name, curve.path
+    ...     print('{} {}'.format(curve.name, curve.path))
     one /path/to/curve/one
     two /path/to/curve/two
     >>> p[-1].info['attr with spaces']