From 15108e3be11b259335d067f3f762daa122bda06f Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 7 Feb 2024 11:53:53 +0900 Subject: [PATCH] Remove logic for python 2 support ... because python 2 support was already removed. Change-Id: I57e8ac2549ecf170d6b43bc0557fd388e025e536 --- oslo_reports/models/base.py | 6 +----- oslo_reports/tests/test_base_report.py | 6 +----- oslo_reports/views/text/generic.py | 5 +---- oslo_reports/views/xml/generic.py | 6 +----- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/oslo_reports/models/base.py b/oslo_reports/models/base.py index 447da2a..9de3c5b 100644 --- a/oslo_reports/models/base.py +++ b/oslo_reports/models/base.py @@ -21,13 +21,9 @@ store unserialized data generated by generators during the report serialization process. """ +from collections import abc import copy -try: # python 3 - from collections import abc -except ImportError: # python 2 - import collections as abc - class ReportModel(abc.MutableMapping): """A Report Data Model diff --git a/oslo_reports/tests/test_base_report.py b/oslo_reports/tests/test_base_report.py index 62c9ca9..11dd18b 100644 --- a/oslo_reports/tests/test_base_report.py +++ b/oslo_reports/tests/test_base_report.py @@ -12,13 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from collections import abc import re -try: # python 3 - from collections import abc -except ImportError: # python 2 - import collections as abc - from oslotest import base from oslo_reports.models import base as base_model diff --git a/oslo_reports/views/text/generic.py b/oslo_reports/views/text/generic.py index e69f653..3de3a45 100644 --- a/oslo_reports/views/text/generic.py +++ b/oslo_reports/views/text/generic.py @@ -18,10 +18,7 @@ This modules provides several generic views for serializing models into human-readable text. """ -try: # python 3 - from collections import abc -except ImportError: # python 2 - import collections as abc +from collections import abc class MultiView(object): diff --git a/oslo_reports/views/xml/generic.py b/oslo_reports/views/xml/generic.py index 0bf2e35..2d1cd94 100644 --- a/oslo_reports/views/xml/generic.py +++ b/oslo_reports/views/xml/generic.py @@ -23,14 +23,10 @@ and non-naive serializers check for this attribute and handle such strings specially) """ +from collections import abc import copy import xml.etree.ElementTree as ET -try: # python 3 - from collections import abc -except ImportError: # python 2 - import collections as abc - from oslo_reports import _utils as utils