Remove six
Replace the following items with Python 3 style code: - six.text_type - six.StringIO Change-Id: I9db56ea304938d66753106357e572f307d226850
This commit is contained in:
parent
aa0e1dc076
commit
cff1b05773
@ -14,7 +14,6 @@
|
||||
# limitations under the License.
|
||||
import ast
|
||||
import logging
|
||||
import six
|
||||
|
||||
from cliff import command
|
||||
from cliff.formatters import table
|
||||
@ -90,7 +89,7 @@ class BlazarCommand(OpenStackCommand):
|
||||
|
||||
def format_output_data(self, data):
|
||||
for k, v in data.items():
|
||||
if isinstance(v, six.text_type):
|
||||
if isinstance(v, str):
|
||||
try:
|
||||
# Deserialize if possible into dict, lists, tuples...
|
||||
v = ast.literal_eval(v)
|
||||
|
@ -25,7 +25,6 @@ from cliff import app
|
||||
from cliff import commandmanager
|
||||
from keystoneauth1 import loading
|
||||
from oslo_utils import encodeutils
|
||||
import six
|
||||
|
||||
from blazarclient import client as blazar_client
|
||||
from blazarclient import exception
|
||||
@ -265,10 +264,10 @@ class BlazarShell(app.App):
|
||||
|
||||
except Exception as err:
|
||||
if self.options.debug:
|
||||
self.log.exception(six.text_type(err))
|
||||
self.log.exception(str(err))
|
||||
raise
|
||||
else:
|
||||
self.log.error(six.text_type(err))
|
||||
self.log.error(str(err))
|
||||
return 1
|
||||
if self.interactive_mode:
|
||||
_argv = [sys.argv[0]]
|
||||
@ -291,17 +290,17 @@ class BlazarShell(app.App):
|
||||
return run_command(cmd, cmd_parser, sub_argv)
|
||||
except Exception as err:
|
||||
if self.options.debug:
|
||||
self.log.exception(six.text_type(err))
|
||||
self.log.exception(str(err))
|
||||
else:
|
||||
self.log.error(six.text_type(err))
|
||||
self.log.error(str(err))
|
||||
try:
|
||||
self.clean_up(cmd, result, err)
|
||||
except Exception as err2:
|
||||
if self.options.debug:
|
||||
self.log.exception(six.text_type(err2))
|
||||
self.log.exception(str(err2))
|
||||
else:
|
||||
self.log.error('Could not clean up: %s',
|
||||
six.text_type(err2))
|
||||
str(err2))
|
||||
if self.options.debug:
|
||||
raise
|
||||
else:
|
||||
@ -309,10 +308,10 @@ class BlazarShell(app.App):
|
||||
self.clean_up(cmd, result, None)
|
||||
except Exception as err3:
|
||||
if self.options.debug:
|
||||
self.log.exception(six.text_type(err3))
|
||||
self.log.exception(str(err3))
|
||||
else:
|
||||
self.log.error('Could not clean up: %s',
|
||||
six.text_type(err3))
|
||||
str(err3))
|
||||
return result
|
||||
|
||||
def authenticate_user(self):
|
||||
@ -349,7 +348,7 @@ class BlazarShell(app.App):
|
||||
def clean_up(self, cmd, result, err):
|
||||
self.log.debug('clean_up %s', cmd.__class__.__name__)
|
||||
if err:
|
||||
self.log.debug('got an error: %s', six.text_type(err))
|
||||
self.log.debug('got an error: %s', str(err))
|
||||
|
||||
def configure_logging(self):
|
||||
"""Create logging handlers for any log output."""
|
||||
@ -383,7 +382,7 @@ def main(argv=sys.argv[1:]):
|
||||
except exception.BlazarClientException:
|
||||
return 1
|
||||
except Exception as e:
|
||||
print(six.text_type(e))
|
||||
print(str(e))
|
||||
return 1
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import io
|
||||
import re
|
||||
import six
|
||||
import sys
|
||||
|
||||
import fixtures
|
||||
@ -53,8 +53,8 @@ class BlazarShellTestCase(tests.TestCase):
|
||||
orig = sys.stdout
|
||||
orig_stderr = sys.stderr
|
||||
try:
|
||||
sys.stdout = six.StringIO()
|
||||
sys.stderr = six.StringIO()
|
||||
sys.stdout = io.StringIO()
|
||||
sys.stderr = io.StringIO()
|
||||
_shell = shell.BlazarShell()
|
||||
_shell.initialize_app(argstr.split())
|
||||
except SystemExit:
|
||||
|
@ -37,7 +37,6 @@ PyYAML==3.12
|
||||
requests==2.14.2
|
||||
requestsexceptions==1.2.0
|
||||
rfc3986==0.3.1
|
||||
six==1.10.0
|
||||
stevedore==1.20.0
|
||||
testrepository==0.0.18
|
||||
testtools==2.2.0
|
||||
|
@ -4,7 +4,6 @@
|
||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
cliff!=2.9.0,>=2.8.0 # Apache-2.0
|
||||
PrettyTable<0.8,>=0.7.1 # BSD
|
||||
six>=1.10.0 # MIT
|
||||
Babel!=2.4.0,>=2.3.4 # BSD
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user