dycw-utilities 0.126.7__py3-none-any.whl → 0.126.8__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.126.7
3
+ Version: 0.126.8
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,6 +1,6 @@
1
- utilities/__init__.py,sha256=k4Q-FdII9KXkuYXSZgXMDtdGhp9lcKoxpPtcuL_YIlQ,60
1
+ utilities/__init__.py,sha256=tHZcQi-F0lX9h4wRP-VlMPEMmYsRGBcE76oVT3fWO0Q,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.8.dist-info/METADATA,sha256=QTn45soIcSLhaix1ir-sRbOhQ1hhtCko6VPIC90HJwk,12849
95
+ dycw_utilities-0.126.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
96
+ dycw_utilities-0.126.8.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
97
+ dycw_utilities-0.126.8.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.8"
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."""