diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2020-12-02 14:34:27 -0500 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2020-12-03 14:12:09 +0000 |
commit | d7adc293d377f4691b0285f62363c3958c68d235 (patch) | |
tree | 83839c8d66cf342f460aa808cfcbfacf08f9fff1 /src/vpp-api/python/vpp_papi/vpp_serializer.py | |
parent | 5395c6a07996b9d852ce1e942bd2b3c094b89d27 (diff) |
papi: remove python2 patterns
Type: refactor
Change-Id: I541759b4b788acf08599661eb9e7abc58e9283d2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi/vpp_serializer.py')
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_serializer.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py index d31a0bbc95e..81ce53e378d 100644 --- a/src/vpp-api/python/vpp_papi/vpp_serializer.py +++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py @@ -29,10 +29,9 @@ from . import vpp_format # logger = logging.getLogger('vpp_papi.serializer') -if sys.version[0] == '2': - def check(d): type(d) is dict -else: - def check(d): type(d) is dict or type(d) is bytes + +def check(d): + return type(d) is dict or type(d) is bytes def conversion_required(data, field_type): @@ -57,8 +56,7 @@ def conversion_unpacker(data, field_type): return vpp_format.conversion_unpacker_table[field_type](data) -# TODO: post 20.01, remove inherit from object. -class Packer(object): +class Packer: options = {} def pack(self, data, kwargs): @@ -384,9 +382,6 @@ class VPPEnumType(Packer): def __bool__(self): return True - # TODO: Remove post 20.01. - if sys.version[0] == '2': - __nonzero__ = __bool__ def pack(self, data, kwargs=None): if data is None: # Default to zero if not specified |