Remove six
Replace the following items with Python 3 style code Change-Id: I9e0a23816aa5e66132217b869eb23682212840f5
This commit is contained in:
parent
48f12a2f38
commit
ad2f83b52b
|
@ -27,10 +27,10 @@ import sys
|
|||
import time
|
||||
import logging
|
||||
|
||||
import six.moves.http_client as httplib
|
||||
import http.client as httplib
|
||||
|
||||
import oslo_i18n
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from heat_cfnclient.version import version_info as version
|
||||
from heat_cfnclient.common import exception
|
||||
|
|
|
@ -31,7 +31,7 @@ Keystone (an identity management system).
|
|||
import httplib2
|
||||
import json
|
||||
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import urllib.parse as urlparse
|
||||
|
||||
from heat_cfnclient.common import exception
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@ import functools
|
|||
import os
|
||||
import urllib
|
||||
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import six.moves.http_client as httplib
|
||||
import urllib.parse as urlparse
|
||||
import http.client as httplib
|
||||
try:
|
||||
from eventlet.green import socket
|
||||
from eventlet.green import ssl
|
||||
|
@ -435,7 +434,7 @@ class BaseClient(object):
|
|||
return method.lower() in ('post', 'put')
|
||||
|
||||
def _simple(body):
|
||||
return body is None or isinstance(body, six.string_types)
|
||||
return body is None or isinstance(body, str)
|
||||
|
||||
def _filelike(body):
|
||||
return hasattr(body, 'read')
|
||||
|
|
|
@ -20,14 +20,25 @@
|
|||
import functools
|
||||
import sys
|
||||
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import urllib.parse as urlparse
|
||||
|
||||
from heat_cfnclient._i18n import _
|
||||
|
||||
_FATAL_EXCEPTION_FORMAT_ERRORS = False
|
||||
|
||||
|
||||
def reraise(tp, value, tb=None):
|
||||
try:
|
||||
if value is None:
|
||||
value = tp()
|
||||
if value.__traceback__ is not tb:
|
||||
raise value.with_traceback(tb)
|
||||
raise value
|
||||
finally:
|
||||
value = None
|
||||
tb = None
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
def __init__(self, message=None):
|
||||
super(Error, self).__init__(message)
|
||||
|
@ -119,7 +130,7 @@ def wrap_exception(notifier=None, publisher_id=None, event_type=None,
|
|||
payload)
|
||||
|
||||
# re-raise original exception since it may have been clobbered
|
||||
six.reraise(*exc_info)
|
||||
reraise(*exc_info)
|
||||
|
||||
return functools.wraps(f)(wrapped)
|
||||
return inner
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
import functools
|
||||
|
||||
import six
|
||||
|
||||
from heat_cfnclient.common import exception
|
||||
from oslo_log import log as logging
|
||||
|
@ -50,7 +49,7 @@ def catch_error(action):
|
|||
if options.debug:
|
||||
raise
|
||||
LOG.error("Failed to %s. Got error:" % action)
|
||||
pieces = six.text_type(e).split('\n')
|
||||
pieces = str(e).split('\n')
|
||||
for piece in pieces:
|
||||
LOG.error(piece)
|
||||
return FAILURE
|
||||
|
|
Loading…
Reference in New Issue