diff --git a/plugins/action/k8s_info.py b/plugins/action/k8s_info.py index 181daca4e6..650e0beaf5 100644 --- a/plugins/action/k8s_info.py +++ b/plugins/action/k8s_info.py @@ -8,21 +8,21 @@ __metaclass__ = type import copy -import traceback import os -from contextlib import contextmanager import platform +import traceback +from contextlib import contextmanager from ansible.config.manager import ensure_type from ansible.errors import ( - AnsibleError, - AnsibleFileNotFound, AnsibleAction, AnsibleActionFail, + AnsibleError, + AnsibleFileNotFound, ) +from ansible.module_utils._text import to_bytes, to_native, to_text from ansible.module_utils.parsing.convert_bool import boolean -from ansible.module_utils.six import string_types, iteritems -from ansible.module_utils._text import to_text, to_bytes, to_native +from ansible.module_utils.six import iteritems, string_types from ansible.plugins.action import ActionBase @@ -55,7 +55,6 @@ def output(self): class ActionModule(ActionBase): - TRANSFERS_FILES = True DEFAULT_NEWLINE_SEQUENCE = "\n" diff --git a/plugins/connection/kubectl.py b/plugins/connection/kubectl.py index d0c3baa8b4..8aff4efed7 100644 --- a/plugins/connection/kubectl.py +++ b/plugins/connection/kubectl.py @@ -172,18 +172,18 @@ aliases: [ kubectl_verify_ssl ] """ +import json import os import os.path import shutil import subprocess import tempfile -import json -from ansible.parsing.yaml.loader import AnsibleLoader from ansible.errors import AnsibleError, AnsibleFileNotFound -from ansible.module_utils.six.moves import shlex_quote from ansible.module_utils._text import to_bytes -from ansible.plugins.connection import ConnectionBase, BUFSIZE +from ansible.module_utils.six.moves import shlex_quote +from ansible.parsing.yaml.loader import AnsibleLoader +from ansible.plugins.connection import BUFSIZE, ConnectionBase from ansible.utils.display import Display display = Display() diff --git a/plugins/doc_fragments/helm_common_options.py b/plugins/doc_fragments/helm_common_options.py index dde91db12c..260ed94a63 100644 --- a/plugins/doc_fragments/helm_common_options.py +++ b/plugins/doc_fragments/helm_common_options.py @@ -12,7 +12,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: binary_path: diff --git a/plugins/doc_fragments/k8s_auth_options.py b/plugins/doc_fragments/k8s_auth_options.py index 516ef64fda..c2ef9a0655 100644 --- a/plugins/doc_fragments/k8s_auth_options.py +++ b/plugins/doc_fragments/k8s_auth_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: host: diff --git a/plugins/doc_fragments/k8s_delete_options.py b/plugins/doc_fragments/k8s_delete_options.py index a8f20cf9cf..5b3581f8b6 100644 --- a/plugins/doc_fragments/k8s_delete_options.py +++ b/plugins/doc_fragments/k8s_delete_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: delete_options: diff --git a/plugins/doc_fragments/k8s_name_options.py b/plugins/doc_fragments/k8s_name_options.py index e14658b035..07f7c2935f 100644 --- a/plugins/doc_fragments/k8s_name_options.py +++ b/plugins/doc_fragments/k8s_name_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: api_version: diff --git a/plugins/doc_fragments/k8s_resource_options.py b/plugins/doc_fragments/k8s_resource_options.py index 6920efa45c..0aa275af9c 100644 --- a/plugins/doc_fragments/k8s_resource_options.py +++ b/plugins/doc_fragments/k8s_resource_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: resource_definition: diff --git a/plugins/doc_fragments/k8s_scale_options.py b/plugins/doc_fragments/k8s_scale_options.py index ca0605fdf3..87fa17d310 100644 --- a/plugins/doc_fragments/k8s_scale_options.py +++ b/plugins/doc_fragments/k8s_scale_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: replicas: diff --git a/plugins/doc_fragments/k8s_state_options.py b/plugins/doc_fragments/k8s_state_options.py index 0333186676..e01a9aaff5 100644 --- a/plugins/doc_fragments/k8s_state_options.py +++ b/plugins/doc_fragments/k8s_state_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: state: diff --git a/plugins/doc_fragments/k8s_wait_options.py b/plugins/doc_fragments/k8s_wait_options.py index e498e3ac6f..acf8f8aea3 100644 --- a/plugins/doc_fragments/k8s_wait_options.py +++ b/plugins/doc_fragments/k8s_wait_options.py @@ -11,7 +11,6 @@ class ModuleDocFragment(object): - DOCUMENTATION = r""" options: wait: diff --git a/plugins/inventory/k8s.py b/plugins/inventory/k8s.py index a49c35a7e8..144a373f86 100644 --- a/plugins/inventory/k8s.py +++ b/plugins/inventory/k8s.py @@ -124,6 +124,7 @@ import json from ansible.errors import AnsibleError +from ansible.plugins.inventory import BaseInventoryPlugin, Cacheable, Constructable from ansible_collections.kubernetes.core.plugins.module_utils.common import ( HAS_K8S_MODULE_HELPER, k8s_import_exception, @@ -131,7 +132,6 @@ from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) -from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable try: from kubernetes.dynamic.exceptions import DynamicApiError @@ -193,7 +193,6 @@ def setup(self, config_data, cache, cache_key): self.fetch_objects(connections) def fetch_objects(self, connections): - if connections: if not isinstance(connections, list): raise K8sInventoryException("Expecting connections to be a list.") diff --git a/plugins/lookup/k8s.py b/plugins/lookup/k8s.py index bd69a99238..3211fbb74b 100644 --- a/plugins/lookup/k8s.py +++ b/plugins/lookup/k8s.py @@ -179,7 +179,6 @@ from ansible.errors import AnsibleError from ansible.module_utils.common._collections_compat import KeysView from ansible.module_utils.common.validation import check_type_bool - from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) @@ -214,7 +213,6 @@ class KubernetesLookup(object): def __init__(self): - if not HAS_K8S_MODULE_HELPER: raise Exception( "Requires the Kubernetes Python client. Try `pip install kubernetes`. Detail: {0}".format( diff --git a/plugins/lookup/kustomize.py b/plugins/lookup/kustomize.py index ef7e50f067..dd580a2ff4 100644 --- a/plugins/lookup/kustomize.py +++ b/plugins/lookup/kustomize.py @@ -64,12 +64,11 @@ key1: val1 """ +import subprocess + from ansible.errors import AnsibleLookupError -from ansible.plugins.lookup import LookupBase from ansible.module_utils.common.process import get_bin_path - - -import subprocess +from ansible.plugins.lookup import LookupBase def get_binary_from_path(name, opt_dirs=None): diff --git a/plugins/module_utils/ansiblemodule.py b/plugins/module_utils/ansiblemodule.py index 8b17866dcc..d3eba8df74 100644 --- a/plugins/module_utils/ansiblemodule.py +++ b/plugins/module_utils/ansiblemodule.py @@ -14,9 +14,9 @@ if enable_turbo_mode: try: - from ansible_collections.cloud.common.plugins.module_utils.turbo.module import ( + from ansible_collections.cloud.common.plugins.module_utils.turbo.module import ( # noqa: F401 AnsibleTurboModule as AnsibleModule, - ) # noqa: F401 + ) AnsibleModule.collection_name = "kubernetes.core" except ImportError: diff --git a/plugins/module_utils/apply.py b/plugins/module_utils/apply.py index dea185ef3e..18b153a3be 100644 --- a/plugins/module_utils/apply.py +++ b/plugins/module_utils/apply.py @@ -17,8 +17,8 @@ __metaclass__ = type -from collections import OrderedDict import json +from collections import OrderedDict from ansible.module_utils.common.dict_transformations import dict_merge from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import ( @@ -31,7 +31,6 @@ LooseVersion, ) - try: from kubernetes.dynamic.exceptions import NotFoundError except ImportError: diff --git a/plugins/module_utils/client/discovery.py b/plugins/module_utils/client/discovery.py index 898a82cef3..848d4bdbcd 100644 --- a/plugins/module_utils/client/discovery.py +++ b/plugins/module_utils/client/discovery.py @@ -13,15 +13,18 @@ # limitations under the License. +import hashlib import json import os -from collections import defaultdict -import hashlib import tempfile +from collections import defaultdict from functools import partial import kubernetes.dynamic import kubernetes.dynamic.discovery +from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import ( + ResourceList, +) from kubernetes import __version__ from kubernetes.dynamic.exceptions import ( ResourceNotFoundError, @@ -29,10 +32,6 @@ ServiceUnavailableError, ) -from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import ( - ResourceList, -) - class Discoverer(kubernetes.dynamic.discovery.Discoverer): def __init__(self, client, cache_file): diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py index a46c813fe2..e297197276 100644 --- a/plugins/module_utils/common.py +++ b/plugins/module_utils/common.py @@ -20,17 +20,20 @@ __metaclass__ = type import base64 -import time +import hashlib import os -import traceback import sys -import hashlib +import time +import traceback from datetime import datetime from tempfile import NamedTemporaryFile -from ansible_collections.kubernetes.core.plugins.module_utils.version import ( - LooseVersion, -) +from ansible.module_utils._text import to_bytes, to_native, to_text +from ansible.module_utils.basic import missing_required_lib +from ansible.module_utils.common.dict_transformations import dict_merge +from ansible.module_utils.parsing.convert_bool import boolean +from ansible.module_utils.six import iteritems, string_types +from ansible.module_utils.urls import Request from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( AUTH_ARG_MAP, AUTH_ARG_SPEC, @@ -42,27 +45,23 @@ from ansible_collections.kubernetes.core.plugins.module_utils.selector import ( LabelSelectorFilter, ) - -from ansible.module_utils.basic import missing_required_lib -from ansible.module_utils.six import iteritems, string_types -from ansible.module_utils._text import to_native, to_bytes, to_text -from ansible.module_utils.common.dict_transformations import dict_merge -from ansible.module_utils.parsing.convert_bool import boolean -from ansible.module_utils.urls import Request +from ansible_collections.kubernetes.core.plugins.module_utils.version import ( + LooseVersion, +) K8S_IMP_ERR = None try: import kubernetes from kubernetes.dynamic.exceptions import ( - NotFoundError, - ResourceNotFoundError, - ResourceNotUniqueError, - DynamicApiError, + BadRequestError, ConflictError, + DynamicApiError, ForbiddenError, - MethodNotAllowedError, - BadRequestError, KubernetesValidateMissing, + MethodNotAllowedError, + NotFoundError, + ResourceNotFoundError, + ResourceNotUniqueError, ) HAS_K8S_MODULE_HELPER = True @@ -819,7 +818,7 @@ def execute_module(self): try: self.client = get_api_client(self.module) # Hopefully the kubernetes client will provide its own exception class one day - except (urllib3.exceptions.RequestError) as e: + except urllib3.exceptions.RequestError as e: self.fail_json(msg="Couldn't connect to Kubernetes: %s" % str(e)) flattened_definitions = [] @@ -837,7 +836,7 @@ def execute_module(self): resource = self.find_resource(kind, api_version, fail=True) flattened_definitions.append((resource, definition)) - for (resource, definition) in flattened_definitions: + for resource, definition in flattened_definitions: kind = definition.get("kind", self.kind) api_version = definition.get("apiVersion", self.api_version) definition = self.set_defaults(resource, definition) diff --git a/plugins/module_utils/copy.py b/plugins/module_utils/copy.py index c7e1b4e21a..c70eed1a4c 100644 --- a/plugins/module_utils/copy.py +++ b/plugins/module_utils/copy.py @@ -18,25 +18,26 @@ __metaclass__ = type import os -from tempfile import TemporaryFile, NamedTemporaryFile -from select import select -from abc import ABCMeta, abstractmethod import tarfile +from abc import ABCMeta, abstractmethod +from select import select +from tempfile import NamedTemporaryFile, TemporaryFile + +from ansible.module_utils._text import to_native # from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import AnsibleModule from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, ) -from ansible.module_utils._text import to_native try: from kubernetes.client.api import core_v1_api from kubernetes.stream import stream from kubernetes.stream.ws_client import ( - STDOUT_CHANNEL, - STDERR_CHANNEL, - ERROR_CHANNEL, ABNF, + ERROR_CHANNEL, + STDERR_CHANNEL, + STDOUT_CHANNEL, ) except ImportError: pass diff --git a/plugins/module_utils/hashes.py b/plugins/module_utils/hashes.py index 3d44a7d906..5e0e70559b 100644 --- a/plugins/module_utils/hashes.py +++ b/plugins/module_utils/hashes.py @@ -19,8 +19,8 @@ __metaclass__ = type -import json import hashlib +import json try: import string @@ -37,7 +37,7 @@ def sorted_dict(unsorted_dict): result = OrderedDict() - for (k, v) in sorted(unsorted_dict.items()): + for k, v in sorted(unsorted_dict.items()): if isinstance(v, dict): v = sorted_dict(v) result[k] = v diff --git a/plugins/module_utils/helm.py b/plugins/module_utils/helm.py index a7a2fa7c01..8bd06eccde 100644 --- a/plugins/module_utils/helm.py +++ b/plugins/module_utils/helm.py @@ -7,19 +7,18 @@ __metaclass__ = type +import copy +import json import os +import re import tempfile import traceback -import re -import json -import copy -from ansible.module_utils.basic import missing_required_lib +from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.six import string_types from ansible_collections.kubernetes.core.plugins.module_utils.version import ( LooseVersion, ) -from ansible.module_utils.basic import AnsibleModule try: import yaml @@ -84,7 +83,6 @@ class AnsibleHelmModule(object): """ def __init__(self, **kwargs): - self._module = None if "module" in kwargs: self._module = kwargs.get("module") @@ -184,7 +182,6 @@ def get_helm_binary(self): ) def get_helm_version(self): - command = self.get_helm_binary() + " version" rc, out, err = self.run_command(command) m = re.match(r'version.BuildInfo{Version:"v([0-9\.]*)",', out) @@ -216,7 +213,6 @@ def get_values(self, release_name, get_all=False): return yaml.safe_load(out) def parse_yaml_content(self, content): - if not HAS_YAML: self.fail_json(msg=missing_required_lib("yaml"), exception=HAS_YAML) @@ -228,7 +224,6 @@ def parse_yaml_content(self, content): ) def get_manifest(self, release_name): - command = [ self.get_helm_binary(), "get", @@ -241,7 +236,6 @@ def get_manifest(self, release_name): return self.parse_yaml_content(out) def get_notes(self, release_name): - command = [ self.get_helm_binary(), "get", diff --git a/plugins/module_utils/k8s/client.py b/plugins/module_utils/k8s/client.py index 2589e56073..a0d8dcfa6b 100644 --- a/plugins/module_utils/k8s/client.py +++ b/plugins/module_utils/k8s/client.py @@ -1,12 +1,11 @@ # Copyright: (c) 2021, Red Hat | Ansible # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -import os import hashlib +import os from typing import Any, Dict, List, Optional from ansible.module_utils.six import iteritems, string_types - from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( AUTH_ARG_MAP, AUTH_ARG_SPEC, diff --git a/plugins/module_utils/k8s/core.py b/plugins/module_utils/k8s/core.py index 131e80e29e..1ecc182ece 100644 --- a/plugins/module_utils/k8s/core.py +++ b/plugins/module_utils/k8s/core.py @@ -1,15 +1,12 @@ import traceback - from typing import Optional +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.common.text.converters import to_text from ansible_collections.kubernetes.core.plugins.module_utils.version import ( LooseVersion, ) -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.basic import missing_required_lib -from ansible.module_utils.common.text.converters import to_text - class AnsibleK8SModule: """A base module class for K8S modules. diff --git a/plugins/module_utils/k8s/resource.py b/plugins/module_utils/k8s/resource.py index 4c9d3e1d12..314f7a38ac 100644 --- a/plugins/module_utils/k8s/resource.py +++ b/plugins/module_utils/k8s/resource.py @@ -2,7 +2,7 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) import os -from typing import cast, Dict, Iterable, List, Optional, Union +from typing import Dict, Iterable, List, Optional, Union, cast from ansible.module_utils.six import string_types from ansible.module_utils.urls import Request diff --git a/plugins/module_utils/k8s/runner.py b/plugins/module_utils/k8s/runner.py index 60904b4228..61ad1fb6ac 100644 --- a/plugins/module_utils/k8s/runner.py +++ b/plugins/module_utils/k8s/runner.py @@ -4,12 +4,12 @@ from typing import Dict from ansible.module_utils._text import to_native - from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, + ResourceTimeout, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import ( create_definitions, @@ -19,9 +19,6 @@ diff_objects, hide_fields, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( - ResourceTimeout, -) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import exists from ansible_collections.kubernetes.core.plugins.module_utils.selector import ( LabelSelectorFilter, diff --git a/plugins/module_utils/k8s/service.py b/plugins/module_utils/k8s/service.py index 95cf2136c9..dc91bc0c6c 100644 --- a/plugins/module_utils/k8s/service.py +++ b/plugins/module_utils/k8s/service.py @@ -4,36 +4,30 @@ import copy from typing import Any, Dict, List, Optional, Tuple +from ansible.module_utils.common.dict_transformations import dict_merge from ansible_collections.kubernetes.core.plugins.module_utils.hashes import ( generate_hash, ) - +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import requires +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( + CoreException, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import ( Waiter, exists, - resource_absent, get_waiter, + resource_absent, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( - requires, -) - -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( - CoreException, -) - -from ansible.module_utils.common.dict_transformations import dict_merge - try: from kubernetes.dynamic.exceptions import ( - NotFoundError, - ResourceNotFoundError, - ResourceNotUniqueError, + BadRequestError, ConflictError, ForbiddenError, MethodNotAllowedError, - BadRequestError, + NotFoundError, + ResourceNotFoundError, + ResourceNotUniqueError, ) except ImportError: # Handled in module setup diff --git a/plugins/module_utils/k8s/waiter.py b/plugins/module_utils/k8s/waiter.py index 55afd80174..5328d63180 100644 --- a/plugins/module_utils/k8s/waiter.py +++ b/plugins/module_utils/k8s/waiter.py @@ -3,7 +3,6 @@ from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union from ansible.module_utils.parsing.convert_bool import boolean - from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, ) diff --git a/plugins/module_utils/k8sdynamicclient.py b/plugins/module_utils/k8sdynamicclient.py index b1beca4cd7..7a6e8e66a5 100644 --- a/plugins/module_utils/k8sdynamicclient.py +++ b/plugins/module_utils/k8sdynamicclient.py @@ -18,12 +18,11 @@ __metaclass__ = type -from kubernetes.dynamic import DynamicClient - from ansible_collections.kubernetes.core.plugins.module_utils.apply import k8s_apply from ansible_collections.kubernetes.core.plugins.module_utils.exceptions import ( ApplyException, ) +from kubernetes.dynamic import DynamicClient class K8SDynamicClient(DynamicClient): diff --git a/plugins/module_utils/selector.py b/plugins/module_utils/selector.py index 2a85d0bfde..08178602aa 100644 --- a/plugins/module_utils/selector.py +++ b/plugins/module_utils/selector.py @@ -16,7 +16,6 @@ class Selector(object): - equality_based_operators = ("==", "!=", "=") def __init__(self, data): diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index 87d5177be9..dc756e728d 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -393,10 +393,11 @@ sample: helm upgrade ... """ +import copy import re import tempfile import traceback -import copy + from ansible_collections.kubernetes.core.plugins.module_utils.version import ( LooseVersion, ) @@ -877,7 +878,6 @@ def main(): changed = True else: - helm_diff_version = get_plugin_version("diff") if helm_diff_version and ( not chart_repo_url diff --git a/plugins/modules/helm_info.py b/plugins/modules/helm_info.py index 5a7a561662..4f4a5e0451 100644 --- a/plugins/modules/helm_info.py +++ b/plugins/modules/helm_info.py @@ -137,8 +137,8 @@ version_added: "2.4.0" """ -import traceback import copy +import traceback try: import yaml diff --git a/plugins/modules/helm_plugin.py b/plugins/modules/helm_plugin.py index 795dbf29ec..e91d122e06 100644 --- a/plugins/modules/helm_plugin.py +++ b/plugins/modules/helm_plugin.py @@ -109,6 +109,7 @@ """ import copy + from ansible_collections.kubernetes.core.plugins.module_utils.helm import ( AnsibleHelmModule, parse_helm_plugin_list, diff --git a/plugins/modules/helm_plugin_info.py b/plugins/modules/helm_plugin_info.py index 3b9fcd1898..e39c61ed0c 100644 --- a/plugins/modules/helm_plugin_info.py +++ b/plugins/modules/helm_plugin_info.py @@ -71,9 +71,10 @@ """ import copy + from ansible_collections.kubernetes.core.plugins.module_utils.helm import ( - parse_helm_plugin_list, AnsibleHelmModule, + parse_helm_plugin_list, ) from ansible_collections.kubernetes.core.plugins.module_utils.helm_args_common import ( HELM_AUTH_ARG_SPEC, @@ -82,7 +83,6 @@ def main(): - argument_spec = copy.deepcopy(HELM_AUTH_ARG_SPEC) argument_spec.update( dict( diff --git a/plugins/modules/helm_repository.py b/plugins/modules/helm_repository.py index 34213addc2..b7f9815511 100644 --- a/plugins/modules/helm_repository.py +++ b/plugins/modules/helm_repository.py @@ -166,8 +166,8 @@ sample: 'Repository already have a repository named bitnami' """ -import traceback import copy +import traceback try: import yaml diff --git a/plugins/modules/k8s.py b/plugins/modules/k8s.py index 0a7549f2d2..fb8e68003e 100644 --- a/plugins/modules/k8s.py +++ b/plugins/modules/k8s.py @@ -423,10 +423,10 @@ ) from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( AUTH_ARG_SPEC, - WAIT_ARG_SPEC, + DELETE_OPTS_ARG_SPEC, NAME_ARG_SPEC, RESOURCE_ARG_SPEC, - DELETE_OPTS_ARG_SPEC, + WAIT_ARG_SPEC, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( AnsibleK8SModule, diff --git a/plugins/modules/k8s_cluster_info.py b/plugins/modules/k8s_cluster_info.py index 9cd2ac17be..916c30599e 100644 --- a/plugins/modules/k8s_cluster_info.py +++ b/plugins/modules/k8s_cluster_info.py @@ -154,15 +154,15 @@ from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) +from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( + AUTH_ARG_SPEC, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( AnsibleK8SModule, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, ) -from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( - AUTH_ARG_SPEC, -) def execute_module(module, client): diff --git a/plugins/modules/k8s_cp.py b/plugins/modules/k8s_cp.py index e8f1dea72d..185c8e064c 100644 --- a/plugins/modules/k8s_cp.py +++ b/plugins/modules/k8s_cp.py @@ -139,9 +139,18 @@ import copy +from ansible.module_utils._text import to_native from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) +from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( + AUTH_ARG_SPEC, +) +from ansible_collections.kubernetes.core.plugins.module_utils.copy import ( + K8SCopyFromPod, + K8SCopyToPod, + check_pod, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) @@ -155,16 +164,6 @@ K8sService, ) -from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( - AUTH_ARG_SPEC, -) -from ansible_collections.kubernetes.core.plugins.module_utils.copy import ( - K8SCopyFromPod, - K8SCopyToPod, - check_pod, -) -from ansible.module_utils._text import to_native - def argspec(): argument_spec = copy.deepcopy(AUTH_ARG_SPEC) diff --git a/plugins/modules/k8s_drain.py b/plugins/modules/k8s_drain.py index e7596ed7f1..6b6e96482d 100644 --- a/plugins/modules/k8s_drain.py +++ b/plugins/modules/k8s_drain.py @@ -145,8 +145,9 @@ import copy import time import traceback - from datetime import datetime + +from ansible.module_utils._text import to_native from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) @@ -163,12 +164,10 @@ CoreException, ) -from ansible.module_utils._text import to_native - try: from kubernetes.client.api import core_v1_api - from kubernetes.client.models import V1DeleteOptions, V1ObjectMeta from kubernetes.client.exceptions import ApiException + from kubernetes.client.models import V1DeleteOptions, V1ObjectMeta except ImportError: # ImportError are managed by the common module already. pass @@ -429,7 +428,6 @@ def _revert_node_patch(): return dict(result=" ".join(result)) def patch_node(self, unschedulable): - body = {"spec": {"unschedulable": unschedulable}} try: self._api_instance.patch_node( @@ -441,7 +439,6 @@ def patch_node(self, unschedulable): ) def execute_module(self): - state = self._module.params.get("state") name = self._module.params.get("name") try: diff --git a/plugins/modules/k8s_exec.py b/plugins/modules/k8s_exec.py index c54c23c06f..17affe811a 100644 --- a/plugins/modules/k8s_exec.py +++ b/plugins/modules/k8s_exec.py @@ -131,27 +131,27 @@ # ImportError are managed by the common module already. pass +from ansible.module_utils._text import to_native from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) -from ansible.module_utils._text import to_native from ansible_collections.kubernetes.core.plugins.module_utils.common import ( AUTH_ARG_SPEC, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( - AnsibleK8SModule, -) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( + AnsibleK8SModule, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, ) try: from kubernetes.client.apis import core_v1_api - from kubernetes.stream import stream from kubernetes.client.exceptions import ApiException + from kubernetes.stream import stream except ImportError: # ImportError are managed by the common module already. pass diff --git a/plugins/modules/k8s_info.py b/plugins/modules/k8s_info.py index 7f144243c2..e750d4cc57 100644 --- a/plugins/modules/k8s_info.py +++ b/plugins/modules/k8s_info.py @@ -165,12 +165,12 @@ AUTH_ARG_SPEC, WAIT_ARG_SPEC, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( - AnsibleK8SModule, -) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( + AnsibleK8SModule, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, ) diff --git a/plugins/modules/k8s_json_patch.py b/plugins/modules/k8s_json_patch.py index 5ea8dbc956..efa62f484f 100644 --- a/plugins/modules/k8s_json_patch.py +++ b/plugins/modules/k8s_json_patch.py @@ -127,8 +127,8 @@ import copy import traceback -from ansible.module_utils.basic import missing_required_lib from ansible.module_utils._text import to_native +from ansible.module_utils.basic import missing_required_lib from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) @@ -152,7 +152,6 @@ get_waiter, ) - try: from kubernetes.dynamic.exceptions import DynamicApiError except ImportError: diff --git a/plugins/modules/k8s_scale.py b/plugins/modules/k8s_scale.py index 20d692900f..cccd35271e 100644 --- a/plugins/modules/k8s_scale.py +++ b/plugins/modules/k8s_scale.py @@ -6,7 +6,6 @@ from __future__ import absolute_import, division, print_function - __metaclass__ = type @@ -151,14 +150,13 @@ pass from ansible.module_utils._text import to_native - from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) from ansible_collections.kubernetes.core.plugins.module_utils.args_common import ( AUTH_ARG_SPEC, - RESOURCE_ARG_SPEC, NAME_ARG_SPEC, + RESOURCE_ARG_SPEC, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, @@ -170,15 +168,15 @@ CoreException, ResourceTimeout, ) +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import ( + create_definitions, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import ( diff_objects, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import ( get_waiter, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import ( - create_definitions, -) SCALE_ARG_SPEC = { "replicas": {"type": "int", "required": True}, diff --git a/plugins/modules/k8s_service.py b/plugins/modules/k8s_service.py index 1eed29bd3c..745520d96a 100644 --- a/plugins/modules/k8s_service.py +++ b/plugins/modules/k8s_service.py @@ -143,7 +143,6 @@ """ import copy - from collections import defaultdict from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( @@ -154,25 +153,24 @@ COMMON_ARG_SPEC, RESOURCE_ARG_SPEC, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( - AnsibleK8SModule, -) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( get_api_client, ) +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( + AnsibleK8SModule, +) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.exceptions import ( CoreException, ) -from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import ( - K8sService, -) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.resource import ( create_definitions, ) from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import ( perform_action, ) - +from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import ( + K8sService, +) SERVICE_ARG_SPEC = { "apply": {"type": "bool", "default": False}, diff --git a/plugins/modules/k8s_taint.py b/plugins/modules/k8s_taint.py index bfa80db5ec..5f0355ca55 100644 --- a/plugins/modules/k8s_taint.py +++ b/plugins/modules/k8s_taint.py @@ -127,7 +127,6 @@ import copy from ansible.module_utils._text import to_native - from ansible_collections.kubernetes.core.plugins.module_utils.ansiblemodule import ( AnsibleModule, ) diff --git a/tests/integration/targets/helm/library/helm_test_pending.py b/tests/integration/targets/helm/library/helm_test_pending.py index c0f3935f34..cc8bde7f97 100644 --- a/tests/integration/targets/helm/library/helm_test_pending.py +++ b/tests/integration/targets/helm/library/helm_test_pending.py @@ -48,9 +48,10 @@ RETURN = r""" """ -import subprocess import json +import subprocess import time + from ansible.module_utils.basic import AnsibleModule diff --git a/tests/integration/targets/helm/library/helm_test_version.py b/tests/integration/targets/helm/library/helm_test_version.py index dfd9a08605..1ac12e0f65 100644 --- a/tests/integration/targets/helm/library/helm_test_version.py +++ b/tests/integration/targets/helm/library/helm_test_version.py @@ -52,12 +52,12 @@ """ import re + +from ansible.module_utils.basic import AnsibleModule from ansible_collections.kubernetes.core.plugins.module_utils.version import ( LooseVersion, ) -from ansible.module_utils.basic import AnsibleModule - def main(): module = AnsibleModule( diff --git a/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py b/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py index bcf097839c..e84bbffd87 100644 --- a/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py +++ b/tests/integration/targets/k8s_copy/library/kubectl_file_compare.py @@ -89,10 +89,10 @@ RETURN = r""" """ -import os import filecmp - +import os from tempfile import NamedTemporaryFile, TemporaryDirectory + from ansible.module_utils.basic import AnsibleModule @@ -157,7 +157,6 @@ def compare_directories(dir1, dir2): def execute_module(module): - args = module.params.get("args") local_path = module.params.get("local_path") namespace = module.params.get("namespace") diff --git a/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py b/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py index 9c9e879660..1e0d45ec3e 100644 --- a/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py +++ b/tests/integration/targets/setup_kubeconfig/library/test_inventory_read_credentials.py @@ -78,7 +78,6 @@ class K8SInventoryTestModule(AnsibleModule): def __init__(self): - argument_spec = dict( kube_config=dict(required=True, type="path"), dest_dir=dict(required=True, type="path"), @@ -88,7 +87,6 @@ def __init__(self): self.execute_module() def execute_module(self): - dest_dir = os.path.abspath(self.params.get("dest_dir")) kubeconfig_path = self.params.get("kube_config") if not os.path.isdir(dest_dir): diff --git a/tests/sanity/refresh_ignore_files b/tests/sanity/refresh_ignore_files index d06fb31e2a..2f94f12ee8 100644 --- a/tests/sanity/refresh_ignore_files +++ b/tests/sanity/refresh_ignore_files @@ -2,10 +2,8 @@ import itertools - from pathlib import Path - # Mapping of Ansible versions to supported Python versions ANSIBLE_VERSIONS = { "2.9": ["3.6", "3.7", "3.8"], diff --git a/tests/unit/action/test_remove_omit.py b/tests/unit/action/test_remove_omit.py index 3432c19f99..e8206a4407 100644 --- a/tests/unit/action/test_remove_omit.py +++ b/tests/unit/action/test_remove_omit.py @@ -7,6 +7,7 @@ __metaclass__ = type from datetime import datetime + from ansible_collections.kubernetes.core.plugins.action.k8s_info import RemoveOmit diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 20615adb09..63eca8b575 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -6,12 +6,11 @@ import sys from io import BytesIO -import pytest - import ansible.module_utils.basic -from ansible.module_utils.six import string_types +import pytest from ansible.module_utils._text import to_bytes from ansible.module_utils.common._collections_compat import MutableMapping +from ansible.module_utils.six import string_types @pytest.fixture diff --git a/tests/unit/module_utils/test_apply.py b/tests/unit/module_utils/test_apply.py index 07986007bf..3dd1161082 100644 --- a/tests/unit/module_utils/test_apply.py +++ b/tests/unit/module_utils/test_apply.py @@ -18,8 +18,8 @@ __metaclass__ = type from ansible_collections.kubernetes.core.plugins.module_utils.apply import ( - merge, apply_patch, + merge, ) tests = [ diff --git a/tests/unit/module_utils/test_client.py b/tests/unit/module_utils/test_client.py index bba03589e7..d3fec2299c 100644 --- a/tests/unit/module_utils/test_client.py +++ b/tests/unit/module_utils/test_client.py @@ -1,14 +1,14 @@ -import os import base64 +import os import tempfile -import yaml -import mock -from mock import MagicMock +import mock +import yaml from ansible_collections.kubernetes.core.plugins.module_utils.k8s.client import ( _create_auth_spec, _create_configuration, ) +from mock import MagicMock TEST_HOST = "test-host" TEST_SSL_HOST = "https://test-host" diff --git a/tests/unit/module_utils/test_core.py b/tests/unit/module_utils/test_core.py index 189f1f9508..a50833d6e7 100644 --- a/tests/unit/module_utils/test_core.py +++ b/tests/unit/module_utils/test_core.py @@ -6,7 +6,6 @@ import kubernetes import pytest - from ansible_collections.kubernetes.core.plugins.module_utils.k8s.core import ( AnsibleK8SModule, ) diff --git a/tests/unit/module_utils/test_discoverer.py b/tests/unit/module_utils/test_discoverer.py index b23a7a9aa6..618b0cb08b 100644 --- a/tests/unit/module_utils/test_discoverer.py +++ b/tests/unit/module_utils/test_discoverer.py @@ -14,19 +14,17 @@ import pytest - -from kubernetes.client import ApiClient -from kubernetes.dynamic import Resource - -from ansible_collections.kubernetes.core.plugins.module_utils.k8sdynamicclient import ( - K8SDynamicClient, -) from ansible_collections.kubernetes.core.plugins.module_utils.client.discovery import ( LazyDiscoverer, ) from ansible_collections.kubernetes.core.plugins.module_utils.client.resource import ( ResourceList, ) +from ansible_collections.kubernetes.core.plugins.module_utils.k8sdynamicclient import ( + K8SDynamicClient, +) +from kubernetes.client import ApiClient +from kubernetes.dynamic import Resource @pytest.fixture(scope="module") diff --git a/tests/unit/module_utils/test_helm.py b/tests/unit/module_utils/test_helm.py index 0bb9a4b71a..5db0a017c8 100644 --- a/tests/unit/module_utils/test_helm.py +++ b/tests/unit/module_utils/test_helm.py @@ -7,18 +7,17 @@ __metaclass__ = type import os.path -import yaml +import random +import string import tempfile -import pytest - +from unittest.mock import MagicMock +import pytest +import yaml from ansible_collections.kubernetes.core.plugins.module_utils.helm import ( AnsibleHelmModule, write_temp_kubeconfig, ) -from unittest.mock import MagicMock -import random -import string @pytest.fixture() @@ -114,7 +113,6 @@ def test_write_temp_kubeconfig_with_kubeconfig(): def test_module_get_helm_binary_from_params(): - helm_binary_path = MagicMock() helm_sys_binary_path = MagicMock() @@ -129,7 +127,6 @@ def test_module_get_helm_binary_from_params(): def test_module_get_helm_binary_from_system(): - helm_sys_binary_path = MagicMock() module = MagicMock() module.params = {} @@ -140,7 +137,6 @@ def test_module_get_helm_binary_from_system(): def test_module_get_helm_plugin_list(_ansible_helm_module): - _ansible_helm_module.run_helm_command = MagicMock() _ansible_helm_module.run_helm_command.return_value = (0, "output", "error") @@ -156,7 +152,6 @@ def test_module_get_helm_plugin_list(_ansible_helm_module): def test_module_get_helm_plugin_list_failure(_ansible_helm_module): - _ansible_helm_module.run_helm_command = MagicMock() _ansible_helm_module.run_helm_command.return_value = (-1, "output", "error") @@ -175,7 +170,6 @@ def test_module_get_helm_plugin_list_failure(_ansible_helm_module): @pytest.mark.parametrize("no_values", [True, False]) @pytest.mark.parametrize("get_all", [True, False]) def test_module_get_values(_ansible_helm_module, no_values, get_all): - expected = {"test": "units"} output = "---\ntest: units\n" @@ -211,7 +205,6 @@ def test_module_get_values(_ansible_helm_module, no_values, get_all): ], ) def test_module_get_helm_version(_ansible_helm_module, output, expected): - _ansible_helm_module.run_command = MagicMock() _ansible_helm_module.run_command.return_value = (0, output, "error") @@ -224,7 +217,6 @@ def test_module_get_helm_version(_ansible_helm_module, output, expected): def test_module_run_helm_command(_ansible_helm_module): - error = "".join( random.choice(string.ascii_letters + string.digits) for x in range(10) ) @@ -252,7 +244,6 @@ def test_module_run_helm_command(_ansible_helm_module): @pytest.mark.parametrize("fails_on_error", [True, False]) def test_module_run_helm_command_failure(_ansible_helm_module, fails_on_error): - error = "".join( random.choice(string.ascii_letters + string.digits) for x in range(10) ) @@ -311,7 +302,6 @@ def test_module_run_helm_command_failure(_ansible_helm_module, fails_on_error): ], ) def test_module_prepare_helm_environment(params, env_update, kubeconfig): - module = MagicMock() module.params = params @@ -355,7 +345,6 @@ def test_module_prepare_helm_environment(params, env_update, kubeconfig): def test_module_prepare_helm_environment_with_validate_certs( helm_version, is_env_var_set ): - module = MagicMock() module.params = {"validate_certs": False} @@ -387,7 +376,6 @@ def test_module_prepare_helm_environment_with_validate_certs( ], ) def test_module_prepare_helm_environment_with_ca_cert(helm_version, is_env_var_set): - ca_cert = "".join( random.choice(string.ascii_letters + string.digits) for i in range(50) ) @@ -441,7 +429,6 @@ def test_module_prepare_helm_environment_with_ca_cert(helm_version, is_env_var_s ], ) def test_module_get_helm_set_values_args(set_values, expected): - module = MagicMock() module.params = {} module.fail_json.side_effect = SystemExit(1) diff --git a/tests/unit/module_utils/test_runner.py b/tests/unit/module_utils/test_runner.py index 45c6f29aa7..a0555c411f 100644 --- a/tests/unit/module_utils/test_runner.py +++ b/tests/unit/module_utils/test_runner.py @@ -1,12 +1,11 @@ -import pytest from copy import deepcopy from unittest.mock import Mock -from kubernetes.dynamic.resource import ResourceInstance - +import pytest from ansible_collections.kubernetes.core.plugins.module_utils.k8s.runner import ( perform_action, ) +from kubernetes.dynamic.resource import ResourceInstance definition = { "apiVersion": "v1", diff --git a/tests/unit/module_utils/test_service.py b/tests/unit/module_utils/test_service.py index a1822de61a..9803361763 100644 --- a/tests/unit/module_utils/test_service.py +++ b/tests/unit/module_utils/test_service.py @@ -1,14 +1,12 @@ from unittest.mock import Mock import pytest -from kubernetes.dynamic.resource import ResourceInstance, Resource - from ansible_collections.kubernetes.core.plugins.module_utils.k8s.service import ( K8sService, diff_objects, ) - from kubernetes.dynamic.exceptions import NotFoundError +from kubernetes.dynamic.resource import Resource, ResourceInstance pod_definition = { "apiVersion": "v1", diff --git a/tests/unit/module_utils/test_waiter.py b/tests/unit/module_utils/test_waiter.py index b5ce10a51f..e63019ec73 100644 --- a/tests/unit/module_utils/test_waiter.py +++ b/tests/unit/module_utils/test_waiter.py @@ -5,20 +5,19 @@ import pytest import yaml -from kubernetes.dynamic.resource import ResourceInstance -from kubernetes.dynamic.exceptions import NotFoundError - from ansible_collections.kubernetes.core.plugins.module_utils.k8s.waiter import ( + DummyWaiter, + Waiter, clock, custom_condition, deployment_ready, - DummyWaiter, exists, get_waiter, pod_ready, resource_absent, - Waiter, ) +from kubernetes.dynamic.exceptions import NotFoundError +from kubernetes.dynamic.resource import ResourceInstance def resources(filepath): diff --git a/tests/unit/modules/test_helm_template_module.py b/tests/unit/modules/test_helm_template_module.py index 9fd98e4c8b..0ff6ad016a 100644 --- a/tests/unit/modules/test_helm_template_module.py +++ b/tests/unit/modules/test_helm_template_module.py @@ -7,14 +7,13 @@ __metaclass__ = type import unittest - from unittest.mock import patch from ansible.module_utils import basic from ansible_collections.kubernetes.core.plugins.modules import helm_template from ansible_collections.kubernetes.core.tests.unit.utils.ansible_module_mock import ( - AnsibleFailJson, AnsibleExitJson, + AnsibleFailJson, exit_json, fail_json, get_bin_path, diff --git a/tests/unit/modules/test_module_helm.py b/tests/unit/modules/test_module_helm.py index ca61cf3ef4..50ce8a4fd8 100644 --- a/tests/unit/modules/test_module_helm.py +++ b/tests/unit/modules/test_module_helm.py @@ -7,14 +7,13 @@ __metaclass__ = type import unittest - -from unittest.mock import MagicMock, patch, call +from unittest.mock import MagicMock, call, patch from ansible.module_utils import basic from ansible_collections.kubernetes.core.plugins.modules import helm from ansible_collections.kubernetes.core.tests.unit.utils.ansible_module_mock import ( - AnsibleFailJson, AnsibleExitJson, + AnsibleFailJson, exit_json, fail_json, get_bin_path, diff --git a/tox.ini b/tox.ini index c307fbd186..e2d15b071f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,9 @@ minversion = 1.4.2 skipsdist = True +[common] +format_dirs = {toxinidir}/plugins {toxinidir}/tests + [testenv:integration] install_command = pip install {opts} {packages} @@ -27,19 +30,33 @@ commands = black -v --check --diff {toxinidir}/plugins {toxinidir}/tests [testenv:black] +depends = + flynt, isort deps = - {[testenv:black_check]deps} + black >=23.0, <24.0 +commands = + black -v {[common]format_dirs} +[testenv:isort] +deps = + isort commands = - black -v {posargs:{toxinidir}/plugins {toxinidir}/tests} + isort --profile black {[common]format_dirs} + +[testenv:flynt] +deps = + flynt +commands = + flynt {[common]format_dirs} [testenv:linters] deps = - yamllint + {[testenv:black]deps} + {[testenv:isort]deps} flake8 - {[testenv:black_check]deps} - + yamllint commands = - {[testenv:black_check]commands} + black -v --check {toxinidir}/plugins {toxinidir}/tests + isort --profile black --check-only --diff {toxinidir}/plugins {toxinidir}/tests + flake8 {posargs} {toxinidir}/plugins {toxinidir}/tests yamllint -s {toxinidir} - flake8 {toxinidir}