##// END OF EJS Templates
Merge pull request #11250 from Carreau/invalid-escape-sequence...
Min RK -
r24469:eed56ba3 merge
parent child Browse files
Show More
@@ -1592,7 +1592,7 b' class IPCompleter(Completer):'
1592 $
1592 $
1593 '''
1593 '''
1594 regexps = self.__dict_key_regexps = {
1594 regexps = self.__dict_key_regexps = {
1595 False: re.compile(dict_key_re_fmt % '''
1595 False: re.compile(dict_key_re_fmt % r'''
1596 # identifiers separated by .
1596 # identifiers separated by .
1597 (?!\d)\w+
1597 (?!\d)\w+
1598 (?:\.(?!\d)\w+)*
1598 (?:\.(?!\d)\w+)*
@@ -176,7 +176,7 b' class Tracer(object):'
176 self.debugger.set_trace(sys._getframe().f_back)
176 self.debugger.set_trace(sys._getframe().f_back)
177
177
178
178
179 RGX_EXTRA_INDENT = re.compile('(?<=\n)\s+')
179 RGX_EXTRA_INDENT = re.compile(r'(?<=\n)\s+')
180
180
181
181
182 def strip_indentation(multiline_string):
182 def strip_indentation(multiline_string):
@@ -65,7 +65,7 b" ini_spaces_re = re.compile(r'^([ \\t\\r\\f\\v]+)')"
65
65
66 # regexp to match pure comment lines so we don't accidentally insert 'if 1:'
66 # regexp to match pure comment lines so we don't accidentally insert 'if 1:'
67 # before pure comments
67 # before pure comments
68 comment_line_re = re.compile('^\s*\#')
68 comment_line_re = re.compile(r'^\s*\#')
69
69
70
70
71 def num_ini_spaces(s):
71 def num_ini_spaces(s):
@@ -171,7 +171,7 b' class assemble_python_lines(TokenInputTransformer):'
171
171
172 @CoroutineInputTransformer.wrap
172 @CoroutineInputTransformer.wrap
173 def assemble_logical_lines():
173 def assemble_logical_lines():
174 """Join lines following explicit line continuations (\)"""
174 r"""Join lines following explicit line continuations (\)"""
175 line = ''
175 line = ''
176 while True:
176 while True:
177 line = (yield line)
177 line = (yield line)
@@ -361,7 +361,7 b' def cellmagic(end_on_blank_line=False):'
361 reset (sent None).
361 reset (sent None).
362 """
362 """
363 tpl = 'get_ipython().run_cell_magic(%r, %r, %r)'
363 tpl = 'get_ipython().run_cell_magic(%r, %r, %r)'
364 cellmagic_help_re = re.compile('%%\w+\?')
364 cellmagic_help_re = re.compile(r'%%\w+\?')
365 line = ''
365 line = ''
366 while True:
366 while True:
367 line = (yield line)
367 line = (yield line)
@@ -24,7 +24,7 b' from logging import error'
24 # Magic implementation classes
24 # Magic implementation classes
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26
26
27 reg = re.compile('^\w+\.\w+$')
27 reg = re.compile(r'^\w+\.\w+$')
28 @magics_class
28 @magics_class
29 class ConfigMagics(Magics):
29 class ConfigMagics(Magics):
30
30
@@ -41,7 +41,7 b' from IPython.utils.encoding import get_stream_enc'
41 # ! and !! trigger if they are first char(s) *or* follow an indent
41 # ! and !! trigger if they are first char(s) *or* follow an indent
42 # ? triggers as first or last char.
42 # ? triggers as first or last char.
43
43
44 line_split = re.compile("""
44 line_split = re.compile(r"""
45 ^(\s*) # any leading space
45 ^(\s*) # any leading space
46 ([,;/%]|!!?|\?\??)? # escape character or characters
46 ([,;/%]|!!?|\?\??)? # escape character or characters
47 \s*(%{0,2}[\w\.\*]*) # function/method, possibly with leading %
47 \s*(%{0,2}[\w\.\*]*) # function/method, possibly with leading %
@@ -68,7 +68,7 b' def split_user_input(line, pattern=None):'
68 except ValueError:
68 except ValueError:
69 # print "split failed for line '%s'" % line
69 # print "split failed for line '%s'" % line
70 ifun, the_rest = line, u''
70 ifun, the_rest = line, u''
71 pre = re.match('^(\s*)(.*)',line).groups()[0]
71 pre = re.match(r'^(\s*)(.*)',line).groups()[0]
72 esc = ""
72 esc = ""
73 else:
73 else:
74 pre, esc, ifun, the_rest = match.groups()
74 pre, esc, ifun, the_rest = match.groups()
@@ -202,7 +202,7 b' def get_home_dir(require_writable=False):'
202 import _winreg as wreg # Py 2
202 import _winreg as wreg # Py 2
203 key = wreg.OpenKey(
203 key = wreg.OpenKey(
204 wreg.HKEY_CURRENT_USER,
204 wreg.HKEY_CURRENT_USER,
205 "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
205 r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
206 )
206 )
207 homedir = wreg.QueryValueEx(key,'Personal')[0]
207 homedir = wreg.QueryValueEx(key,'Personal')[0]
208 key.Close()
208 key.Close()
@@ -588,7 +588,7 b' class DollarFormatter(FullEvalFormatter):'
588 In [4]: f.format('$a or {b}', a=1, b=2)
588 In [4]: f.format('$a or {b}', a=1, b=2)
589 Out[4]: '1 or 2'
589 Out[4]: '1 or 2'
590 """
590 """
591 _dollar_pattern_ignore_single_quote = re.compile("(.*?)\$(\$?[\w\.]+)(?=([^']*'[^']*')*[^']*$)")
591 _dollar_pattern_ignore_single_quote = re.compile(r"(.*?)\$(\$?[\w\.]+)(?=([^']*'[^']*')*[^']*$)")
592 def parse(self, fmt_string):
592 def parse(self, fmt_string):
593 for literal_txt, field_name, format_spec, conversion \
593 for literal_txt, field_name, format_spec, conversion \
594 in Formatter.parse(self, fmt_string):
594 in Formatter.parse(self, fmt_string):
@@ -47,7 +47,7 b' from token import *'
47 from codecs import lookup, BOM_UTF8
47 from codecs import lookup, BOM_UTF8
48 import collections
48 import collections
49 from io import TextIOWrapper
49 from io import TextIOWrapper
50 cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
50 cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)")
51
51
52 import token
52 import token
53 __all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
53 __all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
General Comments 0
You need to be logged in to leave comments. Login now