diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-04-18 03:35:41 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-04-18 03:35:41 -0600 |
commit | acca826adf39ddfedde78cfbfc47e81a06c6f42a (patch) | |
tree | 3f30b915acc60f31e12ed5467ba9b1e1fe990f42 /cloudinit/distros | |
parent | 6a979bb2fabd187efc392de7b0852cd0361bc9b8 (diff) | |
download | vyos-cloud-init-acca826adf39ddfedde78cfbfc47e81a06c6f42a.tar.gz vyos-cloud-init-acca826adf39ddfedde78cfbfc47e81a06c6f42a.zip |
pycodestyle: Fix invalid escape sequences in string literals.
Python has deprecated these invalid string literals now
https://bugs.python.org/issue27364
and pycodestyle is identifying them with a W605 warning.
https://github.com/PyCQA/pycodestyle/pull/676
So basically, any use of \ not followed by one of [\'"abfnrtv]
or \ooo (octal) \xhh (hex) or a newline is invalid. This is most
comomnly seen for us in regex. To solve, you either:
a.) use a raw string r'...'
b.) correctly escape the \ that was not intended to be interpreted.
Diffstat (limited to 'cloudinit/distros')
-rw-r--r-- | cloudinit/distros/freebsd.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index 754d3df6..099fac5c 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -110,7 +110,7 @@ class Distro(distros.Distro): if dev.startswith('lo'): return dev - n = re.search('\d+$', dev) + n = re.search(r'\d+$', dev) index = n.group(0) (out, err) = util.subp(['ifconfig', '-a']) @@ -118,7 +118,7 @@ class Distro(distros.Distro): if len(x.split()) > 0] bsddev = 'NOT_FOUND' for line in ifconfigoutput: - m = re.match('^\w+', line) + m = re.match(r'^\w+', line) if m: if m.group(0).startswith('lo'): continue @@ -128,7 +128,7 @@ class Distro(distros.Distro): break # Replace the index with the one we're after. - bsddev = re.sub('\d+$', index, bsddev) + bsddev = re.sub(r'\d+$', index, bsddev) LOG.debug("Using network interface %s", bsddev) return bsddev |