Cleanup: use raw-strings for regex in console completion

This commit is contained in:
Campbell Barton 2020-10-02 10:16:06 +10:00
parent 41d2d6da0c
commit 6b1bbcd3b0

@ -25,19 +25,19 @@ import re
# regular expression constants # regular expression constants
DEF_DOC = '%s\s*(\(.*?\))' DEF_DOC = r'%s\s*(\(.*?\))'
DEF_SOURCE = 'def\s+%s\s*(\(.*?\)):' DEF_SOURCE = r'def\s+%s\s*(\(.*?\)):'
RE_EMPTY_LINE = re.compile('^\s*\n') RE_EMPTY_LINE = re.compile(r'^\s*\n')
RE_FLAG = re.MULTILINE | re.DOTALL RE_FLAG = re.MULTILINE | re.DOTALL
RE_NEWLINE = re.compile('\n+') RE_NEWLINE = re.compile('\n+')
RE_SPACE = re.compile('\s+') RE_SPACE = re.compile(r'\s+')
RE_DEF_COMPLETE = re.compile( RE_DEF_COMPLETE = re.compile(
# don't start with a quote # don't start with a quote
'''(?:^|[^"'a-zA-Z0-9_])''' '''(?:^|[^"'a-zA-Z0-9_])'''
# start with a \w = [a-zA-Z0-9_] # start with a \w = [a-zA-Z0-9_]
'''((\w+''' r'''((\w+'''
# allow also dots and closed bracket pairs [] # allow also dots and closed bracket pairs []
'''(?:\w|[.]|\[.+?\])*''' r'''(?:\w|[.]|\[.+?\])*'''
# allow empty string # allow empty string
'''|)''' '''|)'''
# allow opening bracket(s) # allow opening bracket(s)