Fix pylint error

This commit is contained in:
ChillerDragon 2023-04-07 13:08:44 +02:00
parent 2346e271ac
commit 5fc964e4ed

View file

@ -86,20 +86,19 @@ class Unpacker():
self.idx += str_end + 1
if sanitize == NO_SANITIZE:
return res.decode('utf-8', 'ignore')
elif sanitize == SANITIZE:
if sanitize == SANITIZE:
return bytes( \
[x if x > 32 or x in (9, 10, 13) else 32 for x in res]) \
.decode('utf-8', 'ignore' \
)
elif sanitize == SANITIZE_CC:
if sanitize == SANITIZE_CC:
return bytes( \
[x if x > 32 else 32 for x in res]) \
.decode('utf-8', 'ignore' \
)
elif sanitize == SKIP_START_WHITESPACES:
if sanitize == SKIP_START_WHITESPACES:
return res.decode('utf-8').lstrip()
else:
raise ValueError(f"Error: invalid sanitize mode {sanitize}")
raise ValueError(f"Error: invalid sanitize mode {sanitize}")
# TODO: optimize performance and benchmark in tests
def pack_int(num: int) -> bytes: