dycw-utilities 0.175.19__py3-none-any.whl → 0.175.21__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.175.19
3
+ Version: 0.175.21
4
4
  Summary: Miscellaneous Python utilities
5
5
  Author: Derek Wan
6
6
  Author-email: Derek Wan <d.wan@icloud.com>
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=Icf2ql4qG7C1V1W6jJzw-EbFjcuaZSkx7-OyX1zNNMY,61
1
+ utilities/__init__.py,sha256=c3FAa7J9i9A9QwY7M7bRf_yJU_6W4YVirou_51-hDaE,61
2
2
  utilities/altair.py,sha256=TLfRFbG9HwG7SLXoJ-v0r-t49ZaGgTQZD82cpjVi4vs,9085
3
3
  utilities/asyncio.py,sha256=aJySVxBY0gqsIYnoNmH7-1r8djKuf4vSsU69VCD08t8,16772
4
4
  utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
@@ -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=F4sRJq9eNnXwZ46GgYxTQQCT-YUx_ghZ4o91dH4KgW4,45405
83
+ utilities/subprocess.py,sha256=1nM6Fb-aD4xO673bqWt79rReS2gAhUGmxiA00ZPHYcU,45578
84
84
  utilities/tempfile.py,sha256=a3_M1QyxGZql_VcGkBOQBeWbbkItjgkfIpVyzU1UAic,3843
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.175.19.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
101
- dycw_utilities-0.175.19.dist-info/entry_points.txt,sha256=cOGtKeJI0KXLSV7MJ8Dhc2G8jPgDcBDm53MVNJU4ycI,136
102
- dycw_utilities-0.175.19.dist-info/METADATA,sha256=-Ng54LQmTd_U_-Vbb0rRL7bAKisLDxfPhIrEkrxtT9U,1443
103
- dycw_utilities-0.175.19.dist-info/RECORD,,
100
+ dycw_utilities-0.175.21.dist-info/WHEEL,sha256=RRVLqVugUmFOqBedBFAmA4bsgFcROUBiSUKlERi0Hcg,79
101
+ dycw_utilities-0.175.21.dist-info/entry_points.txt,sha256=cOGtKeJI0KXLSV7MJ8Dhc2G8jPgDcBDm53MVNJU4ycI,136
102
+ dycw_utilities-0.175.21.dist-info/METADATA,sha256=y3VJmWeWtzyIF4omQ2e7If6NjJvyNU7DND56LbeP7m4,1443
103
+ dycw_utilities-0.175.21.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.175.19"
3
+ __version__ = "0.175.21"
utilities/subprocess.py CHANGED
@@ -95,16 +95,17 @@ def apt_install_cmd(package: str, /) -> list[str]:
95
95
  ##
96
96
 
97
97
 
98
- def cat(path: PathLike, /, *, sudo: bool = False) -> str:
99
- """Concatenate a file."""
98
+ def cat(path: PathLike, /, *paths: PathLike, sudo: bool = False) -> str:
99
+ """Concatenate and print files."""
100
100
  if sudo: # pragma: no cover
101
- return run(*sudo_cmd(*cat_cmd(path)), return_=True)
102
- return Path(path).read_text()
101
+ return run(*sudo_cmd(*cat_cmd(path, *paths)), return_=True)
102
+ all_paths = list(map(Path, [path, *paths]))
103
+ return "\n".join(p.read_text() for p in all_paths)
103
104
 
104
105
 
105
- def cat_cmd(path: PathLike, /) -> list[str]:
106
+ def cat_cmd(path: PathLike, /, *paths: PathLike) -> list[str]:
106
107
  """Command to use 'cat' to concatenate and print files."""
107
- return ["cat", str(path)]
108
+ return ["cat", str(path), *map(str, paths)]
108
109
 
109
110
 
110
111
  ##
@@ -444,7 +445,8 @@ def rm(path: PathLike, /, *paths: PathLike, sudo: bool = False) -> None:
444
445
  if sudo: # pragma: no cover
445
446
  run(*sudo_cmd(*rm_cmd(path, *paths)))
446
447
  else:
447
- for p in map(Path, [path, *paths]):
448
+ all_paths = list(map(Path, [path, *paths]))
449
+ for p in all_paths:
448
450
  if p.is_file():
449
451
  p.unlink(missing_ok=True)
450
452
  elif p.is_dir():