Fix pylint reported anomalous-backslash-in-string.

This commit is contained in:
Andris Raugulis 2016-10-20 16:27:11 +03:00
parent 42be99a2c7
commit 67087fb920
1 changed files with 4 additions and 4 deletions

View File

@ -784,7 +784,7 @@ class SSH(object):
if full: if full:
patch = self.patch or '' patch = self.patch or ''
if self.product == SSH.Product.OpenSSH: if self.product == SSH.Product.OpenSSH:
mx = re.match('^(p\d)(.*)$', patch) mx = re.match(r'^(p\d)(.*)$', patch)
if mx is not None: if mx is not None:
out += mx.group(1) out += mx.group(1)
patch = mx.group(2).strip() patch = mx.group(2).strip()
@ -843,7 +843,7 @@ class SSH(object):
return 'FreeBSD' if d is None else 'FreeBSD ({0})'.format(d) return 'FreeBSD' if d is None else 'FreeBSD ({0})'.format(d)
w = ['RemotelyAnywhere', 'DesktopAuthority', 'RemoteSupportManager'] w = ['RemotelyAnywhere', 'DesktopAuthority', 'RemoteSupportManager']
for win_soft in w: for win_soft in w:
mx = re.match(r'^in ' + win_soft + ' ([\d\.]+\d)$', c) mx = re.match(r'^in ' + win_soft + r' ([\d\.]+\d)$', c)
if mx: if mx:
ver = mx.group(1) ver = mx.group(1)
return 'Microsoft Windows ({0} {1})'.format(win_soft, ver) return 'Microsoft Windows ({0} {1})'.format(win_soft, ver)
@ -893,7 +893,7 @@ class SSH(object):
class Banner(object): class Banner(object):
_RXP, _RXR = r'SSH-\d\.\s*?\d+', r'(-\s*([^\s]*)(?:\s+(.*))?)?' _RXP, _RXR = r'SSH-\d\.\s*?\d+', r'(-\s*([^\s]*)(?:\s+(.*))?)?'
RX_PROTOCOL = re.compile(re.sub(r'\\d(\+?)', '(\\d\g<1>)', _RXP)) RX_PROTOCOL = re.compile(re.sub(r'\\d(\+?)', r'(\\d\g<1>)', _RXP))
RX_BANNER = re.compile(r'^({0}(?:(?:-{0})*)){1}$'.format(_RXP, _RXR)) RX_BANNER = re.compile(r'^({0}(?:(?:-{0})*)){1}$'.format(_RXP, _RXR))
def __init__(self, protocol, software, comments, valid_ascii): def __init__(self, protocol, software, comments, valid_ascii):
@ -957,7 +957,7 @@ class SSH(object):
software = '' software = ''
comments = (mx.group(4) or '').strip() or None comments = (mx.group(4) or '').strip() or None
if comments is not None: if comments is not None:
comments = re.sub('\s+', ' ', comments) comments = re.sub(r'\s+', ' ', comments)
return cls(protocol, software, comments, valid_ascii) return cls(protocol, software, comments, valid_ascii)
class Fingerprint(object): class Fingerprint(object):