Merge "Replace reduce and unichr , these are no longer available in py3"

This commit is contained in:
Jenkins 2015-07-15 00:20:13 +00:00 committed by Gerrit Code Review
commit d3789d6493
3 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,7 @@ class Tee(object):
raise EnvironmentError('tee not available') raise EnvironmentError('tee not available')
if not isinstance(flags, six.integer_types): if not isinstance(flags, six.integer_types):
c_flags = reduce(operator.or_, flags, 0) c_flags = six.moves.reduce(operator.or_, flags, 0)
else: else:
c_flags = flags c_flags = flags
@ -177,7 +177,7 @@ class Splice(object):
raise EnvironmentError('splice not available') raise EnvironmentError('splice not available')
if not isinstance(flags, six.integer_types): if not isinstance(flags, six.integer_types):
c_flags = reduce(operator.or_, flags, 0) c_flags = six.moves.reduce(operator.or_, flags, 0)
else: else:
c_flags = flags c_flags = flags

View File

@ -15,6 +15,7 @@ from ConfigParser import ConfigParser
import os import os
import string import string
import textwrap import textwrap
import six
from swift.common.utils import ( from swift.common.utils import (
config_true_value, SWIFT_CONF_FILE, whataremyips) config_true_value, SWIFT_CONF_FILE, whataremyips)
@ -76,7 +77,8 @@ class BindPortsCache(object):
# the first one we notice. # the first one we notice.
# Return the requested set of ports from our (now-freshened) cache # Return the requested set of ports from our (now-freshened) cache
return reduce(set.union, self.portsets_by_ring_path.values(), set()) return six.moves.reduce(set.union,
self.portsets_by_ring_path.values(), set())
class PolicyError(ValueError): class PolicyError(ValueError):

View File

@ -22,6 +22,7 @@ import zlib
from textwrap import dedent from textwrap import dedent
import os import os
import six
from six.moves import range from six.moves import range
from test.unit import FakeLogger from test.unit import FakeLogger
import eventlet import eventlet
@ -39,7 +40,7 @@ def not_sleep(seconds):
def unicode_string(start, length): def unicode_string(start, length):
return u''.join([unichr(x) for x in range(start, start + length)]) return u''.join([six.unichr(x) for x in range(start, start + length)])
def path_parts(): def path_parts():