dycw-utilities 0.129.14__py3-none-any.whl → 0.130.0__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.
utilities/redis.py CHANGED
@@ -53,7 +53,7 @@ if TYPE_CHECKING:
53
53
  from redis.typing import EncodableT, ResponseT
54
54
 
55
55
  from utilities.iterables import MaybeIterable
56
- from utilities.types import Duration, TypeLike
56
+ from utilities.types import Duration, MaybeType, TypeLike
57
57
 
58
58
 
59
59
  _K = TypeVar("_K")
@@ -90,7 +90,7 @@ class RedisHashMapKey(Generic[_K, _V]):
90
90
  value_serializer: Callable[[_V], bytes] | None = None
91
91
  value_deserializer: Callable[[bytes], _V] | None = None
92
92
  timeout: Duration | None = None
93
- error: type[Exception] = TimeoutError
93
+ error: MaybeType[BaseException] = TimeoutError
94
94
  ttl: Duration | None = None
95
95
 
96
96
  async def delete(self, redis: Redis, key: _K, /) -> int:
@@ -402,7 +402,7 @@ class RedisKey(Generic[_T]):
402
402
  serializer: Callable[[_T], bytes] | None = None
403
403
  deserializer: Callable[[bytes], _T] | None = None
404
404
  timeout: Duration | None = None
405
- error: type[Exception] = TimeoutError
405
+ error: MaybeType[BaseException] = TimeoutError
406
406
  ttl: Duration | None = None
407
407
 
408
408
  async def delete(self, redis: Redis, /) -> int:
utilities/sqlalchemy.py CHANGED
@@ -82,7 +82,13 @@ from utilities.iterables import (
82
82
  )
83
83
  from utilities.reprlib import get_repr
84
84
  from utilities.text import snake_case
85
- from utilities.types import Duration, MaybeIterable, StrMapping, TupleOrStrMapping
85
+ from utilities.types import (
86
+ Duration,
87
+ MaybeIterable,
88
+ MaybeType,
89
+ StrMapping,
90
+ TupleOrStrMapping,
91
+ )
86
92
 
87
93
  _T = TypeVar("_T")
88
94
  type _EngineOrConnectionOrAsync = Engine | Connection | AsyncEngine | AsyncConnection
@@ -830,7 +836,7 @@ async def yield_connection(
830
836
  /,
831
837
  *,
832
838
  timeout: Duration | None = None,
833
- error: type[Exception] = TimeoutError,
839
+ error: MaybeType[BaseException] = TimeoutError,
834
840
  ) -> AsyncIterator[AsyncConnection]:
835
841
  """Yield an async connection."""
836
842
  async with timeout_dur(duration=timeout, error=error), engine.begin() as conn:
@@ -68,7 +68,7 @@ if TYPE_CHECKING:
68
68
  from tenacity.wait import WaitBaseT
69
69
 
70
70
  import utilities.types
71
- from utilities.types import TimeZoneLike
71
+ from utilities.types import MaybeType, TimeZoneLike
72
72
 
73
73
 
74
74
  async def insert_dataframe(
@@ -303,7 +303,7 @@ async def select_to_dataframe(
303
303
  in_clauses_chunk_size: int | None = None,
304
304
  chunk_size_frac: float = CHUNK_SIZE_FRAC,
305
305
  timeout: utilities.types.Duration | None = None,
306
- error: type[Exception] = TimeoutError,
306
+ error: MaybeType[BaseException] = TimeoutError,
307
307
  **kwargs: Any,
308
308
  ) -> DataFrame | Iterable[DataFrame] | AsyncIterable[DataFrame]:
309
309
  """Read a table from a database into a DataFrame."""