From 7146b6085517d591a6c9eb1148ed85c784e6a447 Mon Sep 17 00:00:00 2001 From: Yandong Xuan Date: Wed, 17 Mar 2021 14:37:06 +0800 Subject: [PATCH] remove six from cinder.transfer - six.binary_type - six.text_type Implements: blueprint six-removal Change-Id: Iab21702dd274c1c81f95beb59bfadec54a39a358 --- cinder/transfer/api.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cinder/transfer/api.py b/cinder/transfer/api.py index 115c3880e03..4871802e38a 100644 --- a/cinder/transfer/api.py +++ b/cinder/transfer/api.py @@ -26,7 +26,6 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import strutils -import six from cinder.db import base from cinder import exception @@ -119,13 +118,13 @@ class API(base.Base): def _get_crypt_hash(self, salt, auth_key): """Generate a random hash based on the salt and the auth key.""" - if not isinstance(salt, (six.binary_type, six.text_type)): + if not isinstance(salt, (bytes, str)): salt = str(salt) - if isinstance(salt, six.text_type): + if isinstance(salt, str): salt = salt.encode('utf-8') - if not isinstance(auth_key, (six.binary_type, six.text_type)): + if not isinstance(auth_key, (bytes, str)): auth_key = str(auth_key) - if isinstance(auth_key, six.text_type): + if isinstance(auth_key, str): auth_key = auth_key.encode('utf-8') return hmac.new(salt, auth_key, hashlib.sha1).hexdigest()