Remove usage of six

Remove six-library Replace the following items with Python 3 style code.
- six.raise_from
- six.StringIO
- six.moves
- requirement.txt

Change-Id: If3d810a1dbe7d506aa55cc07717babec8393b8c5
This commit is contained in:
songwenping 2021-10-25 07:20:35 +00:00 committed by Wenping Song
parent 99d5dcc170
commit 1f2fdddd9c
4 changed files with 5 additions and 7 deletions

View File

@ -16,7 +16,6 @@ import logging
import keystoneauth1.exceptions.http as ks_exceptions
import osc_lib.exceptions as exceptions
import simplejson as json
import six
from osc_placement import version
@ -42,7 +41,7 @@ def _wrap_http_exceptions():
msg = detail.split('\n')[-1].strip()
exc_class = _http_error_to_exc.get(exc.http_status,
exceptions.CommandError)
six.raise_from(exc_class(exc.http_status, msg), exc)
raise exc_class(exc.http_status, msg) from exc
else:
raise

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from six.moves.urllib import parse as urlparse
from urllib import parse as urlparse
def encode(value, encoding='utf-8'):

View File

@ -10,11 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import logging
import random
import fixtures
import six
from openstackclient import shell
from oslotest import base
@ -93,8 +93,8 @@ class BaseTestCase(base.BaseTestCase):
# Context manager here instead of setUp because we only want
# output trapping around the run().
self.output = six.StringIO()
self.error = six.StringIO()
self.output = io.StringIO()
self.error = io.StringIO()
stdout_fix = fixtures.MonkeyPatch('sys.stdout', self.output)
stderr_fix = fixtures.MonkeyPatch('sys.stderr', self.error)
with stdout_fix, stderr_fix:

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later.
pbr>=2.0.0 # Apache-2.0
six>=1.10.0 # MIT
keystoneauth1>=3.3.0 # Apache-2.0
simplejson>=3.16.0 # MIT
osc-lib>=1.2.0 # Apache-2.0