diff --git a/.ansible-lint b/.ansible-lint index 5062e31..35f1c5a 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 afadeaa..bab3c42 100755 --- a/.azure-pipelines/scripts/combine-coverage.py +++ b/.azure-pipelines/scripts/combine-coverage.py @@ -7,6 +7,7 @@ Keep in mind that Azure Pipelines does not enforce unique job display names (onl 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 ada4d5a..783e745 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 1a55fd5..eee4a9c 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 f82d128..147ebc6 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 @@ keyed_groups: 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 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): """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 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): 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 49bda6d..c83a6c6 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 @@ class AnsibleHCloud: def fail_json_hcloud( self, exception: HCloudException, - msg: Optional[str] = None, + msg: str | None = None, params: Any = None, **kwargs, ) -> None: @@ -91,7 +93,7 @@ class AnsibleHCloud: 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 @@ class AnsibleHCloud: }, } - 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 bd71ba7..8148af5 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 a1cd4a1..ea39be6 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 @@ hcloud_certificate: 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 @@ from ..module_utils.vendor.hcloud.certificates import BoundCertificate 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 @@ class AnsibleHCloudCertificate(AnsibleHCloud): "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 0116d5e..e074046 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 @@ hcloud_certificate_info: 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 @@ from ..module_utils.vendor.hcloud.certificates import BoundCertificate 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 @@ class AnsibleHCloudCertificateInfo(AnsibleHCloud): 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 83c5fdc..f6665a6 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 @@ hcloud_datacenter_info: 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 @@ from ..module_utils.vendor.hcloud.datacenters import BoundDatacenter 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 4760b4b..2a62660 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 @@ hcloud_firewall: """ 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 @@ from ..module_utils.vendor.hcloud.firewalls import BoundFirewall, FirewallRule 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 @@ class AnsibleHCloudFirewall(AnsibleHCloud): "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 96c55b8..e037dd7 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 @@ hcloud_floating_ip: 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 @@ from ..module_utils.vendor.hcloud.floating_ips import BoundFloatingIP 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 0576b8e..663d296 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 @@ hcloud_floating_ip_info: 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 @@ from ..module_utils.vendor.hcloud.floating_ips import BoundFloatingIP 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 1f39322..b0d7fc4 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 @@ hcloud_image_info: 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 @@ from ..module_utils.vendor.hcloud.images import BoundImage 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 @@ class AnsibleHCloudImageInfo(AnsibleHCloud): 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 d49f188..c641d69 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 @@ hcloud_iso_info: 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 @@ from ..module_utils.vendor.hcloud.isos import BoundIso 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 55db368..1a0d871 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 @@ hcloud_load_balancer: 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 @@ from ..module_utils.vendor.hcloud.load_balancers import ( 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 @@ class AnsibleHCloudLoadBalancer(AnsibleHCloud): "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 18a086c..19ead98 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 @@ hcloud_load_balancer_info: 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 @@ from ..module_utils.vendor.hcloud.load_balancers import BoundLoadBalancer 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 @@ class AnsibleHCloudLoadBalancerInfo(AnsibleHCloud): 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 ec3abd7..4560f87 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 @@ hcloud_load_balancer_network: 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 @@ from ..module_utils.vendor.hcloud.networks import BoundNetwork 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 070909d..1fc18de 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 @@ hcloud_load_balancer_service: 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 @@ from ..module_utils.vendor.hcloud.load_balancers import ( 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 d2fa083..36e7f60 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 @@ hcloud_load_balancer_target: 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 @@ from ..module_utils.vendor.hcloud.servers import BoundServer 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 e1bf617..67feafd 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 @@ hcloud_load_balancer_type_info: 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 @@ from ..module_utils.vendor.hcloud.load_balancer_types import BoundLoadBalancerTy 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 a23a9d7..ac495c6 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 @@ hcloud_location_info: 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 @@ from ..module_utils.vendor.hcloud.locations import BoundLocation 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 3dd4006..24e45a4 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 @@ hcloud_network: 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 @@ from ..module_utils.vendor.hcloud.networks import BoundNetwork 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 @@ class AnsibleHCloudNetwork(AnsibleHCloud): "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 2ca8937..4008352 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 @@ hcloud_network_info: 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 @@ from ..module_utils.vendor.hcloud.networks import BoundNetwork 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 @@ class AnsibleHCloudNetworkInfo(AnsibleHCloud): 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 dfc8d97..ba26fad 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 @@ hcloud_placement_group: - 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 @@ from ..module_utils.vendor.hcloud.placement_groups import BoundPlacementGroup 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 @@ class AnsibleHCloudPlacementGroup(AnsibleHCloud): "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 f48793d..607f6c7 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 @@ hcloud_primary_ip: 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 @@ from ..module_utils.vendor.hcloud.primary_ips import BoundPrimaryIP 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 @@ class AnsibleHCloudPrimaryIP(AnsibleHCloud): "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 3fc6c57..c0bfdbb 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 @@ hcloud_primary_ip_info: 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 @@ from ..module_utils.vendor.hcloud.primary_ips import BoundPrimaryIP 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 @@ class AnsibleHCloudPrimaryIPInfo(AnsibleHCloud): 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 cde124a..73279b1 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 @@ hcloud_rdns: 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 @@ from ..module_utils.vendor.hcloud.servers import BoundServer 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 @@ class AnsibleHCloudReverseDNS(AnsibleHCloud): "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 7099a52..3c96a73 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 @@ hcloud_route: 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 @@ from ..module_utils.vendor.hcloud.networks import BoundNetwork, NetworkRoute 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 @@ class AnsibleHCloudRoute(AnsibleHCloud): "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 62f2e7b..f5cadb8 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 @@ hcloud_server: """ 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 @@ from ..module_utils.vendor.hcloud.volumes import Volume 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 e6b6fda..cee1634 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 @@ hcloud_server_info: 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 @@ from ..module_utils.vendor.hcloud.servers import BoundServer 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 @@ class AnsibleHCloudServerInfo(AnsibleHCloud): 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 96d80be..ca80a8a 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 @@ hcloud_server_network: 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 @@ from ..module_utils.vendor.hcloud.servers import BoundServer, PrivateNet 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 @@ class AnsibleHCloudServerNetwork(AnsibleHCloud): "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 1f00e14..abee399 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 @@ hcloud_server_type_info: """ -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 @@ from ..module_utils.vendor.hcloud.server_types import BoundServerType 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 4d2ec96..349c52c 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 @@ hcloud_ssh_key: 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 @@ from ..module_utils.vendor.hcloud.ssh_keys import BoundSSHKey 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 @@ class AnsibleHCloudSSHKey(AnsibleHCloud): "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 5cf5259..7a4ab59 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 @@ hcloud_ssh_key_info: 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 @@ from ..module_utils.vendor.hcloud.ssh_keys import BoundSSHKey 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 @@ class AnsibleHCloudSSHKeyInfo(AnsibleHCloud): 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 bfcaedd..aea40bb 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 @@ hcloud_subnetwork: 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 @@ from ..module_utils.vendor.hcloud.networks import BoundNetwork, NetworkSubnet 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 @@ class AnsibleHCloudSubnetwork(AnsibleHCloud): "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 36b7e8b..8442ed9 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 @@ hcloud_volume: 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 @@ from ..module_utils.vendor.hcloud.volumes import BoundVolume 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 @@ class AnsibleHCloudVolume(AnsibleHCloud): "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 1729700..1e50769 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 @@ hcloud_volume_info: 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 @@ from ..module_utils.vendor.hcloud.volumes import BoundVolume 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 @@ class AnsibleHCloudVolumeInfo(AnsibleHCloud): 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 f60460a..5263580 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 7083db5..b148ade 100755 --- a/scripts/vendor.py +++ b/scripts/vendor.py @@ -8,6 +8,8 @@ Fetch the desired version `HCLOUD_VERSION` from https://github.com/hetznercloud/ 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 0000000..176c426 --- /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 0000000..c031536 --- /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 197de85..c1a9ffb 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