Skip to content

Commit 8558479

Browse files
committed
Fix DeprecationWarnings for "invalid escape sequence"
1 parent 73bf331 commit 8558479

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

pyrepl/completing_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def get_completions(self, stem):
275275
reader.ps1 = "c**> "
276276
reader.ps2 = "c/*> "
277277
reader.ps3 = "c|*> "
278-
reader.ps4 = "c\*> "
278+
reader.ps4 = r"c\*> "
279279
while reader.readline():
280280
pass
281281

pyrepl/historical_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test():
304304
reader.ps1 = "h**> "
305305
reader.ps2 = "h/*> "
306306
reader.ps3 = "h|*> "
307-
reader.ps4 = "h\*> "
307+
reader.ps4 = r"h\*> "
308308
while reader.readline():
309309
pass
310310

pyrepl/keymap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"'":"'",
5959
'"':'"',
6060
'a':'\a',
61-
'b':'\h',
61+
'b':r'\h',
6262
'e':'\033',
6363
'f':'\f',
6464
'n':'\n',

pyrepl/reader.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _my_unctrl(c, u=_make_unctrl_map()):
5353
return u[c]
5454
else:
5555
if unicodedata.category(c).startswith('C'):
56-
return b'\u%04x' % ord(c)
56+
return br'\u%04x' % ord(c)
5757
else:
5858
return c
5959

@@ -238,7 +238,7 @@ def __init__(self, console):
238238
self.ps1 = "->> "
239239
self.ps2 = "/>> "
240240
self.ps3 = "|.. "
241-
self.ps4 = "\__ "
241+
self.ps4 = r"\__ "
242242
self.kill_ring = []
243243
self.arg = None
244244
self.finished = 0
@@ -632,9 +632,10 @@ def test():
632632
reader.ps1 = "**> "
633633
reader.ps2 = "/*> "
634634
reader.ps3 = "|*> "
635-
reader.ps4 = "\*> "
635+
reader.ps4 = r"\*> "
636636
while reader.readline():
637637
pass
638638

639+
639640
if __name__ == '__main__':
640641
test()

0 commit comments

Comments
 (0)