diff --git a/.pylintrc b/.pylintrc index 6a1ddf32..145d25d9 100644 --- a/.pylintrc +++ b/.pylintrc @@ -384,7 +384,6 @@ disable=raw-checker-failed, consider-using-with, fixme, import-error, # TODO figure out why pylint cannot find the module - no-else-raise, no-else-return, no-member, no-name-in-module, # TODO figure out why pylint cannot find the module diff --git a/plugins/connection/docker_api.py b/plugins/connection/docker_api.py index 20d9bfda..32da8516 100644 --- a/plugins/connection/docker_api.py +++ b/plugins/connection/docker_api.py @@ -159,10 +159,9 @@ class Connection(ConnectionBase): raise AnsibleConnectionFailure( f'Could not find container "{remote_addr}" or resource in it ({e})' ) - else: - raise AnsibleConnectionFailure( - f'Could not find container "{remote_addr}" ({e})' - ) + raise AnsibleConnectionFailure( + f'Could not find container "{remote_addr}" ({e})' + ) except APIError as e: if e.response is not None and e.response.status_code == 409: raise AnsibleConnectionFailure( diff --git a/plugins/module_utils/_api/credentials/store.py b/plugins/module_utils/_api/credentials/store.py index 7e5b662e..5bf5fd28 100644 --- a/plugins/module_utils/_api/credentials/store.py +++ b/plugins/module_utils/_api/credentials/store.py @@ -91,8 +91,7 @@ class Store: raise errors.StoreError( f"{self.program} not installed or not available in PATH" ) - else: - raise errors.StoreError( - f'Unexpected OS error "{e.strerror}", errno={e.errno}' - ) + raise errors.StoreError( + f'Unexpected OS error "{e.strerror}", errno={e.errno}' + ) return output diff --git a/plugins/module_utils/_api/utils/build.py b/plugins/module_utils/_api/utils/build.py index 67367ce3..5a06772b 100644 --- a/plugins/module_utils/_api/utils/build.py +++ b/plugins/module_utils/_api/utils/build.py @@ -130,7 +130,7 @@ def mkbuildcontext(dockerfile): with tarfile.open(mode="w", fileobj=f) as t: if isinstance(dockerfile, io.StringIO): raise TypeError("Please use io.BytesIO to create in-memory Dockerfiles") - elif isinstance(dockerfile, io.BytesIO): + if isinstance(dockerfile, io.BytesIO): dfinfo = tarfile.TarInfo("Dockerfile") dfinfo.size = len(dockerfile.getvalue()) dockerfile.seek(0) diff --git a/plugins/module_utils/_api/utils/utils.py b/plugins/module_utils/_api/utils/utils.py index 393fca4f..27a5bfab 100644 --- a/plugins/module_utils/_api/utils/utils.py +++ b/plugins/module_utils/_api/utils/utils.py @@ -273,12 +273,11 @@ def parse_host(addr, is_win32=False, tls=False): raise errors.DockerException( f"Invalid bind address format: no path allowed for this protocol: {addr}" ) - else: - path = parsed_url.path - if proto == "unix" and parsed_url.hostname is not None: - # For legacy reasons, we consider unix://path - # to be valid and equivalent to unix:///path - path = "/".join((parsed_url.hostname, path)) + path = parsed_url.path + if proto == "unix" and parsed_url.hostname is not None: + # For legacy reasons, we consider unix://path + # to be valid and equivalent to unix:///path + path = "/".join((parsed_url.hostname, path)) netloc = parsed_url.netloc if proto in ("tcp", "ssh"): diff --git a/plugins/modules/docker_swarm_service.py b/plugins/modules/docker_swarm_service.py index a2a7635a..bde82590 100644 --- a/plugins/modules/docker_swarm_service.py +++ b/plugins/modules/docker_swarm_service.py @@ -1047,8 +1047,7 @@ def has_list_changed(new_list, old_list, sort_lists=True, sort_key=None): if unsorted_list and isinstance(unsorted_list[0], dict): if not sort_key: raise ValueError("A sort key was not specified when sorting list") - else: - return sorted(unsorted_list, key=lambda k: k[sort_key]) + return sorted(unsorted_list, key=lambda k: k[sort_key]) # Either the list is empty or does not contain dictionaries try: