msgpackutils: drop Python 2.6 support
We doesn't support python 2.6 now, this commit removes Python 2.6 related code in module msgpackutls. Change-Id: Id148239ee6c1ad461188fa38b06ca0d7913d7454
This commit is contained in:
parent
e7ef8fedb4
commit
550afa9c0e
@ -31,7 +31,6 @@ This module provides a few things:
|
|||||||
import datetime
|
import datetime
|
||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
import sys
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import msgpack
|
import msgpack
|
||||||
@ -42,13 +41,6 @@ import six.moves.xmlrpc_client as xmlrpclib
|
|||||||
|
|
||||||
netaddr = importutils.try_import("netaddr")
|
netaddr = importutils.try_import("netaddr")
|
||||||
|
|
||||||
# NOTE(harlowja): itertools.count only started to take a step value
|
|
||||||
# in python 2.7+ so we can't use it in 2.6...
|
|
||||||
if sys.version_info[0:2] == (2, 6):
|
|
||||||
_PY26 = True
|
|
||||||
else:
|
|
||||||
_PY26 = False
|
|
||||||
|
|
||||||
# Expose these so that users don't have to import msgpack to gain these.
|
# Expose these so that users don't have to import msgpack to gain these.
|
||||||
|
|
||||||
PackException = msgpack.PackException
|
PackException = msgpack.PackException
|
||||||
@ -187,13 +179,7 @@ class CountHandler(object):
|
|||||||
def deserialize(data):
|
def deserialize(data):
|
||||||
value = msgpack.unpackb(data)
|
value = msgpack.unpackb(data)
|
||||||
start, step = value
|
start, step = value
|
||||||
if not _PY26:
|
|
||||||
return itertools.count(start, step)
|
return itertools.count(start, step)
|
||||||
else:
|
|
||||||
if step != 1:
|
|
||||||
raise ValueError("Python 2.6.x does not support steps"
|
|
||||||
" that are not equal to one")
|
|
||||||
return itertools.count(start)
|
|
||||||
|
|
||||||
|
|
||||||
if netaddr is not None:
|
if netaddr is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user