Remove urllib2 pylint check (#86139)

No supported Python version provides urllib2.
This commit is contained in:
Matt Clay
2025-11-05 16:55:32 -08:00
committed by GitHub
parent 5b8ae0b5b5
commit 8ac5c8580b
4 changed files with 7 additions and 15 deletions

View File

@@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Remove pylint check for ``urllib2`` usage.

View File

@@ -3,13 +3,13 @@ from __future__ import annotations
import tempfile
try:
import urllib2 # intentionally trigger pylint ansible-bad-import error # pylint: disable=unused-import
import ansible.module_utils.six # intentionally trigger pylint ansible-bad-import error # pylint: disable=unused-import
except ImportError:
urllib2 = None
pass
try:
from urllib2 import Request # intentionally trigger pylint ansible-bad-import-from error # pylint: disable=unused-import
from ansible.module_utils.six import PY3 # intentionally trigger pylint ansible-bad-import-from error # pylint: disable=unused-import
except ImportError:
Request = None
pass
tempfile.mktemp() # intentionally trigger pylint ansible-bad-function error

View File

@@ -83,15 +83,8 @@ class AnsibleUnwantedChecker(BaseChecker):
)
unwanted_imports = {
# see https://docs.python.org/2/library/urllib2.html
'urllib2': UnwantedEntry(
'ansible.module_utils.urls',
ignore_paths=(
'/lib/ansible/module_utils/urls.py',
)
),
# see https://docs.python.org/3/library/collections.abc.html
# deprecated: description='remove collections check now that Python 3.9 is no longer supported' core_version='2.23'
'collections': UnwantedEntry(
'collections.abc',
names=(

View File

@@ -116,9 +116,6 @@ ignore_missing_imports = True
[mypy-selinux.*]
ignore_missing_imports = True
[mypy-urllib2.*]
ignore_missing_imports = True
[mypy-httplib.*]
ignore_missing_imports = True