From 0ffbc53211ca6a35d0fe6e7f13519db9f440893d Mon Sep 17 00:00:00 2001 From: songwenping Date: Tue, 19 Apr 2022 10:15:36 +0800 Subject: [PATCH] Remove six We don't need this dependency anymore. Change-Id: I816b9aa687b90299326085b642c992e42c11c029 --- openstack_releases/cmds/interactive_release.py | 6 ++---- openstack_releases/cmds/validate.py | 5 ++--- openstack_releases/rst2txt.py | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/openstack_releases/cmds/interactive_release.py b/openstack_releases/cmds/interactive_release.py index 8509630439..31ae3439af 100644 --- a/openstack_releases/cmds/interactive_release.py +++ b/openstack_releases/cmds/interactive_release.py @@ -20,8 +20,6 @@ import subprocess import sys import tempfile -import six - from prompt_toolkit.completion import WordCompleter from prompt_toolkit import prompt from prompt_toolkit.validation import ValidationError @@ -55,9 +53,9 @@ Notes: def to_unicode(blob, encoding='utf8'): - if isinstance(blob, six.text_type): + if isinstance(blob, str): return blob - elif isinstance(blob, six.binary_type): + elif isinstance(blob, bytes): return blob.decode(encoding) else: raise TypeError("Unable to convert %r to a text type" % blob) diff --git a/openstack_releases/cmds/validate.py b/openstack_releases/cmds/validate.py index e635da8107..02ab94bbd7 100644 --- a/openstack_releases/cmds/validate.py +++ b/openstack_releases/cmds/validate.py @@ -30,7 +30,6 @@ import tempfile from openstack_governance import governance import requests -import six # Disable warnings about insecure connections. from requests.packages import urllib3 @@ -1560,7 +1559,7 @@ def validate_stable_branches(deliv, context): location = branch.location if branch_mode == 'std' or branch_mode == 'std-with-versions': - if not isinstance(location, six.string_types): + if not isinstance(location, str): context.error( ('branch location for %s is ' 'expected to be a string but got a %s' % ( @@ -1645,7 +1644,7 @@ def validate_stable_branches(deliv, context): ) elif branch_mode == 'upstream': - if not isinstance(location, six.string_types): + if not isinstance(location, str): context.error( ('branch location for %s is ' 'expected to be a string but got a %s' % ( diff --git a/openstack_releases/rst2txt.py b/openstack_releases/rst2txt.py index a5cf1f8fc0..de369e0dab 100644 --- a/openstack_releases/rst2txt.py +++ b/openstack_releases/rst2txt.py @@ -29,7 +29,6 @@ from docutils import core from docutils import nodes from docutils.utils import column_width from docutils import writers -from six.moves import zip_longest from sphinx import addnodes @@ -563,7 +562,7 @@ class TextTranslator(nodes.NodeVisitor): self.add_text(''.join(out) + self.nl) def writerow(row): - lines = zip_longest(*row) + lines = itertools.zip_longest(*row) for line in lines: out = ['|'] for i, cell in enumerate(line):