2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 12:57:57 +00:00

pb2dict: Disable undefined name 'basestring'

The following error is falsely reported by flake8:

lib/py/images/pb2dict.py:266:24: F821 undefined name 'basestring'

This error occurs because `basestring` is not available in Python 3,
however the if condition on the line above ensures that this error
will not occur at run time.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
Radostin Stoyanov 2019-07-31 07:08:20 +01:00 committed by Andrei Vagin
parent 5721e61000
commit b25d1facae

View File

@ -224,7 +224,7 @@ def get_bytes_dec(field):
def is_string(value):
# Python 3 compatibility
if "basestring" in __builtins__:
string_types = basestring
string_types = basestring # noqa: F821
else:
string_types = (str, bytes)
return isinstance(value, string_types)