Skip to content

Commit

Permalink
Apply isort formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Sep 28, 2023
1 parent 2377893 commit 01212f3
Show file tree
Hide file tree
Showing 171 changed files with 494 additions and 410 deletions.
5 changes: 4 additions & 1 deletion plugins/action/s3_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

import os

from ansible.errors import AnsibleError, AnsibleAction, AnsibleActionFail, AnsibleFileNotFound
from ansible.errors import AnsibleAction
from ansible.errors import AnsibleActionFail
from ansible.errors import AnsibleError
from ansible.errors import AnsibleFileNotFound
from ansible.module_utils._text import to_text
from ansible.plugins.action import ActionBase
from ansible.utils.vars import merge_hash
Expand Down
2 changes: 1 addition & 1 deletion plugins/callback/aws_resource_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#
"""

from ansible.plugins.callback import CallbackBase
from ansible.module_utils._text import to_native
from ansible.plugins.callback import CallbackBase


class CallbackModule(CallbackBase):
Expand Down
4 changes: 1 addition & 3 deletions plugins/inventory/aws_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@
from ansible.module_utils._text import to_text
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict


from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.plugin_utils.inventory import AWSInventoryBase


# The mappings give an array of keys to get from the filter name to the value
# returned by boto3's EC2 describe_instances method.

Expand Down
3 changes: 1 addition & 2 deletions plugins/inventory/aws_rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict

from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list
from ansible_collections.amazon.aws.plugins.plugin_utils.inventory import AWSInventoryBase


Expand Down
4 changes: 2 additions & 2 deletions plugins/lookup/aws_service_ip_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
import json

from ansible.errors import AnsibleLookupError
from ansible.module_utils._text import to_native
from ansible.module_utils.six.moves.urllib.error import HTTPError
from ansible.module_utils.six.moves.urllib.error import URLError
from ansible.module_utils._text import to_native
from ansible.module_utils.urls import ConnectionError
from ansible.module_utils.urls import open_url
from ansible.module_utils.urls import SSLValidationError
from ansible.module_utils.urls import open_url
from ansible.plugins.lookup import LookupBase


Expand Down
3 changes: 1 addition & 2 deletions plugins/lookup/secretsmanager_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@
pass # Handled by AWSLookupBase

from ansible.errors import AnsibleLookupError
from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_native
from ansible.module_utils.six import string_types

from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_message
from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry

from ansible_collections.amazon.aws.plugins.plugin_utils.lookup import AWSLookupBase


Expand Down
5 changes: 2 additions & 3 deletions plugins/lookup/ssm_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,12 @@

from ansible.errors import AnsibleLookupError
from ansible.module_utils._text import to_native
from ansible.utils.display import Display
from ansible.module_utils.six import string_types
from ansible.utils.display import Display

from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry

from ansible_collections.amazon.aws.plugins.module_utils.tagging import boto3_tag_list_to_ansible_dict
from ansible_collections.amazon.aws.plugins.plugin_utils.lookup import AWSLookupBase

display = Display()
Expand Down
3 changes: 2 additions & 1 deletion plugins/module_utils/acm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"""

try:
from botocore.exceptions import BotoCoreError, ClientError
from botocore.exceptions import BotoCoreError
from botocore.exceptions import ClientError
except ImportError:
pass

Expand Down
1 change: 1 addition & 0 deletions plugins/module_utils/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
pass # Handled by HAS_BOTO3

from typing import Union

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict


Expand Down
3 changes: 2 additions & 1 deletion plugins/module_utils/botocore.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
from ansible.module_utils.six import binary_type
from ansible.module_utils.six import text_type

from .common import get_collection_info
from .exceptions import AnsibleBotocoreError
from .retries import AWSRetry
from .common import get_collection_info

MINIMUM_BOTOCORE_VERSION = "1.29.0"
MINIMUM_BOTO3_VERSION = "1.26.0"
Expand Down Expand Up @@ -412,6 +412,7 @@ def enable_placebo(session):
pill.record()
if "_ANSIBLE_PLACEBO_REPLAY" in os.environ:
import shutil

import placebo

existing_entries = sorted([int(i) for i in os.listdir(os.environ["_ANSIBLE_PLACEBO_REPLAY"])])
Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import time
import functools
import random
import time


class BackoffIterator:
Expand Down
3 changes: 2 additions & 1 deletion plugins/module_utils/cloudfront_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
except ImportError:
pass

from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict

from .retries import AWSRetry
from .tagging import boto3_tag_list_to_ansible_dict
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict


class CloudFrontFactsServiceManagerFailure(Exception):
Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@

# Used to live here, moved into ansible_collections.amazon.aws.plugins.module_utils.botocore
from .botocore import HAS_BOTO3 # pylint: disable=unused-import
from .botocore import get_boto3_client_method_parameters # pylint: disable=unused-import
from .botocore import is_boto3_error_code # pylint: disable=unused-import
from .botocore import is_boto3_error_message # pylint: disable=unused-import
from .botocore import get_boto3_client_method_parameters # pylint: disable=unused-import
from .botocore import normalize_boto3_result # pylint: disable=unused-import

# Used to live here, moved into ansible_collections.amazon.aws.plugins.module_utils.exceptions
Expand Down
23 changes: 11 additions & 12 deletions plugins/module_utils/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
import re

from ansible.module_utils.ansible_release import __version__
from ansible.module_utils.six import string_types
from ansible.module_utils.six import integer_types

# Used to live here, moved into ansible.module_utils.common.dict_transformations
from ansible.module_utils.common.dict_transformations import _camel_to_snake # pylint: disable=unused-import
from ansible.module_utils.common.dict_transformations import _snake_to_camel # pylint: disable=unused-import
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict # pylint: disable=unused-import
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict # pylint: disable=unused-import
from ansible.module_utils.six import integer_types
from ansible.module_utils.six import string_types

# Used to live here, moved into # ansible_collections.amazon.aws.plugins.module_utils.arn
from .arn import is_outpost_arn as is_outposts_arn # pylint: disable=unused-import
Expand All @@ -57,9 +57,8 @@
from .botocore import boto3_conn # pylint: disable=unused-import
from .botocore import boto3_inventory_conn # pylint: disable=unused-import
from .botocore import boto_exception # pylint: disable=unused-import
from .botocore import get_aws_region # pylint: disable=unused-import
from .botocore import get_aws_connection_info # pylint: disable=unused-import

from .botocore import get_aws_region # pylint: disable=unused-import
from .botocore import paginated_query_with_retries

# Used to live here, moved into ansible_collections.amazon.aws.plugins.module_utils.exceptions
Expand All @@ -70,6 +69,14 @@
from .modules import _aws_common_argument_spec as aws_common_argument_spec # pylint: disable=unused-import
from .modules import aws_argument_spec as ec2_argument_spec # pylint: disable=unused-import

# Used to live here, moved into # ansible_collections.amazon.aws.plugins.module_utils.policy
from .policy import _py3cmp as py3cmp # pylint: disable=unused-import
from .policy import compare_policies # pylint: disable=unused-import
from .policy import sort_json_policy_dict # pylint: disable=unused-import

# Used to live here, moved into # ansible_collections.amazon.aws.plugins.module_utils.retries
from .retries import AWSRetry # pylint: disable=unused-import

# Used to live here, moved into ansible_collections.amazon.aws.plugins.module_utils.tagging
from .tagging import ansible_dict_to_boto3_tag_list # pylint: disable=unused-import
from .tagging import boto3_tag_list_to_ansible_dict # pylint: disable=unused-import
Expand All @@ -79,14 +86,6 @@
from .transformation import ansible_dict_to_boto3_filter_list # pylint: disable=unused-import
from .transformation import map_complex_type # pylint: disable=unused-import

# Used to live here, moved into # ansible_collections.amazon.aws.plugins.module_utils.policy
from .policy import _py3cmp as py3cmp # pylint: disable=unused-import
from .policy import compare_policies # pylint: disable=unused-import
from .policy import sort_json_policy_dict # pylint: disable=unused-import

# Used to live here, moved into # ansible_collections.amazon.aws.plugins.module_utils.retries
from .retries import AWSRetry # pylint: disable=unused-import

try:
import botocore
except ImportError:
Expand Down
3 changes: 2 additions & 1 deletion plugins/module_utils/elb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

try:
from botocore.exceptions import BotoCoreError, ClientError
from botocore.exceptions import BotoCoreError
from botocore.exceptions import ClientError
except ImportError:
pass

Expand Down
9 changes: 5 additions & 4 deletions plugins/module_utils/elbv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
from copy import deepcopy

try:
from botocore.exceptions import BotoCoreError, ClientError
from botocore.exceptions import BotoCoreError
from botocore.exceptions import ClientError
except ImportError:
pass

from .retries import AWSRetry
from .tagging import ansible_dict_to_boto3_tag_list
from .tagging import boto3_tag_list_to_ansible_dict
from .ec2 import get_ec2_security_group_ids_from_names
from .elb_utils import convert_tg_name_to_arn
from .elb_utils import get_elb
from .elb_utils import get_elb_listener
from .retries import AWSRetry
from .tagging import ansible_dict_to_boto3_tag_list
from .tagging import boto3_tag_list_to_ansible_dict
from .waiters import get_waiter


Expand Down
6 changes: 3 additions & 3 deletions plugins/module_utils/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@
# Python 3
from io import StringIO

from ansible.module_utils._text import to_native
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import env_fallback
from ansible.module_utils.basic import missing_required_lib
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils._text import to_native

from .botocore import boto3_conn
from .botocore import boto3_at_least
from .botocore import boto3_conn
from .botocore import botocore_at_least
from .botocore import check_sdk_version_supported
from .botocore import gather_sdk_versions
from .botocore import get_aws_connection_info
from .botocore import get_aws_region
from .botocore import gather_sdk_versions
from .exceptions import AnsibleBotocoreError
from .retries import RetryingBotoClientWrapper

Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@

from functools import cmp_to_key

import ansible.module_utils.common.warnings as ansible_warnings
from ansible.module_utils._text import to_text
from ansible.module_utils.six import binary_type
from ansible.module_utils.six import string_types

import ansible.module_utils.common.warnings as ansible_warnings


def _canonify_root_arn(arn):
# There are multiple ways to specifiy delegation of access to an account
Expand Down
4 changes: 3 additions & 1 deletion plugins/module_utils/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from time import sleep

try:
from botocore.exceptions import BotoCoreError, ClientError, WaiterError
from botocore.exceptions import BotoCoreError
from botocore.exceptions import ClientError
from botocore.exceptions import WaiterError
except ImportError:
pass

Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
# LIABILITY, OR TORT (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 ansible.module_utils.six import string_types
from ansible.module_utils.six import integer_types
from ansible.module_utils.six import string_types


def ansible_dict_to_boto3_filter_list(filters_dict):
Expand Down
1 change: 0 additions & 1 deletion plugins/module_utils/waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from .retries import AWSRetry
from .waiters import get_waiter


MATCH_LOOKUP = {
"byte": {
"method": "byte_match_set",
Expand Down
1 change: 0 additions & 1 deletion plugins/module_utils/waiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from ansible_collections.amazon.aws.plugins.module_utils.retries import RetryingBotoClientWrapper


ec2_data = {
"version": 2,
"waiters": {
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/autoscaling_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,13 +660,13 @@
pass # Handled by AnsibleAWSModule

from ansible.module_utils._text import to_native
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict

from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters

ASG_ATTRIBUTES = (
"AvailabilityZones",
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/autoscaling_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict

from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule


def match_asg_tags(tags_to_match, asg):
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/aws_az_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@
"""

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

Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/aws_caller_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"""

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

Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/backup_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,15 @@

from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict

from ansible_collections.amazon.aws.plugins.module_utils.backup import get_plan_details
from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.tagging import compare_aws_tags
from ansible_collections.amazon.aws.plugins.module_utils.transformation import scrub_none_parameters

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

Expand Down
Loading

0 comments on commit 01212f3

Please sign in to comment.