forked from ansible-collections/hetzner.hcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add future annotations imports (ansible-collections#398)
##### SUMMARY This adds future annotations imports to benefit from the modern python typing system.
- Loading branch information
Showing
43 changed files
with
275 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ exclude_paths: | |
|
||
warn_list: | ||
- internal-error | ||
- sanity[cannot-ignore] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Copyright (c) 2019 Hetzner Cloud GmbH <[email protected]> | ||
# 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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from __future__ import annotations | ||
|
||
version = "2.3.0" # x-release-please-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.