From b3307f1aa738372d0fb4f5ee5aaed6b3fa436bd6 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 3 Feb 2023 14:22:57 -0800 Subject: [PATCH] Remove unused stdlib imports from module_utils (#79905) --- changelogs/fragments/unused-imports-module-utils-stdlib.yml | 4 ++++ lib/ansible/module_utils/common/file.py | 5 ----- lib/ansible/module_utils/compat/selectors.py | 1 - lib/ansible/module_utils/facts/network/iscsi.py | 1 - lib/ansible/module_utils/facts/network/nvme.py | 1 - lib/ansible/module_utils/yumdnf.py | 1 - 6 files changed, 4 insertions(+), 9 deletions(-) create mode 100644 changelogs/fragments/unused-imports-module-utils-stdlib.yml diff --git a/changelogs/fragments/unused-imports-module-utils-stdlib.yml b/changelogs/fragments/unused-imports-module-utils-stdlib.yml new file mode 100644 index 00000000000..99f4294aa79 --- /dev/null +++ b/changelogs/fragments/unused-imports-module-utils-stdlib.yml @@ -0,0 +1,4 @@ +minor_changes: + - > + Remove unused Python stdlib imports from module_utils which were not present for backwards compatibility in: + common.file, compat.selectors, facts.network.iscsi, facts.network.nvme, yumdnf diff --git a/lib/ansible/module_utils/common/file.py b/lib/ansible/module_utils/common/file.py index 045565be63c..a92c88ab3bd 100644 --- a/lib/ansible/module_utils/common/file.py +++ b/lib/ansible/module_utils/common/file.py @@ -4,15 +4,10 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import errno import os import stat import re -import pwd -import grp import time -import shutil -import traceback import fcntl import sys diff --git a/lib/ansible/module_utils/compat/selectors.py b/lib/ansible/module_utils/compat/selectors.py index 93ffc626297..0d26ea8ab22 100644 --- a/lib/ansible/module_utils/compat/selectors.py +++ b/lib/ansible/module_utils/compat/selectors.py @@ -35,7 +35,6 @@ _BUNDLED_METADATA = {"pypi_name": "selectors2", "version": "1.1.1", "version_con # Fix use of OSError exception for py3 and use the wrapper of kqueue.control so retries of # interrupted syscalls work with kqueue -import os.path import sys import types diff --git a/lib/ansible/module_utils/facts/network/iscsi.py b/lib/ansible/module_utils/facts/network/iscsi.py index 2bb93834236..ef5ac398a98 100644 --- a/lib/ansible/module_utils/facts/network/iscsi.py +++ b/lib/ansible/module_utils/facts/network/iscsi.py @@ -19,7 +19,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys -import subprocess import ansible.module_utils.compat.typing as t diff --git a/lib/ansible/module_utils/facts/network/nvme.py b/lib/ansible/module_utils/facts/network/nvme.py index febd0abb38c..1d759566c99 100644 --- a/lib/ansible/module_utils/facts/network/nvme.py +++ b/lib/ansible/module_utils/facts/network/nvme.py @@ -19,7 +19,6 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type import sys -import subprocess import ansible.module_utils.compat.typing as t diff --git a/lib/ansible/module_utils/yumdnf.py b/lib/ansible/module_utils/yumdnf.py index 27bc8ba2d24..7eb9d5fc2b7 100644 --- a/lib/ansible/module_utils/yumdnf.py +++ b/lib/ansible/module_utils/yumdnf.py @@ -15,7 +15,6 @@ __metaclass__ = type import os import time import glob -import tempfile from abc import ABCMeta, abstractmethod from ansible.module_utils.six import with_metaclass