diff --git a/.travis.yml b/.travis.yml index 29ed7d3d0f91e4..21d0177fb9fec0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,8 @@ install: script: # urllib2's defaults are not secure enough for us - ./test/code-smell/replace-urlopen.sh . +- ./test/code-smell/use-compat-six.sh . +- ./test/code-smell/boilerplate.sh . - if test x"$TOXENV" != x'py24' ; then tox ; fi - if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi #- make -C docsite all diff --git a/bin/ansible b/bin/ansible index a117856d899cba..70e6863f6bfd51 100755 --- a/bin/ansible +++ b/bin/ansible @@ -18,7 +18,7 @@ # along with Ansible. If not, see . ######################################################## -from __future__ import (absolute_import, print_function) +from __future__ import (absolute_import, division, print_function) __metaclass__ = type __requires__ = ['ansible'] diff --git a/lib/ansible/__init__.py b/lib/ansible/__init__.py index 704b6456f74202..ad6193463a4648 100644 --- a/lib/ansible/__init__.py +++ b/lib/ansible/__init__.py @@ -14,5 +14,10 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + __version__ = '2.0.0' __author__ = 'Ansible, Inc.' diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index ff5e512402da2c..6b0437c1774b4d 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -15,6 +15,9 @@ # 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 + ######################################################## from ansible import constants as C from ansible.cli import CLI diff --git a/lib/ansible/cli/doc.py b/lib/ansible/cli/doc.py index 02ede783597cd3..05f26abae5bbce 100644 --- a/lib/ansible/cli/doc.py +++ b/lib/ansible/cli/doc.py @@ -16,6 +16,9 @@ # ansible-vault is a script that encrypts/decrypts YAML files. See # http://docs.ansible.com/playbooks_vault.html for more details. +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import fcntl import datetime import os diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index 716eac9616dcb8..42f3cf2b50f02b 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -19,6 +19,9 @@ # ######################################################################## +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import os.path import sys diff --git a/lib/ansible/cli/playbook.py b/lib/ansible/cli/playbook.py index 306c134790c265..417c41c6e93ca0 100644 --- a/lib/ansible/cli/playbook.py +++ b/lib/ansible/cli/playbook.py @@ -18,6 +18,10 @@ # along with Ansible. If not, see . ######################################################## + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import stat diff --git a/lib/ansible/cli/pull.py b/lib/ansible/cli/pull.py index 0c33568d3d0e9f..6caa8525dbf186 100644 --- a/lib/ansible/cli/pull.py +++ b/lib/ansible/cli/pull.py @@ -15,6 +15,9 @@ # 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 + ######################################################## import datetime import os diff --git a/lib/ansible/cli/vault.py b/lib/ansible/cli/vault.py index ce017650d17b9e..f3367ea28f5905 100644 --- a/lib/ansible/cli/vault.py +++ b/lib/ansible/cli/vault.py @@ -16,6 +16,9 @@ # ansible-vault is a script that encrypts/decrypts YAML files. See # http://docs.ansible.com/playbooks_vault.html for more details. +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import sys import traceback diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index b883ec3835e00b..4687185510c4be 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -16,7 +16,7 @@ # along with Ansible. If not, see . # Make coding more python3-ish -from __future__ import (absolute_import, division) +from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os diff --git a/lib/ansible/galaxy/__init__.py b/lib/ansible/galaxy/__init__.py index 99876f08066991..3b63b2df9c9511 100644 --- a/lib/ansible/galaxy/__init__.py +++ b/lib/ansible/galaxy/__init__.py @@ -20,6 +20,9 @@ ######################################################################## ''' This manages remote shared Ansible objects, mainly roles''' +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os from ansible.compat.six import string_types diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py index 5b67d9d6c92553..4a61af878cc5a4 100644 --- a/lib/ansible/galaxy/api.py +++ b/lib/ansible/galaxy/api.py @@ -20,6 +20,10 @@ # along with Ansible. If not, see . # ######################################################################## + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import json from urllib2 import quote as urlquote, HTTPError from urlparse import urlparse diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py index 4e6cdc9d151429..dc9da5d79cee29 100644 --- a/lib/ansible/galaxy/role.py +++ b/lib/ansible/galaxy/role.py @@ -19,6 +19,9 @@ # ######################################################################## +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import datetime import os import tarfile diff --git a/lib/ansible/inventory/vars_plugins/__init__.py b/lib/ansible/inventory/vars_plugins/__init__.py index e69de29bb2d1d6..83a17728e23a52 100644 --- a/lib/ansible/inventory/vars_plugins/__init__.py +++ b/lib/ansible/inventory/vars_plugins/__init__.py @@ -0,0 +1,4 @@ +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + diff --git a/lib/ansible/plugins/cache/jsonfile.py b/lib/ansible/plugins/cache/jsonfile.py index 4004288471a84d..71a30e8f86a255 100644 --- a/lib/ansible/plugins/cache/jsonfile.py +++ b/lib/ansible/plugins/cache/jsonfile.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import time import errno diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index c75cc3d710ba04..6b937ef99ab78e 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -16,7 +16,7 @@ # along with Ansible. If not, see . # Make coding more python3-ish -from __future__ import (absolute_import, division) +from __future__ import (absolute_import, division, print_function) __metaclass__ = type import json diff --git a/lib/ansible/plugins/callback/context_demo.py b/lib/ansible/plugins/callback/context_demo.py index ad22ead07df258..3a5cd844cdcf21 100644 --- a/lib/ansible/plugins/callback/context_demo.py +++ b/lib/ansible/plugins/callback/context_demo.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from ansible.plugins.callback import CallbackBase class CallbackModule(CallbackBase): diff --git a/lib/ansible/plugins/callback/hipchat.py b/lib/ansible/plugins/callback/hipchat.py index 139b450866d018..53551ba82c7281 100644 --- a/lib/ansible/plugins/callback/hipchat.py +++ b/lib/ansible/plugins/callback/hipchat.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import urllib diff --git a/lib/ansible/plugins/callback/log_plays.py b/lib/ansible/plugins/callback/log_plays.py index 8b82586df92ca6..d8a834cadce144 100644 --- a/lib/ansible/plugins/callback/log_plays.py +++ b/lib/ansible/plugins/callback/log_plays.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import time import json diff --git a/lib/ansible/plugins/callback/mail.py b/lib/ansible/plugins/callback/mail.py index f6ec212966a046..3895fbaddd0dcf 100644 --- a/lib/ansible/plugins/callback/mail.py +++ b/lib/ansible/plugins/callback/mail.py @@ -16,6 +16,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import smtplib import json diff --git a/lib/ansible/plugins/callback/osx_say.py b/lib/ansible/plugins/callback/osx_say.py index 36b053026e29ef..da1044c2b1f18f 100644 --- a/lib/ansible/plugins/callback/osx_say.py +++ b/lib/ansible/plugins/callback/osx_say.py @@ -16,6 +16,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import subprocess import os diff --git a/lib/ansible/plugins/callback/profile_tasks.py b/lib/ansible/plugins/callback/profile_tasks.py index 4824ef4a87a772..669d6f05c01457 100644 --- a/lib/ansible/plugins/callback/profile_tasks.py +++ b/lib/ansible/plugins/callback/profile_tasks.py @@ -18,6 +18,10 @@ # Provides per-task timing, ongoing playbook elapsed time and # ordered list of top 20 longest running tasks at end +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import time from ansible.plugins.callback import CallbackBase diff --git a/lib/ansible/plugins/callback/syslog_json.py b/lib/ansible/plugins/callback/syslog_json.py index 5d22dbd300fb93..71deb4f9762d1d 100644 --- a/lib/ansible/plugins/callback/syslog_json.py +++ b/lib/ansible/plugins/callback/syslog_json.py @@ -1,3 +1,7 @@ +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import json diff --git a/lib/ansible/plugins/callback/timer.py b/lib/ansible/plugins/callback/timer.py index f75b55e4be6d19..8694b281e70ef8 100644 --- a/lib/ansible/plugins/callback/timer.py +++ b/lib/ansible/plugins/callback/timer.py @@ -1,3 +1,7 @@ +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import datetime from datetime import datetime, timedelta diff --git a/lib/ansible/plugins/filter/__init__.py b/lib/ansible/plugins/filter/__init__.py index e69de29bb2d1d6..cbbbd641184971 100644 --- a/lib/ansible/plugins/filter/__init__.py +++ b/lib/ansible/plugins/filter/__init__.py @@ -0,0 +1,5 @@ +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + + diff --git a/lib/ansible/plugins/filter/core.py b/lib/ansible/plugins/filter/core.py index d469550f0fac99..d5e1a12e5319ca 100644 --- a/lib/ansible/plugins/filter/core.py +++ b/lib/ansible/plugins/filter/core.py @@ -15,7 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -from __future__ import absolute_import +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import sys import base64 diff --git a/lib/ansible/plugins/filter/ipaddr.py b/lib/ansible/plugins/filter/ipaddr.py index b2de8759e1218a..432de6031b1bb3 100644 --- a/lib/ansible/plugins/filter/ipaddr.py +++ b/lib/ansible/plugins/filter/ipaddr.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from functools import partial import types diff --git a/lib/ansible/plugins/filter/mathstuff.py b/lib/ansible/plugins/filter/mathstuff.py index 341c2aa2d8c7c6..599d9982d7bb22 100644 --- a/lib/ansible/plugins/filter/mathstuff.py +++ b/lib/ansible/plugins/filter/mathstuff.py @@ -15,7 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -from __future__ import absolute_import +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import math import collections diff --git a/lib/ansible/plugins/lookup/list.py b/lib/ansible/plugins/lookup/list.py index cd92718b38444f..76b86dd16794fc 100644 --- a/lib/ansible/plugins/lookup/list.py +++ b/lib/ansible/plugins/lookup/list.py @@ -14,7 +14,9 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -from __future__ import (absolute_import, division) + +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.plugins.lookup import LookupBase diff --git a/lib/ansible/plugins/test/__init__.py b/lib/ansible/plugins/test/__init__.py index e69de29bb2d1d6..980f84a225b973 100644 --- a/lib/ansible/plugins/test/__init__.py +++ b/lib/ansible/plugins/test/__init__.py @@ -0,0 +1,3 @@ +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type diff --git a/lib/ansible/plugins/test/core.py b/lib/ansible/plugins/test/core.py index daf2240211ed2f..1bd789260f7545 100644 --- a/lib/ansible/plugins/test/core.py +++ b/lib/ansible/plugins/test/core.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import re from ansible import errors diff --git a/lib/ansible/plugins/test/files.py b/lib/ansible/plugins/test/files.py index 0c46b53160b594..5ab5788e01b96c 100644 --- a/lib/ansible/plugins/test/files.py +++ b/lib/ansible/plugins/test/files.py @@ -15,6 +15,10 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + from os.path import isdir, isfile, isabs, exists, lexists, islink, samefile, ismount from ansible import errors diff --git a/lib/ansible/utils/cmd_functions.py b/lib/ansible/utils/cmd_functions.py index 31b120e22557fb..99f0483b5994b2 100644 --- a/lib/ansible/utils/cmd_functions.py +++ b/lib/ansible/utils/cmd_functions.py @@ -14,7 +14,9 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -from __future__ import absolute_import + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type import os import sys diff --git a/lib/ansible/utils/module_docs.py b/lib/ansible/utils/module_docs.py index 0e25e565ec4c1e..4a90c3caca1a61 100755 --- a/lib/ansible/utils/module_docs.py +++ b/lib/ansible/utils/module_docs.py @@ -17,6 +17,10 @@ # along with Ansible. If not, see . # +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + import os import sys import ast diff --git a/lib/ansible/utils/shlex.py b/lib/ansible/utils/shlex.py index dd845e0e4ef624..2dee15816bfac8 100644 --- a/lib/ansible/utils/shlex.py +++ b/lib/ansible/utils/shlex.py @@ -15,7 +15,9 @@ # You should have received a copy of the GNU General Public License # alongwith Ansible. If not, see . -from __future__ import absolute_import +# Make coding more python3-ish +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type import shlex from ansible.compat.six import PY3 diff --git a/lib/ansible/vars/unsafe_proxy.py b/lib/ansible/vars/unsafe_proxy.py index 19707e10b32aef..ff48292ba1a637 100644 --- a/lib/ansible/vars/unsafe_proxy.py +++ b/lib/ansible/vars/unsafe_proxy.py @@ -50,6 +50,9 @@ # http://code.activestate.com/recipes/496741-object-proxying/ # Author: Tomer Filiba +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + __all__ = ['UnsafeProxy', 'AnsibleUnsafe', 'wrap_var']