pb2dict: fix flake8 error

This patch fixes the following flake8 error:
python3 -m flake8 --config=scripts/flake8.cfg lib/pycriu/images/pb2dict.py
lib/pycriu/images/pb2dict.py:361:43: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov 2024-01-18 14:26:33 +00:00 committed by Andrei Vagin
parent e0f91e66ee
commit 7fd4a15e68

View file

@ -358,7 +358,10 @@ def pb2dict(pb, pretty=False, is_hex=False):
else:
d_val = _pb2dict_cast(field, value, pretty, is_hex)
d[field.name] = d_val.decode() if type(d_val) == bytes else d_val
try:
d[field.name] = d_val.decode()
except (UnicodeDecodeError, AttributeError):
d[field.name] = d_val
return d