Skip to content

Commit 925705f

Browse files
committed
Remove return bool from Channel.close()
Theres was defined meaning to the return bool either in the code or in the human text: - no code calls close to give an example of interpretation - it's not success/fail because local channel returns False to indicate that it didn't need to do anything, not that there was a failure. Other .close() style methods return None and raise an exception if there is a problem. This PR pushes Channel.close() in this direction. A separate PR will actually invoke this .close() method.
1 parent 59c9c44 commit 925705f

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

parsl/channels/base.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,8 @@ def pull_file(self, remote_source: str, local_dir: str) -> str:
8989
pass
9090

9191
@abstractmethod
92-
def close(self) -> bool:
93-
''' Closes the channel. Clean out any auth credentials.
94-
95-
Args:
96-
None
97-
98-
Returns:
99-
Bool
100-
92+
def close(self) -> None:
93+
''' Closes the channel.
10194
'''
10295
pass
10396

parsl/channels/local/local.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,10 @@ def push_file(self, source, dest_dir):
107107
def pull_file(self, remote_source, local_dir):
108108
return self.push_file(remote_source, local_dir)
109109

110-
def close(self):
111-
''' There's nothing to close here, and this really doesn't do anything
112-
113-
Returns:
114-
- False, because it really did not "close" this channel.
110+
def close(self) -> None:
111+
''' There's nothing to close here, and so this doesn't do anything
115112
'''
116-
return False
113+
pass
117114

118115
def isdir(self, path):
119116
"""Return true if the path refers to an existing directory.

parsl/channels/oauth_ssh/oauth_ssh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@ def execute_wait(self, cmd, walltime=60, envs={}):
106106

107107
return exit_status, stdout, stderr
108108

109-
def close(self):
110-
return self.transport.close()
109+
def close(self) -> None:
110+
self.transport.close()

parsl/channels/ssh/ssh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ def pull_file(self, remote_source, local_dir):
217217

218218
return local_dest
219219

220-
def close(self):
220+
def close(self) -> None:
221221
if self._is_connected():
222-
return self.ssh_client.close()
222+
self.ssh_client.close()
223223

224224
def isdir(self, path):
225225
"""Return true if the path refers to an existing directory.

0 commit comments

Comments
 (0)