dycw-utilities 0.157.0__py3-none-any.whl → 0.157.1__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.157.0.dist-info → dycw_utilities-0.157.1.dist-info}/METADATA +1 -1
- {dycw_utilities-0.157.0.dist-info → dycw_utilities-0.157.1.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/eventkit.py +2 -5
- utilities/logging.py +4 -12
- {dycw_utilities-0.157.0.dist-info → dycw_utilities-0.157.1.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.157.0.dist-info → dycw_utilities-0.157.1.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.157.0.dist-info → dycw_utilities-0.157.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=aCEk399BQ2RGpGQ17jdGxjzeW08BgR-YI0pg_VvNlKM,60
|
2
2
|
utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
|
3
3
|
utilities/asyncio.py,sha256=PUedzQ5deqlSECQ33sam9cRzI9TnygHz3FdOqWJWPTM,15288
|
4
4
|
utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
|
@@ -13,7 +13,7 @@ utilities/cvxpy.py,sha256=Rv1-fD-XYerosCavRF8Pohop2DBkU3AlFaGTfD8AEAA,13776
|
|
13
13
|
utilities/dataclasses.py,sha256=MXrvIPSZHlpV4msRdVVDRZZo7MC3gX5C9jDUSoNOdpE,32478
|
14
14
|
utilities/enum.py,sha256=5l6pwZD1cjSlVW4ss-zBPspWvrbrYrdtJWcg6f5_J5w,5781
|
15
15
|
utilities/errors.py,sha256=mFlDGSM0LI1jZ1pbqwLAH3ttLZ2JVIxyZLojw8tGVZU,1479
|
16
|
-
utilities/eventkit.py,sha256=
|
16
|
+
utilities/eventkit.py,sha256=ddoleSwW9zdc2tjX5Ge0pMKtYwV_JMxhHYOxnWX2AGM,12609
|
17
17
|
utilities/fastapi.py,sha256=3wpd63Tw9paSyy7STpAD7GGe8fLkLaRC6TPCwIGm1BU,1361
|
18
18
|
utilities/fpdf2.py,sha256=HgM8JSvoioDXrjC0UR3HVLjnMnnb_mML7nL2EmkTwGI,1854
|
19
19
|
utilities/functions.py,sha256=RNVAoLeT_sl-gXaBv2VI_U_EB-d-nSVosYR4gTeeojE,28261
|
@@ -31,7 +31,7 @@ utilities/json.py,sha256=-WcGtSsCr9Y42wHZzAMnfvU6ihAfVftylFfRUORaDFo,2102
|
|
31
31
|
utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
|
32
32
|
utilities/libcst.py,sha256=TKgKN4bNmtBNEE-TUfhTyd1BrTncfsl_7tTuhpesGYY,5585
|
33
33
|
utilities/lightweight_charts.py,sha256=YM3ojBvJxuCSUBu_KrhFBmaMCvRPvupKC3qkm-UVZq4,2751
|
34
|
-
utilities/logging.py,sha256=
|
34
|
+
utilities/logging.py,sha256=ihbfQJgjc7t3Pds0oPvF_J1eigiqFKzxNOijzoee8U4,18064
|
35
35
|
utilities/math.py,sha256=7ve4RxX3g-FGGVnWV0K9bBeGnKUEjnTbH13VxdvFtGE,26847
|
36
36
|
utilities/memory_profiler.py,sha256=XzN56jDCa5aqXS_DxEjb_K4L6aIWh_5zyKi6OhcIxw0,853
|
37
37
|
utilities/modules.py,sha256=iuvLluJya-hvl1Q25-Jk3dLgx2Es3ck4SjJiEkAlVTs,3195
|
@@ -87,8 +87,8 @@ utilities/zoneinfo.py,sha256=FBMcUQ4662Aq8SsuCL1OAhDQiyANmVjtb-C30DRrWoE,1966
|
|
87
87
|
utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
88
88
|
utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
|
89
89
|
utilities/pytest_plugins/pytest_regressions.py,sha256=9v8kAXDM2ycIXJBimoiF4EgrwbUvxTycFWJiGR_GHhM,1466
|
90
|
-
dycw_utilities-0.157.
|
91
|
-
dycw_utilities-0.157.
|
92
|
-
dycw_utilities-0.157.
|
93
|
-
dycw_utilities-0.157.
|
94
|
-
dycw_utilities-0.157.
|
90
|
+
dycw_utilities-0.157.1.dist-info/METADATA,sha256=OvC7ucuMA0zBo4CHiaNRLyMYPjJgGjD7meIO_vUXdG4,1643
|
91
|
+
dycw_utilities-0.157.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
92
|
+
dycw_utilities-0.157.1.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
93
|
+
dycw_utilities-0.157.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.157.1.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/eventkit.py
CHANGED
@@ -48,7 +48,6 @@ def add_listener[E: Event, F: Callable](
|
|
48
48
|
error: Callable[[Event, BaseException], MaybeCoro[None]] | None = None,
|
49
49
|
ignore: TypeLike[BaseException] | None = None,
|
50
50
|
logger: LoggerLike | None = None,
|
51
|
-
logger_allow_pytest: bool = False,
|
52
51
|
decorators: MaybeIterable[Callable[[F], F]] | None = None,
|
53
52
|
done: Callable[..., MaybeCoro[None]] | None = None,
|
54
53
|
keep_ref: bool = False,
|
@@ -60,7 +59,6 @@ def add_listener[E: Event, F: Callable](
|
|
60
59
|
error=error,
|
61
60
|
ignore=ignore,
|
62
61
|
logger=logger,
|
63
|
-
logger_allow_pytest=logger_allow_pytest,
|
64
62
|
decorators=decorators,
|
65
63
|
)
|
66
64
|
return cast("E", event.connect(lifted, done=done, keep_ref=keep_ref))
|
@@ -286,7 +284,6 @@ def lift_listener[F1: Callable[..., MaybeCoro[None]], F2: Callable](
|
|
286
284
|
error: Callable[[Event, BaseException], MaybeCoro[None]] | None = None,
|
287
285
|
ignore: TypeLike[BaseException] | None = None,
|
288
286
|
logger: LoggerLike | None = None,
|
289
|
-
logger_allow_pytest: bool = False,
|
290
287
|
decorators: MaybeIterable[Callable[[F2], F2]] | None = None,
|
291
288
|
) -> F1:
|
292
289
|
match error, bool(iscoroutinefunction(listener)):
|
@@ -300,7 +297,7 @@ def lift_listener[F1: Callable[..., MaybeCoro[None]], F2: Callable](
|
|
300
297
|
except Exception as exc: # noqa: BLE001
|
301
298
|
if (ignore is not None) and isinstance(exc, ignore):
|
302
299
|
return
|
303
|
-
to_logger(logger
|
300
|
+
to_logger(logger).exception("")
|
304
301
|
|
305
302
|
lifted = listener_no_error_sync
|
306
303
|
|
@@ -314,7 +311,7 @@ def lift_listener[F1: Callable[..., MaybeCoro[None]], F2: Callable](
|
|
314
311
|
except Exception as exc: # noqa: BLE001
|
315
312
|
if (ignore is not None) and isinstance(exc, ignore):
|
316
313
|
return
|
317
|
-
to_logger(logger
|
314
|
+
to_logger(logger).exception("")
|
318
315
|
|
319
316
|
lifted = listener_no_error_async
|
320
317
|
case _, _:
|
utilities/logging.py
CHANGED
@@ -37,7 +37,6 @@ from utilities.atomicwrites import move_many
|
|
37
37
|
from utilities.dataclasses import replace_non_sentinel
|
38
38
|
from utilities.errors import ImpossibleCaseError
|
39
39
|
from utilities.iterables import OneEmptyError, always_iterable, one
|
40
|
-
from utilities.os import is_pytest
|
41
40
|
from utilities.pathlib import ensure_suffix, to_path
|
42
41
|
from utilities.re import (
|
43
42
|
ExtractGroupError,
|
@@ -96,7 +95,6 @@ def basic_config(
|
|
96
95
|
filters: MaybeIterable[_FilterType] | None = None,
|
97
96
|
plain: bool = False,
|
98
97
|
color_field_styles: Mapping[str, _FieldStyleKeys] | None = None,
|
99
|
-
allow_pytest: bool = False,
|
100
98
|
) -> None:
|
101
99
|
"""Do the basic config."""
|
102
100
|
match obj:
|
@@ -122,7 +120,7 @@ def basic_config(
|
|
122
120
|
)
|
123
121
|
case str() as name:
|
124
122
|
basic_config(
|
125
|
-
obj=to_logger(name
|
123
|
+
obj=to_logger(name),
|
126
124
|
format_=format_,
|
127
125
|
prefix=prefix,
|
128
126
|
hostname=hostname,
|
@@ -262,7 +260,6 @@ def setup_logging(
|
|
262
260
|
console_level: LogLevel = "INFO",
|
263
261
|
console_prefix: str = "❯", # noqa: RUF001
|
264
262
|
console_filters: MaybeIterable[_FilterType] | None = None,
|
265
|
-
allow_pytest: bool = False,
|
266
263
|
files_dir: MaybeCallablePathLike = Path.cwd,
|
267
264
|
files_max_bytes: int = _DEFAULT_MAX_BYTES,
|
268
265
|
files_when: _When = _DEFAULT_WHEN,
|
@@ -279,7 +276,7 @@ def setup_logging(
|
|
279
276
|
level=console_level,
|
280
277
|
filters=console_filters,
|
281
278
|
)
|
282
|
-
logger_use = to_logger(logger
|
279
|
+
logger_use = to_logger(logger)
|
283
280
|
name = logger_use.name
|
284
281
|
levels: list[LogLevel] = ["DEBUG", "INFO", "ERROR"]
|
285
282
|
for level in levels:
|
@@ -578,18 +575,13 @@ class _Rotation:
|
|
578
575
|
##
|
579
576
|
|
580
577
|
|
581
|
-
def to_logger(
|
582
|
-
logger: LoggerLike | None = None, /, *, allow_pytest: bool = False
|
583
|
-
) -> Logger:
|
578
|
+
def to_logger(logger: LoggerLike | None = None, /) -> Logger:
|
584
579
|
"""Convert to a logger."""
|
585
580
|
match logger:
|
586
581
|
case Logger():
|
587
582
|
return logger
|
588
583
|
case str() | None:
|
589
|
-
|
590
|
-
if not allow_pytest:
|
591
|
-
_ = logger.addFilter(lambda _: not is_pytest())
|
592
|
-
return logger
|
584
|
+
return getLogger(logger)
|
593
585
|
case never:
|
594
586
|
assert_never(never)
|
595
587
|
|
File without changes
|
File without changes
|
File without changes
|