mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-15 19:42:06 +00:00
Fix issues with pylint 4.0.
This commit is contained in:
parent
16b5bfa27b
commit
6f9ebc3f14
@ -14,10 +14,6 @@ from __future__ import annotations
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
REQUESTS_IMPORT_ERROR = None
|
|
||||||
URLLIB3_IMPORT_ERROR = None
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from requests import Session # noqa: F401, pylint: disable=unused-import
|
from requests import Session # noqa: F401, pylint: disable=unused-import
|
||||||
from requests.adapters import ( # noqa: F401, pylint: disable=unused-import
|
from requests.adapters import ( # noqa: F401, pylint: disable=unused-import
|
||||||
@ -28,7 +24,7 @@ try:
|
|||||||
InvalidSchema,
|
InvalidSchema,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
REQUESTS_IMPORT_ERROR = traceback.format_exc()
|
REQUESTS_IMPORT_ERROR = traceback.format_exc() # pylint: disable=invalid-name
|
||||||
|
|
||||||
class Session:
|
class Session:
|
||||||
__attrs__ = []
|
__attrs__ = []
|
||||||
@ -42,7 +38,11 @@ except ImportError:
|
|||||||
class InvalidSchema(Exception):
|
class InvalidSchema(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
else:
|
||||||
|
REQUESTS_IMPORT_ERROR = None # pylint: disable=invalid-name
|
||||||
|
|
||||||
|
|
||||||
|
URLLIB3_IMPORT_ERROR = None # pylint: disable=invalid-name
|
||||||
try:
|
try:
|
||||||
from requests.packages import urllib3 # pylint: disable=unused-import
|
from requests.packages import urllib3 # pylint: disable=unused-import
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ except ImportError:
|
|||||||
connection as urllib3_connection, # pylint: disable=unused-import
|
connection as urllib3_connection, # pylint: disable=unused-import
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
URLLIB3_IMPORT_ERROR = traceback.format_exc()
|
URLLIB3_IMPORT_ERROR = traceback.format_exc() # pylint: disable=invalid-name
|
||||||
|
|
||||||
class _HTTPConnectionPool:
|
class _HTTPConnectionPool:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
PYWIN32_IMPORT_ERROR = None
|
|
||||||
try:
|
try:
|
||||||
import pywintypes
|
import pywintypes
|
||||||
import win32api
|
import win32api
|
||||||
@ -25,7 +24,9 @@ try:
|
|||||||
import win32file
|
import win32file
|
||||||
import win32pipe
|
import win32pipe
|
||||||
except ImportError:
|
except ImportError:
|
||||||
PYWIN32_IMPORT_ERROR = traceback.format_exc()
|
PYWIN32_IMPORT_ERROR = traceback.format_exc() # pylint: disable=invalid-name
|
||||||
|
else:
|
||||||
|
PYWIN32_IMPORT_ERROR = None # pylint: disable=invalid-name
|
||||||
|
|
||||||
|
|
||||||
ERROR_PIPE_BUSY = 0xE7
|
ERROR_PIPE_BUSY = 0xE7
|
||||||
|
|||||||
@ -25,11 +25,12 @@ from .._import_helper import HTTPAdapter, urllib3, urllib3_connection
|
|||||||
from .basehttpadapter import BaseHTTPAdapter
|
from .basehttpadapter import BaseHTTPAdapter
|
||||||
|
|
||||||
|
|
||||||
PARAMIKO_IMPORT_ERROR = None
|
|
||||||
try:
|
try:
|
||||||
import paramiko
|
import paramiko
|
||||||
except ImportError:
|
except ImportError:
|
||||||
PARAMIKO_IMPORT_ERROR = traceback.format_exc()
|
PARAMIKO_IMPORT_ERROR = traceback.format_exc() # pylint: disable=invalid-name
|
||||||
|
else:
|
||||||
|
PARAMIKO_IMPORT_ERROR = None # pylint: disable=invalid-name
|
||||||
|
|
||||||
|
|
||||||
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
RecentlyUsedContainer = urllib3._collections.RecentlyUsedContainer
|
||||||
|
|||||||
@ -34,11 +34,8 @@ from ansible_collections.community.docker.plugins.module_utils._version import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
HAS_DOCKER_PY = True
|
HAS_DOCKER_PY_2 = False # pylint: disable=invalid-name
|
||||||
HAS_DOCKER_PY_2 = False
|
HAS_DOCKER_PY_3 = False # pylint: disable=invalid-name
|
||||||
HAS_DOCKER_PY_3 = False
|
|
||||||
HAS_DOCKER_ERROR = None
|
|
||||||
HAS_DOCKER_TRACEBACK = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from docker import __version__ as docker_version
|
from docker import __version__ as docker_version
|
||||||
@ -48,18 +45,22 @@ try:
|
|||||||
from requests.exceptions import SSLError
|
from requests.exceptions import SSLError
|
||||||
|
|
||||||
if LooseVersion(docker_version) >= LooseVersion("3.0.0"):
|
if LooseVersion(docker_version) >= LooseVersion("3.0.0"):
|
||||||
HAS_DOCKER_PY_3 = True
|
HAS_DOCKER_PY_3 = True # pylint: disable=invalid-name
|
||||||
from docker import APIClient as Client
|
from docker import APIClient as Client
|
||||||
elif LooseVersion(docker_version) >= LooseVersion("2.0.0"):
|
elif LooseVersion(docker_version) >= LooseVersion("2.0.0"):
|
||||||
HAS_DOCKER_PY_2 = True
|
HAS_DOCKER_PY_2 = True # pylint: disable=invalid-name
|
||||||
from docker import APIClient as Client
|
from docker import APIClient as Client
|
||||||
else:
|
else:
|
||||||
from docker import Client
|
from docker import Client
|
||||||
|
|
||||||
except ImportError as exc:
|
except ImportError as exc:
|
||||||
HAS_DOCKER_ERROR = str(exc)
|
HAS_DOCKER_ERROR = str(exc) # pylint: disable=invalid-name
|
||||||
HAS_DOCKER_TRACEBACK = traceback.format_exc()
|
HAS_DOCKER_TRACEBACK = traceback.format_exc() # pylint: disable=invalid-name
|
||||||
HAS_DOCKER_PY = False
|
HAS_DOCKER_PY = False # pylint: disable=invalid-name
|
||||||
|
else:
|
||||||
|
HAS_DOCKER_PY = True # pylint: disable=invalid-name
|
||||||
|
HAS_DOCKER_ERROR = None # pylint: disable=invalid-name
|
||||||
|
HAS_DOCKER_TRACEBACK = None # pylint: disable=invalid-name
|
||||||
|
|
||||||
|
|
||||||
# The next two imports ``docker.models`` and ``docker.ssladapter`` are used
|
# The next two imports ``docker.models`` and ``docker.ssladapter`` are used
|
||||||
|
|||||||
@ -42,11 +42,12 @@ try:
|
|||||||
from yaml import CSafeDumper as _SafeDumper
|
from yaml import CSafeDumper as _SafeDumper
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from yaml import SafeDumper as _SafeDumper
|
from yaml import SafeDumper as _SafeDumper
|
||||||
HAS_PYYAML = True
|
|
||||||
PYYAML_IMPORT_ERROR = None
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYYAML = False
|
HAS_PYYAML = False
|
||||||
PYYAML_IMPORT_ERROR = traceback.format_exc()
|
PYYAML_IMPORT_ERROR = traceback.format_exc() # pylint: disable=invalid-name
|
||||||
|
else:
|
||||||
|
HAS_PYYAML = True
|
||||||
|
PYYAML_IMPORT_ERROR = None # pylint: disable=invalid-name
|
||||||
|
|
||||||
|
|
||||||
DOCKER_COMPOSE_FILES = (
|
DOCKER_COMPOSE_FILES = (
|
||||||
|
|||||||
@ -17,14 +17,12 @@ from ansible_collections.community.docker.plugins.module_utils._api.transport im
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
HAS_MATCH_HOSTNAME = True
|
|
||||||
try:
|
try:
|
||||||
from backports.ssl_match_hostname import CertificateError, match_hostname
|
from ssl import CertificateError, match_hostname
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
HAS_MATCH_HOSTNAME = False # pylint: disable=invalid-name
|
||||||
from ssl import CertificateError, match_hostname
|
else:
|
||||||
except ImportError:
|
HAS_MATCH_HOSTNAME = True # pylint: disable=invalid-name
|
||||||
HAS_MATCH_HOSTNAME = False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ssl import OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_TLSv1
|
from ssl import OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_TLSv1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user