Skip to content

Commit 301a354

Browse files
committed
Use print function
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent d9a4f3e commit 301a354

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

bpdb/__init__.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
# THE SOFTWARE.
2323

24+
from __future__ import print_function
25+
2426
import os
2527
import sys
2628
import traceback
@@ -65,16 +67,16 @@ def main():
6567
help='Print version and exit.')
6668
options, args = parser.parse_args(sys.argv)
6769
if options.version:
68-
print 'bpdb on top of bpython version', __version__,
69-
print 'on top of Python', sys.version.split()[0]
70-
print ('(C) 2008-2013 Bob Farrell, Andreas Stuehrk et al. '
71-
'See AUTHORS for detail.')
70+
print('bpdb on top of bpython version', __version__, end="")
71+
print('on top of Python', sys.version.split()[0])
72+
print('(C) 2008-2013 Bob Farrell, Andreas Stuehrk et al. '
73+
'See AUTHORS for detail.')
7274
return 0
7375

7476
# The following code is baed on Python's pdb.py.
7577
mainpyfile = args[1]
7678
if not os.path.exists(mainpyfile):
77-
print 'Error:', mainpyfile, 'does not exist'
79+
print('Error:', mainpyfile, 'does not exist')
7880
return 1
7981

8082
# Hide bpdb from argument list.
@@ -89,20 +91,20 @@ def main():
8991
pdb._runscript(mainpyfile)
9092
if pdb._user_requested_quit:
9193
break
92-
print "The program finished and will be restarted"
94+
print("The program finished and will be restarted")
9395
except Restart:
94-
print "Restarting", mainpyfile, "with arguments:"
95-
print "\t" + " ".join(sys.argv[1:])
96+
print("Restarting", mainpyfile, "with arguments:")
97+
print("\t" + " ".join(sys.argv[1:]))
9698
except SystemExit:
9799
# In most cases SystemExit does not warrant a post-mortem session.
98-
print "The program exited via sys.exit(). Exit status: ",
99-
print sys.exc_info()[1]
100+
print("The program exited via sys.exit(). Exit status: ",)
101+
print(sys.exc_info()[1])
100102
except:
101103
traceback.print_exc()
102-
print "Uncaught exception. Entering post mortem debugging"
103-
print "Running 'cont' or 'step' will restart the program"
104+
print("Uncaught exception. Entering post mortem debugging")
105+
print("Running 'cont' or 'step' will restart the program")
104106
t = sys.exc_info()[2]
105107
pdb.interaction(None, t)
106-
print "Post mortem debugger finished. The " + mainpyfile + \
107-
" will be restarted"
108+
print("Post mortem debugger finished. The " + mainpyfile + \
109+
" will be restarted")
108110

bpdb/debugger.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222

23+
from __future__ import print_function
2324

2425
import pdb
2526
import bpython
@@ -46,10 +47,10 @@ def do_Bpython(self, arg):
4647

4748

4849
def help_Bpython(self):
49-
print "B(python)"
50-
print
51-
print ("Invoke the bpython interpreter for this stack frame. To exit "
52-
"bpython and return to a standard pdb press Ctrl-d")
50+
print("B(python)")
51+
print("")
52+
print("Invoke the bpython interpreter for this stack frame. To exit "
53+
"bpython and return to a standard pdb press Ctrl-d")
5354

5455

5556
### shortcuts

bpython/args.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Module to handle command line argument parsing, for all front-ends.
33
"""
44

5-
from __future__ import with_statement
5+
from __future__ import with_statement, print_function
66
import os
77
import sys
88
import code
@@ -86,10 +86,10 @@ def parse(args, extras=None, ignore_stdin=False):
8686
os.execv(sys.executable, [sys.executable] + args)
8787

8888
if options.version:
89-
print 'bpython version', __version__,
90-
print 'on top of Python', sys.version.split()[0]
91-
print ('(C) 2008-2014 Bob Farrell, Andreas Stuehrk et al. '
92-
'See AUTHORS for detail.')
89+
print('bpython version', __version__, eof="")
90+
print('on top of Python', sys.version.split()[0])
91+
print('(C) 2008-2015 Bob Farrell, Andreas Stuehrk et al. '
92+
'See AUTHORS for detail.')
9393
raise SystemExit
9494

9595
if not ignore_stdin and not (sys.stdin.isatty() and sys.stdout.isatty()):

bpython/urwid.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"""
3434

3535

36-
from __future__ import absolute_import, with_statement, division
36+
from __future__ import absolute_import, with_statement, division, print_function
3737

3838
import sys
3939
import os
@@ -144,7 +144,7 @@ def wrapper(*args, **kwargs):
144144
# This is the same as in urwid.
145145
# We are obviously not supposed to ever hit this.
146146
import sys
147-
print sys.exc_info()
147+
print(sys.exc_info())
148148
self._exc_info = sys.exc_info()
149149
self.reactor.crash()
150150
return wrapper
@@ -1141,7 +1141,7 @@ def main(args=None, locals_=None, banner=None):
11411141
from twisted.application import reactors
11421142
# Stolen from twisted.application.app (twistd).
11431143
for r in reactors.getReactorTypes():
1144-
print ' %-4s\t%s' % (r.shortName, r.description)
1144+
print(' %-4s\t%s' % (r.shortName, r.description))
11451145
except ImportError:
11461146
sys.stderr.write('No reactors are available. Please install '
11471147
'twisted for reactor support.\n')

0 commit comments

Comments
 (0)