summaryrefslogtreecommitdiff
path: root/heatclient/common
diff options
context:
space:
mode:
authorTakashi Kajinami <tkajinam@redhat.com>2022-05-09 14:48:19 +0900
committerTakashi Kajinami <tkajinam@redhat.com>2022-05-09 17:01:25 +0000
commit23e647539cb9c6872d9f72de99c21e113fded77c (patch)
treecb1d066f225e328b664a6fa3dd73607fec181f9e /heatclient/common
parenta12456c17c5f43a35a54e605e89f74205be1e98e (diff)
downloadpython-heatclient-23e647539cb9c6872d9f72de99c21e113fded77c.tar.gz
Remove six
This library no longer supports Python 2, thus usage of six can be removed. Change-Id: I8d0c1cfd6dff375b3b7756a5b36c95a2df3f04c6
Diffstat (limited to 'heatclient/common')
-rw-r--r--heatclient/common/base.py6
-rw-r--r--heatclient/common/deployment_utils.py5
-rw-r--r--heatclient/common/format_utils.py3
-rw-r--r--heatclient/common/http.py5
-rw-r--r--heatclient/common/template_utils.py15
-rw-r--r--heatclient/common/utils.py17
6 files changed, 19 insertions, 32 deletions
diff --git a/heatclient/common/base.py b/heatclient/common/base.py
index e881511..550a77a 100644
--- a/heatclient/common/base.py
+++ b/heatclient/common/base.py
@@ -24,8 +24,7 @@ import copy
from oslo_utils import reflection
from oslo_utils import strutils
-import six
-from six.moves.urllib import parse
+from urllib import parse
from heatclient._i18n import _
from heatclient import exc as exceptions
@@ -207,8 +206,7 @@ class BaseManager(HookableMixin):
return self.client.delete(url)
-@six.add_metaclass(abc.ABCMeta)
-class ManagerWithFind(BaseManager):
+class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
"""Manager with additional `find()`/`findall()` methods."""
@abc.abstractmethod
diff --git a/heatclient/common/deployment_utils.py b/heatclient/common/deployment_utils.py
index c44da2f..90ce66d 100644
--- a/heatclient/common/deployment_utils.py
+++ b/heatclient/common/deployment_utils.py
@@ -13,10 +13,9 @@
import copy
import uuid
-import six
-from six.moves.urllib import parse as urlparse
from swiftclient import client as sc
from swiftclient import utils as swiftclient_utils
+from urllib import parse as urlparse
from heatclient._i18n import _
from heatclient import exc
@@ -102,7 +101,7 @@ def create_temp_url(swift_client, name, timeout, container=None):
key_header = 'x-account-meta-temp-url-key'
if key_header not in swift_client.head_account():
swift_client.post_account({
- key_header: six.text_type(uuid.uuid4())[:32]})
+ key_header: str(uuid.uuid4())[:32]})
key = swift_client.head_account()[key_header]
project_path = swift_client.url.split('/')[-1]
diff --git a/heatclient/common/format_utils.py b/heatclient/common/format_utils.py
index d1a9206..598ae9e 100644
--- a/heatclient/common/format_utils.py
+++ b/heatclient/common/format_utils.py
@@ -15,7 +15,6 @@
import sys
from osc_lib.command import command
-import six
class RawFormat(command.ShowOne):
@@ -63,7 +62,7 @@ def indent_and_truncate(txt, spaces=0, truncate=False, truncate_limit=10,
"""
if txt is None:
return
- lines = six.text_type(txt).splitlines()
+ lines = str(txt).splitlines()
if truncate and len(lines) > truncate_limit:
lines = lines[-truncate_limit:]
if truncate_prefix is not None:
diff --git a/heatclient/common/http.py b/heatclient/common/http.py
index 3a85bc5..f71ca66 100644
--- a/heatclient/common/http.py
+++ b/heatclient/common/http.py
@@ -24,8 +24,7 @@ from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslo_utils import importutils
import requests
-import six
-from six.moves.urllib import parse
+from urllib import parse
from heatclient._i18n import _
from heatclient.common import utils
@@ -151,7 +150,7 @@ class HTTPClient(object):
dump.append('')
if resp.content:
content = resp.content
- if isinstance(content, six.binary_type):
+ if isinstance(content, bytes):
content = content.decode()
dump.extend([content, ''])
LOG.debug('\n'.join(dump))
diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py
index ebabc04..cc81435 100644
--- a/heatclient/common/template_utils.py
+++ b/heatclient/common/template_utils.py
@@ -15,10 +15,9 @@
from collections import abc
from oslo_serialization import jsonutils
-import six
-from six.moves.urllib import error
-from six.moves.urllib import parse
-from six.moves.urllib import request
+from urllib import error
+from urllib import parse
+from urllib import request
from heatclient._i18n import _
from heatclient.common import environment_format
@@ -92,7 +91,7 @@ def get_template_contents(template_file=None, template_url=None,
% template_url)
try:
- if isinstance(tpl, six.binary_type):
+ if isinstance(tpl, bytes):
tpl = tpl.decode('utf-8')
template = template_format.parse(tpl)
except ValueError as e:
@@ -114,7 +113,7 @@ def resolve_template_get_files(template, files, template_base_url,
def ignore_if(key, value):
if key != 'get_file' and key != 'type':
return True
- if not isinstance(value, six.string_types):
+ if not isinstance(value, str):
return True
if (key == 'type' and
not value.endswith(('.yaml', '.template'))):
@@ -130,7 +129,7 @@ def resolve_template_get_files(template, files, template_base_url,
def is_template(file_content):
try:
- if isinstance(file_content, six.binary_type):
+ if isinstance(file_content, bytes):
file_content = file_content.decode('utf-8')
template_format.parse(file_content)
except (ValueError, TypeError):
@@ -144,7 +143,7 @@ def get_file_contents(from_data, files, base_url=None,
if recurse_if and recurse_if(from_data):
if isinstance(from_data, dict):
- recurse_data = six.itervalues(from_data)
+ recurse_data = from_data.values()
else:
recurse_data = from_data
for value in recurse_data:
diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py
index 3d82f98..869c297 100644
--- a/heatclient/common/utils.py
+++ b/heatclient/common/utils.py
@@ -22,10 +22,9 @@ import uuid
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
import prettytable
-import six
-from six.moves.urllib import error
-from six.moves.urllib import parse
-from six.moves.urllib import request
+from urllib import error
+from urllib import parse
+from urllib import request
import yaml
from heatclient._i18n import _
@@ -123,10 +122,7 @@ def print_list(objs, fields, formatters=None, sortby_index=0,
row.append(data)
pt.add_row(row)
- if six.PY3:
- print(encodeutils.safe_encode(pt.get_string(**kwargs)).decode())
- else:
- print(encodeutils.safe_encode(pt.get_string(**kwargs)))
+ print(encodeutils.safe_encode(pt.get_string(**kwargs)).decode())
def link_formatter(links):
@@ -286,10 +282,7 @@ def print_update_list(lst, fields, formatters=None):
pt.add_row(row)
- if six.PY3:
- print(encodeutils.safe_encode(pt.get_string()).decode())
- else:
- print(encodeutils.safe_encode(pt.get_string()))
+ print(encodeutils.safe_encode(pt.get_string()).decode())
def find_resource(manager, name_or_id):