From fac394f79cbf9213a340fdc887a5ed58d5262886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Tue, 2 Jun 2020 20:56:04 +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: I15d451f6a832b2e698b28e7351a36ef7aea92abe --- detail.py | 2 -- openstack_requirements/cmds/check_conflicts.py | 2 -- openstack_requirements/cmds/check_exists.py | 2 -- openstack_requirements/cmds/check_py2.py | 2 -- openstack_requirements/cmds/generate.py | 2 -- openstack_requirements/cmds/normalize_requirements.py | 3 --- openstack_requirements/tests/test_check_constraints.py | 1 - openstack_requirements/tests/test_update.py | 2 -- openstack_requirements/tests/test_update_pbr.py | 2 -- openstack_requirements/tests/test_update_suffix.py | 2 -- tools/check-install.py | 2 -- 11 files changed, 22 deletions(-) diff --git a/detail.py b/detail.py index 080bb1101b..8a468c57a5 100644 --- a/detail.py +++ b/detail.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import contextlib import json import os diff --git a/openstack_requirements/cmds/check_conflicts.py b/openstack_requirements/cmds/check_conflicts.py index 32be1e8f77..11c7be4cf8 100644 --- a/openstack_requirements/cmds/check_conflicts.py +++ b/openstack_requirements/cmds/check_conflicts.py @@ -14,8 +14,6 @@ """ -from __future__ import print_function - import argparse import sys import traceback diff --git a/openstack_requirements/cmds/check_exists.py b/openstack_requirements/cmds/check_exists.py index 76d171b762..5c958af57c 100644 --- a/openstack_requirements/cmds/check_exists.py +++ b/openstack_requirements/cmds/check_exists.py @@ -15,8 +15,6 @@ u-c. """ -from __future__ import print_function - import argparse from packaging.specifiers import SpecifierSet diff --git a/openstack_requirements/cmds/check_py2.py b/openstack_requirements/cmds/check_py2.py index c5e2abc8fd..09148547b2 100755 --- a/openstack_requirements/cmds/check_py2.py +++ b/openstack_requirements/cmds/check_py2.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import argparse import pkg_resources diff --git a/openstack_requirements/cmds/generate.py b/openstack_requirements/cmds/generate.py index 4e18919ad0..aca59ead92 100644 --- a/openstack_requirements/cmds/generate.py +++ b/openstack_requirements/cmds/generate.py @@ -11,8 +11,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import copy import hashlib import optparse diff --git a/openstack_requirements/cmds/normalize_requirements.py b/openstack_requirements/cmds/normalize_requirements.py index dfac9419bb..a5d728fb54 100644 --- a/openstack_requirements/cmds/normalize_requirements.py +++ b/openstack_requirements/cmds/normalize_requirements.py @@ -12,9 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function -from __future__ import unicode_literals - import argparse import os.path diff --git a/openstack_requirements/tests/test_check_constraints.py b/openstack_requirements/tests/test_check_constraints.py index 1048fcf64a..535ca49fa9 100644 --- a/openstack_requirements/tests/test_check_constraints.py +++ b/openstack_requirements/tests/test_check_constraints.py @@ -9,7 +9,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function import io import mock diff --git a/openstack_requirements/tests/test_update.py b/openstack_requirements/tests/test_update.py index b20264fd7f..9cc94a590d 100644 --- a/openstack_requirements/tests/test_update.py +++ b/openstack_requirements/tests/test_update.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import six import sys import textwrap diff --git a/openstack_requirements/tests/test_update_pbr.py b/openstack_requirements/tests/test_update_pbr.py index f9e46d37f3..81d5a65d41 100644 --- a/openstack_requirements/tests/test_update_pbr.py +++ b/openstack_requirements/tests/test_update_pbr.py @@ -16,8 +16,6 @@ # Based on test_update.py -from __future__ import print_function - import testtools from openstack_requirements.cmds import update diff --git a/openstack_requirements/tests/test_update_suffix.py b/openstack_requirements/tests/test_update_suffix.py index 54bff0b53d..b360d84b26 100644 --- a/openstack_requirements/tests/test_update_suffix.py +++ b/openstack_requirements/tests/test_update_suffix.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - import testtools from openstack_requirements.cmds import update diff --git a/tools/check-install.py b/tools/check-install.py index 2b2fef2822..ad29b7b8fb 100644 --- a/tools/check-install.py +++ b/tools/check-install.py @@ -1,7 +1,5 @@ #!/usr/bin/env python -from __future__ import print_function - import importlib import re import sys