From f72403ad3ca4ff2be939b1e392230b61b1275c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Tue, 2 Jun 2020 20:06:38 +0200 Subject: [PATCH] Stop to use the __future__ module. The __future__ module [1] was used in this context to ensure compatibility between python 2 and python 3. We previously dropped the support of python 2.7 [2] and now we only support python 3 so we don't need to continue to use this module and the imports listed below. Imports commonly used and their related PEPs: - `division` is related to PEP 238 [3] - `print_function` is related to PEP 3105 [4] - `unicode_literals` is related to PEP 3112 [5] - `with_statement` is related to PEP 343 [6] - `absolute_import` is related to PEP 328 [7] [1] https://docs.python.org/3/library/__future__.html [2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html [3] https://www.python.org/dev/peps/pep-0238 [4] https://www.python.org/dev/peps/pep-3105 [5] https://www.python.org/dev/peps/pep-3112 [6] https://www.python.org/dev/peps/pep-0343 [7] https://www.python.org/dev/peps/pep-0328 Change-Id: Ib1ed5b598a52375e29e247db9ab4786df5b6d142 --- charms_openstack/adapters.py | 1 - charms_openstack/ip.py | 1 - setup.py | 1 - unit_tests/test_charms_openstack_devices_pci.py | 2 -- unit_tests/test_charms_openstack_ip.py | 1 - unit_tests/test_charms_openstack_sdn_ovs.py | 1 - unit_tests/test_charms_openstack_test_utils.py | 1 - 7 files changed, 8 deletions(-) diff --git a/charms_openstack/adapters.py b/charms_openstack/adapters.py index 1fea5c1..f383240 100644 --- a/charms_openstack/adapters.py +++ b/charms_openstack/adapters.py @@ -13,7 +13,6 @@ # limitations under the License. """Adapter classes and utilities for use with Reactive interfaces""" -from __future__ import absolute_import import collections import itertools diff --git a/charms_openstack/ip.py b/charms_openstack/ip.py index 2219085..2d23a84 100644 --- a/charms_openstack/ip.py +++ b/charms_openstack/ip.py @@ -13,7 +13,6 @@ # limitations under the License. # need/want absolute imports for the package imports to work properly -from __future__ import absolute_import import netaddr import charmhelpers.core.hookenv as hookenv diff --git a/setup.py b/setup.py index 7c208a6..e89903e 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import print_function import sys from setuptools import setup, find_packages diff --git a/unit_tests/test_charms_openstack_devices_pci.py b/unit_tests/test_charms_openstack_devices_pci.py index 1c35250..825dcbe 100644 --- a/unit_tests/test_charms_openstack_devices_pci.py +++ b/unit_tests/test_charms_openstack_devices_pci.py @@ -19,8 +19,6 @@ # mock out some charmhelpers libraries as they have apt install side effects # sys.modules['charmhelpers.contrib.openstack.utils'] = mock.MagicMock() # sys.modules['charmhelpers.contrib.network.ip'] = mock.MagicMock() - -from __future__ import absolute_import import mock import charms_openstack.devices.pci as pci diff --git a/unit_tests/test_charms_openstack_ip.py b/unit_tests/test_charms_openstack_ip.py index 6627f47..941d337 100644 --- a/unit_tests/test_charms_openstack_ip.py +++ b/unit_tests/test_charms_openstack_ip.py @@ -19,7 +19,6 @@ # mock out some charmhelpers libraries as they have apt install side effects # sys.modules['charmhelpers.contrib.openstack.utils'] = mock.MagicMock() # sys.modules['charmhelpers.contrib.network.ip'] = mock.MagicMock() -from __future__ import absolute_import import unit_tests.utils as utils diff --git a/unit_tests/test_charms_openstack_sdn_ovs.py b/unit_tests/test_charms_openstack_sdn_ovs.py index 1a43d19..c9dfb44 100644 --- a/unit_tests/test_charms_openstack_sdn_ovs.py +++ b/unit_tests/test_charms_openstack_sdn_ovs.py @@ -19,7 +19,6 @@ # mock out some charmhelpers libraries as they have apt install side effects # sys.modules['charmhelpers.contrib.openstack.utils'] = mock.MagicMock() # sys.modules['charmhelpers.contrib.network.ip'] = mock.MagicMock() -from __future__ import absolute_import import unit_tests.utils as utils diff --git a/unit_tests/test_charms_openstack_test_utils.py b/unit_tests/test_charms_openstack_test_utils.py index 34a80dc..06ec374 100644 --- a/unit_tests/test_charms_openstack_test_utils.py +++ b/unit_tests/test_charms_openstack_test_utils.py @@ -18,7 +18,6 @@ # mock out some charmhelpers libraries as they have apt install side effects # sys.modules['charmhelpers.contrib.openstack.utils'] = mock.MagicMock() # sys.modules['charmhelpers.contrib.network.ip'] = mock.MagicMock() -from __future__ import absolute_import import unittest