dycw-utilities 0.125.0__py3-none-any.whl → 0.125.2__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,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.125.0
3
+ Version: 0.125.2
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
7
7
  Requires-Dist: typing-extensions<4.14,>=4.13.1
8
8
  Provides-Extra: test
9
- Requires-Dist: hypothesis<6.132,>=6.131.24; extra == 'test'
9
+ Requires-Dist: hypothesis<6.132,>=6.131.27; extra == 'test'
10
10
  Requires-Dist: pytest-asyncio<0.27,>=0.26.0; extra == 'test'
11
11
  Requires-Dist: pytest-cov<6.2,>=6.1.1; extra == 'test'
12
12
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
@@ -78,7 +78,7 @@ Provides-Extra: zzz-test-hypothesis
78
78
  Requires-Dist: aiosqlite<0.22,>=0.21.0; extra == 'zzz-test-hypothesis'
79
79
  Requires-Dist: asyncpg<0.31,>=0.30.0; extra == 'zzz-test-hypothesis'
80
80
  Requires-Dist: greenlet<3.3,>=3.2.0; extra == 'zzz-test-hypothesis'
81
- Requires-Dist: hypothesis<6.132,>=6.131.24; extra == 'zzz-test-hypothesis'
81
+ Requires-Dist: hypothesis<6.132,>=6.131.27; extra == 'zzz-test-hypothesis'
82
82
  Requires-Dist: luigi<3.7,>=3.6.0; extra == 'zzz-test-hypothesis'
83
83
  Requires-Dist: numpy<2.3,>=2.2.6; extra == 'zzz-test-hypothesis'
84
84
  Requires-Dist: pathvalidate<3.3,>=3.2.3; extra == 'zzz-test-hypothesis'
@@ -144,7 +144,7 @@ Requires-Dist: atomicwrites<1.5,>=1.4.1; extra == 'zzz-test-pydantic'
144
144
  Requires-Dist: pydantic<2.12,>=2.11.4; extra == 'zzz-test-pydantic'
145
145
  Provides-Extra: zzz-test-pyinstrument
146
146
  Requires-Dist: atomicwrites<1.5,>=1.4.1; extra == 'zzz-test-pyinstrument'
147
- Requires-Dist: pyinstrument<5.1,>=5.0.0; extra == 'zzz-test-pyinstrument'
147
+ Requires-Dist: pyinstrument<5.1,>=5.0.2; extra == 'zzz-test-pyinstrument'
148
148
  Requires-Dist: tzlocal<5.4,>=5.3.1; extra == 'zzz-test-pyinstrument'
149
149
  Provides-Extra: zzz-test-pyrsistent
150
150
  Requires-Dist: pyrsistent<0.21,>=0.20.0; extra == 'zzz-test-pyrsistent'
@@ -1,6 +1,6 @@
1
- utilities/__init__.py,sha256=QGDJ0f72zDhkWMU5d6JojuaUWYcF1Z-mqiuQN6pmnBo,60
1
+ utilities/__init__.py,sha256=7x7l5p4UMSL99Ss01VIGeMRAm8Ye9uEgOEkCcsohyRs,60
2
2
  utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
3
- utilities/asyncio.py,sha256=joGmwv-WiDLYoK4q41TtVgfIT23s8Ok46jT_yEQGjaM,28240
3
+ utilities/asyncio.py,sha256=gr2eUx0E6LiCup6VKgUGwh8lAUriGdX2TlK-PZdlvfo,28284
4
4
  utilities/atomicwrites.py,sha256=geFjn9Pwn-tTrtoGjDDxWli9NqbYfy3gGL6ZBctiqSo,5393
5
5
  utilities/atools.py,sha256=IYMuFSFGSKyuQmqD6v5IUtDlz8PPw0Sr87Cub_gRU3M,1168
6
6
  utilities/cachetools.py,sha256=C1zqOg7BYz0IfQFK8e3qaDDgEZxDpo47F15RTfJM37Q,2910
@@ -24,7 +24,7 @@ utilities/git.py,sha256=wpt5dZ5Oi5931pN24_VLZYaQOvmR0OcQuVtgHzFUN1k,2359
24
24
  utilities/hashlib.py,sha256=SVTgtguur0P4elppvzOBbLEjVM3Pea0eWB61yg2ilxo,309
25
25
  utilities/http.py,sha256=WcahTcKYRtZ04WXQoWt5EGCgFPcyHD3EJdlMfxvDt-0,946
26
26
  utilities/hypothesis.py,sha256=a75izXg9aCBhhDkj_ZgK3TDzlzk38evP8TO7JbYYQvg,46264
27
- utilities/importlib.py,sha256=ueY3R39hWrUtrVXs39utM2xDig-eyJfYn1FBVxWb3_w,368
27
+ utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
28
28
  utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
29
29
  utilities/iterables.py,sha256=prKXBdF5QfLTGC-q4567DwO8xzUng_Z-2a4wBkMqyDo,45360
30
30
  utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
@@ -87,7 +87,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
87
87
  utilities/whenever.py,sha256=jS31ZAY5OMxFxLja_Yo5Fidi87Pd-GoVZ7Vi_teqVDA,16743
88
88
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
89
89
  utilities/zoneinfo.py,sha256=-5j7IQ9nb7gR43rdgA7ms05im-XuqhAk9EJnQBXxCoQ,1874
90
- dycw_utilities-0.125.0.dist-info/METADATA,sha256=539k9z6K4GTl6bfPw8x0gEN_tWp0guvq15SQrIcaHjg,12852
91
- dycw_utilities-0.125.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
- dycw_utilities-0.125.0.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
93
- dycw_utilities-0.125.0.dist-info/RECORD,,
90
+ dycw_utilities-0.125.2.dist-info/METADATA,sha256=THq9zaven45RgPNzFE1TPKNJs-tvrIDGiPmekj1FdRM,12852
91
+ dycw_utilities-0.125.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
+ dycw_utilities-0.125.2.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
93
+ dycw_utilities-0.125.2.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.125.0"
3
+ __version__ = "0.125.2"
utilities/asyncio.py CHANGED
@@ -624,11 +624,12 @@ class InfiniteQueueLooper(InfiniteLooper[THashable], Generic[THashable, _T]):
624
624
  """Put items into the queue at the end without blocking."""
625
625
  self._queue.put_right_nowait(*items) # pragma: no cover
626
626
 
627
- async def run_until_empty(self) -> None:
627
+ async def run_until_empty(self, *, stop: bool = False) -> None:
628
628
  """Run until the queue is empty."""
629
629
  while not self.empty():
630
630
  await self._process_queue()
631
- await self.stop()
631
+ if stop:
632
+ await self.stop()
632
633
 
633
634
 
634
635
  ##
utilities/importlib.py CHANGED
@@ -4,11 +4,13 @@ from importlib import import_module
4
4
  from importlib.util import find_spec
5
5
 
6
6
 
7
- def is_valid_import(module: str, name: str) -> bool:
7
+ def is_valid_import(module: str, /, *, name: str | None = None) -> bool:
8
8
  """Check if an import is valid."""
9
9
  spec = find_spec(module)
10
10
  if spec is None:
11
11
  return False
12
+ if name is None:
13
+ return True
12
14
  mod = import_module(module)
13
15
  return hasattr(mod, name)
14
16