Merge "Remove six"

This commit is contained in:
Zuul 2022-02-11 19:02:07 +00:00 committed by Gerrit Code Review
commit 2b26dea61a
4 changed files with 11 additions and 14 deletions

View File

@ -28,7 +28,6 @@ import sys
import threading
import msgpack
import six
from oslo_privsep._i18n import _
from oslo_utils import uuidutils
@ -67,7 +66,7 @@ class Serializer(object):
self.writesock.shutdown(socket.SHUT_WR)
class Deserializer(six.Iterator):
class Deserializer(object):
def __init__(self, readsock):
self.readsock = readsock
self.unpacker = msgpack.Unpacker(use_list=False, raw=False,
@ -202,7 +201,7 @@ class ClientChannel(object):
self.reader_thread.join()
class ServerChannel(six.Iterator):
class ServerChannel(object):
"""Server-side twin to ClientChannel"""
def __init__(self, sock):

View File

@ -62,7 +62,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import encodeutils
from oslo_utils import importutils
import six
from oslo_privsep._i18n import _
from oslo_privsep import capabilities
@ -513,8 +512,8 @@ class Daemon(object):
reply = (comm.Message.ERR.value, cls_name, e.args)
try:
channel.send((msgid, reply))
except IOError:
self.communication_error = sys.exc_info()
except IOError as exc:
self.communication_error = exc
return _call_back
@ -529,10 +528,10 @@ class Daemon(object):
for msgid, msg in self.channel:
error = self.communication_error
if error:
if error[1].errno == errno.EPIPE:
if error.errno == errno.EPIPE:
# Write stream closed, exit loop
break
six.reraise(*error)
raise error
# Submit the command for execution
future = self.thread_pool.submit(self._process_cmd, msgid, *msg)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import io
from oslotest import base
@ -22,7 +22,7 @@ from oslo_privsep import comm
class BufSock(object):
def __init__(self):
self.readpos = 0
self.buf = six.BytesIO()
self.buf = io.BytesIO()
def recv(self, bufsize):
if self.buf.closed:

View File

@ -25,7 +25,6 @@ from unittest import mock
from oslo_log import formatters
from oslo_log import log as logging
from oslotest import base
import six
import testtools
from oslo_privsep import capabilities
@ -198,12 +197,12 @@ class WithContextTest(testctx.TestContextTestCase):
class ClientChannelTestCase(base.BaseTestCase):
DICT = {
'string_1': ('tuple_1', six.b('tuple_2')),
six.b('byte_1'): ['list_1', 'list_2'],
'string_1': ('tuple_1', b'tuple_2'),
b'byte_1': ['list_1', 'list_2'],
}
EXPECTED = {
'string_1': ('tuple_1', six.b('tuple_2')),
'string_1': ('tuple_1', b'tuple_2'),
'byte_1': ['list_1', 'list_2'],
}