Merge "Switch use of cStringIO.StringIO to io.BytesIO"

This commit is contained in:
Jenkins 2016-03-10 20:59:00 +00:00 committed by Gerrit Code Review
commit 630ba7fad2
1 changed files with 4 additions and 4 deletions

View File

@ -15,10 +15,10 @@
# under the License. # under the License.
import argparse import argparse
import cStringIO
import daemon import daemon
import gear import gear
import gzip import gzip
import io
import json import json
import logging import logging
import os import os
@ -121,14 +121,14 @@ class SubunitRetriever(threading.Thread):
return None return None
if gzipped: if gzipped:
logging.debug("Decompressing gzipped source file.") logging.debug("Decompressing gzipped source file.")
raw_strIO = cStringIO.StringIO(raw_buf) raw_strIO = io.BytesIO(raw_buf)
f = gzip.GzipFile(fileobj=raw_strIO) f = gzip.GzipFile(fileobj=raw_strIO)
buf = cStringIO.StringIO(f.read()) buf = io.BytesIO(f.read())
raw_strIO.close() raw_strIO.close()
f.close() f.close()
else: else:
logging.debug("Decoding source file.") logging.debug("Decoding source file.")
buf = cStringIO.StringIO(raw_buf) buf = io.BytesIO(raw_buf)
return buf return buf
def _get_subunit_data(self, source_url, retry): def _get_subunit_data(self, source_url, retry):