Skip to content

Commit

Permalink
Reorder imports based on PEP8 import recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Jul 9, 2021
1 parent 25d71ad commit fe960ac
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion plugins/modules/ec2_vpc_peering_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.core import normalize_boto3_result
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict


Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/wafv2_ip_set_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
type: str
"""

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict

try:
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict


def list_ip_sets(wafv2, scope, fail_json_aws, Nextmarker=None):
# there is currently no paginator for wafv2
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/wafv2_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
type: list
"""

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls

try:
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls


def get_web_acl(wafv2, name, scope, id, fail_json_aws):
try:
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/wafv2_resources_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
type: list
"""

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls

try:
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls


def get_web_acl(wafv2, name, scope, id, fail_json_aws):
try:
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/wafv2_rule_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@
sampled_requests_enabled: False
"""

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_rule_groups

try:
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_rule_groups


def get_rule_group(wafv2, name, scope, id, fail_json_aws):
try:
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/wafv2_web_acl_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@
sampled_requests_enabled: false
"""

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls

try:
from botocore.exceptions import ClientError, BotoCoreError
except ImportError:
pass # caught by AnsibleAWSModule

from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict
from ansible_collections.community.aws.plugins.module_utils.wafv2 import wafv2_list_web_acls


def get_web_acl(wafv2, name, scope, id, fail_json_aws):
try:
Expand Down
20 changes: 10 additions & 10 deletions scripts/inventory/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,24 +140,23 @@
'webserver-ansible-blue-172.31.0.1'
'''

import sys
import os
import argparse
import json
import os
import re
from time import time
import sys
from collections import defaultdict
from copy import deepcopy
from datetime import date, datetime
from time import time

import boto
from boto import ec2
from boto import rds
from boto import elasticache
from boto import rds
from boto import route53
from boto import sts

from ansible.module_utils import six
from ansible_collections.amazon.aws.plugins.module_utils import ec2 as ec2_utils
from ansible.module_utils.six.moves import configparser

HAS_BOTO3 = False
try:
# Used so that we can cleanly fail, some of our (optional) dependencies need this
Expand All @@ -166,9 +165,10 @@
except ImportError:
pass

from collections import defaultdict
from ansible.module_utils import six
from ansible.module_utils.six.moves import configparser
from ansible_collections.amazon.aws.plugins.module_utils import ec2 as ec2_utils

import json

DEFAULTS = {
'all_elasticache_clusters': 'False',
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/plugins/modules/test_aws_acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils._text import to_text

from pprint import pprint

from ansible_collections.community.aws.plugins.modules.aws_acm import chain_compare
from ansible_collections.community.aws.plugins.modules.aws_acm import pem_chain_split
from ansible.module_utils._text import to_text


def test_chain_compare():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
pass

from ansible_collections.amazon.aws.plugins.module_utils.ec2 import HAS_BOTO3
from ansible_collections.community.aws.tests.unit.compat.mock import patch
from ansible_collections.community.aws.tests.unit.compat.mock import call
from ansible_collections.community.aws.tests.unit.compat.mock import patch
from ansible_collections.community.aws.tests.unit.plugins.modules.utils import AnsibleExitJson
from ansible_collections.community.aws.tests.unit.plugins.modules.utils import AnsibleFailJson
from ansible_collections.community.aws.tests.unit.plugins.modules.utils import ModuleTestCase
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/plugins/modules/test_data_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import collections
import os
import json
import collections

import pytest

from ansible.module_utils._text import to_text

# Magic... Incorrectly identified by pylint as unused
from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import maybe_sleep # pylint: disable=unused-import
from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import placeboify # pylint: disable=unused-import

from ansible_collections.community.aws.plugins.modules import data_pipeline
from ansible.module_utils._text import to_text

# test_api_gateway.py requires the `boto3` and `botocore` modules
boto3 = pytest.importorskip('boto3')
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/plugins/modules/test_ec2_vpc_vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

import pytest
import os
import pytest

# Magic... Incorrectly identified by pylint as unused
from ansible_collections.amazon.aws.tests.unit.utils.amazon_placebo_fixtures import placeboify # pylint: disable=unused-import
Expand Down
1 change: 1 addition & 0 deletions tests/unit/plugins/modules/test_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from ansible_collections.community.aws.tests.unit.plugins.modules.utils import ModuleTestCase
from ansible_collections.community.aws.tests.unit.plugins.modules.utils import set_module_args


if not HAS_BOTO3:
pytestmark = pytest.mark.skip("lambda.py requires the `boto3` and `botocore` modules")

Expand Down

0 comments on commit fe960ac

Please sign in to comment.