diff --git a/.ansible-lint b/.ansible-lint index 5062e311..35f1c5ae 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -24,3 +24,4 @@ exclude_paths: warn_list: - internal-error + - sanity[cannot-ignore] diff --git a/.azure-pipelines/scripts/combine-coverage.py b/.azure-pipelines/scripts/combine-coverage.py index afadeaa3..bab3c422 100755 --- a/.azure-pipelines/scripts/combine-coverage.py +++ b/.azure-pipelines/scripts/combine-coverage.py @@ -7,6 +7,7 @@ It is up to pipeline authors to avoid name collisions when deviating from the recommended format. """ +from __future__ import annotations import os import re diff --git a/.azure-pipelines/scripts/time-command.py b/.azure-pipelines/scripts/time-command.py index ada4d5a8..783e745d 100755 --- a/.azure-pipelines/scripts/time-command.py +++ b/.azure-pipelines/scripts/time-command.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Prepends a relative timestamp to each input line from stdin and writes it to stdout.""" +from __future__ import annotations import sys import time diff --git a/plugins/doc_fragments/hcloud.py b/plugins/doc_fragments/hcloud.py index 1a55fd5a..eee4a9c8 100644 --- a/plugins/doc_fragments/hcloud.py +++ b/plugins/doc_fragments/hcloud.py @@ -2,6 +2,9 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + + class ModuleDocFragment: DOCUMENTATION = """ options: diff --git a/plugins/inventory/hcloud.py b/plugins/inventory/hcloud.py index f82d128e..147ebc6b 100644 --- a/plugins/inventory/hcloud.py +++ b/plugins/inventory/hcloud.py @@ -1,6 +1,8 @@ # Copyright (c) 2019 Hetzner Cloud GmbH # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = r""" name: hcloud short_description: Ansible dynamic inventory plugin for the Hetzner Cloud. @@ -135,7 +137,6 @@ import os import sys from ipaddress import IPv6Network -from typing import List, Optional, Tuple from ansible.errors import AnsibleError from ansible.inventory.manager import InventoryData @@ -391,7 +392,7 @@ def verify_file(self, path): """Return the possibly of a file being consumable by this plugin.""" return super().verify_file(path) and path.endswith(("hcloud.yaml", "hcloud.yml")) - def _get_cached_result(self, path, cache) -> Tuple[List[Optional[InventoryServer]], bool]: + def _get_cached_result(self, path, cache) -> tuple[list[InventoryServer | None], bool]: # false when refresh_cache or --flush-cache is used if not cache: return None, False @@ -409,7 +410,7 @@ def _get_cached_result(self, path, cache) -> Tuple[List[Optional[InventoryServer return cached_result, True - def _update_cached_result(self, path, cache, result: List[InventoryServer]): + def _update_cached_result(self, path, cache, result: list[InventoryServer]): if not self.get_option("cache"): return diff --git a/plugins/module_utils/hcloud.py b/plugins/module_utils/hcloud.py index 49bda6df..c83a6c6b 100644 --- a/plugins/module_utils/hcloud.py +++ b/plugins/module_utils/hcloud.py @@ -3,8 +3,10 @@ # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) +from __future__ import annotations + import traceback -from typing import Any, Dict, Optional, Union +from typing import Any from ansible.module_utils.basic import ( AnsibleModule as AnsibleModuleBase, @@ -56,7 +58,7 @@ def __init__(self, module: AnsibleModule): def fail_json_hcloud( self, exception: HCloudException, - msg: Optional[str] = None, + msg: str | None = None, params: Any = None, **kwargs, ) -> None: @@ -91,7 +93,7 @@ def _build_client(self) -> None: application_version=version, ) - def _client_get_by_name_or_id(self, resource: str, param: Union[str, int]): + def _client_get_by_name_or_id(self, resource: str, param: str | int): """ Get a resource by name, and if not found by its ID. @@ -132,11 +134,11 @@ def base_module_arguments(cls): }, } - def _prepare_result(self) -> Dict[str, Any]: + def _prepare_result(self) -> dict[str, Any]: """Prepare the result for every module""" return {} - def get_result(self) -> Dict[str, Any]: + def get_result(self) -> dict[str, Any]: if getattr(self, self.represent) is not None: self.result[self.represent] = self._prepare_result() return self.result diff --git a/plugins/module_utils/version.py b/plugins/module_utils/version.py index bd71ba7e..8148af51 100644 --- a/plugins/module_utils/version.py +++ b/plugins/module_utils/version.py @@ -1 +1,3 @@ +from __future__ import annotations + version = "2.3.0" # x-release-please-version diff --git a/plugins/modules/certificate.py b/plugins/modules/certificate.py index a1cd4a1d..ea39be6c 100644 --- a/plugins/modules/certificate.py +++ b/plugins/modules/certificate.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: certificate @@ -143,8 +145,6 @@ type: dict """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -156,7 +156,7 @@ class AnsibleHCloudCertificate(AnsibleHCloud): represent = "hcloud_certificate" - hcloud_certificate: Optional[BoundCertificate] = None + hcloud_certificate: BoundCertificate | None = None def _prepare_result(self): return { @@ -264,7 +264,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], required_if=[["state", "present", ["name"]]], diff --git a/plugins/modules/certificate_info.py b/plugins/modules/certificate_info.py index 0116d5e6..e074046f 100644 --- a/plugins/modules/certificate_info.py +++ b/plugins/modules/certificate_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: certificate_info @@ -83,7 +85,6 @@ returned: always type: dict """ -from typing import List, Optional from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -96,7 +97,7 @@ class AnsibleHCloudCertificateInfo(AnsibleHCloud): represent = "hcloud_certificate_info" - hcloud_certificate_info: Optional[List[BoundCertificate]] = None + hcloud_certificate_info: list[BoundCertificate] | None = None def _prepare_result(self): certificates = [] @@ -140,7 +141,7 @@ def define_module(cls): id={"type": "int"}, name={"type": "str"}, label_selector={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/datacenter_info.py b/plugins/modules/datacenter_info.py index 83c5fdc6..f6665a6f 100644 --- a/plugins/modules/datacenter_info.py +++ b/plugins/modules/datacenter_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: datacenter_info @@ -115,8 +117,6 @@ sample: [1, 2, 3] """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -128,7 +128,7 @@ class AnsibleHCloudDatacenterInfo(AnsibleHCloud): represent = "hcloud_datacenter_info" - hcloud_datacenter_info: Optional[List[BoundDatacenter]] = None + hcloud_datacenter_info: list[BoundDatacenter] | None = None def _prepare_result(self): tmp = [] diff --git a/plugins/modules/firewall.py b/plugins/modules/firewall.py index 4760b4ba..2a626604 100644 --- a/plugins/modules/firewall.py +++ b/plugins/modules/firewall.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: firewall @@ -167,7 +169,6 @@ """ import time -from typing import Optional from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -180,7 +181,7 @@ class AnsibleHCloudFirewall(AnsibleHCloud): represent = "hcloud_firewall" - hcloud_firewall: Optional[BoundFirewall] = None + hcloud_firewall: BoundFirewall | None = None def _prepare_result(self): return { @@ -324,7 +325,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], required_if=[["state", "present", ["name"]]], diff --git a/plugins/modules/floating_ip.py b/plugins/modules/floating_ip.py index 96c55b8a..e037dd7a 100644 --- a/plugins/modules/floating_ip.py +++ b/plugins/modules/floating_ip.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: floating_ip @@ -157,8 +159,6 @@ mylabel: 123 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -170,7 +170,7 @@ class AnsibleHCloudFloatingIP(AnsibleHCloud): represent = "hcloud_floating_ip" - hcloud_floating_ip: Optional[BoundFloatingIP] = None + hcloud_floating_ip: BoundFloatingIP | None = None def _prepare_result(self): server = None diff --git a/plugins/modules/floating_ip_info.py b/plugins/modules/floating_ip_info.py index 0576b8ea..663d2962 100644 --- a/plugins/modules/floating_ip_info.py +++ b/plugins/modules/floating_ip_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: floating_ip_info @@ -97,8 +99,6 @@ type: dict """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -110,7 +110,7 @@ class AnsibleHCloudFloatingIPInfo(AnsibleHCloud): represent = "hcloud_floating_ip_info" - hcloud_floating_ip_info: Optional[List[BoundFloatingIP]] = None + hcloud_floating_ip_info: list[BoundFloatingIP] | None = None def _prepare_result(self): tmp = [] diff --git a/plugins/modules/image_info.py b/plugins/modules/image_info.py index 1f393221..b0d7fc48 100644 --- a/plugins/modules/image_info.py +++ b/plugins/modules/image_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: image_info @@ -109,8 +111,6 @@ type: dict """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -122,7 +122,7 @@ class AnsibleHCloudImageInfo(AnsibleHCloud): represent = "hcloud_image_info" - hcloud_image_info: Optional[List[BoundImage]] = None + hcloud_image_info: list[BoundImage] | None = None def _prepare_result(self): tmp = [] @@ -188,7 +188,7 @@ def define_module(cls): label_selector={"type": "str"}, type={"choices": ["system", "snapshot", "backup"], "default": "system", "type": "str"}, architecture={"choices": ["x86", "arm"], "type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/iso_info.py b/plugins/modules/iso_info.py index d49f1881..c641d69f 100644 --- a/plugins/modules/iso_info.py +++ b/plugins/modules/iso_info.py @@ -5,6 +5,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: iso_info @@ -119,8 +121,6 @@ sample: "2021-12-01T00:00:00+00:00" """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -132,7 +132,7 @@ class AnsibleHCloudIsoInfo(AnsibleHCloud): represent = "hcloud_iso_info" - hcloud_iso_info: Optional[List[BoundIso]] = None + hcloud_iso_info: list[BoundIso] | None = None def _prepare_result(self): tmp = [] diff --git a/plugins/modules/load_balancer.py b/plugins/modules/load_balancer.py index 55db3680..1a0d8712 100644 --- a/plugins/modules/load_balancer.py +++ b/plugins/modules/load_balancer.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: load_balancer @@ -149,8 +151,6 @@ sample: false """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -165,7 +165,7 @@ class AnsibleHCloudLoadBalancer(AnsibleHCloud): represent = "hcloud_load_balancer" - hcloud_load_balancer: Optional[BoundLoadBalancer] = None + hcloud_load_balancer: BoundLoadBalancer | None = None def _prepare_result(self): private_ipv4_address = ( @@ -315,7 +315,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], mutually_exclusive=[["location", "network_zone"]], diff --git a/plugins/modules/load_balancer_info.py b/plugins/modules/load_balancer_info.py index 18a086cd..19ead98c 100644 --- a/plugins/modules/load_balancer_info.py +++ b/plugins/modules/load_balancer_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: load_balancer_info @@ -274,8 +276,6 @@ sample: false """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -287,7 +287,7 @@ class AnsibleHCloudLoadBalancerInfo(AnsibleHCloud): represent = "hcloud_load_balancer_info" - hcloud_load_balancer_info: Optional[List[BoundLoadBalancer]] = None + hcloud_load_balancer_info: list[BoundLoadBalancer] | None = None def _prepare_result(self): tmp = [] @@ -403,7 +403,7 @@ def define_module(cls): id={"type": "int"}, name={"type": "str"}, label_selector={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/load_balancer_network.py b/plugins/modules/load_balancer_network.py index ec3abd78..4560f873 100644 --- a/plugins/modules/load_balancer_network.py +++ b/plugins/modules/load_balancer_network.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: load_balancer_network @@ -87,8 +89,6 @@ sample: 10.0.0.8 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -101,9 +101,9 @@ class AnsibleHCloudLoadBalancerNetwork(AnsibleHCloud): represent = "hcloud_load_balancer_network" - hcloud_network: Optional[BoundNetwork] = None - hcloud_load_balancer: Optional[BoundLoadBalancer] = None - hcloud_load_balancer_network: Optional[PrivateNet] = None + hcloud_network: BoundNetwork | None = None + hcloud_load_balancer: BoundLoadBalancer | None = None + hcloud_load_balancer_network: PrivateNet | None = None def _prepare_result(self): return { diff --git a/plugins/modules/load_balancer_service.py b/plugins/modules/load_balancer_service.py index 070909d6..1fc18dee 100644 --- a/plugins/modules/load_balancer_service.py +++ b/plugins/modules/load_balancer_service.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: load_balancer_service @@ -276,8 +278,6 @@ sample: false """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -295,8 +295,8 @@ class AnsibleHCloudLoadBalancerService(AnsibleHCloud): represent = "hcloud_load_balancer_service" - hcloud_load_balancer: Optional[BoundLoadBalancer] = None - hcloud_load_balancer_service: Optional[LoadBalancerService] = None + hcloud_load_balancer: BoundLoadBalancer | None = None + hcloud_load_balancer_service: LoadBalancerService | None = None def _prepare_result(self): http = None diff --git a/plugins/modules/load_balancer_target.py b/plugins/modules/load_balancer_target.py index d2fa083a..36e7f608 100644 --- a/plugins/modules/load_balancer_target.py +++ b/plugins/modules/load_balancer_target.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: load_balancer_target @@ -131,8 +133,6 @@ returned: always """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -150,9 +150,9 @@ class AnsibleHCloudLoadBalancerTarget(AnsibleHCloud): represent = "hcloud_load_balancer_target" - hcloud_load_balancer: Optional[BoundLoadBalancer] = None - hcloud_load_balancer_target: Optional[LoadBalancerTarget] = None - hcloud_server: Optional[BoundServer] = None + hcloud_load_balancer: BoundLoadBalancer | None = None + hcloud_load_balancer_target: LoadBalancerTarget | None = None + hcloud_server: BoundServer | None = None def _prepare_result(self): result = { diff --git a/plugins/modules/load_balancer_type_info.py b/plugins/modules/load_balancer_type_info.py index e1bf617a..67feafd5 100644 --- a/plugins/modules/load_balancer_type_info.py +++ b/plugins/modules/load_balancer_type_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: load_balancer_type_info @@ -85,8 +87,6 @@ sample: 5 """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -98,7 +98,7 @@ class AnsibleHCloudLoadBalancerTypeInfo(AnsibleHCloud): represent = "hcloud_load_balancer_type_info" - hcloud_load_balancer_type_info: Optional[List[BoundLoadBalancerType]] = None + hcloud_load_balancer_type_info: list[BoundLoadBalancerType] | None = None def _prepare_result(self): tmp = [] diff --git a/plugins/modules/location_info.py b/plugins/modules/location_info.py index a23a9d74..ac495c6c 100644 --- a/plugins/modules/location_info.py +++ b/plugins/modules/location_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: location_info @@ -75,8 +77,6 @@ sample: Falkenstein """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -88,7 +88,7 @@ class AnsibleHCloudLocationInfo(AnsibleHCloud): represent = "hcloud_location_info" - hcloud_location_info: Optional[List[BoundLocation]] = None + hcloud_location_info: list[BoundLocation] | None = None def _prepare_result(self): tmp = [] diff --git a/plugins/modules/network.py b/plugins/modules/network.py index 3dd4006b..24e45a48 100644 --- a/plugins/modules/network.py +++ b/plugins/modules/network.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: network @@ -112,8 +114,6 @@ mylabel: 123 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -125,7 +125,7 @@ class AnsibleHCloudNetwork(AnsibleHCloud): represent = "hcloud_network" - hcloud_network: Optional[BoundNetwork] = None + hcloud_network: BoundNetwork | None = None def _prepare_result(self): return { @@ -235,7 +235,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], supports_check_mode=True, diff --git a/plugins/modules/network_info.py b/plugins/modules/network_info.py index 2ca8937a..4008352b 100644 --- a/plugins/modules/network_info.py +++ b/plugins/modules/network_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: network_info @@ -182,8 +184,6 @@ type: dict """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -195,7 +195,7 @@ class AnsibleHCloudNetworkInfo(AnsibleHCloud): represent = "hcloud_network_info" - hcloud_network_info: Optional[List[BoundNetwork]] = None + hcloud_network_info: list[BoundNetwork] | None = None def _prepare_result(self): tmp = [] @@ -275,7 +275,7 @@ def define_module(cls): id={"type": "int"}, name={"type": "str"}, label_selector={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/placement_group.py b/plugins/modules/placement_group.py index dfc8d97b..ba26fad2 100644 --- a/plugins/modules/placement_group.py +++ b/plugins/modules/placement_group.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: placement_group @@ -104,8 +106,6 @@ - 4712 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -117,7 +117,7 @@ class AnsibleHCloudPlacementGroup(AnsibleHCloud): represent = "hcloud_placement_group" - hcloud_placement_group: Optional[BoundPlacementGroup] = None + hcloud_placement_group: BoundPlacementGroup | None = None def _prepare_result(self): return { @@ -195,7 +195,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], required_if=[["state", "present", ["name"]]], diff --git a/plugins/modules/primary_ip.py b/plugins/modules/primary_ip.py index f48793d8..607f6c7e 100644 --- a/plugins/modules/primary_ip.py +++ b/plugins/modules/primary_ip.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: primary_ip @@ -127,8 +129,6 @@ mylabel: 123 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -140,7 +140,7 @@ class AnsibleHCloudPrimaryIP(AnsibleHCloud): represent = "hcloud_primary_ip" - hcloud_primary_ip: Optional[BoundPrimaryIP] = None + hcloud_primary_ip: BoundPrimaryIP | None = None def _prepare_result(self): return { @@ -236,7 +236,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], supports_check_mode=True, diff --git a/plugins/modules/primary_ip_info.py b/plugins/modules/primary_ip_info.py index 3fc6c575..c0bfdbb3 100644 --- a/plugins/modules/primary_ip_info.py +++ b/plugins/modules/primary_ip_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: primary_ip_info @@ -117,8 +119,6 @@ type: bool """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -130,7 +130,7 @@ class AnsibleHCloudPrimaryIPInfo(AnsibleHCloud): represent = "hcloud_primary_ip_info" - hcloud_primary_ip_info: Optional[List[BoundPrimaryIP]] = None + hcloud_primary_ip_info: list[BoundPrimaryIP] | None = None def _prepare_result(self): tmp = [] @@ -182,7 +182,7 @@ def define_module(cls): id={"type": "int"}, label_selector={"type": "str"}, name={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/rdns.py b/plugins/modules/rdns.py index cde124ad..73279b1a 100644 --- a/plugins/modules/rdns.py +++ b/plugins/modules/rdns.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: rdns @@ -130,7 +132,7 @@ sample: example.com """ -from typing import Any, Dict, Optional, Union +from typing import Any from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -149,8 +151,8 @@ class AnsibleHCloudReverseDNS(AnsibleHCloud): represent = "hcloud_rdns" - hcloud_resource: Optional[Union[BoundServer, BoundFloatingIP, BoundLoadBalancer, BoundPrimaryIP]] = None - hcloud_rdns: Optional[Dict[str, Any]] = None + hcloud_resource: BoundServer | BoundFloatingIP | BoundLoadBalancer | BoundPrimaryIP | None = None + hcloud_rdns: dict[str, Any] | None = None def _prepare_result(self): result = { @@ -331,7 +333,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["server", "floating_ip", "load_balancer", "primary_ip"]], mutually_exclusive=[["server", "floating_ip", "load_balancer", "primary_ip"]], diff --git a/plugins/modules/route.py b/plugins/modules/route.py index 7099a522..3c96a738 100644 --- a/plugins/modules/route.py +++ b/plugins/modules/route.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: route @@ -83,8 +85,6 @@ sample: 10.0.0.1 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -96,8 +96,8 @@ class AnsibleHCloudRoute(AnsibleHCloud): represent = "hcloud_route" - hcloud_network: Optional[BoundNetwork] = None - hcloud_route: Optional[NetworkRoute] = None + hcloud_network: BoundNetwork | None = None + hcloud_route: NetworkRoute | None = None def _prepare_result(self): return { @@ -167,7 +167,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/server.py b/plugins/modules/server.py index 62f2e7b7..f5cadb80 100644 --- a/plugins/modules/server.py +++ b/plugins/modules/server.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: server @@ -334,7 +336,6 @@ """ from datetime import datetime, timedelta, timezone -from typing import Optional from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -354,7 +355,7 @@ class AnsibleHCloudServer(AnsibleHCloud): represent = "hcloud_server" - hcloud_server: Optional[BoundServer] = None + hcloud_server: BoundServer | None = None def _prepare_result(self): image = None if self.hcloud_server.image is None else to_native(self.hcloud_server.image.name) diff --git a/plugins/modules/server_info.py b/plugins/modules/server_info.py index e6b6fdac..cee1634c 100644 --- a/plugins/modules/server_info.py +++ b/plugins/modules/server_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: server_info @@ -143,8 +145,6 @@ version_added: "0.1.0" """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -156,7 +156,7 @@ class AnsibleHCloudServerInfo(AnsibleHCloud): represent = "hcloud_server_info" - hcloud_server_info: Optional[List[BoundServer]] = None + hcloud_server_info: list[BoundServer] | None = None def _prepare_result(self): tmp = [] @@ -217,7 +217,7 @@ def define_module(cls): id={"type": "int"}, name={"type": "str"}, label_selector={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/server_network.py b/plugins/modules/server_network.py index 96d80bed..ca80a8a7 100644 --- a/plugins/modules/server_network.py +++ b/plugins/modules/server_network.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: server_network @@ -108,8 +110,6 @@ sample: [10.1.0.1, ...] """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -122,9 +122,9 @@ class AnsibleHCloudServerNetwork(AnsibleHCloud): represent = "hcloud_server_network" - hcloud_network: Optional[BoundNetwork] = None - hcloud_server: Optional[BoundServer] = None - hcloud_server_network: Optional[PrivateNet] = None + hcloud_network: BoundNetwork | None = None + hcloud_server: BoundServer | None = None + hcloud_server_network: PrivateNet | None = None def _prepare_result(self): return { @@ -223,7 +223,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/server_type_info.py b/plugins/modules/server_type_info.py index 1f00e149..abee399e 100644 --- a/plugins/modules/server_type_info.py +++ b/plugins/modules/server_type_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: server_type_info @@ -121,8 +123,6 @@ """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -134,7 +134,7 @@ class AnsibleHCloudServerTypeInfo(AnsibleHCloud): represent = "hcloud_server_type_info" - hcloud_server_type_info: Optional[List[BoundServerType]] = None + hcloud_server_type_info: list[BoundServerType] | None = None def _prepare_result(self): tmp = [] diff --git a/plugins/modules/ssh_key.py b/plugins/modules/ssh_key.py index 4d2ec968..349c52c6 100644 --- a/plugins/modules/ssh_key.py +++ b/plugins/modules/ssh_key.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: ssh_key @@ -110,8 +112,6 @@ mylabel: 123 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -123,7 +123,7 @@ class AnsibleHCloudSSHKey(AnsibleHCloud): represent = "hcloud_ssh_key" - hcloud_ssh_key: Optional[BoundSSHKey] = None + hcloud_ssh_key: BoundSSHKey | None = None def _prepare_result(self): return { @@ -209,7 +209,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name", "fingerprint"]], required_if=[["state", "present", ["name"]]], diff --git a/plugins/modules/ssh_key_info.py b/plugins/modules/ssh_key_info.py index 5cf5259a..7a4ab592 100644 --- a/plugins/modules/ssh_key_info.py +++ b/plugins/modules/ssh_key_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: ssh_key_info @@ -75,7 +77,6 @@ returned: always type: dict """ -from typing import List, Optional from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -88,7 +89,7 @@ class AnsibleHCloudSSHKeyInfo(AnsibleHCloud): represent = "hcloud_ssh_key_info" - hcloud_ssh_key_info: Optional[List[BoundSSHKey]] = None + hcloud_ssh_key_info: list[BoundSSHKey] | None = None def _prepare_result(self): ssh_keys = [] @@ -134,7 +135,7 @@ def define_module(cls): name={"type": "str"}, fingerprint={"type": "str"}, label_selector={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/subnetwork.py b/plugins/modules/subnetwork.py index bfcaedd1..aea40bb1 100644 --- a/plugins/modules/subnetwork.py +++ b/plugins/modules/subnetwork.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: subnetwork @@ -120,8 +122,6 @@ sample: 10.0.0.1 """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -133,8 +133,8 @@ class AnsibleHCloudSubnetwork(AnsibleHCloud): represent = "hcloud_subnetwork" - hcloud_network: Optional[BoundNetwork] = None - hcloud_subnetwork: Optional[NetworkSubnet] = None + hcloud_network: BoundNetwork | None = None + hcloud_subnetwork: NetworkSubnet | None = None def _prepare_result(self): return { @@ -213,7 +213,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py index 36b7e8bd..8442ed90 100644 --- a/plugins/modules/volume.py +++ b/plugins/modules/volume.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: volume @@ -157,8 +159,6 @@ version_added: "0.1.0" """ -from typing import Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -170,7 +170,7 @@ class AnsibleHCloudVolume(AnsibleHCloud): represent = "hcloud_volume" - hcloud_volume: Optional[BoundVolume] = None + hcloud_volume: BoundVolume | None = None def _prepare_result(self): server_name = None @@ -305,7 +305,7 @@ def define_module(cls): "choices": ["absent", "present"], "default": "present", }, - **super().base_module_arguments() + **super().base_module_arguments(), ), required_one_of=[["id", "name"]], mutually_exclusive=[["location", "server"]], diff --git a/plugins/modules/volume_info.py b/plugins/modules/volume_info.py index 17297006..1e507690 100644 --- a/plugins/modules/volume_info.py +++ b/plugins/modules/volume_info.py @@ -4,6 +4,8 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +from __future__ import annotations + DOCUMENTATION = """ --- module: volume_info @@ -92,8 +94,6 @@ type: dict """ -from typing import List, Optional - from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native @@ -105,7 +105,7 @@ class AnsibleHCloudVolumeInfo(AnsibleHCloud): represent = "hcloud_volume_info" - hcloud_volume_info: Optional[List[BoundVolume]] = None + hcloud_volume_info: list[BoundVolume] | None = None def _prepare_result(self): tmp = [] @@ -153,7 +153,7 @@ def define_module(cls): id={"type": "int"}, name={"type": "str"}, label_selector={"type": "str"}, - **super().base_module_arguments() + **super().base_module_arguments(), ), supports_check_mode=True, ) diff --git a/pyproject.toml b/pyproject.toml index f60460ae..5263580c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ line-length = 120 [tool.isort] profile = "black" combine_as_imports = true +add_imports = ["from __future__ import annotations"] [tool.pylint.main] py-version = "3.8" diff --git a/scripts/vendor.py b/scripts/vendor.py index 7083db51..b148ade2 100755 --- a/scripts/vendor.py +++ b/scripts/vendor.py @@ -8,6 +8,8 @@ move the modified files at the vendor location `HCLOUD_VENDOR_PATH`. """ +from __future__ import annotations + import logging import re from argparse import ArgumentParser diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt new file mode 100644 index 00000000..176c4260 --- /dev/null +++ b/tests/sanity/ignore-2.13.txt @@ -0,0 +1,64 @@ +plugins/inventory/hcloud.py validate-modules:illegal-future-imports +plugins/inventory/hcloud.py validate-modules:import-before-documentation +plugins/modules/certificate_info.py validate-modules:illegal-future-imports +plugins/modules/certificate_info.py validate-modules:import-before-documentation +plugins/modules/certificate.py validate-modules:illegal-future-imports +plugins/modules/certificate.py validate-modules:import-before-documentation +plugins/modules/datacenter_info.py validate-modules:illegal-future-imports +plugins/modules/datacenter_info.py validate-modules:import-before-documentation +plugins/modules/firewall.py validate-modules:illegal-future-imports +plugins/modules/firewall.py validate-modules:import-before-documentation +plugins/modules/floating_ip_info.py validate-modules:illegal-future-imports +plugins/modules/floating_ip_info.py validate-modules:import-before-documentation +plugins/modules/floating_ip.py validate-modules:illegal-future-imports +plugins/modules/floating_ip.py validate-modules:import-before-documentation +plugins/modules/image_info.py validate-modules:illegal-future-imports +plugins/modules/image_info.py validate-modules:import-before-documentation +plugins/modules/iso_info.py validate-modules:illegal-future-imports +plugins/modules/iso_info.py validate-modules:import-before-documentation +plugins/modules/load_balancer_info.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_info.py validate-modules:import-before-documentation +plugins/modules/load_balancer_network.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_network.py validate-modules:import-before-documentation +plugins/modules/load_balancer_service.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_service.py validate-modules:import-before-documentation +plugins/modules/load_balancer_target.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_target.py validate-modules:import-before-documentation +plugins/modules/load_balancer_type_info.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_type_info.py validate-modules:import-before-documentation +plugins/modules/load_balancer.py validate-modules:illegal-future-imports +plugins/modules/load_balancer.py validate-modules:import-before-documentation +plugins/modules/location_info.py validate-modules:illegal-future-imports +plugins/modules/location_info.py validate-modules:import-before-documentation +plugins/modules/network_info.py validate-modules:illegal-future-imports +plugins/modules/network_info.py validate-modules:import-before-documentation +plugins/modules/network.py validate-modules:illegal-future-imports +plugins/modules/network.py validate-modules:import-before-documentation +plugins/modules/placement_group.py validate-modules:illegal-future-imports +plugins/modules/placement_group.py validate-modules:import-before-documentation +plugins/modules/primary_ip_info.py validate-modules:illegal-future-imports +plugins/modules/primary_ip_info.py validate-modules:import-before-documentation +plugins/modules/primary_ip.py validate-modules:illegal-future-imports +plugins/modules/primary_ip.py validate-modules:import-before-documentation +plugins/modules/rdns.py validate-modules:illegal-future-imports +plugins/modules/rdns.py validate-modules:import-before-documentation +plugins/modules/route.py validate-modules:illegal-future-imports +plugins/modules/route.py validate-modules:import-before-documentation +plugins/modules/server_info.py validate-modules:illegal-future-imports +plugins/modules/server_info.py validate-modules:import-before-documentation +plugins/modules/server_network.py validate-modules:illegal-future-imports +plugins/modules/server_network.py validate-modules:import-before-documentation +plugins/modules/server_type_info.py validate-modules:illegal-future-imports +plugins/modules/server_type_info.py validate-modules:import-before-documentation +plugins/modules/server.py validate-modules:illegal-future-imports +plugins/modules/server.py validate-modules:import-before-documentation +plugins/modules/ssh_key_info.py validate-modules:illegal-future-imports +plugins/modules/ssh_key_info.py validate-modules:import-before-documentation +plugins/modules/ssh_key.py validate-modules:illegal-future-imports +plugins/modules/ssh_key.py validate-modules:import-before-documentation +plugins/modules/subnetwork.py validate-modules:illegal-future-imports +plugins/modules/subnetwork.py validate-modules:import-before-documentation +plugins/modules/volume_info.py validate-modules:illegal-future-imports +plugins/modules/volume_info.py validate-modules:import-before-documentation +plugins/modules/volume.py validate-modules:illegal-future-imports +plugins/modules/volume.py validate-modules:import-before-documentation diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt new file mode 100644 index 00000000..c0315363 --- /dev/null +++ b/tests/sanity/ignore-2.14.txt @@ -0,0 +1,63 @@ +plugins/inventory/hcloud.py validate-modules:illegal-future-imports +plugins/modules/certificate_info.py validate-modules:illegal-future-imports +plugins/modules/certificate_info.py validate-modules:import-before-documentation +plugins/modules/certificate.py validate-modules:illegal-future-imports +plugins/modules/certificate.py validate-modules:import-before-documentation +plugins/modules/datacenter_info.py validate-modules:illegal-future-imports +plugins/modules/datacenter_info.py validate-modules:import-before-documentation +plugins/modules/firewall.py validate-modules:illegal-future-imports +plugins/modules/firewall.py validate-modules:import-before-documentation +plugins/modules/floating_ip_info.py validate-modules:illegal-future-imports +plugins/modules/floating_ip_info.py validate-modules:import-before-documentation +plugins/modules/floating_ip.py validate-modules:illegal-future-imports +plugins/modules/floating_ip.py validate-modules:import-before-documentation +plugins/modules/image_info.py validate-modules:illegal-future-imports +plugins/modules/image_info.py validate-modules:import-before-documentation +plugins/modules/iso_info.py validate-modules:illegal-future-imports +plugins/modules/iso_info.py validate-modules:import-before-documentation +plugins/modules/load_balancer_info.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_info.py validate-modules:import-before-documentation +plugins/modules/load_balancer_network.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_network.py validate-modules:import-before-documentation +plugins/modules/load_balancer_service.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_service.py validate-modules:import-before-documentation +plugins/modules/load_balancer_target.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_target.py validate-modules:import-before-documentation +plugins/modules/load_balancer_type_info.py validate-modules:illegal-future-imports +plugins/modules/load_balancer_type_info.py validate-modules:import-before-documentation +plugins/modules/load_balancer.py validate-modules:illegal-future-imports +plugins/modules/load_balancer.py validate-modules:import-before-documentation +plugins/modules/location_info.py validate-modules:illegal-future-imports +plugins/modules/location_info.py validate-modules:import-before-documentation +plugins/modules/network_info.py validate-modules:illegal-future-imports +plugins/modules/network_info.py validate-modules:import-before-documentation +plugins/modules/network.py validate-modules:illegal-future-imports +plugins/modules/network.py validate-modules:import-before-documentation +plugins/modules/placement_group.py validate-modules:illegal-future-imports +plugins/modules/placement_group.py validate-modules:import-before-documentation +plugins/modules/primary_ip_info.py validate-modules:illegal-future-imports +plugins/modules/primary_ip_info.py validate-modules:import-before-documentation +plugins/modules/primary_ip.py validate-modules:illegal-future-imports +plugins/modules/primary_ip.py validate-modules:import-before-documentation +plugins/modules/rdns.py validate-modules:illegal-future-imports +plugins/modules/rdns.py validate-modules:import-before-documentation +plugins/modules/route.py validate-modules:illegal-future-imports +plugins/modules/route.py validate-modules:import-before-documentation +plugins/modules/server_info.py validate-modules:illegal-future-imports +plugins/modules/server_info.py validate-modules:import-before-documentation +plugins/modules/server_network.py validate-modules:illegal-future-imports +plugins/modules/server_network.py validate-modules:import-before-documentation +plugins/modules/server_type_info.py validate-modules:illegal-future-imports +plugins/modules/server_type_info.py validate-modules:import-before-documentation +plugins/modules/server.py validate-modules:illegal-future-imports +plugins/modules/server.py validate-modules:import-before-documentation +plugins/modules/ssh_key_info.py validate-modules:illegal-future-imports +plugins/modules/ssh_key_info.py validate-modules:import-before-documentation +plugins/modules/ssh_key.py validate-modules:illegal-future-imports +plugins/modules/ssh_key.py validate-modules:import-before-documentation +plugins/modules/subnetwork.py validate-modules:illegal-future-imports +plugins/modules/subnetwork.py validate-modules:import-before-documentation +plugins/modules/volume_info.py validate-modules:illegal-future-imports +plugins/modules/volume_info.py validate-modules:import-before-documentation +plugins/modules/volume.py validate-modules:illegal-future-imports +plugins/modules/volume.py validate-modules:import-before-documentation diff --git a/tests/unit/module_utils/test_hcloud.py b/tests/unit/module_utils/test_hcloud.py index 197de85b..c1a9ffb7 100644 --- a/tests/unit/module_utils/test_hcloud.py +++ b/tests/unit/module_utils/test_hcloud.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import traceback from datetime import datetime, timezone from unittest.mock import MagicMock