diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3fad8ddcb..db2b6506b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,12 @@ - id: requirements-txt-fixer - id: trailing-whitespace - repo: git://github.com/asottile/reorder_python_imports - sha: 3d86483455ab5bd06cc1069fdd5ac57be5463f10 + sha: v0.1.0 hooks: - id: reorder-python-imports language_version: 'python2.7' + args: + - --add-import + - from __future__ import absolute_import + - --add-import + - from __future__ import unicode_literals diff --git a/compose/__init__.py b/compose/__init__.py index 7c16c97ba..3ba90fdef 100644 --- a/compose/__init__.py +++ b/compose/__init__.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals __version__ = '1.6.0dev' diff --git a/compose/cli/colors.py b/compose/cli/colors.py index af4a32ab4..3c18886f8 100644 --- a/compose/cli/colors.py +++ b/compose/cli/colors.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals NAMES = [ 'grey', diff --git a/compose/cli/docker_client.py b/compose/cli/docker_client.py index 177d5d6c0..48ba97bda 100644 --- a/compose/cli/docker_client.py +++ b/compose/cli/docker_client.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import logging import os diff --git a/compose/cli/errors.py b/compose/cli/errors.py index ca4413bd1..03d6a50c6 100644 --- a/compose/cli/errors.py +++ b/compose/cli/errors.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import unicode_literals from textwrap import dedent diff --git a/compose/cli/main.py b/compose/cli/main.py index 006d33ecb..9ea9df71b 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals diff --git a/compose/cli/multiplexer.py b/compose/cli/multiplexer.py index 4c73c6cdc..5e8d91a47 100644 --- a/compose/cli/multiplexer.py +++ b/compose/cli/multiplexer.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import unicode_literals from threading import Thread diff --git a/compose/cli/verbose_proxy.py b/compose/cli/verbose_proxy.py index 68dfabe52..b1592eabe 100644 --- a/compose/cli/verbose_proxy.py +++ b/compose/cli/verbose_proxy.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import functools import logging import pprint diff --git a/compose/config/__init__.py b/compose/config/__init__.py index 6fe9ff9fb..dd01f221e 100644 --- a/compose/config/__init__.py +++ b/compose/config/__init__.py @@ -1,4 +1,7 @@ # flake8: noqa +from __future__ import absolute_import +from __future__ import unicode_literals + from .config import ConfigurationError from .config import DOCKER_CONFIG_KEYS from .config import find diff --git a/compose/config/config.py b/compose/config/config.py index c77e61008..61b40589e 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import unicode_literals import codecs import logging diff --git a/compose/config/errors.py b/compose/config/errors.py index 6d6a69df9..99129f3de 100644 --- a/compose/config/errors.py +++ b/compose/config/errors.py @@ -1,3 +1,7 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + + class ConfigurationError(Exception): def __init__(self, msg): self.msg = msg diff --git a/compose/config/interpolation.py b/compose/config/interpolation.py index 12eb497b6..7a7576448 100644 --- a/compose/config/interpolation.py +++ b/compose/config/interpolation.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import logging import os from string import Template diff --git a/compose/config/validation.py b/compose/config/validation.py index 091014f65..f2162a874 100644 --- a/compose/config/validation.py +++ b/compose/config/validation.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import json import logging import os diff --git a/compose/const.py b/compose/const.py index 9c607ca26..f1493cdd5 100644 --- a/compose/const.py +++ b/compose/const.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import os import sys diff --git a/compose/progress_stream.py b/compose/progress_stream.py index a6c8e0a26..1f873d1d9 100644 --- a/compose/progress_stream.py +++ b/compose/progress_stream.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + from compose import utils diff --git a/compose/utils.py b/compose/utils.py index 362629bc2..4a7df3346 100644 --- a/compose/utils.py +++ b/compose/utils.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import codecs import hashlib import json diff --git a/script/travis/render-bintray-config.py b/script/travis/render-bintray-config.py index fc5d409a0..c2b11ca3f 100755 --- a/script/travis/render-bintray-config.py +++ b/script/travis/render-bintray-config.py @@ -1,5 +1,7 @@ #!/usr/bin/env python from __future__ import print_function +from __future__ import absolute_import +from __future__ import unicode_literals import datetime import os.path diff --git a/script/versions.py b/script/versions.py index 513ca754c..98f97ef32 100755 --- a/script/versions.py +++ b/script/versions.py @@ -21,7 +21,9 @@ For example, if the list of versions is: `default` would return `1.7.1` and `recent -n 3` would return `1.8.0-rc2 1.7.1 1.6.2` """ +from __future__ import absolute_import from __future__ import print_function +from __future__ import unicode_literals import argparse import itertools diff --git a/tests/__init__.py b/tests/__init__.py index d3cfb8649..1ac1b21cf 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import sys if sys.version_info >= (2, 7): diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index 1885727a1..6859c7741 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import unicode_literals import os import shlex diff --git a/tests/integration/project_test.py b/tests/integration/project_test.py index d51830bb0..2cf5f5565 100644 --- a/tests/integration/project_test.py +++ b/tests/integration/project_test.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals import random diff --git a/tests/integration/state_test.py b/tests/integration/state_test.py index d07dfa82a..6e656c292 100644 --- a/tests/integration/state_test.py +++ b/tests/integration/state_test.py @@ -2,6 +2,7 @@ Integration tests which cover state convergence (aka smart recreate) performed by `docker-compose up`. """ +from __future__ import absolute_import from __future__ import unicode_literals import py diff --git a/tests/unit/cli/command_test.py b/tests/unit/cli/command_test.py index 0d4324e35..180446721 100644 --- a/tests/unit/cli/command_test.py +++ b/tests/unit/cli/command_test.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import unicode_literals import pytest from requests.exceptions import ConnectionError diff --git a/tests/unit/cli/main_test.py b/tests/unit/cli/main_test.py index db37ac1af..ab2368669 100644 --- a/tests/unit/cli/main_test.py +++ b/tests/unit/cli/main_test.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +from __future__ import unicode_literals import logging diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py index 281e81d1e..8cb5d9b26 100644 --- a/tests/unit/config/config_test.py +++ b/tests/unit/config/config_test.py @@ -1,5 +1,7 @@ # encoding: utf-8 +from __future__ import absolute_import from __future__ import print_function +from __future__ import unicode_literals import os import shutil diff --git a/tests/unit/config/sort_services_test.py b/tests/unit/config/sort_services_test.py index 8d0c3ae40..c2ebbc67f 100644 --- a/tests/unit/config/sort_services_test.py +++ b/tests/unit/config/sort_services_test.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + from compose.config.errors import DependencyError from compose.config.sort_services import sort_service_dicts from compose.config.types import VolumeFromSpec diff --git a/tests/unit/container_test.py b/tests/unit/container_test.py index 5f7bf1ea7..886911504 100644 --- a/tests/unit/container_test.py +++ b/tests/unit/container_test.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals import docker diff --git a/tests/unit/interpolation_test.py b/tests/unit/interpolation_test.py index 7444884cb..317982a9b 100644 --- a/tests/unit/interpolation_test.py +++ b/tests/unit/interpolation_test.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import unittest from compose.config.interpolation import BlankDefaultDict as bddict diff --git a/tests/unit/multiplexer_test.py b/tests/unit/multiplexer_test.py index d565d39d1..c56ece1bd 100644 --- a/tests/unit/multiplexer_test.py +++ b/tests/unit/multiplexer_test.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import unicode_literals + import unittest from compose.cli.multiplexer import Multiplexer diff --git a/tests/unit/project_test.py b/tests/unit/project_test.py index 4bf5f4636..a182680b3 100644 --- a/tests/unit/project_test.py +++ b/tests/unit/project_test.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import from __future__ import unicode_literals import docker diff --git a/tests/unit/utils_test.py b/tests/unit/utils_test.py index 15999dde9..8ee37b078 100644 --- a/tests/unit/utils_test.py +++ b/tests/unit/utils_test.py @@ -1,4 +1,5 @@ # encoding: utf-8 +from __future__ import absolute_import from __future__ import unicode_literals from compose import utils