dycw-utilities 0.149.6__py3-none-any.whl → 0.149.7__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.4
2
2
  Name: dycw-utilities
3
- Version: 0.149.6
3
+ Version: 0.149.7
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=HYLaFhglhHj-FrtFRRNqJjUPGNbgxtteCIxVq1uwDbY,60
1
+ utilities/__init__.py,sha256=lQsuAKe4Wmv9Y7o9Yk0hwSWFsXKPNxyN0T-BSFTp7Ak,60
2
2
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
3
3
  utilities/asyncio.py,sha256=z0w3fb-U5Ml5YXVaFFPClizXaQmjDO6YgZg-V9QL0VQ,16021
4
4
  utilities/atomicwrites.py,sha256=xcOWenTBRS0oat3kg7Sqe51AohNThMQ2ixPL7QCG8hw,5795
@@ -70,7 +70,7 @@ utilities/sqlalchemy.py,sha256=q2aYUDAC3SE88Lt6XaKa3CLzT_ePaWvQu_OuRk19x9g,35520
70
70
  utilities/sqlalchemy_polars.py,sha256=18AoEbeNJUKF3-5hroNy9J5LQwS_QJAXbMfKc9sChtk,14250
71
71
  utilities/statsmodels.py,sha256=koyiBHvpMcSiBfh99wFUfSggLNx7cuAw3rwyfAhoKpQ,3410
72
72
  utilities/string.py,sha256=MB0X6UPTUc06JdAdj-PctZ238IXeCjE5dAJibNw6ZrU,587
73
- utilities/tempfile.py,sha256=VqmZJAhTJ1OaVywFzk5eqROV8iJbW9XQ_QYAV0bpdRo,1384
73
+ utilities/tempfile.py,sha256=HxB2BF28CcecDJLQ3Bx2Ej-Pb6RJc6W9ngSpB9CnP4k,2018
74
74
  utilities/text.py,sha256=ymBFlP_cA8OgNnZRVNs7FAh7OG8HxE6YkiLEMZv5g_A,11297
75
75
  utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
76
76
  utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
@@ -89,8 +89,8 @@ utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
89
89
  utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
90
90
  utilities/pytest_plugins/pytest_randomly.py,sha256=NXzCcGKbpgYouz5yehKb4jmxmi2SexKKpgF4M65bi10,414
91
91
  utilities/pytest_plugins/pytest_regressions.py,sha256=Iwhfv_OJH7UCPZCfoh7ugZ2Xjqjil-BBBsOb8sDwiGI,1471
92
- dycw_utilities-0.149.6.dist-info/METADATA,sha256=-hselO-iXbPeAVN8eVXLCEGYaXTyXlqOCUvQeHobNu4,1697
93
- dycw_utilities-0.149.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
94
- dycw_utilities-0.149.6.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
95
- dycw_utilities-0.149.6.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
96
- dycw_utilities-0.149.6.dist-info/RECORD,,
92
+ dycw_utilities-0.149.7.dist-info/METADATA,sha256=y1Ql1n3c2o-8NqKPJIt4IC9Nb-pDG4fvGSmmn-S-U_o,1697
93
+ dycw_utilities-0.149.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
94
+ dycw_utilities-0.149.7.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
95
+ dycw_utilities-0.149.7.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
96
+ dycw_utilities-0.149.7.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.149.6"
3
+ __version__ = "0.149.7"
utilities/tempfile.py CHANGED
@@ -1,9 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import tempfile
3
4
  from pathlib import Path
4
- from tempfile import TemporaryDirectory as _TemporaryDirectory
5
5
  from tempfile import gettempdir as _gettempdir
6
- from typing import TYPE_CHECKING
6
+ from typing import TYPE_CHECKING, override
7
+
8
+ from utilities.warnings import suppress_warnings
7
9
 
8
10
  if TYPE_CHECKING:
9
11
  from types import TracebackType
@@ -21,13 +23,15 @@ class TemporaryDirectory:
21
23
  prefix: str | None = None,
22
24
  dir: PathLike | None = None, # noqa: A002
23
25
  ignore_cleanup_errors: bool = False,
26
+ delete: bool = True,
24
27
  ) -> None:
25
28
  super().__init__()
26
- self._temp_dir = _TemporaryDirectory(
29
+ self._temp_dir = _TemporaryDirectoryNoResourceWarning(
27
30
  suffix=suffix,
28
31
  prefix=prefix,
29
32
  dir=dir,
30
33
  ignore_cleanup_errors=ignore_cleanup_errors,
34
+ delete=delete,
31
35
  )
32
36
  self.path = Path(self._temp_dir.name)
33
37
 
@@ -43,6 +47,25 @@ class TemporaryDirectory:
43
47
  self._temp_dir.__exit__(exc, val, tb)
44
48
 
45
49
 
50
+ class _TemporaryDirectoryNoResourceWarning(tempfile.TemporaryDirectory):
51
+ @classmethod
52
+ @override
53
+ def _cleanup( # pyright: ignore[reportGeneralTypeIssues]
54
+ cls,
55
+ name: str,
56
+ warn_message: str,
57
+ ignore_errors: bool = False,
58
+ delete: bool = True,
59
+ ) -> None:
60
+ with suppress_warnings(category=ResourceWarning):
61
+ return super()._cleanup( # pyright: ignore[reportAttributeAccessIssue]
62
+ name, warn_message, ignore_errors=ignore_errors, delete=delete
63
+ )
64
+
65
+
66
+ ##
67
+
68
+
46
69
  def gettempdir() -> Path:
47
70
  """Get the name of the directory used for temporary files."""
48
71
  return Path(_gettempdir())