Remove usage of six

Remove six-library Replace the following items with Python 3 style code.
- six.StringIO

Change-Id: Ia8a28940edc9ca1b26ca0ef5112a44fe5fc6258d
This commit is contained in:
songwenping 2021-01-05 06:30:18 +00:00 committed by Wenping Song
parent 8ff9746a30
commit 0fa2069510
4 changed files with 7 additions and 8 deletions

View File

@ -14,6 +14,7 @@
# under the License.
import io
import select
import socket
import time
@ -67,7 +68,7 @@ class Client(object):
self.password = password
if isinstance(pkey, six.string_types):
pkey = paramiko.RSAKey.from_private_key(
six.StringIO(str(pkey)))
io.StringIO(str(pkey)))
self.pkey = pkey
self.look_for_keys = look_for_keys
self.key_filename = key_filename

View File

@ -12,15 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from io import StringIO
import os
import shutil
import subprocess
import tempfile
from unittest.mock import patch
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from tempest.cmd import workspace
from tempest.lib.common.utils import data_utils

View File

@ -12,11 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from io import StringIO
import socket
from unittest import mock
import six
from six import StringIO
import testtools
from tempest.lib.common import ssh
@ -30,7 +30,7 @@ class TestSshClient(base.TestCase):
SELECT_POLLIN = 1
@mock.patch('paramiko.RSAKey.from_private_key')
@mock.patch('six.StringIO')
@mock.patch('io.StringIO')
def test_pkey_calls_paramiko_RSAKey(self, cs_mock, rsa_mock):
cs_mock.return_value = mock.sentinel.csio
pkey = 'mykey'

View File

@ -17,6 +17,7 @@
import argparse
import gzip
import io
import os
import re
import sys
@ -69,7 +70,7 @@ def process_files(file_specs, url_specs, allow_lists):
req = urlreq.Request(url)
req.add_header('Accept-Encoding', 'gzip')
page = urlreq.urlopen(req)
buf = six.StringIO(page.read())
buf = io.StringIO(page.read())
f = gzip.GzipFile(fileobj=buf)
if scan_content(f.read().splitlines(), regexp, allow_list):
logs_with_errors.append(name)