Remove deprecated imports from basic.py (#86065)

Fixes #85997
pull/86099/head
Martin Krizek 1 month ago committed by GitHub
parent bb30a7fa1f
commit 2e8a859477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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``.

@ -2200,30 +2200,11 @@ _mini_six = {
def __getattr__(importable_name): def __getattr__(importable_name):
"""Inject import-time deprecation warnings.""" """Inject import-time deprecation warnings."""
if importable_name == 'datetime': if (importable := _mini_six.get(importable_name, ...)) is ...:
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 ...:
raise AttributeError(f"module {__name__!r} has no attribute {importable_name!r}") raise AttributeError(f"module {__name__!r} has no attribute {importable_name!r}")
deprecate( deprecate(
msg=f"Importing '{importable_name}' from '{__name__}' is deprecated.", msg=f"Importing '{importable_name}' from '{__name__}' is deprecated.",
version="2.21", version="2.24",
) )
return importable return importable

@ -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-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-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 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/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/connection/paramiko_ssh.py pylint:ansible-deprecated-version # TODO: 2.21
lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version # TODO: 2.21 lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version # TODO: 2.21

Loading…
Cancel
Save