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.
- {dycw_utilities-0.129.14.dist-info → dycw_utilities-0.130.0.dist-info}/METADATA +26 -28
- {dycw_utilities-0.129.14.dist-info → dycw_utilities-0.130.0.dist-info}/RECORD +11 -13
- utilities/__init__.py +1 -1
- utilities/asyncio.py +9 -4
- utilities/logging.py +276 -498
- utilities/redis.py +3 -3
- utilities/sqlalchemy.py +8 -2
- utilities/sqlalchemy_polars.py +2 -2
- utilities/traceback.py +102 -901
- utilities/loguru.py +0 -144
- utilities/sys.py +0 -87
- {dycw_utilities-0.129.14.dist-info → dycw_utilities-0.130.0.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.129.14.dist-info → dycw_utilities-0.130.0.dist-info}/licenses/LICENSE +0 -0
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:
|
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:
|
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
|
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:
|
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:
|
utilities/sqlalchemy_polars.py
CHANGED
@@ -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:
|
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."""
|