Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6179e3

Browse files
committed
Fix more escape sequences
1 parent 003150e commit a6179e3

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

IPython/core/completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ def get_keys(obj):
15921592
$
15931593
'''
15941594
regexps = self.__dict_key_regexps = {
1595-
False: re.compile(dict_key_re_fmt % '''
1595+
False: re.compile(dict_key_re_fmt % r'''
15961596
# identifiers separated by .
15971597
(?!\d)\w+
15981598
(?:\.(?!\d)\w+)*

IPython/core/inputsplitter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
# regexp to match pure comment lines so we don't accidentally insert 'if 1:'
6767
# before pure comments
68-
comment_line_re = re.compile('^\s*\#')
68+
comment_line_re = re.compile(r'^\s*\#')
6969

7070

7171
def num_ini_spaces(s):

IPython/core/inputtransformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def output(self, tokens):
171171

172172
@CoroutineInputTransformer.wrap
173173
def assemble_logical_lines():
174-
"""Join lines following explicit line continuations (\)"""
174+
r"""Join lines following explicit line continuations (\)"""
175175
line = ''
176176
while True:
177177
line = (yield line)
@@ -361,7 +361,7 @@ def cellmagic(end_on_blank_line=False):
361361
reset (sent None).
362362
"""
363363
tpl = 'get_ipython().run_cell_magic(%r, %r, %r)'
364-
cellmagic_help_re = re.compile('%%\w+\?')
364+
cellmagic_help_re = re.compile(r'%%\w+\?')
365365
line = ''
366366
while True:
367367
line = (yield line)

IPython/core/magics/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Magic implementation classes
2525
#-----------------------------------------------------------------------------
2626

27-
reg = re.compile('^\w+\.\w+$')
27+
reg = re.compile(r'^\w+\.\w+$')
2828
@magics_class
2929
class ConfigMagics(Magics):
3030

IPython/core/splitinput.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# ! and !! trigger if they are first char(s) *or* follow an indent
4242
# ? triggers as first or last char.
4343

44-
line_split = re.compile("""
44+
line_split = re.compile(r"""
4545
^(\s*) # any leading space
4646
([,;/%]|!!?|\?\??)? # escape character or characters
4747
\s*(%{0,2}[\w\.\*]*) # function/method, possibly with leading %
@@ -68,7 +68,7 @@ def split_user_input(line, pattern=None):
6868
except ValueError:
6969
# print "split failed for line '%s'" % line
7070
ifun, the_rest = line, u''
71-
pre = re.match('^(\s*)(.*)',line).groups()[0]
71+
pre = re.match(r'^(\s*)(.*)',line).groups()[0]
7272
esc = ""
7373
else:
7474
pre, esc, ifun, the_rest = match.groups()

IPython/utils/tokenize2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from codecs import lookup, BOM_UTF8
4848
import collections
4949
from io import TextIOWrapper
50-
cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
50+
cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)")
5151

5252
import token
5353
__all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",

0 commit comments

Comments
 (0)