From 4816bb4f43ee22f20fa7d75a79db659cc1cdeaf3 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 22 Jun 2020 19:05:30 -0700 Subject: [PATCH] More boilerplate fixes. (#70224) * Fix boilerplate in hacking dir. * Fix boilerplate in docs dir. * Fix boilerplate in integration tests. * Fix boilerplate in examples. --- docs/bin/find-plugin-refs.py | 2 + docs/docsite/_extensions/pygments_lexer.py | 3 +- .../_themes/sphinx_rtd_theme/__init__.py | 3 + docs/docsite/rst/conf.py | 3 + examples/scripts/uptime.py | 3 + hacking/fix_test_syntax.py | 3 + hacking/get_library.py | 3 + hacking/report.py | 3 +- hacking/return_skeleton_generator.py | 4 +- hacking/test-module.py | 3 + .../gen_distribution_version_testcase.py | 2 + .../ansible-runner/files/adhoc_example1.py | 3 + .../ansible-runner/files/playbook_example1.py | 3 + .../targets/async/library/async_test.py | 3 + .../targets/async_fail/library/async_test.py | 3 + .../builtin_vars_prompt/test-vars_prompt.py | 3 + .../targets/expect/files/test_command.py | 3 + .../targets/get_url/files/testserver.py | 3 + .../integration/targets/group/files/gidget.py | 3 + .../fake_connectors/bad_exec.py | 3 + .../fake_connectors/bad_put_file.py | 3 + .../vmware_inventory.py | 4 +- .../integration/targets/infra/library/test.py | 3 + .../module_precedence/lib_no_extension/ping | 2 + .../lib_with_extension/ping.py | 2 + .../multiple_roles/bar/library/ping.py | 2 + .../multiple_roles/foo/library/ping.py | 2 + .../roles_no_extension/foo/library/ping | 2 + .../roles_with_extension/foo/library/ping.py | 2 + .../targets/module_utils/library/test.py | 2 + .../module_utils/library/test_env_override.py | 3 + .../module_utils/library/test_failure.py | 2 + .../module_utils/library/test_override.py | 3 + test/integration/targets/pause/test-pause.py | 3 + .../files/ansible_test_pip_chdir/__init__.py | 4 + test/integration/targets/pip/files/setup.py | 3 + .../targets/run_modules/library/test.py | 3 + .../targets/script/files/no_shebang.py | 3 + .../service/files/ansible_test_service.py | 3 + .../setup_rpm_repo/files/create-repo.py | 2 + .../role_filter/filter_plugins/myplugin.py | 3 + .../targets/uri/files/testserver.py | 3 + .../ansible-var-precedence-check.py | 3 + .../targets/vault/test-vault-client.py | 3 + .../targets/wait_for/files/testserver.py | 3 + .../library/helloworld.py | 3 + test/sanity/ignore.txt | 91 +------------------ 47 files changed, 128 insertions(+), 93 deletions(-) diff --git a/docs/bin/find-plugin-refs.py b/docs/bin/find-plugin-refs.py index dee8ce68c9c..d603409d688 100755 --- a/docs/bin/find-plugin-refs.py +++ b/docs/bin/find-plugin-refs.py @@ -8,6 +8,8 @@ # For my listing of what needs to be changed after running this script, see the comment at the end # of the file +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type import glob import os diff --git a/docs/docsite/_extensions/pygments_lexer.py b/docs/docsite/_extensions/pygments_lexer.py index 62c7fdfd76a..d672ee77c80 100644 --- a/docs/docsite/_extensions/pygments_lexer.py +++ b/docs/docsite/_extensions/pygments_lexer.py @@ -33,7 +33,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import absolute_import, print_function +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type from pygments.lexer import LexerContext, ExtendedRegexLexer, DelegatingLexer, RegexLexer, bygroups, include from pygments.lexers import DiffLexer diff --git a/docs/docsite/_themes/sphinx_rtd_theme/__init__.py b/docs/docsite/_themes/sphinx_rtd_theme/__init__.py index f449982ec29..61c05417cb6 100644 --- a/docs/docsite/_themes/sphinx_rtd_theme/__init__.py +++ b/docs/docsite/_themes/sphinx_rtd_theme/__init__.py @@ -3,6 +3,9 @@ From https://github.com/ryan-roemer/sphinx-bootstrap-theme. """ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from os import path __version__ = '0.2.5b2' diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py index e564808d7cf..f26fdf37db5 100644 --- a/docs/docsite/rst/conf.py +++ b/docs/docsite/rst/conf.py @@ -13,6 +13,9 @@ # All configuration values have a default value; values that are commented out # serve to show the default value. +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys import os diff --git a/examples/scripts/uptime.py b/examples/scripts/uptime.py index 507e384ff83..c403dd91019 100755 --- a/examples/scripts/uptime.py +++ b/examples/scripts/uptime.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from ansible.executor.task_queue_manager import TaskQueueManager from ansible.inventory.manager import InventoryManager from ansible.parsing.dataloader import DataLoader diff --git a/hacking/fix_test_syntax.py b/hacking/fix_test_syntax.py index 4ac990bd01c..7178033406a 100755 --- a/hacking/fix_test_syntax.py +++ b/hacking/fix_test_syntax.py @@ -31,6 +31,9 @@ # Which should be converted to: # var|string is search('foo') +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import argparse import os import re diff --git a/hacking/get_library.py b/hacking/get_library.py index ea5d44bf3d0..23bf4a39bb5 100755 --- a/hacking/get_library.py +++ b/hacking/get_library.py @@ -18,6 +18,9 @@ # along with Ansible. If not, see . # +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import ansible.constants as C import sys diff --git a/hacking/report.py b/hacking/report.py index 580d87dd00b..58b3a6b915a 100755 --- a/hacking/report.py +++ b/hacking/report.py @@ -2,7 +2,8 @@ # PYTHON_ARGCOMPLETE_OK """A tool to aggregate data about Ansible source and testing into a sqlite DB for reporting.""" -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type import argparse import json diff --git a/hacking/return_skeleton_generator.py b/hacking/return_skeleton_generator.py index adfe3d76c12..83fd76a8920 100755 --- a/hacking/return_skeleton_generator.py +++ b/hacking/return_skeleton_generator.py @@ -26,7 +26,9 @@ # You will likely want to adjust this to remove sensitive data or # ensure the `returns` value is correct, and to write a useful description -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from collections import OrderedDict import json import sys diff --git a/hacking/test-module.py b/hacking/test-module.py index 1a063082fde..e954883cae9 100755 --- a/hacking/test-module.py +++ b/hacking/test-module.py @@ -28,6 +28,9 @@ # ./hacking/test-module.py -m lib/ansible/modules/files/lineinfile.py -a "dest=/etc/exports line='/srv/home hostname1(rw,sync)'" --check # ./hacking/test-module.py -m lib/ansible/modules/commands/command.py -a "echo hello" -n -o "test_hello" +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import glob import optparse import os diff --git a/hacking/tests/gen_distribution_version_testcase.py b/hacking/tests/gen_distribution_version_testcase.py index 21c51d358ed..39c0a2fc2c9 100755 --- a/hacking/tests/gen_distribution_version_testcase.py +++ b/hacking/tests/gen_distribution_version_testcase.py @@ -9,6 +9,8 @@ and the current ansible_facts regarding the distribution version. This assumes a working ansible version in the path. """ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type import os.path import subprocess diff --git a/test/integration/targets/ansible-runner/files/adhoc_example1.py b/test/integration/targets/ansible-runner/files/adhoc_example1.py index 3e0d8414624..ab24bcad96d 100644 --- a/test/integration/targets/ansible-runner/files/adhoc_example1.py +++ b/test/integration/targets/ansible-runner/files/adhoc_example1.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json import os import sys diff --git a/test/integration/targets/ansible-runner/files/playbook_example1.py b/test/integration/targets/ansible-runner/files/playbook_example1.py index 83cb19ff26b..550c1857cb9 100644 --- a/test/integration/targets/ansible-runner/files/playbook_example1.py +++ b/test/integration/targets/ansible-runner/files/playbook_example1.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json import os import sys diff --git a/test/integration/targets/async/library/async_test.py b/test/integration/targets/async/library/async_test.py index 3098bc601cb..723058ab871 100644 --- a/test/integration/targets/async/library/async_test.py +++ b/test/integration/targets/async/library/async_test.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json import sys diff --git a/test/integration/targets/async_fail/library/async_test.py b/test/integration/targets/async_fail/library/async_test.py index 838f2f07ea4..e0cbd6fee51 100644 --- a/test/integration/targets/async_fail/library/async_test.py +++ b/test/integration/targets/async_fail/library/async_test.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json import sys import time diff --git a/test/integration/targets/builtin_vars_prompt/test-vars_prompt.py b/test/integration/targets/builtin_vars_prompt/test-vars_prompt.py index 6c805fdd905..93958fc2adb 100644 --- a/test/integration/targets/builtin_vars_prompt/test-vars_prompt.py +++ b/test/integration/targets/builtin_vars_prompt/test-vars_prompt.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import pexpect import sys diff --git a/test/integration/targets/expect/files/test_command.py b/test/integration/targets/expect/files/test_command.py index 685c50c229b..e45c847e97d 100644 --- a/test/integration/targets/expect/files/test_command.py +++ b/test/integration/targets/expect/files/test_command.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys try: diff --git a/test/integration/targets/get_url/files/testserver.py b/test/integration/targets/get_url/files/testserver.py index 81043b6616c..24967d4f0d8 100644 --- a/test/integration/targets/get_url/files/testserver.py +++ b/test/integration/targets/get_url/files/testserver.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys if __name__ == '__main__': diff --git a/test/integration/targets/group/files/gidget.py b/test/integration/targets/group/files/gidget.py index 128985e731d..4b771516fdd 100644 --- a/test/integration/targets/group/files/gidget.py +++ b/test/integration/targets/group/files/gidget.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import grp gids = [g.gr_gid for g in grp.getgrall()] diff --git a/test/integration/targets/ignore_unreachable/fake_connectors/bad_exec.py b/test/integration/targets/ignore_unreachable/fake_connectors/bad_exec.py index b5e9ca88a62..0d8c385b179 100644 --- a/test/integration/targets/ignore_unreachable/fake_connectors/bad_exec.py +++ b/test/integration/targets/ignore_unreachable/fake_connectors/bad_exec.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import ansible.plugins.connection.local as ansible_local from ansible.errors import AnsibleConnectionFailure diff --git a/test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py b/test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py index 98927997a1c..d4131f45e01 100644 --- a/test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py +++ b/test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import ansible.plugins.connection.local as ansible_local from ansible.errors import AnsibleConnectionFailure diff --git a/test/integration/targets/incidental_script_inventory_vmware_inventory/vmware_inventory.py b/test/integration/targets/incidental_script_inventory_vmware_inventory/vmware_inventory.py index 0271110c965..21d4153b5b0 100755 --- a/test/integration/targets/incidental_script_inventory_vmware_inventory/vmware_inventory.py +++ b/test/integration/targets/incidental_script_inventory_vmware_inventory/vmware_inventory.py @@ -25,7 +25,9 @@ $ jq '._meta.hostvars[].config' data.json | head "firmware": "bios", """ -from __future__ import print_function +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import atexit import datetime diff --git a/test/integration/targets/infra/library/test.py b/test/integration/targets/infra/library/test.py index 9386057517a..dbc4b610855 100644 --- a/test/integration/targets/infra/library/test.py +++ b/test/integration/targets/infra/library/test.py @@ -1,6 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from ansible.module_utils.basic import AnsibleModule diff --git a/test/integration/targets/module_precedence/lib_no_extension/ping b/test/integration/targets/module_precedence/lib_no_extension/ping index e30706e8946..a28f4699ee7 100644 --- a/test/integration/targets/module_precedence/lib_no_extension/ping +++ b/test/integration/targets/module_precedence/lib_no_extension/ping @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], diff --git a/test/integration/targets/module_precedence/lib_with_extension/ping.py b/test/integration/targets/module_precedence/lib_with_extension/ping.py index e30706e8946..a28f4699ee7 100644 --- a/test/integration/targets/module_precedence/lib_with_extension/ping.py +++ b/test/integration/targets/module_precedence/lib_with_extension/ping.py @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], diff --git a/test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py b/test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py index e7776001e24..98ef7b448c0 100644 --- a/test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py +++ b/test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], diff --git a/test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py b/test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py index a6d153baf2a..8860b7aa658 100644 --- a/test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py +++ b/test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], diff --git a/test/integration/targets/module_precedence/roles_no_extension/foo/library/ping b/test/integration/targets/module_precedence/roles_no_extension/foo/library/ping index a6d153baf2a..8860b7aa658 100644 --- a/test/integration/targets/module_precedence/roles_no_extension/foo/library/ping +++ b/test/integration/targets/module_precedence/roles_no_extension/foo/library/ping @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], diff --git a/test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.py b/test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.py index a6d153baf2a..8860b7aa658 100644 --- a/test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.py +++ b/test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.py @@ -19,6 +19,8 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], diff --git a/test/integration/targets/module_utils/library/test.py b/test/integration/targets/module_utils/library/test.py index fbb7e6e224f..fb6c8a81c35 100644 --- a/test/integration/targets/module_utils/library/test.py +++ b/test/integration/targets/module_utils/library/test.py @@ -2,6 +2,8 @@ # Most of these names are only available via PluginLoader so pylint doesn't # know they exist # pylint: disable=no-name-in-module +__metaclass__ = type + results = {} # Test import with no from diff --git a/test/integration/targets/module_utils/library/test_env_override.py b/test/integration/targets/module_utils/library/test_env_override.py index 94e3051bf29..ebfb5ddff06 100644 --- a/test/integration/targets/module_utils/library/test_env_override.py +++ b/test/integration/targets/module_utils/library/test_env_override.py @@ -2,6 +2,9 @@ # Most of these names are only available via PluginLoader so pylint doesn't # know they exist # pylint: disable=no-name-in-module +from __future__ import absolute_import, division, print_function +__metaclass__ = type + from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.json_utils import data from ansible.module_utils.mork import data as mork_data diff --git a/test/integration/targets/module_utils/library/test_failure.py b/test/integration/targets/module_utils/library/test_failure.py index e1a87c2e719..258217a74e7 100644 --- a/test/integration/targets/module_utils/library/test_failure.py +++ b/test/integration/targets/module_utils/library/test_failure.py @@ -1,4 +1,6 @@ #!/usr/bin/python +from __future__ import absolute_import, division, print_function +__metaclass__ = type results = {} # Test that we are rooted correctly diff --git a/test/integration/targets/module_utils/library/test_override.py b/test/integration/targets/module_utils/library/test_override.py index 9ff54bf949f..b4e21cdd189 100644 --- a/test/integration/targets/module_utils/library/test_override.py +++ b/test/integration/targets/module_utils/library/test_override.py @@ -1,4 +1,7 @@ #!/usr/bin/python +from __future__ import absolute_import, division, print_function +__metaclass__ = type + from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.facts import data diff --git a/test/integration/targets/pause/test-pause.py b/test/integration/targets/pause/test-pause.py index 7b37c666464..866a2df6c9d 100755 --- a/test/integration/targets/pause/test-pause.py +++ b/test/integration/targets/pause/test-pause.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import pexpect import sys diff --git a/test/integration/targets/pip/files/ansible_test_pip_chdir/__init__.py b/test/integration/targets/pip/files/ansible_test_pip_chdir/__init__.py index c8a79430f96..5d1f9aec746 100644 --- a/test/integration/targets/pip/files/ansible_test_pip_chdir/__init__.py +++ b/test/integration/targets/pip/files/ansible_test_pip_chdir/__init__.py @@ -1,2 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + + def main(): print("success") diff --git a/test/integration/targets/pip/files/setup.py b/test/integration/targets/pip/files/setup.py index 094064b7c0e..aaf21875ca2 100755 --- a/test/integration/targets/pip/files/setup.py +++ b/test/integration/targets/pip/files/setup.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from setuptools import setup, find_packages setup( diff --git a/test/integration/targets/run_modules/library/test.py b/test/integration/targets/run_modules/library/test.py index bbe3182c585..15a92e9128f 100644 --- a/test/integration/targets/run_modules/library/test.py +++ b/test/integration/targets/run_modules/library/test.py @@ -1,5 +1,8 @@ #!/usr/bin/python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from ansible.module_utils.basic import AnsibleModule module = AnsibleModule(argument_spec=dict()) diff --git a/test/integration/targets/script/files/no_shebang.py b/test/integration/targets/script/files/no_shebang.py index c6c813afc45..f2d386a0b25 100644 --- a/test/integration/targets/script/files/no_shebang.py +++ b/test/integration/targets/script/files/no_shebang.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys sys.stdout.write("Script with shebang omitted") diff --git a/test/integration/targets/service/files/ansible_test_service.py b/test/integration/targets/service/files/ansible_test_service.py index c4feed8502f..522493fcc77 100644 --- a/test/integration/targets/service/files/ansible_test_service.py +++ b/test/integration/targets/service/files/ansible_test_service.py @@ -3,6 +3,9 @@ # this is mostly based off of the code found here: # http://code.activestate.com/recipes/278731-creating-a-daemon-the-python-way/ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import resource import signal diff --git a/test/integration/targets/setup_rpm_repo/files/create-repo.py b/test/integration/targets/setup_rpm_repo/files/create-repo.py index 2337463c424..ec2c1240125 100644 --- a/test/integration/targets/setup_rpm_repo/files/create-repo.py +++ b/test/integration/targets/setup_rpm_repo/files/create-repo.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type import sys from collections import namedtuple diff --git a/test/integration/targets/template/role_filter/filter_plugins/myplugin.py b/test/integration/targets/template/role_filter/filter_plugins/myplugin.py index 44935ab0ea1..b0a8889439a 100644 --- a/test/integration/targets/template/role_filter/filter_plugins/myplugin.py +++ b/test/integration/targets/template/role_filter/filter_plugins/myplugin.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + class FilterModule(object): def filters(self): diff --git a/test/integration/targets/uri/files/testserver.py b/test/integration/targets/uri/files/testserver.py index 81043b6616c..24967d4f0d8 100644 --- a/test/integration/targets/uri/files/testserver.py +++ b/test/integration/targets/uri/files/testserver.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys if __name__ == '__main__': diff --git a/test/integration/targets/var_precedence/ansible-var-precedence-check.py b/test/integration/targets/var_precedence/ansible-var-precedence-check.py index e9b24adeff8..fc31688be2e 100755 --- a/test/integration/targets/var_precedence/ansible-var-precedence-check.py +++ b/test/integration/targets/var_precedence/ansible-var-precedence-check.py @@ -3,6 +3,9 @@ # A tool to check the order of precedence for ansible variables # https://github.com/ansible/ansible/blob/devel/test/integration/test_var_precedence.yml +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json import os import sys diff --git a/test/integration/targets/vault/test-vault-client.py b/test/integration/targets/vault/test-vault-client.py index a2f17dc5cfa..ee46188742d 100755 --- a/test/integration/targets/vault/test-vault-client.py +++ b/test/integration/targets/vault/test-vault-client.py @@ -1,6 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} diff --git a/test/integration/targets/wait_for/files/testserver.py b/test/integration/targets/wait_for/files/testserver.py index 1f6f1187db2..2b728b6c10e 100644 --- a/test/integration/targets/wait_for/files/testserver.py +++ b/test/integration/targets/wait_for/files/testserver.py @@ -1,3 +1,6 @@ +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys if __name__ == '__main__': diff --git a/test/integration/targets/want_json_modules_posix/library/helloworld.py b/test/integration/targets/want_json_modules_posix/library/helloworld.py index ad0301cbcb9..80f876175d9 100644 --- a/test/integration/targets/want_json_modules_posix/library/helloworld.py +++ b/test/integration/targets/want_json_modules_posix/library/helloworld.py @@ -16,6 +16,9 @@ # WANT_JSON +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json import sys diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index ca86e364009..ff4cfeac7d8 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -1,18 +1,8 @@ -docs/bin/find-plugin-refs.py future-import-boilerplate -docs/bin/find-plugin-refs.py metaclass-boilerplate -docs/docsite/_extensions/pygments_lexer.py future-import-boilerplate -docs/docsite/_extensions/pygments_lexer.py metaclass-boilerplate -docs/docsite/_themes/sphinx_rtd_theme/__init__.py future-import-boilerplate -docs/docsite/_themes/sphinx_rtd_theme/__init__.py metaclass-boilerplate -docs/docsite/rst/conf.py future-import-boilerplate -docs/docsite/rst/conf.py metaclass-boilerplate docs/docsite/rst/dev_guide/testing/sanity/no-smart-quotes.rst no-smart-quotes examples/play.yml shebang examples/scripts/ConfigureRemotingForAnsible.ps1 pslint:PSCustomUseLiteralPath examples/scripts/upgrade_to_ps3.ps1 pslint:PSCustomUseLiteralPath examples/scripts/upgrade_to_ps3.ps1 pslint:PSUseApprovedVerbs -examples/scripts/uptime.py future-import-boilerplate -examples/scripts/uptime.py metaclass-boilerplate hacking/build-ansible.py shebang # only run by release engineers, Python 3.6+ required hacking/build_library/build_ansible/announce.py compile-2.6!skip # release process only, 3.6+ required hacking/build_library/build_ansible/announce.py compile-2.7!skip # release process only, 3.6+ required @@ -41,18 +31,6 @@ hacking/build_library/build_ansible/command_plugins/release_announcement.py comp hacking/build_library/build_ansible/command_plugins/update_intersphinx.py compile-2.6!skip # release process and docs build only, 3.6+ required hacking/build_library/build_ansible/command_plugins/update_intersphinx.py compile-2.7!skip # release process and docs build only, 3.6+ required hacking/build_library/build_ansible/command_plugins/update_intersphinx.py compile-3.5!skip # release process and docs build only, 3.6+ required -hacking/fix_test_syntax.py future-import-boilerplate -hacking/fix_test_syntax.py metaclass-boilerplate -hacking/get_library.py future-import-boilerplate -hacking/get_library.py metaclass-boilerplate -hacking/report.py future-import-boilerplate -hacking/report.py metaclass-boilerplate -hacking/return_skeleton_generator.py future-import-boilerplate -hacking/return_skeleton_generator.py metaclass-boilerplate -hacking/test-module.py future-import-boilerplate -hacking/test-module.py metaclass-boilerplate -hacking/tests/gen_distribution_version_testcase.py future-import-boilerplate -hacking/tests/gen_distribution_version_testcase.py metaclass-boilerplate lib/ansible/cli/console.py pylint:blacklisted-name lib/ansible/cli/scripts/ansible_cli_stub.py shebang lib/ansible/cli/scripts/ansible_connection_cli_stub.py shebang @@ -212,39 +190,19 @@ lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version lib/ansible/plugins/strategy/__init__.py pylint:blacklisted-name lib/ansible/plugins/strategy/linear.py pylint:blacklisted-name lib/ansible/vars/hostvars.py pylint:blacklisted-name -test/integration/targets/ansible-runner/files/adhoc_example1.py future-import-boilerplate -test/integration/targets/ansible-runner/files/adhoc_example1.py metaclass-boilerplate -test/integration/targets/ansible-runner/files/playbook_example1.py future-import-boilerplate -test/integration/targets/ansible-runner/files/playbook_example1.py metaclass-boilerplate test/integration/targets/ansible-test/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level test/integration/targets/ansible-test-docker/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level test/integration/targets/ansible-test-docker/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level test/integration/targets/ansible-test-docker/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level -test/integration/targets/async/library/async_test.py future-import-boilerplate -test/integration/targets/async/library/async_test.py metaclass-boilerplate -test/integration/targets/async_fail/library/async_test.py future-import-boilerplate -test/integration/targets/async_fail/library/async_test.py metaclass-boilerplate -test/integration/targets/collections_plugin_namespace/collection_root/ansible_collections/my_ns/my_col/plugins/lookup/lookup_no_future_boilerplate.py future-import-boilerplate +test/integration/targets/collections_plugin_namespace/collection_root/ansible_collections/my_ns/my_col/plugins/lookup/lookup_no_future_boilerplate.py future-import-boilerplate # testing Python 2.x implicit relative imports test/integration/targets/collections_relative_imports/collection_root/ansible_collections/my_ns/my_col/plugins/module_utils/my_util2.py pylint:relative-beyond-top-level test/integration/targets/collections_relative_imports/collection_root/ansible_collections/my_ns/my_col/plugins/module_utils/my_util3.py pylint:relative-beyond-top-level test/integration/targets/collections_relative_imports/collection_root/ansible_collections/my_ns/my_col/plugins/modules/my_module.py pylint:relative-beyond-top-level -test/integration/targets/expect/files/test_command.py future-import-boilerplate -test/integration/targets/expect/files/test_command.py metaclass-boilerplate test/integration/targets/gathering_facts/library/bogus_facts shebang test/integration/targets/gathering_facts/library/facts_one shebang test/integration/targets/gathering_facts/library/facts_two shebang -test/integration/targets/get_url/files/testserver.py future-import-boilerplate -test/integration/targets/get_url/files/testserver.py metaclass-boilerplate -test/integration/targets/group/files/gidget.py future-import-boilerplate -test/integration/targets/group/files/gidget.py metaclass-boilerplate -test/integration/targets/ignore_unreachable/fake_connectors/bad_exec.py future-import-boilerplate -test/integration/targets/ignore_unreachable/fake_connectors/bad_exec.py metaclass-boilerplate -test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py future-import-boilerplate -test/integration/targets/ignore_unreachable/fake_connectors/bad_put_file.py metaclass-boilerplate -test/integration/targets/incidental_script_inventory_vmware_inventory/vmware_inventory.py future-import-boilerplate -test/integration/targets/incidental_script_inventory_vmware_inventory/vmware_inventory.py metaclass-boilerplate test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.0/DSCResources/ANSIBLE_xSetReboot/ANSIBLE_xSetReboot.psm1 pslint!skip test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.0/DSCResources/ANSIBLE_xTestResource/ANSIBLE_xTestResource.psm1 pslint!skip test/integration/targets/incidental_win_dsc/files/xTestDsc/1.0.0/xTestDsc.psd1 pslint!skip @@ -255,65 +213,20 @@ test/integration/targets/incidental_win_reboot/templates/post_reboot.ps1 pslint! test/integration/targets/lookup_ini/lookup-8859-15.ini no-smart-quotes test/integration/targets/module_precedence/lib_with_extension/a.ini shebang test/integration/targets/module_precedence/lib_with_extension/ping.ini shebang -test/integration/targets/module_precedence/lib_with_extension/ping.py future-import-boilerplate -test/integration/targets/module_precedence/lib_with_extension/ping.py metaclass-boilerplate -test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py future-import-boilerplate -test/integration/targets/module_precedence/multiple_roles/bar/library/ping.py metaclass-boilerplate -test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py future-import-boilerplate -test/integration/targets/module_precedence/multiple_roles/foo/library/ping.py metaclass-boilerplate test/integration/targets/module_precedence/roles_with_extension/foo/library/a.ini shebang test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.ini shebang -test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.py future-import-boilerplate -test/integration/targets/module_precedence/roles_with_extension/foo/library/ping.py metaclass-boilerplate -test/integration/targets/module_utils/library/test.py future-import-boilerplate -test/integration/targets/module_utils/library/test.py metaclass-boilerplate -test/integration/targets/module_utils/library/test_env_override.py future-import-boilerplate -test/integration/targets/module_utils/library/test_env_override.py metaclass-boilerplate -test/integration/targets/module_utils/library/test_failure.py future-import-boilerplate -test/integration/targets/module_utils/library/test_failure.py metaclass-boilerplate -test/integration/targets/module_utils/library/test_override.py future-import-boilerplate -test/integration/targets/module_utils/library/test_override.py metaclass-boilerplate +test/integration/targets/module_utils/library/test.py future-import-boilerplate # allow testing of Python 2.x implicit relative imports test/integration/targets/module_utils/module_utils/bar0/foo.py pylint:blacklisted-name test/integration/targets/module_utils/module_utils/foo.py pylint:blacklisted-name test/integration/targets/module_utils/module_utils/sub/bar/__init__.py pylint:blacklisted-name test/integration/targets/module_utils/module_utils/sub/bar/bar.py pylint:blacklisted-name test/integration/targets/module_utils/module_utils/yak/zebra/foo.py pylint:blacklisted-name test/integration/targets/old_style_modules_posix/library/helloworld.sh shebang -test/integration/targets/pause/test-pause.py future-import-boilerplate -test/integration/targets/pause/test-pause.py metaclass-boilerplate -test/integration/targets/pip/files/ansible_test_pip_chdir/__init__.py future-import-boilerplate -test/integration/targets/pip/files/ansible_test_pip_chdir/__init__.py metaclass-boilerplate -test/integration/targets/pip/files/setup.py future-import-boilerplate -test/integration/targets/pip/files/setup.py metaclass-boilerplate -test/integration/targets/run_modules/library/test.py future-import-boilerplate -test/integration/targets/run_modules/library/test.py metaclass-boilerplate -test/integration/targets/script/files/no_shebang.py future-import-boilerplate -test/integration/targets/script/files/no_shebang.py metaclass-boilerplate -test/integration/targets/service/files/ansible_test_service.py future-import-boilerplate -test/integration/targets/service/files/ansible_test_service.py metaclass-boilerplate -test/integration/targets/setup_rpm_repo/files/create-repo.py future-import-boilerplate -test/integration/targets/setup_rpm_repo/files/create-repo.py metaclass-boilerplate test/integration/targets/template/files/encoding_1252_utf-8.expected no-smart-quotes test/integration/targets/template/files/encoding_1252_windows-1252.expected no-smart-quotes test/integration/targets/template/files/foo.dos.txt line-endings -test/integration/targets/template/role_filter/filter_plugins/myplugin.py future-import-boilerplate -test/integration/targets/template/role_filter/filter_plugins/myplugin.py metaclass-boilerplate test/integration/targets/template/templates/encoding_1252.j2 no-smart-quotes -test/integration/targets/infra/library/test.py future-import-boilerplate -test/integration/targets/infra/library/test.py metaclass-boilerplate test/integration/targets/unicode/unicode.yml no-smart-quotes -test/integration/targets/uri/files/testserver.py future-import-boilerplate -test/integration/targets/uri/files/testserver.py metaclass-boilerplate -test/integration/targets/var_precedence/ansible-var-precedence-check.py future-import-boilerplate -test/integration/targets/var_precedence/ansible-var-precedence-check.py metaclass-boilerplate -test/integration/targets/builtin_vars_prompt/test-vars_prompt.py future-import-boilerplate -test/integration/targets/builtin_vars_prompt/test-vars_prompt.py metaclass-boilerplate -test/integration/targets/vault/test-vault-client.py future-import-boilerplate -test/integration/targets/vault/test-vault-client.py metaclass-boilerplate -test/integration/targets/wait_for/files/testserver.py future-import-boilerplate -test/integration/targets/wait_for/files/testserver.py metaclass-boilerplate -test/integration/targets/want_json_modules_posix/library/helloworld.py future-import-boilerplate -test/integration/targets/want_json_modules_posix/library/helloworld.py metaclass-boilerplate test/integration/targets/win_exec_wrapper/library/test_fail.ps1 pslint:PSCustomUseLiteralPath test/integration/targets/win_exec_wrapper/tasks/main.yml no-smart-quotes # We are explicitly testing smart quote support for env vars test/integration/targets/win_module_utils/library/legacy_only_new_way_win_line_ending.ps1 line-endings # Explicitly tests that we still work with Windows line endings