From bd864c45ff0d82f27b0dfe9fd61414fbcab4131b Mon Sep 17 00:00:00 2001
From: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Date: Tue, 21 Jan 2025 07:36:29 +1300
Subject: [PATCH] connection/inventory: adjust import __future__ for Python3
 (#9584)

* connection/inventory: adjust import __future__ for Python3

* add changelog frag

* remove metaclass

* adjust chglog
---
 .../9584-py3-imports-connectioninventory.yml  | 26 +++++++++++++++++++
 plugins/connection/chroot.py                  |  3 +--
 plugins/connection/funcd.py                   |  3 +--
 plugins/connection/incus.py                   |  3 +--
 plugins/connection/iocage.py                  |  3 +--
 plugins/connection/jail.py                    |  3 +--
 plugins/connection/lxc.py                     |  3 +--
 plugins/connection/lxd.py                     |  3 +--
 plugins/connection/proxmox_pct_remote.py      |  3 +--
 plugins/connection/qubes.py                   |  3 +--
 plugins/connection/saltstack.py               |  3 +--
 plugins/connection/zone.py                    |  3 +--
 plugins/inventory/cobbler.py                  |  3 +--
 plugins/inventory/gitlab_runners.py           |  3 +--
 plugins/inventory/icinga2.py                  |  3 +--
 plugins/inventory/iocage.py                   |  3 +--
 plugins/inventory/linode.py                   |  3 +--
 plugins/inventory/lxd.py                      |  3 +--
 plugins/inventory/nmap.py                     |  3 +--
 plugins/inventory/online.py                   |  3 +--
 plugins/inventory/opennebula.py               |  3 +--
 plugins/inventory/proxmox.py                  |  3 +--
 plugins/inventory/scaleway.py                 |  3 +--
 plugins/inventory/stackpath_compute.py        |  3 +--
 plugins/inventory/virtualbox.py               |  3 +--
 plugins/inventory/xen_orchestra.py            |  3 +--
 26 files changed, 51 insertions(+), 50 deletions(-)
 create mode 100644 changelogs/fragments/9584-py3-imports-connectioninventory.yml

diff --git a/changelogs/fragments/9584-py3-imports-connectioninventory.yml b/changelogs/fragments/9584-py3-imports-connectioninventory.yml
new file mode 100644
index 0000000000..0b50cdf052
--- /dev/null
+++ b/changelogs/fragments/9584-py3-imports-connectioninventory.yml
@@ -0,0 +1,26 @@
+minor_changes:
+  - chroot connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - funcd connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - incus connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - iocage connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - jail connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - lxc connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - lxd connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - proxmox_pct_remote connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - qubes connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - saltstack connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - zone connection plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - cobbler inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - gitlab_runners inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - icinga2 inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - iocage inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - linode inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - lxd inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - nmap inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - online inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - opennebula inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - proxmox inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - scaleway inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - stackpath_compute inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - virtualbox inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
+  - xen_orchestra inventory plugin - adjust standard preamble for Python 3 (https://github.com/ansible-collections/community.general/pull/9584).
diff --git a/plugins/connection/chroot.py b/plugins/connection/chroot.py
index 7c4000ec5c..842c3f05d3 100644
--- a/plugins/connection/chroot.py
+++ b/plugins/connection/chroot.py
@@ -7,8 +7,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Maykel Moya (!UNKNOWN) <mmoya@speedyrails.com>
diff --git a/plugins/connection/funcd.py b/plugins/connection/funcd.py
index 31a9431ce1..ad01326aff 100644
--- a/plugins/connection/funcd.py
+++ b/plugins/connection/funcd.py
@@ -6,8 +6,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Michael Scherer (@mscherer) <misc@zarb.org>
diff --git a/plugins/connection/incus.py b/plugins/connection/incus.py
index 9d5a3e7a57..326e91ec38 100644
--- a/plugins/connection/incus.py
+++ b/plugins/connection/incus.py
@@ -5,8 +5,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Stéphane Graber (@stgraber)
diff --git a/plugins/connection/iocage.py b/plugins/connection/iocage.py
index 4d3f415194..35d5ab0658 100644
--- a/plugins/connection/iocage.py
+++ b/plugins/connection/iocage.py
@@ -7,8 +7,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Stephan Lohse (!UNKNOWN) <dev-github@ploek.org>
diff --git a/plugins/connection/jail.py b/plugins/connection/jail.py
index 6e6c156330..6f06c96774 100644
--- a/plugins/connection/jail.py
+++ b/plugins/connection/jail.py
@@ -7,8 +7,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Ansible Core Team
diff --git a/plugins/connection/lxc.py b/plugins/connection/lxc.py
index 0744136192..a9e46cf56f 100644
--- a/plugins/connection/lxc.py
+++ b/plugins/connection/lxc.py
@@ -4,8 +4,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Joerg Thalheim (!UNKNOWN) <joerg@higgsboson.tk>
diff --git a/plugins/connection/lxd.py b/plugins/connection/lxd.py
index 1a071e1d8d..fc8b4ae474 100644
--- a/plugins/connection/lxd.py
+++ b/plugins/connection/lxd.py
@@ -4,8 +4,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Matt Clay (@mattclay) <matt@mystile.com>
diff --git a/plugins/connection/proxmox_pct_remote.py b/plugins/connection/proxmox_pct_remote.py
index d34d022882..c46090083e 100644
--- a/plugins/connection/proxmox_pct_remote.py
+++ b/plugins/connection/proxmox_pct_remote.py
@@ -5,8 +5,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (annotations, absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Nils Stein (@mietzen) <github.nstein@mailbox.org>
diff --git a/plugins/connection/qubes.py b/plugins/connection/qubes.py
index dee476308c..5a9963df2d 100644
--- a/plugins/connection/qubes.py
+++ b/plugins/connection/qubes.py
@@ -8,8 +8,7 @@
 #
 # Written by: Kushal Das (https://github.com/kushaldas)
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 
 DOCUMENTATION = r"""
diff --git a/plugins/connection/saltstack.py b/plugins/connection/saltstack.py
index d9e5d3b1d9..f826741926 100644
--- a/plugins/connection/saltstack.py
+++ b/plugins/connection/saltstack.py
@@ -7,8 +7,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Michael Scherer (@mscherer) <misc@zarb.org>
diff --git a/plugins/connection/zone.py b/plugins/connection/zone.py
index aa5442f28e..baca9312b3 100644
--- a/plugins/connection/zone.py
+++ b/plugins/connection/zone.py
@@ -8,8 +8,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r"""
 author: Ansible Core Team
diff --git a/plugins/inventory/cobbler.py b/plugins/inventory/cobbler.py
index 7d65f583d6..4546bf8d6c 100644
--- a/plugins/inventory/cobbler.py
+++ b/plugins/inventory/cobbler.py
@@ -3,8 +3,7 @@
 # Copyright (c) 2020 Ansible Project
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = '''
     author: Orion Poplawski (@opoplawski)
diff --git a/plugins/inventory/gitlab_runners.py b/plugins/inventory/gitlab_runners.py
index cd6f40169a..961f20444b 100644
--- a/plugins/inventory/gitlab_runners.py
+++ b/plugins/inventory/gitlab_runners.py
@@ -4,9 +4,8 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
+from __future__ import annotations
 
-__metaclass__ = type
 
 DOCUMENTATION = '''
     name: gitlab_runners
diff --git a/plugins/inventory/icinga2.py b/plugins/inventory/icinga2.py
index 527a329173..7ee87df065 100644
--- a/plugins/inventory/icinga2.py
+++ b/plugins/inventory/icinga2.py
@@ -3,9 +3,8 @@
 # Copyright (c) 2021 Ansible Project
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
-from __future__ import (absolute_import, division, print_function)
+from __future__ import annotations
 
-__metaclass__ = type
 
 DOCUMENTATION = '''
     name: icinga2
diff --git a/plugins/inventory/iocage.py b/plugins/inventory/iocage.py
index 6ca7c2ef0a..faa6c82710 100644
--- a/plugins/inventory/iocage.py
+++ b/plugins/inventory/iocage.py
@@ -4,8 +4,7 @@
 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = '''
     name: iocage
diff --git a/plugins/inventory/linode.py b/plugins/inventory/linode.py
index 2419ef3197..594cf30eba 100644
--- a/plugins/inventory/linode.py
+++ b/plugins/inventory/linode.py
@@ -3,8 +3,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r'''
     name: linode
diff --git a/plugins/inventory/lxd.py b/plugins/inventory/lxd.py
index 81229186b8..480af8388c 100644
--- a/plugins/inventory/lxd.py
+++ b/plugins/inventory/lxd.py
@@ -3,8 +3,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r'''
     name: lxd
diff --git a/plugins/inventory/nmap.py b/plugins/inventory/nmap.py
index 5dacd28e95..a9384b7c27 100644
--- a/plugins/inventory/nmap.py
+++ b/plugins/inventory/nmap.py
@@ -3,8 +3,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = '''
     author: Unknown (!UNKNOWN)
diff --git a/plugins/inventory/online.py b/plugins/inventory/online.py
index 9475049c08..9e29c91e54 100644
--- a/plugins/inventory/online.py
+++ b/plugins/inventory/online.py
@@ -3,8 +3,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = r'''
     name: online
diff --git a/plugins/inventory/opennebula.py b/plugins/inventory/opennebula.py
index 7fc320f326..ed26880d07 100644
--- a/plugins/inventory/opennebula.py
+++ b/plugins/inventory/opennebula.py
@@ -3,9 +3,8 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
+from __future__ import annotations
 
-__metaclass__ = type
 
 DOCUMENTATION = r'''
     name: opennebula
diff --git a/plugins/inventory/proxmox.py b/plugins/inventory/proxmox.py
index 2d65657d67..9ef9b78adf 100644
--- a/plugins/inventory/proxmox.py
+++ b/plugins/inventory/proxmox.py
@@ -3,9 +3,8 @@
 # Copyright (c) 2018 Ansible Project
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
-from __future__ import (absolute_import, division, print_function)
+from __future__ import annotations
 
-__metaclass__ = type
 
 DOCUMENTATION = '''
     name: proxmox
diff --git a/plugins/inventory/scaleway.py b/plugins/inventory/scaleway.py
index e396740bca..d815890df4 100644
--- a/plugins/inventory/scaleway.py
+++ b/plugins/inventory/scaleway.py
@@ -3,9 +3,8 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
+from __future__ import annotations
 
-__metaclass__ = type
 
 DOCUMENTATION = r'''
     name: scaleway
diff --git a/plugins/inventory/stackpath_compute.py b/plugins/inventory/stackpath_compute.py
index c87d0e5277..bc55027155 100644
--- a/plugins/inventory/stackpath_compute.py
+++ b/plugins/inventory/stackpath_compute.py
@@ -4,8 +4,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = '''
     name: stackpath_compute
diff --git a/plugins/inventory/virtualbox.py b/plugins/inventory/virtualbox.py
index 9112518a46..db2750f636 100644
--- a/plugins/inventory/virtualbox.py
+++ b/plugins/inventory/virtualbox.py
@@ -3,8 +3,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = '''
     author: Unknown (!UNKNOWN)
diff --git a/plugins/inventory/xen_orchestra.py b/plugins/inventory/xen_orchestra.py
index 0a050d0bf9..5c21fb365a 100644
--- a/plugins/inventory/xen_orchestra.py
+++ b/plugins/inventory/xen_orchestra.py
@@ -3,8 +3,7 @@
 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from __future__ import (absolute_import, division, print_function)
-__metaclass__ = type
+from __future__ import annotations
 
 DOCUMENTATION = '''
     name: xen_orchestra