fix: changes made by pre-commit scripts

This commit is contained in:
Mark Ferrell 2020-10-04 06:22:30 -07:00 committed by Daniel Wozniak
parent 4878766622
commit f997e06da2
13 changed files with 10 additions and 74 deletions

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Apache Libcloud Compute Management Apache Libcloud Compute Management
================================== ==================================
@ -30,21 +29,16 @@ Clouds include Amazon EC2, Azure, Google GCE, VMware, OpenStack Nova
# keep lint from choking on _get_conn and _cache_id # keep lint from choking on _get_conn and _cache_id
# pylint: disable=E0602 # pylint: disable=E0602
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging import logging
import os.path import os.path
# Import salt libs
import salt.utils.args import salt.utils.args
import salt.utils.compat import salt.utils.compat
from salt.ext import six
from salt.utils.versions import LooseVersion as _LooseVersion from salt.utils.versions import LooseVersion as _LooseVersion
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# Import third party libs
REQUIRED_LIBCLOUD_VERSION = "2.0.0" REQUIRED_LIBCLOUD_VERSION = "2.0.0"
try: try:
# pylint: disable=unused-import # pylint: disable=unused-import
@ -69,7 +63,7 @@ def __virtual__():
""" """
if not HAS_LIBCLOUD: if not HAS_LIBCLOUD:
msg = ( msg = (
"A apache-libcloud library with version at least {0} was not " "found" "A apache-libcloud library with version at least {} was not " "found"
).format(REQUIRED_LIBCLOUD_VERSION) ).format(REQUIRED_LIBCLOUD_VERSION)
return (False, msg) return (False, msg)
return True return True
@ -790,7 +784,7 @@ def _get_by_id(collection, id):
if not matches: if not matches:
raise ValueError("Could not find a matching item") raise ValueError("Could not find a matching item")
elif len(matches) > 1: elif len(matches) > 1:
raise ValueError("The id matched {0} items, not 1".format(len(matches))) raise ValueError("The id matched {} items, not 1".format(len(matches)))
return matches[0] return matches[0]
@ -824,7 +818,7 @@ def _simple_node(node):
return { return {
"id": node.id, "id": node.id,
"name": node.name, "name": node.name,
"state": six.text_type(node.state), "state": str(node.state),
"public_ips": node.public_ips, "public_ips": node.public_ips,
"private_ips": node.private_ips, "private_ips": node.private_ips,
"size": _simple_size(node.size) if node.size else {}, "size": _simple_size(node.size) if node.size else {},

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Apache Libcloud DNS Management Apache Libcloud DNS Management
============================== ==============================
@ -28,17 +27,13 @@ Connection module for Apache Libcloud DNS management
# keep lint from choking on _get_conn and _cache_id # keep lint from choking on _get_conn and _cache_id
# pylint: disable=E0602 # pylint: disable=E0602
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging import logging
# Import salt libs
from salt.utils.versions import LooseVersion as _LooseVersion from salt.utils.versions import LooseVersion as _LooseVersion
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# Import third party libs
REQUIRED_LIBCLOUD_VERSION = "2.0.0" REQUIRED_LIBCLOUD_VERSION = "2.0.0"
try: try:
# pylint: disable=unused-import # pylint: disable=unused-import
@ -63,7 +58,7 @@ def __virtual__():
""" """
if not HAS_LIBCLOUD: if not HAS_LIBCLOUD:
msg = ( msg = (
"A apache-libcloud library with version at least {0} was not " "found" "A apache-libcloud library with version at least {} was not " "found"
).format(REQUIRED_LIBCLOUD_VERSION) ).format(REQUIRED_LIBCLOUD_VERSION)
return (False, msg) return (False, msg)
return True return True

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Apache Libcloud Load Balancer Management Apache Libcloud Load Balancer Management
======================================== ========================================
@ -30,20 +29,15 @@ Clouds include Amazon ELB, ALB, Google, Aliyun, CloudStack, Softlayer
# keep lint from choking on _get_conn and _cache_id # keep lint from choking on _get_conn and _cache_id
# pylint: disable=E0602 # pylint: disable=E0602
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging import logging
# Import salt libs
import salt.utils.args import salt.utils.args
import salt.utils.compat import salt.utils.compat
from salt.ext import six
from salt.utils.versions import LooseVersion as _LooseVersion from salt.utils.versions import LooseVersion as _LooseVersion
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# Import third party libs
REQUIRED_LIBCLOUD_VERSION = "1.5.0" REQUIRED_LIBCLOUD_VERSION = "1.5.0"
try: try:
# pylint: disable=unused-import # pylint: disable=unused-import
@ -68,7 +62,7 @@ def __virtual__():
""" """
if not HAS_LIBCLOUD: if not HAS_LIBCLOUD:
msg = ( msg = (
"A apache-libcloud library with version at least {0} was not " "found" "A apache-libcloud library with version at least {} was not " "found"
).format(REQUIRED_LIBCLOUD_VERSION) ).format(REQUIRED_LIBCLOUD_VERSION)
return (False, msg) return (False, msg)
return True return True
@ -186,7 +180,7 @@ def create_balancer(
if algorithm is None: if algorithm is None:
algorithm = Algorithm.ROUND_ROBIN algorithm = Algorithm.ROUND_ROBIN
else: else:
if isinstance(algorithm, six.string_types): if isinstance(algorithm, str):
algorithm = _algorithm_maps()[algorithm] algorithm = _algorithm_maps()[algorithm]
starting_members = [] starting_members = []
if members is not None: if members is not None:

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Apache Libcloud Storage Management Apache Libcloud Storage Management
================================== ==================================
@ -30,19 +29,15 @@ Clouds include Amazon S3, Google Storage, Aliyun, Azure Blobs, Ceph, OpenStack s
# keep lint from choking on _get_conn and _cache_id # keep lint from choking on _get_conn and _cache_id
# pylint: disable=E0602 # pylint: disable=E0602
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
import logging import logging
# Import salt libs
import salt.utils.args import salt.utils.args
import salt.utils.compat import salt.utils.compat
from salt.utils.versions import LooseVersion as _LooseVersion from salt.utils.versions import LooseVersion as _LooseVersion
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# Import third party libs
REQUIRED_LIBCLOUD_VERSION = "1.5.0" REQUIRED_LIBCLOUD_VERSION = "1.5.0"
try: try:
# pylint: disable=unused-import # pylint: disable=unused-import
@ -66,7 +61,7 @@ def __virtual__():
""" """
if not HAS_LIBCLOUD: if not HAS_LIBCLOUD:
msg = ( msg = (
"A apache-libcloud library with version at least {0} was not " "found" "A apache-libcloud library with version at least {} was not " "found"
).format(REQUIRED_LIBCLOUD_VERSION) ).format(REQUIRED_LIBCLOUD_VERSION)
return (False, msg) return (False, msg)
return True return True

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Manage DNS records and zones using libcloud Manage DNS records and zones using libcloud
@ -47,9 +46,6 @@ Example:
:depends: apache-libcloud :depends: apache-libcloud
""" """
# Import Python Libs
from __future__ import absolute_import
def __virtual__(): def __virtual__():
if "libcloud_dns.list_zones" in __salt__: if "libcloud_dns.list_zones" in __salt__:
@ -189,8 +185,6 @@ def record_absent(name, zone, type, data, profile):
matching_zone["id"], record["id"], profile matching_zone["id"], record["id"], profile
) )
) )
return state_result( return state_result(all(result), "Removed {} records".format(len(result)), name)
all(result), "Removed {0} records".format(len(result)), name
)
else: else:
return state_result(True, "Records already absent", name) return state_result(True, "Records already absent", name)

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Apache Libcloud Load Balancer State Apache Libcloud Load Balancer State
=================================== ===================================
@ -46,8 +45,6 @@ Using States to deploy a load balancer with extended arguments to specify region
:depends: apache-libcloud :depends: apache-libcloud
""" """
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging import logging
@ -161,7 +158,7 @@ def member_present(ip, port, balancer_id, profile, **libcloud_kwargs):
) )
return state_result( return state_result(
True, True,
"Member added to balancer, id: {0}".format(member["id"]), "Member added to balancer, id: {}".format(member["id"]),
balancer_id, balancer_id,
member, member,
) )

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
Apache Libcloud Storage State Apache Libcloud Storage State
============================= =============================
@ -64,8 +63,6 @@ This example will download the file from the remote cloud and keep it locally
:depends: apache-libcloud :depends: apache-libcloud
""" """
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging import logging

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
''' '''
{{module_name}} execution module {{module_name}} execution module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -13,14 +12,10 @@
<your example config> <your example config>
''' '''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
import logging import logging
# Import salt libs
import salt.utils.compat import salt.utils.compat
# Import third party libs
try: try:
# Import libs... # Import libs...
{% if depending_libraries %} {% if depending_libraries %}

View file

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
''' '''
{{module_name}} state module {{module_name}} state module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -14,14 +13,10 @@
''' '''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
import logging import logging
# Import salt libs
import salt.utils.compat import salt.utils.compat
# Import third party libs
try: try:
# Import libs... # Import libs...
{% if depending_libraries %} {% if depending_libraries %}

View file

@ -1,17 +1,12 @@
# -*- coding: utf-8 -*-
""" """
:codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>` :codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>`
""" """
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging import logging
import salt.modules.libcloud_compute as libcloud_compute import salt.modules.libcloud_compute as libcloud_compute
from salt.utils.versions import LooseVersion as _LooseVersion from salt.utils.versions import LooseVersion as _LooseVersion
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf from tests.support.unit import TestCase, skipIf

View file

@ -1,20 +1,15 @@
# -*- coding: utf-8 -*-
""" """
:codeauthor: Anthony Shaw <anthonyshaw@apache.org> :codeauthor: Anthony Shaw <anthonyshaw@apache.org>
""" """
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import salt.modules.libcloud_dns as libcloud_dns import salt.modules.libcloud_dns as libcloud_dns
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock from tests.support.mock import MagicMock
from tests.support.unit import TestCase, skipIf from tests.support.unit import TestCase, skipIf
class MockDNSDriver(object): class MockDNSDriver:
def __init__(self): def __init__(self):
pass pass

View file

@ -1,14 +1,9 @@
# -*- coding: utf-8 -*-
""" """
:codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>` :codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>`
""" """
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import salt.modules.libcloud_loadbalancer as libcloud_loadbalancer import salt.modules.libcloud_loadbalancer as libcloud_loadbalancer
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf from tests.support.unit import TestCase, skipIf

View file

@ -1,14 +1,9 @@
# -*- coding: utf-8 -*-
""" """
:codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>` :codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>`
""" """
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import salt.modules.libcloud_storage as libcloud_storage import salt.modules.libcloud_storage as libcloud_storage
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf from tests.support.unit import TestCase, skipIf