Skip to content

Commit a96a04e

Browse files
authored
Update ssh_tunnel.py
1 parent 6a58e18 commit a96a04e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ssh_tunnel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Ports and sockets forwarding tunnel over SSH with systems SSH client."""
12
import logging
23
import os
34
import subprocess
@@ -10,13 +11,14 @@
1011

1112

1213
class SSHTunnelConnectionError(Exception):
13-
pass
14+
"""Connection error exception."""
1415

1516

1617
@contextmanager
1718
def create_ssh_tunnel(
1819
hostname: str, local_socket: str, remote_socket: str, timeout: int = 10
1920
) -> Generator[str, None, None]:
21+
"""Create SSH tunnel."""
2022
ssh_socket_filename = gen_temp_socket_filename(f"{hostname}.")
2123
ssh_tunnel_cmd = [
2224
"ssh",
@@ -80,6 +82,7 @@ def create_ssh_tunnel(
8082
def gen_temp_socket_filename(
8183
prefix: Optional[str] = None, suffix: Optional[str] = None
8284
) -> str:
85+
"""Get filename for temporary socket file."""
8386
temp_socket_filename = None
8487
with tempfile.NamedTemporaryFile(
8588
suffix=suffix, prefix=prefix, dir=tempfile.gettempdir()

0 commit comments

Comments
 (0)