More type hint fixes for module_utils. (#77198)

* Type hint fixes for module_utils.
* Fix type hints in module_utils.facts.
pull/77201/head
Matt Clay 3 years ago committed by GitHub
parent 86f00bd156
commit ccdb552d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,7 +31,7 @@ __metaclass__ = type
import re import re
try: try:
RE_FLAGS = re.VERBOSE | re.ASCII RE_FLAGS = re.VERBOSE | re.ASCII # type: ignore[attr-defined]
except AttributeError: except AttributeError:
RE_FLAGS = re.VERBOSE RE_FLAGS = re.VERBOSE

@ -32,6 +32,8 @@ __metaclass__ = type
import fnmatch import fnmatch
import sys import sys
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts import timeout from ansible.module_utils.facts import timeout
from ansible.module_utils.facts import collector from ansible.module_utils.facts import collector
from ansible.module_utils.common.collections import is_string from ansible.module_utils.common.collections import is_string
@ -104,7 +106,7 @@ class CollectorMetaDataCollector(collector.BaseFactCollector):
'''Collector that provides a facts with the gather_subset metadata.''' '''Collector that provides a facts with the gather_subset metadata.'''
name = 'gather_subset' name = 'gather_subset'
_fact_ids = set([]) _fact_ids = set() # type: t.Set[str]
def __init__(self, collectors=None, namespace=None, gather_subset=None, module_setup=None): def __init__(self, collectors=None, namespace=None, gather_subset=None, module_setup=None):
super(CollectorMetaDataCollector, self).__init__(collectors, namespace) super(CollectorMetaDataCollector, self).__init__(collectors, namespace)

@ -33,6 +33,8 @@ from collections import defaultdict
import platform import platform
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts import timeout from ansible.module_utils.facts import timeout
@ -56,11 +58,11 @@ class CollectorNotFoundError(KeyError):
class BaseFactCollector: class BaseFactCollector:
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
_platform = 'Generic' _platform = 'Generic'
name = None # type: str | None name = None # type: str | None
required_facts = set() required_facts = set() # type: t.Set[str]
def __init__(self, collectors=None, namespace=None): def __init__(self, collectors=None, namespace=None):
'''Base class for things that collect facts. '''Base class for things that collect facts.

@ -29,6 +29,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -50,7 +52,7 @@ class HardwareCollector(BaseFactCollector):
'processor_count', 'processor_count',
# TODO: mounts isnt exactly hardware # TODO: mounts isnt exactly hardware
'mounts', 'mounts',
'devices']) 'devices']) # type: t.Set[str]
_fact_class = Hardware _fact_class = Hardware
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):

@ -16,6 +16,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -48,7 +50,7 @@ class NetworkCollector(BaseFactCollector):
'default_ipv4', 'default_ipv4',
'default_ipv6', 'default_ipv6',
'all_ipv4_addresses', 'all_ipv4_addresses',
'all_ipv6_addresses']) 'all_ipv6_addresses']) # type: t.Set[str]
IPV6_SCOPE = {'0': 'global', IPV6_SCOPE = {'0': 'global',
'10': 'host', '10': 'host',

@ -21,13 +21,15 @@ __metaclass__ = type
import sys import sys
import glob import glob
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_lines from ansible.module_utils.facts.utils import get_file_lines
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
class FcWwnInitiatorFactCollector(BaseFactCollector): class FcWwnInitiatorFactCollector(BaseFactCollector):
name = 'fibre_channel_wwn' name = 'fibre_channel_wwn'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
""" """

@ -21,6 +21,8 @@ __metaclass__ = type
import sys import sys
import subprocess import subprocess
import ansible.module_utils.compat.typing as t
from ansible.module_utils.common.process import get_bin_path from ansible.module_utils.common.process import get_bin_path
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.network.base import NetworkCollector from ansible.module_utils.facts.network.base import NetworkCollector
@ -28,7 +30,7 @@ from ansible.module_utils.facts.network.base import NetworkCollector
class IscsiInitiatorNetworkCollector(NetworkCollector): class IscsiInitiatorNetworkCollector(NetworkCollector):
name = 'iscsi' name = 'iscsi'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
""" """

@ -21,13 +21,15 @@ __metaclass__ = type
import sys import sys
import subprocess import subprocess
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.network.base import NetworkCollector from ansible.module_utils.facts.network.base import NetworkCollector
class NvmeInitiatorNetworkCollector(NetworkCollector): class NvmeInitiatorNetworkCollector(NetworkCollector):
name = 'nvme' name = 'nvme'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
""" """

@ -18,6 +18,8 @@ __metaclass__ = type
import json import json
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.namespace import PrefixFactNamespace from ansible.module_utils.facts.namespace import PrefixFactNamespace
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -25,7 +27,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class FacterFactCollector(BaseFactCollector): class FacterFactCollector(BaseFactCollector):
name = 'facter' name = 'facter'
_fact_ids = set(['facter']) _fact_ids = set(['facter']) # type: t.Set[str]
def __init__(self, collectors=None, namespace=None): def __init__(self, collectors=None, namespace=None):
namespace = PrefixFactNamespace(namespace_name='facter', namespace = PrefixFactNamespace(namespace_name='facter',

@ -18,6 +18,8 @@ __metaclass__ = type
import json import json
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.namespace import PrefixFactNamespace from ansible.module_utils.facts.namespace import PrefixFactNamespace
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -26,7 +28,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class OhaiFactCollector(BaseFactCollector): class OhaiFactCollector(BaseFactCollector):
'''This is a subclass of Facts for including information gathered from Ohai.''' '''This is a subclass of Facts for including information gathered from Ohai.'''
name = 'ohai' name = 'ohai'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def __init__(self, collectors=None, namespace=None): def __init__(self, collectors=None, namespace=None):
namespace = PrefixFactNamespace(namespace_name='ohai', namespace = PrefixFactNamespace(namespace_name='ohai',

@ -20,12 +20,14 @@ __metaclass__ = type
import os import os
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
class ApparmorFactCollector(BaseFactCollector): class ApparmorFactCollector(BaseFactCollector):
name = 'apparmor' name = 'apparmor'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
facts_dict = {} facts_dict = {}

@ -18,6 +18,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils._text import to_text from ansible.module_utils._text import to_text
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -26,7 +27,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class SystemCapabilitiesFactCollector(BaseFactCollector): class SystemCapabilitiesFactCollector(BaseFactCollector):
name = 'caps' name = 'caps'
_fact_ids = set(['system_capabilities', _fact_ids = set(['system_capabilities',
'system_capabilities_enforced']) 'system_capabilities_enforced']) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):

@ -5,6 +5,8 @@ __metaclass__ = type
import os import os
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -41,7 +43,7 @@ def is_chroot(module=None):
class ChrootFactCollector(BaseFactCollector): class ChrootFactCollector(BaseFactCollector):
name = 'chroot' name = 'chroot'
_fact_ids = set(['is_chroot']) _fact_ids = set(['is_chroot']) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
return {'is_chroot': is_chroot(module)} return {'is_chroot': is_chroot(module)}

@ -18,6 +18,8 @@ __metaclass__ = type
import shlex import shlex
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -25,7 +27,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class CmdLineFactCollector(BaseFactCollector): class CmdLineFactCollector(BaseFactCollector):
name = 'cmdline' name = 'cmdline'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def _get_proc_cmdline(self): def _get_proc_cmdline(self):
return get_file_content('/proc/cmdline') return get_file_content('/proc/cmdline')

@ -21,12 +21,14 @@ __metaclass__ = type
import datetime import datetime
import time import time
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
class DateTimeFactCollector(BaseFactCollector): class DateTimeFactCollector(BaseFactCollector):
name = 'date_time' name = 'date_time'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
facts_dict = {} facts_dict = {}

@ -10,6 +10,8 @@ import os
import platform import platform
import re import re
import ansible.module_utils.compat.typing as t
from ansible.module_utils.common.sys_info import get_distribution, get_distribution_version, \ from ansible.module_utils.common.sys_info import get_distribution, get_distribution_version, \
get_distribution_codename get_distribution_codename
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
@ -684,7 +686,7 @@ class DistributionFactCollector(BaseFactCollector):
_fact_ids = set(['distribution_version', _fact_ids = set(['distribution_version',
'distribution_release', 'distribution_release',
'distribution_major_version', 'distribution_major_version',
'os_family']) 'os_family']) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
collected_facts = collected_facts or {} collected_facts = collected_facts or {}

@ -16,6 +16,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
@ -24,7 +25,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class DnsFactCollector(BaseFactCollector): class DnsFactCollector(BaseFactCollector):
name = 'dns' name = 'dns'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
dns_facts = {} dns_facts = {}

@ -18,6 +18,8 @@ __metaclass__ = type
import os import os
import ansible.module_utils.compat.typing as t
from ansible.module_utils.six import iteritems from ansible.module_utils.six import iteritems
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -25,7 +27,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class EnvFactCollector(BaseFactCollector): class EnvFactCollector(BaseFactCollector):
name = 'env' name = 'env'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
env_facts = {} env_facts = {}

@ -18,6 +18,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -25,7 +27,7 @@ from ansible.module_utils.facts.collector import BaseFactCollector
class FipsFactCollector(BaseFactCollector): class FipsFactCollector(BaseFactCollector):
name = 'fips' name = 'fips'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
# NOTE: this is populated even if it is not set # NOTE: this is populated even if it is not set

@ -21,6 +21,8 @@ import json
import os import os
import stat import stat
import ansible.module_utils.compat.typing as t
from ansible.module_utils._text import to_text from ansible.module_utils._text import to_text
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -29,7 +31,7 @@ from ansible.module_utils.six.moves import configparser, StringIO
class LocalFactCollector(BaseFactCollector): class LocalFactCollector(BaseFactCollector):
name = 'local' name = 'local'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
local_facts = {} local_facts = {}

@ -20,13 +20,15 @@ __metaclass__ = type
import os import os
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_lines from ansible.module_utils.facts.utils import get_file_lines
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
class LSBFactCollector(BaseFactCollector): class LSBFactCollector(BaseFactCollector):
name = 'lsb' name = 'lsb'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
STRIP_QUOTES = r'\'\"\\' STRIP_QUOTES = r'\'\"\\'
def _lsb_release_bin(self, lsb_path, module): def _lsb_release_bin(self, lsb_path, module):

@ -8,6 +8,8 @@ __metaclass__ = type
import os import os
import subprocess import subprocess
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
# A list of dicts. If there is a platform with more than one # A list of dicts. If there is a platform with more than one
@ -44,7 +46,7 @@ PKG_MGRS = [{'path': '/usr/bin/rpm-ostree', 'name': 'atomic_container'},
class OpenBSDPkgMgrFactCollector(BaseFactCollector): class OpenBSDPkgMgrFactCollector(BaseFactCollector):
name = 'pkg_mgr' name = 'pkg_mgr'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
_platform = 'OpenBSD' _platform = 'OpenBSD'
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
@ -57,7 +59,7 @@ class OpenBSDPkgMgrFactCollector(BaseFactCollector):
# the fact ends up being 'pkg_mgr' so stick with that naming/spelling # the fact ends up being 'pkg_mgr' so stick with that naming/spelling
class PkgMgrFactCollector(BaseFactCollector): class PkgMgrFactCollector(BaseFactCollector):
name = 'pkg_mgr' name = 'pkg_mgr'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
_platform = 'Generic' _platform = 'Generic'
required_facts = set(['distribution']) required_facts = set(['distribution'])

@ -20,6 +20,8 @@ import re
import socket import socket
import platform import platform
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -37,7 +39,7 @@ class PlatformFactCollector(BaseFactCollector):
'machine', 'machine',
'python_version', 'python_version',
'architecture', 'architecture',
'machine_id']) 'machine_id']) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
platform_facts = {} platform_facts = {}

@ -18,6 +18,8 @@ __metaclass__ = type
import sys import sys
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
try: try:
@ -32,7 +34,7 @@ except ImportError:
class PythonFactCollector(BaseFactCollector): class PythonFactCollector(BaseFactCollector):
name = 'python' name = 'python'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
python_facts = {} python_facts = {}

@ -18,6 +18,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
try: try:
@ -35,7 +37,7 @@ SELINUX_MODE_DICT = {
class SelinuxFactCollector(BaseFactCollector): class SelinuxFactCollector(BaseFactCollector):
name = 'selinux' name = 'selinux'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
facts_dict = {} facts_dict = {}

@ -22,6 +22,8 @@ import os
import platform import platform
import re import re
import ansible.module_utils.compat.typing as t
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
@ -37,7 +39,7 @@ if platform.system() != 'SunOS':
class ServiceMgrFactCollector(BaseFactCollector): class ServiceMgrFactCollector(BaseFactCollector):
name = 'service_mgr' name = 'service_mgr'
_fact_ids = set() _fact_ids = set() # type: t.Set[str]
required_facts = set(['platform', 'distribution']) required_facts = set(['platform', 'distribution'])
@staticmethod @staticmethod

@ -16,6 +16,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.utils import get_file_content from ansible.module_utils.facts.utils import get_file_content
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -27,7 +29,7 @@ class SshPubKeyFactCollector(BaseFactCollector):
'ssh_host_key_dsa_public', 'ssh_host_key_dsa_public',
'ssh_host_key_rsa_public', 'ssh_host_key_rsa_public',
'ssh_host_key_ecdsa_public', 'ssh_host_key_ecdsa_public',
'ssh_host_key_ed25519_public']) 'ssh_host_key_ed25519_public']) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
ssh_pub_key_facts = {} ssh_pub_key_facts = {}

@ -20,6 +20,8 @@ import getpass
import os import os
import pwd import pwd
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -28,7 +30,7 @@ class UserFactCollector(BaseFactCollector):
_fact_ids = set(['user_id', 'user_uid', 'user_gid', _fact_ids = set(['user_id', 'user_uid', 'user_gid',
'user_gecos', 'user_dir', 'user_shell', 'user_gecos', 'user_dir', 'user_shell',
'real_user_id', 'effective_user_id', 'real_user_id', 'effective_user_id',
'effective_group_ids']) 'effective_group_ids']) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
user_facts = {} user_facts = {}

@ -19,6 +19,8 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ansible.module_utils.compat.typing as t
from ansible.module_utils.facts.collector import BaseFactCollector from ansible.module_utils.facts.collector import BaseFactCollector
@ -63,7 +65,7 @@ class VirtualCollector(BaseFactCollector):
'virtualization_role', 'virtualization_role',
'virtualization_tech_guest', 'virtualization_tech_guest',
'virtualization_tech_host', 'virtualization_tech_host',
]) ]) # type: t.Set[str]
def collect(self, module=None, collected_facts=None): def collect(self, module=None, collected_facts=None):
collected_facts = collected_facts or {} collected_facts = collected_facts or {}

@ -68,6 +68,7 @@ except ImportError:
# Python 3 # Python 3
import http.client as httplib # type: ignore[no-redef] import http.client as httplib # type: ignore[no-redef]
import ansible.module_utils.compat.typing as t
import ansible.module_utils.six.moves.http_cookiejar as cookiejar import ansible.module_utils.six.moves.http_cookiejar as cookiejar
import ansible.module_utils.six.moves.urllib.error as urllib_error import ansible.module_utils.six.moves.urllib.error as urllib_error
@ -86,7 +87,7 @@ except ImportError:
import urllib2 as urllib_request # type: ignore[no-redef] import urllib2 as urllib_request # type: ignore[no-redef]
from urllib2 import AbstractHTTPHandler, BaseHandler # type: ignore[no-redef] from urllib2 import AbstractHTTPHandler, BaseHandler # type: ignore[no-redef]
urllib_request.HTTPRedirectHandler.http_error_308 = urllib_request.HTTPRedirectHandler.http_error_307 urllib_request.HTTPRedirectHandler.http_error_308 = urllib_request.HTTPRedirectHandler.http_error_307 # type: ignore[attr-defined]
try: try:
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse, unquote from ansible.module_utils.six.moves.urllib.parse import urlparse, urlunparse, unquote
@ -160,7 +161,7 @@ if not HAS_SSLCONTEXT and HAS_SSL:
# The bundled backports.ssl_match_hostname should really be moved into its own file for processing # The bundled backports.ssl_match_hostname should really be moved into its own file for processing
_BUNDLED_METADATA = {"pypi_name": "backports.ssl_match_hostname", "version": "3.7.0.1"} _BUNDLED_METADATA = {"pypi_name": "backports.ssl_match_hostname", "version": "3.7.0.1"}
LOADED_VERIFY_LOCATIONS = set() LOADED_VERIFY_LOCATIONS = set() # type: t.Set[str]
HAS_MATCH_HOSTNAME = True HAS_MATCH_HOSTNAME = True
try: try:

Loading…
Cancel
Save