Skip to content

Commit

Permalink
Add python3-compat boilerplate to all .py files in lib/ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
abadger committed Oct 20, 2015
1 parent de3ca57 commit f34b55a
Show file tree
Hide file tree
Showing 36 changed files with 123 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/ansible
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

########################################################
from __future__ import (absolute_import, print_function)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

__requires__ = ['ansible']
Expand Down
5 changes: 5 additions & 0 deletions lib/ansible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

__version__ = '2.0.0'
__author__ = 'Ansible, Inc.'
3 changes: 3 additions & 0 deletions lib/ansible/cli/adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

########################################################
from ansible import constants as C
from ansible.cli import CLI
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/cli/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/cli/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#
########################################################################

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import os.path
import sys
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/cli/playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

########################################################

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import stat

Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/cli/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

########################################################
import datetime
import os
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/cli/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/galaxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/galaxy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import json
from urllib2 import quote as urlquote, HTTPError
from urlparse import urlparse
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/galaxy/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#
########################################################################

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import datetime
import os
import tarfile
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/inventory/vars_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

4 changes: 4 additions & 0 deletions lib/ansible/plugins/cache/jsonfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import time
import errno
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/plugins/callback/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import json
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/context_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

from ansible.plugins.callback import CallbackBase

class CallbackModule(CallbackBase):
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/hipchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import urllib

Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/log_plays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import time
import json
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import smtplib
import json
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/osx_say.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import subprocess
import os

Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/profile_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/syslog_json.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import json

Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/callback/timer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/ansible/plugins/filter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type


5 changes: 4 additions & 1 deletion lib/ansible/plugins/filter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type


import sys
import base64
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/filter/ipaddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

from functools import partial
import types

Expand Down
5 changes: 4 additions & 1 deletion lib/ansible/plugins/filter/mathstuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type


import math
import collections
Expand Down
4 changes: 3 additions & 1 deletion lib/ansible/plugins/lookup/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
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
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/plugins/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
4 changes: 4 additions & 0 deletions lib/ansible/plugins/test/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import re
from ansible import errors

Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/plugins/test/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.

# 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

Expand Down
4 changes: 3 additions & 1 deletion lib/ansible/utils/cmd_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import sys
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/utils/module_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#

# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import os
import sys
import ast
Expand Down
4 changes: 3 additions & 1 deletion lib/ansible/utils/shlex.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# You should have received a copy of the GNU General Public License
# alongwith Ansible. If not, see <http://www.gnu.org/licenses/>.

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
Expand Down
3 changes: 3 additions & 0 deletions lib/ansible/vars/unsafe_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']


Expand Down

0 comments on commit f34b55a

Please sign in to comment.