Remove all six usage
Remove six Replace the following items with Python 3 style code. - six.string_types - six.text_type - six.itervalues - six.StringIO Change-Id: I32401859129843242922f1d0510b21e32bb7d8cc
This commit is contained in:
parent
f8cd4689e9
commit
a2122e7432
@ -39,7 +39,6 @@ PyYAML==3.13
|
||||
requests==2.14.2
|
||||
requestsexceptions==1.2.0
|
||||
rfc3986==0.3.1
|
||||
six==1.10.0
|
||||
smmap==0.9.0
|
||||
snowballstemmer==1.2.1
|
||||
stestr==2.0.0
|
||||
|
@ -18,10 +18,8 @@ This module includes various utilities
|
||||
used in generating reports.
|
||||
"""
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class StringWithAttrs(six.text_type):
|
||||
class StringWithAttrs(str):
|
||||
"""A String that can have arbitrary attributes"""
|
||||
|
||||
pass
|
||||
|
@ -28,8 +28,6 @@ try: # python 3
|
||||
except ImportError: # python 2
|
||||
import collections as abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class ReportModel(abc.MutableMapping):
|
||||
"""A Report Data Model
|
||||
@ -71,7 +69,7 @@ class ReportModel(abc.MutableMapping):
|
||||
self_cpy = copy.deepcopy(self)
|
||||
for key in self_cpy:
|
||||
if getattr(self_cpy[key], 'attached_view', None) is not None:
|
||||
self_cpy[key] = six.text_type(self_cpy[key])
|
||||
self_cpy[key] = str(self_cpy[key])
|
||||
|
||||
if self.attached_view is not None:
|
||||
return self.attached_view(self_cpy)
|
||||
@ -147,7 +145,7 @@ class ReportModel(abc.MutableMapping):
|
||||
|
||||
# don't die on recursive structures,
|
||||
# and don't treat strings like sequences
|
||||
if oid in visited or isinstance(obj, six.string_types):
|
||||
if oid in visited or isinstance(obj, str):
|
||||
return
|
||||
|
||||
visited.add(oid)
|
||||
@ -160,7 +158,7 @@ class ReportModel(abc.MutableMapping):
|
||||
traverse_obj(item)
|
||||
|
||||
elif isinstance(obj, abc.Mapping):
|
||||
for val in six.itervalues(obj):
|
||||
for val in obj.values():
|
||||
traverse_obj(val)
|
||||
|
||||
traverse_obj(self)
|
||||
|
@ -19,7 +19,6 @@ All reports take the form of a report class containing various report
|
||||
sections.
|
||||
"""
|
||||
|
||||
import six
|
||||
|
||||
from oslo_reports.views.text import header as header_views
|
||||
|
||||
@ -74,7 +73,7 @@ class BasicReport(object):
|
||||
:returns: the serialized report
|
||||
"""
|
||||
|
||||
return "\n".join(six.text_type(sect) for sect in self.sections)
|
||||
return "\n".join(str(sect) for sect in self.sections)
|
||||
|
||||
|
||||
class ReportSection(object):
|
||||
|
@ -20,7 +20,6 @@ except ImportError: # python 2
|
||||
import collections as abc
|
||||
|
||||
from oslotest import base
|
||||
import six
|
||||
|
||||
from oslo_reports.models import base as base_model
|
||||
from oslo_reports import report
|
||||
@ -30,7 +29,7 @@ class BasicView(object):
|
||||
def __call__(self, model):
|
||||
res = ""
|
||||
for k in sorted(model.keys()):
|
||||
res += six.text_type(k) + ": " + six.text_type(model[k]) + ";"
|
||||
res += str(k) + ": " + str(model[k]) + ";"
|
||||
return res
|
||||
|
||||
|
||||
@ -71,7 +70,7 @@ class TestBaseModel(base.BaseTestCase):
|
||||
def test_submodel_attached_view(self):
|
||||
class TmpView(object):
|
||||
def __call__(self, model):
|
||||
return '{len: ' + six.text_type(len(model.c)) + '}'
|
||||
return '{len: ' + str(len(model.c)) + '}'
|
||||
|
||||
def generate_model_with_submodel():
|
||||
base_m = basic_generator()
|
||||
@ -87,13 +86,13 @@ class TestBaseModel(base.BaseTestCase):
|
||||
model = base_model.ReportModel(data={'c': [1, 2, 3]})
|
||||
self.assertRaisesRegex(Exception,
|
||||
'Cannot stringify model: no attached view',
|
||||
six.text_type, model)
|
||||
str, model)
|
||||
|
||||
def test_str_returns_string_with_attached_view(self):
|
||||
model = base_model.ReportModel(data={'a': 1, 'b': 2},
|
||||
attached_view=BasicView())
|
||||
|
||||
self.assertEqual(six.text_type(model), 'a: 1;b: 2;')
|
||||
self.assertEqual(str(model), 'a: 1;b: 2;')
|
||||
|
||||
def test_model_repr(self):
|
||||
model1 = base_model.ReportModel(data={'a': 1, 'b': 2},
|
||||
@ -120,7 +119,7 @@ class TestBaseModel(base.BaseTestCase):
|
||||
model.attached_view = BasicView()
|
||||
|
||||
# if we don't handle lists properly, we'll get a TypeError here
|
||||
self.assertEqual('0: a;1: b;', six.text_type(model))
|
||||
self.assertEqual('0: a;1: b;', str(model))
|
||||
|
||||
def test_immutable_mappings_produce_mutable_models(self):
|
||||
class SomeImmutableMapping(abc.Mapping):
|
||||
@ -140,9 +139,9 @@ class TestBaseModel(base.BaseTestCase):
|
||||
model = base_model.ReportModel(data=mp)
|
||||
model.attached_view = BasicView()
|
||||
|
||||
self.assertEqual('a: 2;b: 4;c: 8;', six.text_type(model))
|
||||
self.assertEqual('a: 2;b: 4;c: 8;', str(model))
|
||||
|
||||
model['d'] = 16
|
||||
|
||||
self.assertEqual('a: 2;b: 4;c: 8;d: 16;', six.text_type(model))
|
||||
self.assertEqual('a: 2;b: 4;c: 8;d: 16;', str(model))
|
||||
self.assertEqual({'a': 2, 'b': 4, 'c': 8}, mp.data)
|
||||
|
@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
@ -24,7 +25,6 @@ from unittest import mock
|
||||
import fixtures
|
||||
import greenlet
|
||||
from oslotest import base
|
||||
import six
|
||||
|
||||
import oslo_config
|
||||
from oslo_config import fixture
|
||||
@ -189,7 +189,7 @@ class TestGuruMeditationReport(base.BaseTestCase):
|
||||
def test_register_autorun(self):
|
||||
gmr.TextGuruMeditation.setup_autorun(FakeVersionObj())
|
||||
self.old_stderr = sys.stderr
|
||||
sys.stderr = six.StringIO()
|
||||
sys.stderr = io.StringIO()
|
||||
|
||||
os.kill(os.getpid(), signal.SIGUSR2)
|
||||
self.assertIn('Guru Meditation', sys.stderr.getvalue())
|
||||
@ -236,7 +236,7 @@ class TestGuruMeditationReport(base.BaseTestCase):
|
||||
run_mock.side_effect = RunFail()
|
||||
gmr.TextGuruMeditation.setup_autorun(FakeVersionObj())
|
||||
self.old_stderr = sys.stderr
|
||||
sys.stderr = six.StringIO()
|
||||
sys.stderr = io.StringIO()
|
||||
|
||||
os.kill(os.getpid(), signal.SIGUSR2)
|
||||
self.assertIn('RunFail', sys.stderr.getvalue())
|
||||
|
@ -19,7 +19,6 @@ from unittest import mock
|
||||
import greenlet
|
||||
from oslo_config import cfg
|
||||
from oslotest import base
|
||||
import six
|
||||
|
||||
from oslo_reports.generators import conf as os_cgen
|
||||
from oslo_reports.generators import threading as os_tgen
|
||||
@ -43,7 +42,7 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
self.assertTrue(was_ok)
|
||||
|
||||
model.set_current_view_type('text')
|
||||
self.assertIsNotNone(six.text_type(model))
|
||||
self.assertIsNotNone(str(model))
|
||||
|
||||
def test_thread_generator_tb(self):
|
||||
class FakeModel(object):
|
||||
@ -73,7 +72,7 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
self.assertTrue(was_ok)
|
||||
|
||||
model.set_current_view_type('text')
|
||||
self.assertIsNotNone(six.text_type(model))
|
||||
self.assertIsNotNone(str(model))
|
||||
|
||||
def test_config_model(self):
|
||||
conf = cfg.ConfigOpts()
|
||||
@ -114,7 +113,7 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
'%s'
|
||||
' crackers = triscuit\n'
|
||||
' secrets = ***') % config_source_line
|
||||
self.assertEqual(target_str, six.text_type(model))
|
||||
self.assertEqual(target_str, str(model))
|
||||
|
||||
def test_package_report_generator(self):
|
||||
class VersionObj(object):
|
||||
@ -133,7 +132,7 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
target_str = ('product = Sharp Cheddar\n'
|
||||
'vendor = Cheese Shoppe\n'
|
||||
'version = 1.0.0')
|
||||
self.assertEqual(target_str, six.text_type(model))
|
||||
self.assertEqual(target_str, str(model))
|
||||
|
||||
def test_package_report_generator_without_vendor_string(self):
|
||||
class VersionObj(object):
|
||||
@ -149,4 +148,4 @@ class TestOpenstackGenerators(base.BaseTestCase):
|
||||
target_str = ('product = Sharp Cheddar\n'
|
||||
'vendor = None\n'
|
||||
'version = 1.0.0')
|
||||
self.assertEqual(target_str, six.text_type(model))
|
||||
self.assertEqual(target_str, str(model))
|
||||
|
@ -16,7 +16,6 @@ import copy
|
||||
from unittest import mock
|
||||
|
||||
from oslotest import base
|
||||
import six
|
||||
|
||||
from oslo_reports.models import base as base_model
|
||||
from oslo_reports.models import with_default_views as mwdv
|
||||
@ -35,15 +34,15 @@ class TestModelReportType(base.BaseTestCase):
|
||||
model = mwdv_generator()
|
||||
|
||||
model.set_current_view_type('text')
|
||||
self.assertEqual('int = 1\nstring = value', six.text_type(model))
|
||||
self.assertEqual('int = 1\nstring = value', str(model))
|
||||
|
||||
model.set_current_view_type('json')
|
||||
self.assertEqual('{"int": 1, "string": "value"}', six.text_type(model))
|
||||
self.assertEqual('{"int": 1, "string": "value"}', str(model))
|
||||
|
||||
model.set_current_view_type('xml')
|
||||
|
||||
self.assertEqual('<model><int>1</int><string>value</string></model>',
|
||||
six.text_type(model))
|
||||
str(model))
|
||||
|
||||
def test_recursive_type_propagation_with_nested_models(self):
|
||||
model = mwdv_generator()
|
||||
@ -85,7 +84,7 @@ class TestModelReportType(base.BaseTestCase):
|
||||
|
||||
def test_report_of_type(self):
|
||||
rep = report.ReportOfType('json')
|
||||
rep.add_section(lambda x: six.text_type(x), mwdv_generator)
|
||||
rep.add_section(lambda x: str(x), mwdv_generator)
|
||||
|
||||
self.assertEqual('{"int": 1, "string": "value"}', rep.run())
|
||||
|
||||
@ -134,7 +133,7 @@ class TestGenericXMLView(base.BaseTestCase):
|
||||
'<dt><a>1</a><b>2</b></dt>'
|
||||
'<int>1</int>'
|
||||
'<string>value</string></model>')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_list_serialization(self):
|
||||
self.model['lt'] = ['a', 'b']
|
||||
@ -143,7 +142,7 @@ class TestGenericXMLView(base.BaseTestCase):
|
||||
'<int>1</int>'
|
||||
'<lt><item>a</item><item>b</item></lt>'
|
||||
'<string>value</string></model>')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_list_in_dict_serialization(self):
|
||||
self.model['dt'] = {'a': 1, 'b': [2, 3]}
|
||||
@ -153,7 +152,7 @@ class TestGenericXMLView(base.BaseTestCase):
|
||||
'<b><item>2</item><item>3</item></b></dt>'
|
||||
'<int>1</int>'
|
||||
'<string>value</string></model>')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_dict_in_list_serialization(self):
|
||||
self.model['lt'] = [1, {'b': 2, 'c': 3}]
|
||||
@ -163,7 +162,7 @@ class TestGenericXMLView(base.BaseTestCase):
|
||||
'<lt><item>1</item>'
|
||||
'<item><b>2</b><c>3</c></item></lt>'
|
||||
'<string>value</string></model>')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_submodel_serialization(self):
|
||||
sm = mwdv_generator()
|
||||
@ -178,7 +177,7 @@ class TestGenericXMLView(base.BaseTestCase):
|
||||
'<model><int>1</int><string>value</string></model>'
|
||||
'</submodel>'
|
||||
'</model>')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_wrapper_name(self):
|
||||
self.model.attached_view.wrapper_name = 'cheese'
|
||||
@ -187,7 +186,7 @@ class TestGenericXMLView(base.BaseTestCase):
|
||||
'<int>1</int>'
|
||||
'<string>value</string>'
|
||||
'</cheese>')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
|
||||
class TestGenericJSONViews(base.BaseTestCase):
|
||||
@ -203,7 +202,7 @@ class TestGenericJSONViews(base.BaseTestCase):
|
||||
attached_view=attached_view)
|
||||
|
||||
self.assertEqual('{"int": 1, "string": "value"}',
|
||||
six.text_type(self.model))
|
||||
str(self.model))
|
||||
|
||||
def test_dict_serialization(self):
|
||||
self.model['dt'] = {'a': 1, 'b': 2}
|
||||
@ -213,7 +212,7 @@ class TestGenericJSONViews(base.BaseTestCase):
|
||||
'"int": 1, '
|
||||
'"string": "value"'
|
||||
'}')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_list_serialization(self):
|
||||
self.model['lt'] = ['a', 'b']
|
||||
@ -223,7 +222,7 @@ class TestGenericJSONViews(base.BaseTestCase):
|
||||
'"lt": ["a", "b"], '
|
||||
'"string": "value"'
|
||||
'}')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_list_in_dict_serialization(self):
|
||||
self.model['dt'] = {'a': 1, 'b': [2, 3]}
|
||||
@ -233,7 +232,7 @@ class TestGenericJSONViews(base.BaseTestCase):
|
||||
'"int": 1, '
|
||||
'"string": "value"'
|
||||
'}')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_dict_in_list_serialization(self):
|
||||
self.model['lt'] = [1, {'b': 2, 'c': 3}]
|
||||
@ -243,7 +242,7 @@ class TestGenericJSONViews(base.BaseTestCase):
|
||||
'"lt": [1, {"b": 2, "c": 3}], '
|
||||
'"string": "value"'
|
||||
'}')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_submodel_serialization(self):
|
||||
sm = mwdv_generator()
|
||||
@ -256,7 +255,7 @@ class TestGenericJSONViews(base.BaseTestCase):
|
||||
'"string": "value", '
|
||||
'"submodel": {"int": 1, "string": "value"}'
|
||||
'}')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
|
||||
class TestGenericTextViews(base.BaseTestCase):
|
||||
@ -280,7 +279,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
'string = value\n'
|
||||
'int = 2\n'
|
||||
'string = value')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_basic_kv_view(self):
|
||||
attached_view = text_generic.BasicKeyValueView()
|
||||
@ -288,7 +287,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
attached_view=attached_view)
|
||||
|
||||
self.assertEqual('int = 1\nstring = value\n',
|
||||
six.text_type(self.model))
|
||||
str(self.model))
|
||||
|
||||
def test_table_view(self):
|
||||
column_names = ['Column A', 'Column B']
|
||||
@ -305,7 +304,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
' 1 | 2 \n' # noqa
|
||||
' 3 | 4 \n') # noqa
|
||||
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_dict_serialization(self):
|
||||
self.model['dt'] = {'a': 1, 'b': 2}
|
||||
@ -315,7 +314,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
' b = 2\n'
|
||||
'int = 1\n'
|
||||
'string = value')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_list_serialization(self):
|
||||
self.model['lt'] = ['a', 'b']
|
||||
@ -325,7 +324,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
' a\n'
|
||||
' b\n'
|
||||
'string = value')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_list_in_dict_serialization(self):
|
||||
self.model['dt'] = {'a': 1, 'b': [2, 3]}
|
||||
@ -338,7 +337,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
'int = 1\n'
|
||||
'string = value')
|
||||
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_dict_in_list_serialization(self):
|
||||
self.model['lt'] = [1, {'b': 2, 'c': 3}]
|
||||
@ -350,7 +349,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
' b = 2\n'
|
||||
' c = 3\n'
|
||||
'string = value')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_submodel_serialization(self):
|
||||
sm = mwdv_generator()
|
||||
@ -363,7 +362,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
'submodel = \n'
|
||||
' int = 1\n'
|
||||
' string = value')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
def test_custom_indent_string(self):
|
||||
view = text_generic.KeyValueView(indent_str='~~')
|
||||
@ -376,7 +375,7 @@ class TestGenericTextViews(base.BaseTestCase):
|
||||
'~~a\n'
|
||||
'~~b\n'
|
||||
'string = value')
|
||||
self.assertEqual(target_str, six.text_type(self.model))
|
||||
self.assertEqual(target_str, str(self.model))
|
||||
|
||||
|
||||
def get_open_mocks(rv):
|
||||
@ -401,14 +400,14 @@ class TestJinjaView(base.BaseTestCase):
|
||||
self.model.attached_view = jv.JinjaView(path='a/b/c/d.jinja.txt')
|
||||
|
||||
self.assertEqual('int is 1, string is value',
|
||||
six.text_type(self.model))
|
||||
str(self.model))
|
||||
self.MM_FILE.assert_called_with_once('a/b/c/d.jinja.txt')
|
||||
|
||||
def test_direct_pass(self):
|
||||
self.model.attached_view = jv.JinjaView(text=self.TEMPL_STR)
|
||||
|
||||
self.assertEqual('int is 1, string is value',
|
||||
six.text_type(self.model))
|
||||
str(self.model))
|
||||
|
||||
def test_load_from_class(self):
|
||||
class TmpJinjaView(jv.JinjaView):
|
||||
@ -417,7 +416,7 @@ class TestJinjaView(base.BaseTestCase):
|
||||
self.model.attached_view = TmpJinjaView()
|
||||
|
||||
self.assertEqual('int is 1, string is value',
|
||||
six.text_type(self.model))
|
||||
str(self.model))
|
||||
|
||||
def test_is_deepcopiable(self):
|
||||
view_orig = jv.JinjaView(text=self.TEMPL_STR)
|
||||
|
@ -23,8 +23,6 @@ try: # python 3
|
||||
except ImportError: # python 2
|
||||
import collections as abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class MultiView(object):
|
||||
"""A Text View Containing Multiple Views
|
||||
@ -38,7 +36,7 @@ class MultiView(object):
|
||||
"""
|
||||
|
||||
def __call__(self, model):
|
||||
res = sorted([six.text_type(model[key]) for key in model])
|
||||
res = sorted([str(model[key]) for key in model])
|
||||
return "\n".join(res)
|
||||
|
||||
|
||||
@ -126,7 +124,7 @@ class KeyValueView(object):
|
||||
for key in sorted(root):
|
||||
res.extend(serialize(root[key], key, indent + 1))
|
||||
elif (isinstance(root, abc.Sequence) and
|
||||
not isinstance(root, six.string_types)):
|
||||
not isinstance(root, str)):
|
||||
if rootkey is not None:
|
||||
res[0] += self.list_sep
|
||||
if self.before_list is not None:
|
||||
@ -135,7 +133,7 @@ class KeyValueView(object):
|
||||
for val in sorted(root, key=str):
|
||||
res.extend(serialize(val, None, indent + 1))
|
||||
else:
|
||||
str_root = six.text_type(root)
|
||||
str_root = str(root)
|
||||
if '\n' in str_root:
|
||||
# we are in a submodel
|
||||
if rootkey is not None:
|
||||
@ -198,7 +196,7 @@ class TableView(object):
|
||||
def __call__(self, model):
|
||||
res = self.header_fmt_str.format(ch=self.column_names)
|
||||
for raw_row in model[self.table_prop_name]:
|
||||
row = [six.text_type(raw_row[prop_name])
|
||||
row = [str(raw_row[prop_name])
|
||||
for prop_name in self.column_values]
|
||||
# double format is in case we have roundoff error
|
||||
res += '{0: <72}\n'.format(self.row_fmt_str.format(cv=row))
|
||||
|
@ -17,8 +17,6 @@
|
||||
This package defines several text views with headers
|
||||
"""
|
||||
|
||||
import six
|
||||
|
||||
|
||||
class HeaderView(object):
|
||||
"""A Text View With a Header
|
||||
@ -33,7 +31,7 @@ class HeaderView(object):
|
||||
self.header = header
|
||||
|
||||
def __call__(self, model):
|
||||
return six.text_type(self.header) + "\n" + six.text_type(model)
|
||||
return str(self.header) + "\n" + str(model)
|
||||
|
||||
|
||||
class TitledView(HeaderView):
|
||||
|
@ -31,8 +31,6 @@ try: # python 3
|
||||
except ImportError: # python 2
|
||||
import collections as abc
|
||||
|
||||
import six
|
||||
|
||||
from oslo_reports import _utils as utils
|
||||
|
||||
|
||||
@ -73,13 +71,13 @@ class KeyValueView(object):
|
||||
for key in sorted(rootmodel):
|
||||
res.append(serialize(rootmodel[key], key))
|
||||
elif (isinstance(rootmodel, abc.Sequence) and
|
||||
not isinstance(rootmodel, six.string_types)):
|
||||
not isinstance(rootmodel, str)):
|
||||
for val in sorted(rootmodel, key=str):
|
||||
res.append(serialize(val, 'item'))
|
||||
elif ET.iselement(rootmodel):
|
||||
res.append(rootmodel)
|
||||
else:
|
||||
res.text = six.text_type(rootmodel)
|
||||
res.text = str(rootmodel)
|
||||
|
||||
return res
|
||||
|
||||
|
@ -6,6 +6,5 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
Jinja2>=2.10 # BSD License (3 clause)
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
psutil>=3.2.2 # BSD
|
||||
six>=1.10.0 # MIT
|
||||
oslo.i18n>=3.15.3 # Apache-2.0
|
||||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user