Skip to content

Commit ea9ac33

Browse files
committed
Replace unicode literals
1 parent ebbef7b commit ea9ac33

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

bpython/inspection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ def parsekeywordpairs(signature):
121121
parendepth = 0
122122
for token, value in tokens:
123123
if preamble:
124-
if token is Token.Punctuation and value == u"(":
124+
if token is Token.Punctuation and value == "(":
125125
preamble = False
126126
continue
127127

128128
if token is Token.Punctuation:
129-
if value in [u"(", u"{", u"["]:
129+
if value in ["(", "{", "["]:
130130
parendepth += 1
131-
elif value in [u")", u"}", u"]"]:
131+
elif value in [")", "}", "]"]:
132132
parendepth -= 1
133133
elif value == ":" and parendepth == -1:
134134
# End of signature reached

bpython/repl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def ps2(self):
470470
try:
471471
return sys.ps2
472472
except AttributeError:
473-
return u"... "
473+
return "... "
474474

475475
def startup(self):
476476
"""
@@ -659,11 +659,11 @@ def get_source_of_current_name(self):
659659
obj = self.get_object(line)
660660
return inspection.get_source_unicode(obj)
661661
except (AttributeError, NameError) as e:
662-
msg = _(u"Cannot get source: %s") % (e,)
662+
msg = _("Cannot get source: %s") % (e,)
663663
except IOError as e:
664-
msg = u"%s" % (e,)
664+
msg = f"{e}"
665665
except TypeError as e:
666-
if "built-in" in u"%s" % (e,):
666+
if "built-in" in f"{e}":
667667
msg = _("Cannot access source of %r") % (obj,)
668668
else:
669669
msg = _("No source code found for %s") % (self.current_line,)
@@ -946,7 +946,7 @@ def insert_into_history(self, s):
946946
s, pythonhist, getpreferredencoding()
947947
)
948948
except RuntimeError as e:
949-
self.interact.notify(u"%s" % (e,))
949+
self.interact.notify(f"{e}")
950950

951951
def prompt_undo(self):
952952
"""Returns how many lines to undo, 0 means don't undo"""

bpython/test/test_curtsies_coderunner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def ctrlc():
4646

4747
class TestFakeOutput(unittest.TestCase):
4848
def assert_unicode(self, s):
49-
self.assertIsInstance(s, type(u""))
49+
self.assertIsInstance(s, type(""))
5050

5151
def test_bytes(self):
5252
out = FakeOutput(mock.Mock(), self.assert_unicode, None)

bpython/test/test_inspection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
from bpython.test.fodder import encoding_utf8
88

99

10-
foo_ascii_only = u'''def foo():
10+
foo_ascii_only = '''def foo():
1111
"""Test"""
1212
pass
1313
'''
1414

15-
foo_non_ascii = u'''def foo():
15+
foo_non_ascii = '''def foo():
1616
"""Test äöü"""
1717
pass
1818
'''

0 commit comments

Comments
 (0)