dycw-utilities 0.174.0__py3-none-any.whl → 0.174.1__py3-none-any.whl

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.3
2
2
  Name: dycw-utilities
3
- Version: 0.174.0
3
+ Version: 0.174.1
4
4
  Author: Derek Wan
5
5
  Author-email: Derek Wan <d.wan@icloud.com>
6
6
  Requires-Dist: atomicwrites>=1.4.1,<1.5
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=SAizpT7mlxrqXLUp3CAijczSi6mCMJcL-XzIlkyvEKk,60
1
+ utilities/__init__.py,sha256=tLO7x-PFRNnbxnNKusLHsRm5KouG5gC6-6CMhoP9aSQ,60
2
2
  utilities/aeventkit.py,sha256=OmDBhYGgbsKrB7cdC5FFpJHUatX9O76eTeKVVTksp2Y,12673
3
3
  utilities/altair.py,sha256=rUK99g9x6CYDDfiZrf-aTx5fSRbL1Q8ctgKORowzXHg,9060
4
4
  utilities/asyncio.py,sha256=aJySVxBY0gqsIYnoNmH7-1r8djKuf4vSsU69VCD08t8,16772
@@ -80,7 +80,7 @@ utilities/sqlalchemy.py,sha256=HQYpd7LFxdTF5WYVWYtCJeEBI71EJm7ytvCGyAH9B-U,37163
80
80
  utilities/sqlalchemy_polars.py,sha256=JCGhB37raSR7fqeWV5dTsciRTMVzIdVT9YSqKT0piT0,13370
81
81
  utilities/statsmodels.py,sha256=koyiBHvpMcSiBfh99wFUfSggLNx7cuAw3rwyfAhoKpQ,3410
82
82
  utilities/string.py,sha256=shmBK87zZwzGyixuNuXCiUbqzfeZ9xlrFwz6JTaRvDk,582
83
- utilities/subprocess.py,sha256=WQ7MCIFbSHfscNgSAujdQb1iTw0ZtSojySdmoiZcP3w,12582
83
+ utilities/subprocess.py,sha256=8kGrQLnPnlbdXeWE7OPk9Pih2KBNyjBKbntdiloQVrY,13066
84
84
  utilities/tempfile.py,sha256=Lx6qa16lL1XVH6WdmD_G9vlN6gLI8nrIurxmsFkPKvg,3022
85
85
  utilities/testbook.py,sha256=j1KmaVbrX9VrbeMgtPh5gk55myAsn3dyRUn7jGbPbRk,1294
86
86
  utilities/text.py,sha256=7SvwcSR2l_5cOrm1samGnR4C-ZI6qyFLHLzSpO1zeHQ,13958
@@ -97,7 +97,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
97
97
  utilities/whenever.py,sha256=F4ek0-OBWxHYrZdmoZt76N2RnNyKY5KrEHt7rqO4AQE,60183
98
98
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
99
99
  utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
100
- dycw_utilities-0.174.0.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
101
- dycw_utilities-0.174.0.dist-info/entry_points.txt,sha256=ykGI1ArwOPHqm2g5Cqh3ENdMxEej_a_FcOUov5EM5Oc,155
102
- dycw_utilities-0.174.0.dist-info/METADATA,sha256=s1r1jGAcrQUx0YBQBK-2L4K2op5q7VlQkywW4FHbz8Y,1709
103
- dycw_utilities-0.174.0.dist-info/RECORD,,
100
+ dycw_utilities-0.174.1.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
101
+ dycw_utilities-0.174.1.dist-info/entry_points.txt,sha256=ykGI1ArwOPHqm2g5Cqh3ENdMxEej_a_FcOUov5EM5Oc,155
102
+ dycw_utilities-0.174.1.dist-info/METADATA,sha256=olH83qMZVFRCSDboBVmfiiCV1d4hKdtVyvCFi6s1Gp0,1709
103
+ dycw_utilities-0.174.1.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.174.0"
3
+ __version__ = "0.174.1"
utilities/subprocess.py CHANGED
@@ -419,6 +419,21 @@ def touch_cmd(path: PathLike, /) -> list[str]:
419
419
  return ["touch", str(path)]
420
420
 
421
421
 
422
+ @contextmanager
423
+ def yield_ssh_temp_dir(
424
+ user: str, hostname: str, /, *, keep: bool = False, logger: LoggerLike | None = None
425
+ ) -> Iterator[Path]:
426
+ path = Path(ssh(user, hostname, *MKTEMP_DIR_CMD, return_=True))
427
+ try:
428
+ yield path
429
+ finally:
430
+ if keep:
431
+ if logger is not None:
432
+ to_logger(logger).info("Keeping temporary directory '%s'...", path)
433
+ else:
434
+ ssh(user, hostname, *rm_cmd(path))
435
+
436
+
422
437
  __all__ = [
423
438
  "BASH_LC",
424
439
  "BASH_LS",
@@ -434,4 +449,5 @@ __all__ = [
434
449
  "ssh_cmd",
435
450
  "sudo_cmd",
436
451
  "touch_cmd",
452
+ "yield_ssh_temp_dir",
437
453
  ]