diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-11-01 22:13:37 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-11-01 22:13:37 +0200 |
commit | c69795b71aaba8bf0408b357fdec187c0202a1a8 (patch) | |
tree | a30bdad871977f5c05a608067e9b607bc4e701c4 | |
parent | aa18910e4dd78463c07f7f3ef84e1c5b137219cb (diff) | |
download | obnam-c69795b71aaba8bf0408b357fdec187c0202a1a8.tar.gz |
Change type checking in object serialisation
Placate pylint.
-rw-r--r-- | obnamlib/obj_serialiser.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/obnamlib/obj_serialiser.py b/obnamlib/obj_serialiser.py index b39505d9..953bd3a8 100644 --- a/obnamlib/obj_serialiser.py +++ b/obnamlib/obj_serialiser.py @@ -147,8 +147,9 @@ def _next_object(pos, length): def _serialise_dict(obj): keys = obj.keys() - int_keys = [key for key in keys if type(obj[key]) in (int, long)] - str_keys = [key for key in keys if type(obj[key]) is str] + int_keys = [key for key in keys + if isinstance(obj[key], int) or isinstance(obj[key], long)] + str_keys = [key for key in keys if isinstance(obj[key], str)] special_keys = set(int_keys).union(set(str_keys)) other_keys = [key for key in keys if key not in special_keys] |