1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Add noqa comments for flake8 W605

W605 warns of invalid escape sequences in non-`r` strings.
Unfortunately, there's no Python 2/3 compatible way of marking `r`
bytestrings. `rb` is invalid on Python 2, and `r` is for text strings on
Python 3.
This commit is contained in:
Andy Freeland
2018-11-27 13:49:47 -08:00
parent 4f147d2ce6
commit ca42e2a2e9

View File

@@ -894,11 +894,11 @@ def decrypt(value, key, aad=b'', stash=None, digest=None, unencrypted=False):
digest.update(bvalue)
return value
valre = b'^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+)'
valre = b'^ENC\[AES256_GCM,data:(.+),iv:(.+),tag:(.+)' # noqa: W605
# extract fields using a regex
if A_is_newer_than_B(INPUT_VERSION, '0.8'):
valre += b',type:(.+)'
valre += b'\]'
valre += b'\]' # noqa: W605
res = re.match(valre, value.encode('utf-8'))
# if the value isn't in encrypted form, return it as is
if res is None:
@@ -1422,7 +1422,7 @@ def tree_path_comp(comp, path):
comp = comp[0:len(comp)-1]
comp = comp.replace('"', '', 2)
comp = comp.replace("'", "", 2)
if re.search(b'^\d+$', comp.encode('utf-8')):
if re.search(b'^\d+$', comp.encode('utf-8')): # noqa: W605
return int(comp)
else:
return comp