mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
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:
parent
e0f91e66ee
commit
7fd4a15e68
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue