From d113fc708793a7951b4053b035fbf2aa74aee595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Tue, 2 Jun 2020 20:12:42 +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: I2f9d4c9a760bd9a9dbb9cde5bcb8af24fd4b34b9 --- openstack_election/check_candidacy.py | 4 ---- openstack_election/cmds/change_owners.py | 5 ----- openstack_election/cmds/check_all_candidacies.py | 4 ---- openstack_election/cmds/check_candidacy.py | 4 ---- openstack_election/cmds/check_manual.py | 4 ---- openstack_election/cmds/ci_check_all_candidate_files.py | 4 ---- openstack_election/cmds/close_election.py | 4 ---- openstack_election/cmds/create_directories.py | 4 ---- openstack_election/cmds/generate_rolls.py | 4 ---- openstack_election/cmds/render_statistics.py | 4 ---- openstack_election/cmds/search_rolls.py | 4 ---- openstack_election/cmds/setup_election_config.py | 4 ---- openstack_election/cmds/template_emails.py | 2 -- openstack_election/cmds/update_governance.py | 4 ---- openstack_election/exception.py | 4 ---- openstack_election/owners.py | 2 -- openstack_election/require_py3.py | 4 ---- openstack_election/tests/base.py | 4 ---- openstack_election/tests/cmds/test_ci_checks.py | 4 ---- openstack_election/tests/fixtures.py | 4 ---- openstack_election/tests/test_utils.py | 4 ---- openstack_election/utils.py | 4 ---- tools/ptl-election-summary.py | 3 --- tools/tc-election-summary.py | 3 --- 24 files changed, 91 deletions(-) diff --git a/openstack_election/check_candidacy.py b/openstack_election/check_candidacy.py index 2c507e74..7fa17289 100755 --- a/openstack_election/check_candidacy.py +++ b/openstack_election/check_candidacy.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import datetime import os diff --git a/openstack_election/cmds/change_owners.py b/openstack_election/cmds/change_owners.py index 28902830..d42914b4 100644 --- a/openstack_election/cmds/change_owners.py +++ b/openstack_election/cmds/change_owners.py @@ -85,11 +85,6 @@ # Owners of at least 4 changes: 1682 # Owners of at least 5 changes: 1504 - -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import sys diff --git a/openstack_election/cmds/check_all_candidacies.py b/openstack_election/cmds/check_all_candidacies.py index 9e8c7ac8..85b1b1e6 100755 --- a/openstack_election/cmds/check_all_candidacies.py +++ b/openstack_election/cmds/check_all_candidacies.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import input import os diff --git a/openstack_election/cmds/check_candidacy.py b/openstack_election/cmds/check_candidacy.py index 3b81b1c5..a067d690 100755 --- a/openstack_election/cmds/check_candidacy.py +++ b/openstack_election/cmds/check_candidacy.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse from openstack_election import check_candidacy diff --git a/openstack_election/cmds/check_manual.py b/openstack_election/cmds/check_manual.py index 13f15c75..c22926da 100644 --- a/openstack_election/cmds/check_manual.py +++ b/openstack_election/cmds/check_manual.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse from openstack_election import check_candidacy diff --git a/openstack_election/cmds/ci_check_all_candidate_files.py b/openstack_election/cmds/ci_check_all_candidate_files.py index d0e3a338..18159795 100755 --- a/openstack_election/cmds/ci_check_all_candidate_files.py +++ b/openstack_election/cmds/ci_check_all_candidate_files.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import os import subprocess diff --git a/openstack_election/cmds/close_election.py b/openstack_election/cmds/close_election.py index 116a5748..7a0dcc6b 100755 --- a/openstack_election/cmds/close_election.py +++ b/openstack_election/cmds/close_election.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import os import yaml diff --git a/openstack_election/cmds/create_directories.py b/openstack_election/cmds/create_directories.py index a35136f8..eef23372 100755 --- a/openstack_election/cmds/create_directories.py +++ b/openstack_election/cmds/create_directories.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import os from openstack_election import utils diff --git a/openstack_election/cmds/generate_rolls.py b/openstack_election/cmds/generate_rolls.py index 188768cc..39cd2ffd 100755 --- a/openstack_election/cmds/generate_rolls.py +++ b/openstack_election/cmds/generate_rolls.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import glob import hashlib diff --git a/openstack_election/cmds/render_statistics.py b/openstack_election/cmds/render_statistics.py index c3578230..027a8e6e 100755 --- a/openstack_election/cmds/render_statistics.py +++ b/openstack_election/cmds/render_statistics.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import datetime import os diff --git a/openstack_election/cmds/search_rolls.py b/openstack_election/cmds/search_rolls.py index dace192b..ee1aed60 100644 --- a/openstack_election/cmds/search_rolls.py +++ b/openstack_election/cmds/search_rolls.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import os diff --git a/openstack_election/cmds/setup_election_config.py b/openstack_election/cmds/setup_election_config.py index 0fd326f2..4cc524b4 100755 --- a/openstack_election/cmds/setup_election_config.py +++ b/openstack_election/cmds/setup_election_config.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import datetime import pytz diff --git a/openstack_election/cmds/template_emails.py b/openstack_election/cmds/template_emails.py index 56baa702..571e605b 100644 --- a/openstack_election/cmds/template_emails.py +++ b/openstack_election/cmds/template_emails.py @@ -1,5 +1,3 @@ -from __future__ import print_function -from __future__ import unicode_literals import argparse import jinja2 diff --git a/openstack_election/cmds/update_governance.py b/openstack_election/cmds/update_governance.py index f9ba063d..dcc10c05 100644 --- a/openstack_election/cmds/update_governance.py +++ b/openstack_election/cmds/update_governance.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import argparse import os import re diff --git a/openstack_election/exception.py b/openstack_election/exception.py index d20218c2..d186febc 100644 --- a/openstack_election/exception.py +++ b/openstack_election/exception.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - class ElectionException(Exception): """Base Election Exception diff --git a/openstack_election/owners.py b/openstack_election/owners.py index 99aad98d..2fcba679 100644 --- a/openstack_election/owners.py +++ b/openstack_election/owners.py @@ -17,8 +17,6 @@ # counts for each governance project-team, as well as a combined set # for all teams. -from __future__ import print_function - import csv import datetime import os diff --git a/openstack_election/require_py3.py b/openstack_election/require_py3.py index 7506757f..1f81f8d7 100644 --- a/openstack_election/require_py3.py +++ b/openstack_election/require_py3.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import sys if sys.version_info.major < 3: diff --git a/openstack_election/tests/base.py b/openstack_election/tests/base.py index 90d86096..a46cfabc 100644 --- a/openstack_election/tests/base.py +++ b/openstack_election/tests/base.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import testtools from openstack_election.tests import fixtures as election_fixtures diff --git a/openstack_election/tests/cmds/test_ci_checks.py b/openstack_election/tests/cmds/test_ci_checks.py index 398f673a..58ec37ad 100644 --- a/openstack_election/tests/cmds/test_ci_checks.py +++ b/openstack_election/tests/cmds/test_ci_checks.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import mock from openstack_election.cmds import ci_check_all_candidate_files diff --git a/openstack_election/tests/fixtures.py b/openstack_election/tests/fixtures.py index ae99b840..301b4b73 100644 --- a/openstack_election/tests/fixtures.py +++ b/openstack_election/tests/fixtures.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import fixtures import os diff --git a/openstack_election/tests/test_utils.py b/openstack_election/tests/test_utils.py index a1b5c685..2f7891d2 100644 --- a/openstack_election/tests/test_utils.py +++ b/openstack_election/tests/test_utils.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import mock from openstack_election import exception diff --git a/openstack_election/utils.py b/openstack_election/utils.py index ba10448a..ba02827f 100644 --- a/openstack_election/utils.py +++ b/openstack_election/utils.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - import datetime import json import os diff --git a/tools/ptl-election-summary.py b/tools/ptl-election-summary.py index ba206e67..cf85d672 100755 --- a/tools/ptl-election-summary.py +++ b/tools/ptl-election-summary.py @@ -12,9 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import division -from __future__ import print_function - import glob import os import prettytable diff --git a/tools/tc-election-summary.py b/tools/tc-election-summary.py index 9969e21e..26cc5df7 100755 --- a/tools/tc-election-summary.py +++ b/tools/tc-election-summary.py @@ -12,9 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import division -from __future__ import print_function - import prettytable CIVS_BASE = 'https://civs.cs.cornell.edu/cgi-bin/results.pl'