diff --git a/lib/ansible/module_utils/_text.py b/lib/ansible/module_utils/_text.py index 6cd77217eba..f30a5e97126 100644 --- a/lib/ansible/module_utils/_text.py +++ b/lib/ansible/module_utils/_text.py @@ -8,6 +8,7 @@ __metaclass__ = type """ # Backwards compat for people still calling it from this package +# pylint: disable=unused-import import codecs from ansible.module_utils.six import PY3, text_type, binary_type diff --git a/lib/ansible/module_utils/common/_collections_compat.py b/lib/ansible/module_utils/common/_collections_compat.py index 3412408f74e..03692884b81 100644 --- a/lib/ansible/module_utils/common/_collections_compat.py +++ b/lib/ansible/module_utils/common/_collections_compat.py @@ -12,7 +12,7 @@ __metaclass__ = type try: """Python 3.3+ branch.""" - from collections.abc import ( + from collections.abc import ( # pylint: disable=unused-import MappingView, ItemsView, KeysView, diff --git a/lib/ansible/module_utils/common/collections.py b/lib/ansible/module_utils/common/collections.py index fdb910811fa..e194918e888 100644 --- a/lib/ansible/module_utils/common/collections.py +++ b/lib/ansible/module_utils/common/collections.py @@ -8,7 +8,7 @@ __metaclass__ = type from ansible.module_utils.six import binary_type, text_type -from ansible.module_utils.common._collections_compat import Hashable, Mapping, MutableMapping, Sequence +from ansible.module_utils.common._collections_compat import Hashable, Mapping, MutableMapping, Sequence # pylint: disable=unused-import class ImmutableDict(Hashable, Mapping): diff --git a/lib/ansible/module_utils/common/file.py b/lib/ansible/module_utils/common/file.py index a92c88ab3bd..a7638238fb5 100644 --- a/lib/ansible/module_utils/common/file.py +++ b/lib/ansible/module_utils/common/file.py @@ -15,7 +15,7 @@ from contextlib import contextmanager from ansible.module_utils.common.warnings import deprecate try: - import selinux + import selinux # pylint: disable=unused-import HAVE_SELINUX = True except ImportError: HAVE_SELINUX = False diff --git a/lib/ansible/module_utils/common/yaml.py b/lib/ansible/module_utils/common/yaml.py index 770d41d5338..3a9caa6062c 100644 --- a/lib/ansible/module_utils/common/yaml.py +++ b/lib/ansible/module_utils/common/yaml.py @@ -24,13 +24,13 @@ if HAS_YAML: try: from yaml import CSafeLoader as SafeLoader from yaml import CSafeDumper as SafeDumper - from yaml.cyaml import CParser as Parser # type: ignore[attr-defined] + from yaml.cyaml import CParser as Parser # type: ignore[attr-defined] # pylint: disable=unused-import HAS_LIBYAML = True except (ImportError, AttributeError): from yaml import SafeLoader # type: ignore[assignment] from yaml import SafeDumper # type: ignore[assignment] - from yaml.parser import Parser # type: ignore[misc] + from yaml.parser import Parser # type: ignore[misc] # pylint: disable=unused-import yaml_load = _partial(_yaml.load, Loader=SafeLoader) yaml_load_all = _partial(_yaml.load_all, Loader=SafeLoader) diff --git a/lib/ansible/module_utils/compat/importlib.py b/lib/ansible/module_utils/compat/importlib.py index 0b7fb2c78e2..a3dca6b21c8 100644 --- a/lib/ansible/module_utils/compat/importlib.py +++ b/lib/ansible/module_utils/compat/importlib.py @@ -8,7 +8,7 @@ __metaclass__ = type import sys try: - from importlib import import_module + from importlib import import_module # pylint: disable=unused-import except ImportError: # importlib.import_module returns the tail # whereas __import__ returns the head diff --git a/lib/ansible/module_utils/compat/paramiko.py b/lib/ansible/module_utils/compat/paramiko.py index 85478eae2fc..095dfa50dde 100644 --- a/lib/ansible/module_utils/compat/paramiko.py +++ b/lib/ansible/module_utils/compat/paramiko.py @@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import types +import types # pylint: disable=unused-import import warnings PARAMIKO_IMPORT_ERR = None @@ -13,7 +13,7 @@ PARAMIKO_IMPORT_ERR = None try: with warnings.catch_warnings(): warnings.filterwarnings('ignore', message='Blowfish has been deprecated', category=UserWarning) - import paramiko + import paramiko # pylint: disable=unused-import # paramiko and gssapi are incompatible and raise AttributeError not ImportError # When running in FIPS mode, cryptography raises InternalError # https://bugzilla.redhat.com/show_bug.cgi?id=1778939 diff --git a/lib/ansible/module_utils/compat/selectors.py b/lib/ansible/module_utils/compat/selectors.py index 0d26ea8ab22..0c4adc9f0f5 100644 --- a/lib/ansible/module_utils/compat/selectors.py +++ b/lib/ansible/module_utils/compat/selectors.py @@ -36,7 +36,7 @@ _BUNDLED_METADATA = {"pypi_name": "selectors2", "version": "1.1.1", "version_con # interrupted syscalls work with kqueue import sys -import types +import types # pylint: disable=unused-import try: # Python 3.4+ diff --git a/lib/ansible/module_utils/json_utils.py b/lib/ansible/module_utils/json_utils.py index 0e95aa677cd..1ec971ccd2b 100644 --- a/lib/ansible/module_utils/json_utils.py +++ b/lib/ansible/module_utils/json_utils.py @@ -27,7 +27,7 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -import json +import json # pylint: disable=unused-import # NB: a copy of this function exists in ../../modules/core/async_wrapper.py. Ensure any diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 1fbba99ae83..9d0f7d5c4fb 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -53,7 +53,7 @@ import socket import sys import tempfile import traceback -import types +import types # pylint: disable=unused-import from contextlib import contextmanager @@ -115,7 +115,7 @@ except Exception: try: # SNI Handling needs python2.7.9's SSLContext - from ssl import create_default_context, SSLContext + from ssl import create_default_context, SSLContext # pylint: disable=unused-import HAS_SSLCONTEXT = True except ImportError: HAS_SSLCONTEXT = False @@ -196,7 +196,7 @@ except ImportError: # Old import for GSSAPI authentication, this is not used in urls.py but kept for backwards compatibility. try: - import urllib_gssapi + import urllib_gssapi # pylint: disable=unused-import HAS_GSSAPI = True except ImportError: HAS_GSSAPI = False