speedtest-ssh 2.8.0__tar.gz → 2.8.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.
- {speedtest_ssh-2.8.0/speedtest_ssh.egg-info → speedtest_ssh-2.8.1}/PKG-INFO +1 -1
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/pyproject.toml +7 -0
- speedtest_ssh-2.8.1/speedtest_ssh/_version.py +1 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/data_transfer.py +9 -3
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/speedtest_ssh.py +1 -1
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/util.py +4 -4
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1/speedtest_ssh.egg-info}/PKG-INFO +1 -1
- speedtest_ssh-2.8.0/speedtest_ssh/_version.py +0 -1
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/LICENSE +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/README.md +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/setup.cfg +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/__init__.py +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/config.py +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/ping.py +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/py.typed +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/sftp_wrapper.py +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/SOURCES.txt +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/dependency_links.txt +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/entry_points.txt +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/requires.txt +0 -0
- {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__: str = "2.8.1"
|
|
@@ -22,6 +22,13 @@ if TYPE_CHECKING:
|
|
|
22
22
|
__all__ = ("DataTransfer", "SFTP", "Rsync")
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
_dict = string.ascii_uppercase + string.ascii_lowercase + string.digits
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _rand_str(size: int) -> str:
|
|
29
|
+
return "".join(random.choice(_dict) for _ in range(size)) # nosec B311
|
|
30
|
+
|
|
31
|
+
|
|
25
32
|
class ProgressBar(tqdm):
|
|
26
33
|
"""
|
|
27
34
|
A small tqdm wrapper for paramiko's SFTP callbacks to use
|
|
@@ -43,7 +50,7 @@ class ProgressBar(tqdm):
|
|
|
43
50
|
|
|
44
51
|
class DataTransfer:
|
|
45
52
|
"""
|
|
46
|
-
A context
|
|
53
|
+
A context manager used to send and receive data to and from the remote client
|
|
47
54
|
This class is a context manager; on exit will remove the remote file on deletion
|
|
48
55
|
"""
|
|
49
56
|
|
|
@@ -54,8 +61,7 @@ class DataTransfer:
|
|
|
54
61
|
:param config: The Config object the DataTransfer instance should use
|
|
55
62
|
"""
|
|
56
63
|
self._l = getLogger(self._LOG)
|
|
57
|
-
|
|
58
|
-
self._remote_f: str = f"/tmp/speedtest-ssh_{datetime.now()}_{''.join(rand() for _ in range(8))}.tmp"
|
|
64
|
+
self._remote_f: str = f"/tmp/speedtest-ssh_{datetime.now()}_{_rand_str(8)}.tmp"
|
|
59
65
|
self._remote_f = self._remote_f.replace(":", "-").replace(" ", "_")
|
|
60
66
|
# We promise that _remote_f components match: ^[a-zA-Z\d_.-]+$ (old rsync args suck)
|
|
61
67
|
self._l.debug("Parsing ssh config and loading keys...")
|
|
@@ -43,7 +43,7 @@ def run_cmd(cmd: Path, *args: str | Path, **kwargs) -> subprocess.CompletedProce
|
|
|
43
43
|
:return: Completed process
|
|
44
44
|
"""
|
|
45
45
|
_log_cmd(cmd, args)
|
|
46
|
-
return subprocess.run((cmd, *args), **kwargs)
|
|
46
|
+
return subprocess.run((cmd, *args), **kwargs) # nosec B603
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def tee_cmd(cmd: Path, *args: str | Path, level: int, **kwargs) -> tuple[subprocess.Popen, str]:
|
|
@@ -54,11 +54,11 @@ def tee_cmd(cmd: Path, *args: str | Path, level: int, **kwargs) -> tuple[subproc
|
|
|
54
54
|
:param kwargs: Fowarded to subprocess.Popen aside from test and stdout
|
|
55
55
|
:return: Completed process, stdout (do not read stdout from CompletedProcess)
|
|
56
56
|
"""
|
|
57
|
-
assert "text" not in kwargs
|
|
58
|
-
assert "stdout" not in kwargs
|
|
57
|
+
assert "text" not in kwargs # nosec B101
|
|
58
|
+
assert "stdout" not in kwargs # nosec B101
|
|
59
59
|
log = getLogger(_LOG)
|
|
60
60
|
_log_cmd(cmd, args)
|
|
61
|
-
p = subprocess.Popen((cmd, *args), text=True, stdout=subprocess.PIPE, **kwargs)
|
|
61
|
+
p = subprocess.Popen((cmd, *args), text=True, stdout=subprocess.PIPE, **kwargs) # nosec B603
|
|
62
62
|
stdout = ""
|
|
63
63
|
for line in p.stdout: # type: ignore
|
|
64
64
|
log.log(level, line[:-1])
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__: str = "2.8.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|