Skip to content

Commit 7eaef53

Browse files
committed
Remove more calls to str
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 834ffa0 commit 7eaef53

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

bpython/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def fill_config_with_default_values(config, default_values):
5555

5656
for (opt, val) in iteritems(default_values[section]):
5757
if not config.has_option(section, opt):
58-
config.set(section, opt, str(val))
58+
config.set(section, opt, '%s' % (val, ))
5959

6060

6161
def loadini(struct, configfile):

bpython/repl.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,7 @@ def write2file(self):
717717
with open(fn, mode) as f:
718718
f.write(s)
719719
except IOError as e:
720-
self.interact.notify(_("Error writing file '%s': %s") % (fn,
721-
str(e)))
720+
self.interact.notify(_("Error writing file '%s': %s") % (fn, e))
722721
else:
723722
self.interact.notify(_('Saved to %s.') % (fn, ))
724723

@@ -778,7 +777,7 @@ def do_pastebin_json(self, s):
778777
response = requests.post(url, data=payload, verify=True)
779778
response.raise_for_status()
780779
except requests.exceptions.RequestException as exc:
781-
self.interact.notify(_('Upload failed: %s') % (str(exc), ))
780+
self.interact.notify(_('Upload failed: %s') % (exc, ))
782781
return
783782

784783
self.prev_pastebin_content = s
@@ -866,7 +865,7 @@ def insert_into_history(self, s):
866865
self.rl_history.append_reload_and_write(s, self.config.hist_file,
867866
getpreferredencoding())
868867
except RuntimeError as e:
869-
self.interact.notify(str(e))
868+
self.interact.notify(u"%s" % (e, ))
870869

871870
def prompt_undo(self):
872871
"""Returns how many lines to undo, 0 means don't undo"""
@@ -1081,7 +1080,7 @@ def edit_config(self):
10811080
f.write(default_config)
10821081
except (IOError, OSError) as e:
10831082
self.interact.notify(_("Error writing file '%s': %s") %
1084-
(self.config.config.path, str(e)))
1083+
(self.config.config.path, e))
10851084
return False
10861085
else:
10871086
return False

0 commit comments

Comments
 (0)