diff --git a/lower-constraints.txt b/lower-constraints.txt
index 20e3c08..8113195 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -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
diff --git a/oslo_reports/_utils.py b/oslo_reports/_utils.py
index 149aef7..e19f172 100644
--- a/oslo_reports/_utils.py
+++ b/oslo_reports/_utils.py
@@ -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
diff --git a/oslo_reports/models/base.py b/oslo_reports/models/base.py
index 6def606..447da2a 100644
--- a/oslo_reports/models/base.py
+++ b/oslo_reports/models/base.py
@@ -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)
diff --git a/oslo_reports/report.py b/oslo_reports/report.py
index fa8c07b..f12f634 100644
--- a/oslo_reports/report.py
+++ b/oslo_reports/report.py
@@ -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):
diff --git a/oslo_reports/tests/test_base_report.py b/oslo_reports/tests/test_base_report.py
index 547cec7..62c9ca9 100644
--- a/oslo_reports/tests/test_base_report.py
+++ b/oslo_reports/tests/test_base_report.py
@@ -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)
diff --git a/oslo_reports/tests/test_guru_meditation_report.py b/oslo_reports/tests/test_guru_meditation_report.py
index d4c073c..a77af4e 100644
--- a/oslo_reports/tests/test_guru_meditation_report.py
+++ b/oslo_reports/tests/test_guru_meditation_report.py
@@ -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())
diff --git a/oslo_reports/tests/test_openstack_generators.py b/oslo_reports/tests/test_openstack_generators.py
index 84bd46d..3cb0378 100644
--- a/oslo_reports/tests/test_openstack_generators.py
+++ b/oslo_reports/tests/test_openstack_generators.py
@@ -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))
diff --git a/oslo_reports/tests/test_views.py b/oslo_reports/tests/test_views.py
index 7e01801..195390c 100644
--- a/oslo_reports/tests/test_views.py
+++ b/oslo_reports/tests/test_views.py
@@ -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('