mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
python: Fix invalid escape sequences.
It appears that Python silently treats invalid escape sequences in strings as literals, e.g. "\." is the same as "\\.". Newer versions of checkpatch complain, and it does seem reasonable to me to fix these. Acked-by: Numan Siddique <nusiddiq@redhat.com> Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -274,7 +274,7 @@ def diagram_to_nroff(nodes, para):
|
||||
text_s = '.br\n'.join(["\\fL%s\n" % s for s in text if s != ""])
|
||||
return para + """
|
||||
.\\" check if in troff mode (TTY)
|
||||
.if t \{
|
||||
.if t \\{
|
||||
.PS
|
||||
boxht = .2
|
||||
textht = 1/6
|
||||
@@ -283,7 +283,7 @@ fillval = .2
|
||||
.PE
|
||||
\\}
|
||||
.\\" check if in nroff mode:
|
||||
.if n \{
|
||||
.if n \\{
|
||||
.nf
|
||||
""" + text_s + """\
|
||||
.fi
|
||||
|
@@ -73,7 +73,7 @@ class DbSchema(object):
|
||||
parser.finish()
|
||||
|
||||
if (version is not None and
|
||||
not re.match('[0-9]+\.[0-9]+\.[0-9]+$', version)):
|
||||
not re.match(r'[0-9]+\.[0-9]+\.[0-9]+$', version)):
|
||||
raise error.Error('schema version "%s" not in format x.y.z'
|
||||
% version)
|
||||
|
||||
|
@@ -177,7 +177,7 @@ class Parser(object):
|
||||
return False
|
||||
|
||||
__number_re = re.compile("(-)?(0|[1-9][0-9]*)"
|
||||
"(?:\.([0-9]+))?(?:[eE]([-+]?[0-9]+))?$")
|
||||
r"(?:\.([0-9]+))?(?:[eE]([-+]?[0-9]+))?$")
|
||||
|
||||
def __lex_finish_number(self):
|
||||
s = self.buffer
|
||||
@@ -234,7 +234,7 @@ class Parser(object):
|
||||
self.__error("leading zeros not allowed")
|
||||
elif re.match("-([^0-9]|$)", s):
|
||||
self.__error("'-' must be followed by digit")
|
||||
elif re.match("-?(0|[1-9][0-9]*)\.([^0-9]|$)", s):
|
||||
elif re.match(r"-?(0|[1-9][0-9]*)\.([^0-9]|$)", s):
|
||||
self.__error("decimal point must be followed by digit")
|
||||
elif re.search("e[-+]?([^0-9]|$)", s):
|
||||
self.__error("exponent must contain at least one digit")
|
||||
|
@@ -73,7 +73,7 @@ def command_register(name, usage, min_args, max_args, callback, aux):
|
||||
def socket_name_from_target(target):
|
||||
assert isinstance(target, strtypes)
|
||||
|
||||
""" On Windows an absolute path contains ':' ( i.e: C:\ ) """
|
||||
""" On Windows an absolute path contains ':' ( i.e: C:\\ ) """
|
||||
if target.startswith('/') or target.find(':') > -1:
|
||||
return 0, target
|
||||
|
||||
|
@@ -31,7 +31,7 @@ def abs_file_name(dir_, file_name):
|
||||
This differs from os.path.abspath() in that it will never change the
|
||||
meaning of a file name.
|
||||
|
||||
On Windows an absolute path contains ':' ( i.e: C:\ ) """
|
||||
On Windows an absolute path contains ':' ( i.e: C:\\ ) """
|
||||
if file_name.startswith('/') or file_name.find(':') > -1:
|
||||
return file_name
|
||||
else:
|
||||
|
@@ -142,7 +142,7 @@ class Vlog(object):
|
||||
return re.sub(match, replace, tmp)
|
||||
|
||||
def _format_time(self, tmp):
|
||||
date_regex = re.compile('(%(0?[1-9]?[dD])(\{(.*)\})?)')
|
||||
date_regex = re.compile(r'(%(0?[1-9]?[dD])(\{(.*)\})?)')
|
||||
match = date_regex.search(tmp)
|
||||
|
||||
if match is None:
|
||||
|
Reference in New Issue
Block a user