mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Python code modernization, 5/n (#1165)
* Address raise-missing-from. * Address simplifiable-if-expression. * Address unnecessary-dunder-call. * Address unnecessary-pass. * Address use-list-literal. * Address unused-variable. * Address use-dict-literal.
This commit is contained in:
@@ -227,18 +227,20 @@ class APIClient(_Session, DaemonApiMixin):
|
||||
try:
|
||||
version_result = self.version(api_version=False)
|
||||
except Exception as e:
|
||||
raise DockerException(f"Error while fetching server API version: {e}")
|
||||
raise DockerException(
|
||||
f"Error while fetching server API version: {e}"
|
||||
) from e
|
||||
|
||||
try:
|
||||
return version_result["ApiVersion"]
|
||||
except KeyError:
|
||||
raise DockerException(
|
||||
'Invalid response from docker daemon: key "ApiVersion" is missing.'
|
||||
)
|
||||
) from None
|
||||
except Exception as e:
|
||||
raise DockerException(
|
||||
f"Error while fetching server API version: {e}. Response seems to be broken."
|
||||
)
|
||||
) from e
|
||||
|
||||
def _set_request_timeout(self, kwargs):
|
||||
"""Prepare the kwargs for an HTTP request by inserting the timeout
|
||||
|
||||
Reference in New Issue
Block a user