Update StringIO to use six

It's StringIO.StringIO in python2 and io.StringIO in python3,
but six.StringIO everywhere.

Change-Id: Ief0b091b716e3ea6224c0ac374a6066f0270bebc
This commit is contained in:
Monty Taylor 2020-03-24 18:50:19 -05:00
parent 3611248789
commit b6401b0f2f
3 changed files with 6 additions and 6 deletions

View File

@ -23,8 +23,8 @@ from __future__ import print_function
__author__ = "Chmouel Boudjnah <chmouel@chmouel.com>" __author__ = "Chmouel Boudjnah <chmouel@chmouel.com>"
import six
from six.moves import configparser from six.moves import configparser
import cStringIO
import datetime import datetime
import json import json
import os import os
@ -127,7 +127,7 @@ def upload_to_swift(content, objectname):
time.sleep(1) time.sleep(1)
client.put_object(cfg['container'], objectname, client.put_object(cfg['container'], objectname,
cStringIO.StringIO(content)) six.StringIO(content))
def generate_rss(content, project=""): def generate_rss(content, project=""):

View File

@ -18,10 +18,10 @@
# corresponding Launchpad blueprints with links back to the change. # corresponding Launchpad blueprints with links back to the change.
import argparse import argparse
import six
from six.moves import configparser from six.moves import configparser
import os import os
import re import re
import StringIO
import subprocess import subprocess
from launchpadlib import launchpad from launchpadlib import launchpad
@ -54,7 +54,7 @@ def get_broken_config(filename):
for line in conf.readlines(): for line in conf.readlines():
text = "%s%s" % (text, line.lstrip()) text = "%s%s" % (text, line.lstrip())
fp = StringIO.StringIO(text) fp = six.StringIO(text)
c = configparser.ConfigParser() c = configparser.ConfigParser()
c.readfp(fp) c.readfp(fp)
return c return c

View File

@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import six
from six.moves import configparser from six.moves import configparser
import os import os
import StringIO
GERRIT_CONFIG = os.environ.get( GERRIT_CONFIG = os.environ.get(
@ -34,7 +34,7 @@ def get_broken_config(filename):
for line in open(filename, "r"): for line in open(filename, "r"):
text += line.lstrip() text += line.lstrip()
fp = StringIO.StringIO(text) fp = six.StringIO(text)
c = configparser.ConfigParser() c = configparser.ConfigParser()
c.readfp(fp) c.readfp(fp)
return c return c