replaced StringIO imports with import from six

replaced cStringIO and StringIO imports with import from six

fixed StringIO imports

fixed StringIO imports

fixed XSS python-wrap warning
This commit is contained in:
aarif
2019-08-07 16:15:59 +05:00
parent 04c8290197
commit 61800c619f
25 changed files with 47 additions and 44 deletions

View File

@@ -7,7 +7,7 @@ from __future__ import absolute_import
import itertools
import json
import StringIO
from six import StringIO
import unittest
from copy import deepcopy
@@ -650,11 +650,11 @@ class TestRecommenderFileUploading(TestRecommender):
happens or is rejected as expected.
"""
if 'magic_number' in test_case:
f_handler = StringIO.StringIO(test_case['magic_number'].decode('hex'))
f_handler = StringIO(test_case['magic_number'].decode('hex'))
elif content is not None:
f_handler = StringIO.StringIO(json.dumps(content, sort_keys=True))
f_handler = StringIO(json.dumps(content, sort_keys=True))
else:
f_handler = StringIO.StringIO('')
f_handler = StringIO('')
f_handler.content_type = test_case['mimetypes']
f_handler.name = 'file' + test_case['suffixes']

View File

@@ -429,7 +429,7 @@ class XBlockTestCase(XBlockStudentTestCaseMixin,
usage_id = self.xblocks[block_urlname].scope_ids.usage_id
encoded_id = usage_id.replace(";_", "/")
Followed by:
page_xml = defusedxml.ElementTree.parse(StringIO.StringIO(response_content))
page_xml = defusedxml.ElementTree.parse(StringIO(response_content))
page_xml.find("//[@data-usage-id={usage}]".format(usage=encoded_id))
or
soup_html = BeautifulSoup(response_content, 'html.parser')