mirror of
https://github.com/ansible/ansible.git
synced 2025-11-30 23:16:08 +07:00
Remove urllib2 pylint check (#86139)
No supported Python version provides urllib2.
This commit is contained in:
2
changelogs/fragments/ansible-test-pylint-urllib2.yml
Normal file
2
changelogs/fragments/ansible-test-pylint-urllib2.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
minor_changes:
|
||||
- ansible-test - Remove pylint check for ``urllib2`` usage.
|
||||
@@ -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
|
||||
|
||||
@@ -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=(
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user