dycw-utilities 0.126.7__py3-none-any.whl → 0.126.9__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,17 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.126.7
3
+ Version: 0.126.9
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: dycw-pytest-only<2.2,>=2.1.1; extra == 'test'
9
10
  Requires-Dist: hypothesis<6.133,>=6.132.0; extra == 'test'
10
11
  Requires-Dist: pytest-asyncio<1.1,>=1.0.0; extra == 'test'
11
12
  Requires-Dist: pytest-cov<6.2,>=6.1.1; extra == 'test'
12
13
  Requires-Dist: pytest-instafail<0.6,>=0.5.0; extra == 'test'
13
14
  Requires-Dist: pytest-lazy-fixtures<1.2,>=1.1.4; extra == 'test'
14
- Requires-Dist: pytest-only<2.2,>=2.1.2; extra == 'test'
15
15
  Requires-Dist: pytest-randomly<3.17,>=3.16.0; extra == 'test'
16
16
  Requires-Dist: pytest-regressions<2.9,>=2.8.0; extra == 'test'
17
17
  Requires-Dist: pytest-rerunfailures<16,>=15.1; extra == 'test'
@@ -19,7 +19,6 @@ Requires-Dist: pytest-rng<1.1,>=1.0.0; extra == 'test'
19
19
  Requires-Dist: pytest-timeout<2.5,>=2.4.0; extra == 'test'
20
20
  Requires-Dist: pytest-xdist<3.8,>=3.7.0; extra == 'test'
21
21
  Requires-Dist: pytest<8.4,>=8.3.5; extra == 'test'
22
- Requires-Dist: setuptools>=78.0.2; extra == 'test'
23
22
  Provides-Extra: zzz-test-altair
24
23
  Requires-Dist: altair<5.6,>=5.5.0; extra == 'zzz-test-altair'
25
24
  Requires-Dist: atomicwrites<1.5,>=1.4.1; extra == 'zzz-test-altair'
@@ -174,7 +173,7 @@ Requires-Dist: scipy<1.16,>=1.15.3; extra == 'zzz-test-scipy'
174
173
  Provides-Extra: zzz-test-sentinel
175
174
  Provides-Extra: zzz-test-shelve
176
175
  Provides-Extra: zzz-test-slack-sdk
177
- Requires-Dist: aiohttp<3.12.7,>=3.12.6; extra == 'zzz-test-slack-sdk'
176
+ Requires-Dist: aiohttp<3.12.8,>=3.12.7; extra == 'zzz-test-slack-sdk'
178
177
  Requires-Dist: slack-sdk<3.36,>=3.35.0; extra == 'zzz-test-slack-sdk'
179
178
  Provides-Extra: zzz-test-socket
180
179
  Provides-Extra: zzz-test-sqlalchemy
@@ -1,6 +1,6 @@
1
- utilities/__init__.py,sha256=k4Q-FdII9KXkuYXSZgXMDtdGhp9lcKoxpPtcuL_YIlQ,60
1
+ utilities/__init__.py,sha256=aVKs1kn02xCyHOT2ZG3T7fvbEh9r8Eu-f2_9scWzbPI,60
2
2
  utilities/altair.py,sha256=Gpja-flOo-Db0PIPJLJsgzAlXWoKUjPU1qY-DQ829ek,9156
3
- utilities/asyncio.py,sha256=K5Kj7rsM0nA17-b7d7mrNgPR1U_NbkfQmTruq5LBLRA,51778
3
+ utilities/asyncio.py,sha256=phbGti22VSe9cu-SwM1vP8kyUg8AUDHvvciMvE6JnCg,51842
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
@@ -91,7 +91,7 @@ utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
91
91
  utilities/whenever.py,sha256=jS31ZAY5OMxFxLja_Yo5Fidi87Pd-GoVZ7Vi_teqVDA,16743
92
92
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
93
93
  utilities/zoneinfo.py,sha256=-5j7IQ9nb7gR43rdgA7ms05im-XuqhAk9EJnQBXxCoQ,1874
94
- dycw_utilities-0.126.7.dist-info/METADATA,sha256=YC7obEXSZCW1WxlqW0Ljgu2ZI8uM1kUwPPrrODeVHvk,12849
95
- dycw_utilities-0.126.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
96
- dycw_utilities-0.126.7.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
97
- dycw_utilities-0.126.7.dist-info/RECORD,,
94
+ dycw_utilities-0.126.9.dist-info/METADATA,sha256=kgxJx1OLQSkOqyenGUbtVzwcPfk8bt0raQsEypd5FsE,12803
95
+ dycw_utilities-0.126.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
96
+ dycw_utilities-0.126.9.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
97
+ dycw_utilities-0.126.9.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.126.7"
3
+ __version__ = "0.126.9"
utilities/asyncio.py CHANGED
@@ -754,12 +754,6 @@ class Looper(Generic[_T]):
754
754
  _ = self._debug and self._logger.debug(
755
755
  "%s: adding sub-looper %s", self, looper
756
756
  )
757
- if not looper.auto_start:
758
- self._logger.warning(
759
- "%s: changing sub-looper %s to auto-start...", self, looper
760
- )
761
- async with self._lock:
762
- looper.auto_start = True
763
757
  _ = await self._stack.enter_async_context(looper)
764
758
  if self.auto_start:
765
759
  _ = self._debug and self._logger.debug("%s: auto-starting...", self)
@@ -1034,39 +1028,46 @@ class Looper(Generic[_T]):
1034
1028
 
1035
1029
  async def run_looper(self) -> None:
1036
1030
  """Run the looper."""
1037
- async with timeout_dur(duration=self.timeout, error=self.timeout_error):
1038
- while True:
1039
- if self._is_stopped.is_set():
1040
- _ = self._debug and self._logger.debug("%s: stopped", self)
1041
- return
1042
- if (self._is_pending_stop.is_set()) or (
1043
- self._is_pending_stop_when_empty.is_set() and self.empty()
1044
- ):
1045
- await self.stop()
1046
- elif self._is_pending_restart.is_set():
1047
- await self.restart(sleep_if_failure=True)
1048
- elif not self._is_initialized.is_set():
1049
- _ = await self.initialize(sleep_if_failure=True)
1050
- else:
1051
- _ = self._debug and self._logger.debug("%s: running core...", self)
1052
- async with self._lock:
1053
- self._core_attempts += 1
1054
- try:
1055
- await self.core()
1056
- except Exception as error: # noqa: BLE001
1057
- _ = self._logger.warning(
1058
- "%s: encountered %s whilst running core...",
1059
- self,
1060
- repr_error(error),
1061
- )
1062
- async with self._lock:
1063
- self._core_failures += 1
1064
- self.request_restart()
1065
- await sleep(self._backoff)
1031
+ try:
1032
+ async with timeout_dur(duration=self.timeout, error=self.timeout_error):
1033
+ while True:
1034
+ if self._is_stopped.is_set():
1035
+ _ = self._debug and self._logger.debug("%s: stopped", self)
1036
+ return
1037
+ if (self._is_pending_stop.is_set()) or (
1038
+ self._is_pending_stop_when_empty.is_set() and self.empty()
1039
+ ):
1040
+ await self.stop()
1041
+ elif self._is_pending_restart.is_set():
1042
+ await self.restart(sleep_if_failure=True)
1043
+ elif not self._is_initialized.is_set():
1044
+ _ = await self.initialize(sleep_if_failure=True)
1066
1045
  else:
1046
+ _ = self._debug and self._logger.debug(
1047
+ "%s: running core...", self
1048
+ )
1067
1049
  async with self._lock:
1068
- self._core_successes += 1
1069
- await sleep(self._freq)
1050
+ self._core_attempts += 1
1051
+ try:
1052
+ await self.core()
1053
+ except Exception as error: # noqa: BLE001
1054
+ _ = self._logger.warning(
1055
+ "%s: encountered %s whilst running core...",
1056
+ self,
1057
+ repr_error(error),
1058
+ )
1059
+ async with self._lock:
1060
+ self._core_failures += 1
1061
+ self.request_restart()
1062
+ await sleep(self._backoff)
1063
+ else:
1064
+ async with self._lock:
1065
+ self._core_successes += 1
1066
+ await sleep(self._freq)
1067
+ except RuntimeError as error: # pragma: no cover
1068
+ if error.args[0] == "generator didn't stop after athrow()":
1069
+ return
1070
+ raise
1070
1071
 
1071
1072
  async def run_until_empty(self) -> None:
1072
1073
  """Run until the queue is empty."""