Remove deprecated imports from basic.py (#86065)

Fixes #85997
This commit is contained in:
Martin Krizek
2025-10-29 19:53:03 +01:00
committed by GitHub
parent bb30a7fa1f
commit 2e8a859477
3 changed files with 4 additions and 22 deletions

View File

@@ -0,0 +1,2 @@
removed_features:
- Removed deprecated ability to import ``datetime``, ``signal``, ``types``, ``chain``, ``repeat``, ``map`` and ``shlex_quote`` from ``ansible.module_utils.basic``.

View File

@@ -2200,30 +2200,11 @@ _mini_six = {
def __getattr__(importable_name):
"""Inject import-time deprecation warnings."""
if importable_name == 'datetime':
import datetime
importable = datetime
elif importable_name == 'signal':
import signal
importable = signal
elif importable_name == 'types':
import types
importable = types
elif importable_name == 'chain':
from itertools import chain
importable = chain
elif importable_name == 'repeat':
from itertools import repeat
importable = repeat
elif importable_name == 'map':
importable = map
elif importable_name == 'shlex_quote':
importable = shlex.quote
elif (importable := _mini_six.get(importable_name, ...)) is ...:
if (importable := _mini_six.get(importable_name, ...)) is ...:
raise AttributeError(f"module {__name__!r} has no attribute {importable_name!r}")
deprecate(
msg=f"Importing '{importable_name}' from '{__name__}' is deprecated.",
version="2.21",
version="2.24",
)
return importable

View File

@@ -228,7 +228,6 @@ test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:a
test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:ansible-deprecated-date-not-permitted # required to verify plugin against core
test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:ansible-deprecated-unnecessary-collection-name # required to verify plugin against core
test/integration/targets/ansible-test-sanity-pylint/deprecated_thing.py pylint:ansible-deprecated-collection-name-not-permitted # required to verify plugin against core
lib/ansible/module_utils/basic.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/module_utils/compat/paramiko.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/plugins/connection/paramiko_ssh.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version # TODO: 2.21