X Tutup
Skip to content

Commit 9e2efc7

Browse files
committed
always use tuples for string interpolations
1 parent b422374 commit 9e2efc7

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

bpython/_internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _help(obj):
5151
else:
5252
output = doc.document(obj)
5353
if not output:
54-
output = "No help found for %s" % obj
54+
output = "No help found for %s" % (obj, )
5555
return
5656

5757
if output is None:

bpython/cli.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def readlines(self, x):
140140
def DEBUG(s):
141141
"""This shouldn't ever be called in any release of bpython, so
142142
beat me up if you find anything calling it."""
143-
open('/home/bob/tmp/plonker', 'a').write("%s\n" % str(s))
143+
open('/home/bob/tmp/plonker', 'a').write("%s\n" % (str(s), ))
144144

145145

146146
def make_colours():
@@ -231,7 +231,7 @@ def showtraceback(self):
231231
def writetb(self, l):
232232
"""This outputs the traceback and should be overridden for anything
233233
fancy."""
234-
map(self.write, ["\x01y\x03%s" % i for i in l])
234+
map(self.write, ["\x01y\x03%s" % (i, ) for i in l])
235235

236236

237237
class Repl(object):
@@ -713,7 +713,7 @@ def mkargspec(self, topline, down):
713713
ln = len(str(i))
714714
kw = None
715715
if kwargs and k+1 > len(args) - len(kwargs):
716-
kw = '%s' % str(kwargs[k - (len(args) - len(kwargs))])
716+
kw = str(kwargs[k - (len(args) - len(kwargs))])
717717
ln += len(kw) + 1
718718

719719
if ln + x >= w:
@@ -746,12 +746,12 @@ def mkargspec(self, topline, down):
746746
if _args:
747747
self.list_win.addstr(', ',
748748
curses.color_pair(self._C["g"]+1))
749-
self.list_win.addstr('*%s' % _args,
749+
self.list_win.addstr('*%s' % (_args, ),
750750
curses.color_pair(self._C["m"]+1))
751751
if _kwargs:
752752
self.list_win.addstr(', ',
753753
curses.color_pair(self._C["g"]+1))
754-
self.list_win.addstr('**%s' % _kwargs,
754+
self.list_win.addstr('**%s' % (_kwargs, ),
755755
curses.color_pair(self._C["m"]+1))
756756
self.list_win.addstr(')', curses.color_pair(self._C["y"]+1))
757757

@@ -792,9 +792,9 @@ def write2file(self):
792792
f.write(s)
793793
f.close()
794794
except IOError:
795-
self.statusbar.message("Disk write error for file '%s'." % fn)
795+
self.statusbar.message("Disk write error for file '%s'." % (fn, ))
796796
else:
797-
self.statusbar.message('Saved to %s' % fn)
797+
self.statusbar.message('Saved to %s' % (fn, ))
798798

799799
def pastebin(self):
800800
"""Upload to a pastebin and display the URL in the status bar."""
@@ -808,11 +808,11 @@ def pastebin(self):
808808
try:
809809
paste_id = pasteservice.pastes.newPaste('pycon', s)
810810
except XMLRPCError, e:
811-
self.statusbar.message( 'Upload failed: %s' % str(e) )
811+
self.statusbar.message( 'Upload failed: %s' % (str(e), ) )
812812
return
813813

814-
paste_url = urljoin(pasteservice_url, '/show/%s/' % paste_id)
815-
self.statusbar.message('Pastebin URL: %s' % paste_url, 10)
814+
paste_url = urljoin(pasteservice_url, '/show/%s/' % (paste_id, ))
815+
self.statusbar.message('Pastebin URL: %s' % (paste_url, ), 10)
816816

817817
def make_list(self, items):
818818
"""Compile a list of items. At the moment this simply returns

bpython/formatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def format(self, tokensource, outfile):
9393
continue
9494

9595
if token in f_strings:
96-
o += f_strings[token] % text
96+
o += f_strings[token] % (text, )
9797
else:
98-
o += f_strings[Token] % text
98+
o += f_strings[Token] % (text, )
9999
outfile.write(o.rstrip())
100100

101101
# vim: sw=4 ts=4 sts=4 ai et

0 commit comments

Comments
 (0)
X Tutup