shelltastic 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shelltastic
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A fantastic shell command runner for python
5
5
  Author: Bearmine
6
6
  License-Expression: MPL-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "shelltastic"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "A fantastic shell command runner for python"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -8,6 +8,7 @@ import sys
8
8
 
9
9
  from shelltastic.backend.base import RemoteShellBackend, ShellBackend
10
10
  from shelltastic.enum import OutputMode
11
+ from shelltastic.exception import SSHConnectionError
11
12
  from shelltastic.host import Host
12
13
 
13
14
  LOGGER = logging.getLogger(__name__)
@@ -66,20 +67,6 @@ class LocalShellBackend(ShellBackend):
66
67
  return subprocess.run(**cmd_to_run)
67
68
 
68
69
 
69
- class SSHConnectionError(Exception):
70
- def __init__(
71
- self, hostname: str, returncode: int, stdout: bytes | None, stderr: bytes | None
72
- ) -> None:
73
- if stderr:
74
- super().__init__(f"{stderr.decode()}")
75
- else:
76
- super().__init__(f"Could not connect to {hostname}")
77
- self.hostname = hostname
78
- self.returncode = returncode
79
- self.stdout = stdout
80
- self.stderr = stderr
81
-
82
-
83
70
  class SSHShellBackend(LocalShellBackend, RemoteShellBackend):
84
71
  def __init__(self, host: Host) -> None:
85
72
  super().__init__()
@@ -0,0 +1,12 @@
1
+ class SSHConnectionError(Exception):
2
+ def __init__(
3
+ self, hostname: str, returncode: int, stdout: bytes | None, stderr: bytes | None
4
+ ) -> None:
5
+ if stderr:
6
+ super().__init__(f"{stderr.decode()}")
7
+ else:
8
+ super().__init__(f"Could not connect to {hostname}")
9
+ self.hostname = hostname
10
+ self.returncode = returncode
11
+ self.stdout = stdout
12
+ self.stderr = stderr
@@ -4,8 +4,8 @@ from dataclasses import dataclass
4
4
  @dataclass(slots=True)
5
5
  class Host:
6
6
  hostname: str
7
- port: int | None
8
- username: str | None
7
+ port: int | None = None
8
+ username: str | None = None
9
9
 
10
10
  def host_specifier(self):
11
11
  if self.username:
File without changes
File without changes