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.
Files changed (21) hide show
  1. {speedtest_ssh-2.8.0/speedtest_ssh.egg-info → speedtest_ssh-2.8.1}/PKG-INFO +1 -1
  2. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/pyproject.toml +7 -0
  3. speedtest_ssh-2.8.1/speedtest_ssh/_version.py +1 -0
  4. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/data_transfer.py +9 -3
  5. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/speedtest_ssh.py +1 -1
  6. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/util.py +4 -4
  7. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1/speedtest_ssh.egg-info}/PKG-INFO +1 -1
  8. speedtest_ssh-2.8.0/speedtest_ssh/_version.py +0 -1
  9. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/LICENSE +0 -0
  10. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/README.md +0 -0
  11. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/setup.cfg +0 -0
  12. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/__init__.py +0 -0
  13. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/config.py +0 -0
  14. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/ping.py +0 -0
  15. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/py.typed +0 -0
  16. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh/sftp_wrapper.py +0 -0
  17. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/SOURCES.txt +0 -0
  18. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/dependency_links.txt +0 -0
  19. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/entry_points.txt +0 -0
  20. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/requires.txt +0 -0
  21. {speedtest_ssh-2.8.0 → speedtest_ssh-2.8.1}/speedtest_ssh.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: speedtest_ssh
3
- Version: 2.8.0
3
+ Version: 2.8.1
4
4
  Summary: A tool meant to check inter-device speeds via ssh
5
5
  License: GPL
6
6
  Project-URL: Homepage, https://github.com/zwimer/speedtest_ssh
@@ -58,3 +58,10 @@ ignore = ["E731"]
58
58
  line-length = 120
59
59
  [tool.ruff.per-file-ignores]
60
60
  "__init__.py" = ["F401", "F403"]
61
+
62
+ [tool.bandit]
63
+ skips = ["B404", "B108"]
64
+
65
+ [tool.vulture]
66
+ ignore_names = ["cli"]
67
+ paths = ["speedtest_ssh"]
@@ -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 mananger used to send and receive data to and from the remote client
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
- rand = lambda: random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits)
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...")
@@ -15,7 +15,7 @@ from ._version import __version__
15
15
 
16
16
 
17
17
  base_size = 2 * (1024**2)
18
- _password_env_name = "SPEEDTEST_SSH_PASSWORD"
18
+ _password_env_name = "SPEEDTEST_SSH_PASSWORD" # nosec B105
19
19
  _LOG = "speedtest_ssh"
20
20
 
21
21
 
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: speedtest_ssh
3
- Version: 2.8.0
3
+ Version: 2.8.1
4
4
  Summary: A tool meant to check inter-device speeds via ssh
5
5
  License: GPL
6
6
  Project-URL: Homepage, https://github.com/zwimer/speedtest_ssh
@@ -1 +0,0 @@
1
- __version__: str = "2.8.0"
File without changes
File without changes
File without changes