dycw-utilities 0.174.14__py3-none-any.whl → 0.174.15__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.14
3
+ Version: 0.174.15
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=wElh7rM2Gp4Qe3xG2KlBo0z_G6fFiYwVzZ10q9vTQac,61
1
+ utilities/__init__.py,sha256=e_rDHgJr89spnVGWmvxwmI_TbjZtP1QsasPjzzI3FTs,61
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
@@ -81,7 +81,7 @@ utilities/sqlalchemy.py,sha256=HQYpd7LFxdTF5WYVWYtCJeEBI71EJm7ytvCGyAH9B-U,37163
81
81
  utilities/sqlalchemy_polars.py,sha256=JCGhB37raSR7fqeWV5dTsciRTMVzIdVT9YSqKT0piT0,13370
82
82
  utilities/statsmodels.py,sha256=koyiBHvpMcSiBfh99wFUfSggLNx7cuAw3rwyfAhoKpQ,3410
83
83
  utilities/string.py,sha256=shmBK87zZwzGyixuNuXCiUbqzfeZ9xlrFwz6JTaRvDk,582
84
- utilities/subprocess.py,sha256=tYfdY7CdVc91rs9AZ-KSwLvKyNNoPunDOWLgCtwuTvs,28490
84
+ utilities/subprocess.py,sha256=gsRaeBzUSINUBuMZTSz7F7rMdAmhUFCEhMQOEpS5Ro4,28897
85
85
  utilities/tempfile.py,sha256=Lx6qa16lL1XVH6WdmD_G9vlN6gLI8nrIurxmsFkPKvg,3022
86
86
  utilities/testbook.py,sha256=j1KmaVbrX9VrbeMgtPh5gk55myAsn3dyRUn7jGbPbRk,1294
87
87
  utilities/text.py,sha256=7SvwcSR2l_5cOrm1samGnR4C-ZI6qyFLHLzSpO1zeHQ,13958
@@ -98,7 +98,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
98
98
  utilities/whenever.py,sha256=F4ek0-OBWxHYrZdmoZt76N2RnNyKY5KrEHt7rqO4AQE,60183
99
99
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
100
100
  utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
101
- dycw_utilities-0.174.14.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
102
- dycw_utilities-0.174.14.dist-info/entry_points.txt,sha256=ykGI1ArwOPHqm2g5Cqh3ENdMxEej_a_FcOUov5EM5Oc,155
103
- dycw_utilities-0.174.14.dist-info/METADATA,sha256=nHCDEWfo7tFV9RLiNWEE9IqfJAvwPWvuv6rn07LnXpw,1710
104
- dycw_utilities-0.174.14.dist-info/RECORD,,
101
+ dycw_utilities-0.174.15.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
102
+ dycw_utilities-0.174.15.dist-info/entry_points.txt,sha256=ykGI1ArwOPHqm2g5Cqh3ENdMxEej_a_FcOUov5EM5Oc,155
103
+ dycw_utilities-0.174.15.dist-info/METADATA,sha256=-vZ1ta-ZjRzQ0WaZ7uRspE0DJQCqajno8r1UEp8gF2Y,1710
104
+ dycw_utilities-0.174.15.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.174.14"
3
+ __version__ = "0.174.15"
utilities/subprocess.py CHANGED
@@ -938,12 +938,24 @@ def symlink_cmd(target: PathLike, link: PathLike, /) -> list[str]:
938
938
  ##
939
939
 
940
940
 
941
- def tee_cmd(*, append: bool = False) -> list[str]:
941
+ def tee(
942
+ path: PathLike, text: str, /, *, sudo: bool = False, append: bool = False
943
+ ) -> None:
944
+ """Use 'tee' to duplicate standard input."""
945
+ if sudo: # pragma: no cover
946
+ run(*sudo_cmd(*tee_cmd(path, append=append)), input=text)
947
+ else:
948
+ path = Path(path)
949
+ with path.open(mode="a" if append else "w") as fh:
950
+ _ = fh.write(text)
951
+
952
+
953
+ def tee_cmd(path: PathLike, /, *, append: bool = False) -> list[str]:
942
954
  """Command to use 'tee' to duplicate standard input."""
943
955
  args: list[str] = ["tee"]
944
956
  if append:
945
957
  args.append("-a")
946
- return args
958
+ return [*args, str(path)]
947
959
 
948
960
 
949
961
  ##