mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
pycriu: fix lint errors
This patch fixes the following errors reported by ruff: lib/pycriu/images/pb2dict.py:307:24: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks | 305 | elif field.type in _basic_cast: 306 | cast = _basic_cast[field.type] 307 | if pretty and (cast == int): | ^^^^^^^^^^^ E721 308 | if is_hex: 309 | # Fields that have (criu).hex = true option set | lib/pycriu/images/pb2dict.py:379:13: E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks | 377 | elif field.type in _basic_cast: 378 | cast = _basic_cast[field.type] 379 | if (cast == int) and is_string(value): | ^^^^^^^^^^^ E721 380 | if _marked_as_dev(field): 381 | return encode_dev(field, value) | Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
0e780145a5
commit
87b5ac9d9f
@ -304,7 +304,7 @@ def _pb2dict_cast(field, value, pretty=False, is_hex=False):
|
|||||||
return field.enum_type.values_by_number.get(value, None).name
|
return field.enum_type.values_by_number.get(value, None).name
|
||||||
elif field.type in _basic_cast:
|
elif field.type in _basic_cast:
|
||||||
cast = _basic_cast[field.type]
|
cast = _basic_cast[field.type]
|
||||||
if pretty and (cast == int):
|
if pretty and cast is int:
|
||||||
if is_hex:
|
if is_hex:
|
||||||
# Fields that have (criu).hex = true option set
|
# Fields that have (criu).hex = true option set
|
||||||
# should be stored in hex string format.
|
# should be stored in hex string format.
|
||||||
@ -376,7 +376,7 @@ def _dict2pb_cast(field, value):
|
|||||||
return field.enum_type.values_by_name.get(value, None).number
|
return field.enum_type.values_by_name.get(value, None).number
|
||||||
elif field.type in _basic_cast:
|
elif field.type in _basic_cast:
|
||||||
cast = _basic_cast[field.type]
|
cast = _basic_cast[field.type]
|
||||||
if (cast == int) and is_string(value):
|
if cast is int and is_string(value):
|
||||||
if _marked_as_dev(field):
|
if _marked_as_dev(field):
|
||||||
return encode_dev(field, value)
|
return encode_dev(field, value)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user