Merge lp:~brian.curtin/ubuntuone-dev-tools/py3-print-function into lp:ubuntuone-dev-tools

Proposed by Brian Curtin on 2012-08-20
Status: Merged
Approved by: Roberto Alsina on 2012-08-21
Approved revision: 82
Merged at revision: 84
Proposed branch: lp:~brian.curtin/ubuntuone-dev-tools/py3-print-function
Merge into: lp:ubuntuone-dev-tools
Diff against target: 65 lines (+13/-9)
2 files modified
ubuntuone/devtools/handlers.py (+9/-7)
ubuntuone/devtools/services/squid.py (+4/-2)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-dev-tools/py3-print-function
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve on 2012-08-21
Alejandro J. Cura (community) 2012-08-20 Approve on 2012-08-20
Review via email: mp+120472@code.launchpad.net

Commit Message

- Change to Python 3's print function usage via "from __future__ import print_function"

Description of the Change

Change usage of the print statement to Python 3's print function via "from __future__ import print_function"

To post a comment you must log in.
Alejandro J. Cura (alecu) wrote :

ubuntuone/devtools/handlers.py:
    59: [E0001] invalid syntax

review: Needs Fixing
82. By Brian Curtin on 2012-08-20

Left out one of the print function changes

Alejandro J. Cura (alecu) wrote :

+1

review: Approve
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/devtools/handlers.py'
2--- ubuntuone/devtools/handlers.py 2012-04-04 19:13:46 +0000
3+++ ubuntuone/devtools/handlers.py 2012-08-20 22:17:30 +0000
4@@ -31,6 +31,8 @@
5 # files in the program, then also delete it here.
6 """Set of helpers handlers."""
7
8+from __future__ import print_function
9+
10 import logging
11
12
13@@ -51,15 +53,15 @@
14 def dump_contents(self, msgs):
15 """Dumps the contents of the MementoHandler."""
16 if self.debug:
17- print "Expecting:"
18+ print("Expecting:")
19 for msg in msgs:
20- print "\t", msg
21- print "MementoHandler contents:"
22+ print("\t", msg)
23+ print("MementoHandler contents:")
24 for rec in self.records:
25- print "\t", rec.exc_info
26- print "\t", logging.getLevelName(rec.levelno)
27- print "\t\t", rec.message
28- print "\t\t", rec.exc_text
29+ print("\t", rec.exc_info)
30+ print("\t", logging.getLevelName(rec.levelno))
31+ print("\t\t", rec.message)
32+ print("\t\t", rec.exc_text)
33
34 def check(self, level, *msgs):
35 """Verifies that the msgs are logged in the specified level"""
36
37=== modified file 'ubuntuone/devtools/services/squid.py'
38--- ubuntuone/devtools/services/squid.py 2012-06-05 20:52:54 +0000
39+++ ubuntuone/devtools/services/squid.py 2012-08-20 22:17:30 +0000
40@@ -27,6 +27,8 @@
41 # files in the program, then also delete it here.
42 """Utilities for finding and running a squid proxy for testing."""
43
44+from __future__ import print_function
45+
46 import random
47 import signal
48 # pylint:disable=W0402
49@@ -263,7 +265,7 @@
50 def _is_squid_running(self):
51 """Return if squid is running."""
52 squid_args = ['-k', 'check', '-f', self.config_file]
53- print 'Starting squid version...'
54+ print('Starting squid version...')
55 message = 'Waiting for squid to start...'
56 for timeout in (0.4, 0.1, 0.1, 0.2, 0.5, 1, 3, 5):
57 try:
58@@ -274,7 +276,7 @@
59 return True
60 except subprocess.CalledProcessError:
61 message += '.'
62- print message
63+ print(message)
64 time.sleep(timeout)
65 return False
66

Subscribers

People subscribed via source and target branches

to all changes: