dycw-utilities 0.136.10__py3-none-any.whl → 0.137.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.136.10.dist-info → dycw_utilities-0.137.0.dist-info}/METADATA +1 -1
- {dycw_utilities-0.136.10.dist-info → dycw_utilities-0.137.0.dist-info}/RECORD +10 -10
- utilities/__init__.py +1 -1
- utilities/fpdf2.py +2 -2
- utilities/logging.py +8 -3
- utilities/pyinstrument.py +2 -2
- utilities/traceback.py +4 -3
- utilities/whenever.py +10 -1
- {dycw_utilities-0.136.10.dist-info → dycw_utilities-0.137.0.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.136.10.dist-info → dycw_utilities-0.137.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=PUxpzAWl2k1kpcIxVjuaCvi36fODyVik-8mExgNWSXk,60
|
2
2
|
utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
|
3
3
|
utilities/altair.py,sha256=HeZBVUocjkrTNwwKrClppsIqgNFF-ykv05HfZSoHYno,9104
|
4
4
|
utilities/asyncio.py,sha256=dcGeKQzjLBXxKzZkVIk5oZsFXEcynVbRB9iNB5XEDZk,38526
|
@@ -16,7 +16,7 @@ utilities/enum.py,sha256=IEPMGiNJBcofGPuoGZErf4bMNSBE4SLs32nvm2r81h0,5791
|
|
16
16
|
utilities/errors.py,sha256=nC7ZYtxxDBMfrTHtT_MByBfup_wfGQFRo3eDt-0ZPe8,1045
|
17
17
|
utilities/eventkit.py,sha256=cV76NIHKDPyrhnZRuhjCXse5CQqgRGXZ7p7Gon4Mu2g,12646
|
18
18
|
utilities/fastapi.py,sha256=E8T2J1-N_RbpkN4czthU6NPIxAZDzxy-k_WGJaxeJ48,2671
|
19
|
-
utilities/fpdf2.py,sha256=
|
19
|
+
utilities/fpdf2.py,sha256=776PkEX5xEK-whFOzqaVaQVHPy1Xf01kCSyj7TEp80g,1886
|
20
20
|
utilities/functions.py,sha256=qefAfW0zz7OEiRuBtKF-3tI3NaufcwAULRIFv24gZ2Q,28533
|
21
21
|
utilities/functools.py,sha256=I00ru2gQPakZw2SHVeKIKXfTv741655s6HI0lUoE0D4,1552
|
22
22
|
utilities/getpass.py,sha256=DfN5UgMAtFCqS3dSfFHUfqIMZX2shXvwphOz_6J6f6A,103
|
@@ -31,7 +31,7 @@ utilities/iterables.py,sha256=wlcm0PS2fKG-H0r0k367NOLrryMbfXLlwzUeAmBSvv8,43392
|
|
31
31
|
utilities/jupyter.py,sha256=ft5JA7fBxXKzP-L9W8f2-wbF0QeYc_2uLQNFDVk4Z-M,2917
|
32
32
|
utilities/libcst.py,sha256=XTT8cCYAYfI9ZIdxjiTCqbF45cN-viDNDa7GE5mR2T4,5615
|
33
33
|
utilities/lightweight_charts.py,sha256=JrkrAZMo6JID2Eoc9QCc05Y_pK4l2zsApIhmii1z2Ig,2764
|
34
|
-
utilities/logging.py,sha256=
|
34
|
+
utilities/logging.py,sha256=O2IApkDJQ1EqZHCvxp0YHrML7a8UuORtb66Hou_vPfw,17923
|
35
35
|
utilities/luigi.py,sha256=wK7cB3y8NXeSa8d6r_yTKRmjMguNmIPmy52yg10vPaI,4774
|
36
36
|
utilities/math.py,sha256=_6vrDyjtaqE_OFE-F2DNWrDG_J_kMl3nFAJsok9v_bY,26862
|
37
37
|
utilities/memory_profiler.py,sha256=XzN56jDCa5aqXS_DxEjb_K4L6aIWh_5zyKi6OhcIxw0,853
|
@@ -54,7 +54,7 @@ utilities/pqdm.py,sha256=BTsYPtbKQWwX-iXF4qCkfPG7DPxIB54J989n83bXrIo,3092
|
|
54
54
|
utilities/psutil.py,sha256=0j4YxtVb8VjaaKKiHg6UEK95SUPkEcENgPtLgPJsNv0,3760
|
55
55
|
utilities/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
56
|
utilities/pydantic.py,sha256=CmxCi4sukeHM3JGjJ1Rbp8UAvcx4MZapLg10mFYJ-nk,1771
|
57
|
-
utilities/pyinstrument.py,sha256=
|
57
|
+
utilities/pyinstrument.py,sha256=HrTGJ2niUAHUFMSN3im9BeedC0faq2DqoFccDxPpsP8,884
|
58
58
|
utilities/pytest.py,sha256=vv5ZpePZS6pBxl5jY3XQR5SnAhgd4f0sSMyRsvHWg60,8086
|
59
59
|
utilities/pytest_regressions.py,sha256=YI55B7EtLjhz7zPJZ6NK9bWrxrKCKabWZJe1cwcbA5o,5082
|
60
60
|
utilities/python_dotenv.py,sha256=dYooRYwqrvhSoZWuiVbCiKUWiS-M5b5yv2zDWGYPEvI,3209
|
@@ -76,7 +76,7 @@ utilities/tempfile.py,sha256=VqmZJAhTJ1OaVywFzk5eqROV8iJbW9XQ_QYAV0bpdRo,1384
|
|
76
76
|
utilities/text.py,sha256=ymBFlP_cA8OgNnZRVNs7FAh7OG8HxE6YkiLEMZv5g_A,11297
|
77
77
|
utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
78
78
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
79
|
-
utilities/traceback.py,sha256=
|
79
|
+
utilities/traceback.py,sha256=h9yt4C2XkGHXW9e9bz93IGluhIR_Qil8zu5dhC8DXY0,8884
|
80
80
|
utilities/typed_settings.py,sha256=cZqA2IjG1erF1SUZFSsjIHmZX7BP5iIfPd6CixHllA0,4367
|
81
81
|
utilities/types.py,sha256=98pwEfkBikg6UUrshNJZgc8l97FGBbi0twIsqVt-KNA,17247
|
82
82
|
utilities/typing.py,sha256=Z-_XDaWyT_6wIo3qfNK-hvRlzxP2Jxa9PgXzm5rDYRA,13790
|
@@ -85,10 +85,10 @@ utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
|
|
85
85
|
utilities/uuid.py,sha256=32p7DGHGM2Btx6PcBvCZvERSWbpupMXqx6FppPoSoTU,612
|
86
86
|
utilities/version.py,sha256=ufhJMmI6KPs1-3wBI71aj5wCukd3sP_m11usLe88DNA,5117
|
87
87
|
utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
88
|
-
utilities/whenever.py,sha256=
|
88
|
+
utilities/whenever.py,sha256=HdkS19yRIRfevH3kkDw1SJVVZbK3hgAXeb6ZFoUjh38,24094
|
89
89
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
90
90
|
utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
91
|
-
dycw_utilities-0.
|
92
|
-
dycw_utilities-0.
|
93
|
-
dycw_utilities-0.
|
94
|
-
dycw_utilities-0.
|
91
|
+
dycw_utilities-0.137.0.dist-info/METADATA,sha256=S6dRJeuw2HB30BzEpinRuxWt8SORnzlVVs62Dk_0vD4,1637
|
92
|
+
dycw_utilities-0.137.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.137.0.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.137.0.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/fpdf2.py
CHANGED
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, override
|
|
6
6
|
from fpdf import FPDF
|
7
7
|
from fpdf.enums import XPos, YPos
|
8
8
|
|
9
|
-
from utilities.whenever import format_compact,
|
9
|
+
from utilities.whenever import format_compact, get_now, to_local_plain
|
10
10
|
|
11
11
|
if TYPE_CHECKING:
|
12
12
|
from collections.abc import Iterator
|
@@ -47,7 +47,7 @@ def yield_pdf(*, header: str | None = None) -> Iterator[_BasePDF]:
|
|
47
47
|
def footer(self) -> None:
|
48
48
|
self.set_y(-15)
|
49
49
|
self.set_font(family="Helvetica", style="I", size=8)
|
50
|
-
page_no, now = (self.page_no(), format_compact(
|
50
|
+
page_no, now = (self.page_no(), format_compact(to_local_plain(get_now())))
|
51
51
|
text = f"page {page_no}/{{}}; {now}"
|
52
52
|
_ = self.cell(
|
53
53
|
w=0,
|
utilities/logging.py
CHANGED
@@ -45,7 +45,12 @@ from utilities.re import (
|
|
45
45
|
)
|
46
46
|
from utilities.sentinel import Sentinel, sentinel
|
47
47
|
from utilities.tzlocal import LOCAL_TIME_ZONE_NAME
|
48
|
-
from utilities.whenever import
|
48
|
+
from utilities.whenever import (
|
49
|
+
WheneverLogRecord,
|
50
|
+
format_compact,
|
51
|
+
get_now_local,
|
52
|
+
to_local_plain,
|
53
|
+
)
|
49
54
|
|
50
55
|
if TYPE_CHECKING:
|
51
56
|
from collections.abc import Callable, Iterable, Mapping
|
@@ -533,9 +538,9 @@ class _RotatingLogFile:
|
|
533
538
|
case int() as index, None, None:
|
534
539
|
tail = str(index)
|
535
540
|
case int() as index, None, ZonedDateTime() as end:
|
536
|
-
tail = f"{index}__{format_compact(end
|
541
|
+
tail = f"{index}__{format_compact(to_local_plain(end))}"
|
537
542
|
case int() as index, ZonedDateTime() as start, ZonedDateTime() as end:
|
538
|
-
tail = f"{index}__{format_compact(start
|
543
|
+
tail = f"{index}__{format_compact(to_local_plain(start))}__{format_compact(to_local_plain(end))}"
|
539
544
|
case _: # pragma: no cover
|
540
545
|
raise ImpossibleCaseError(
|
541
546
|
case=[f"{self.index=}", f"{self.start=}", f"{self.end=}"]
|
utilities/pyinstrument.py
CHANGED
@@ -8,7 +8,7 @@ from pyinstrument.profiler import Profiler
|
|
8
8
|
|
9
9
|
from utilities.atomicwrites import writer
|
10
10
|
from utilities.pathlib import get_path
|
11
|
-
from utilities.whenever import format_compact,
|
11
|
+
from utilities.whenever import format_compact, get_now, to_local_plain
|
12
12
|
|
13
13
|
if TYPE_CHECKING:
|
14
14
|
from collections.abc import Iterator
|
@@ -22,7 +22,7 @@ def profile(*, path: MaybeCallablePathLike | None = Path.cwd) -> Iterator[None]:
|
|
22
22
|
with Profiler() as profiler:
|
23
23
|
yield
|
24
24
|
filename = get_path(path=path).joinpath(
|
25
|
-
f"profile__{format_compact(
|
25
|
+
f"profile__{format_compact(to_local_plain(get_now()))}.html"
|
26
26
|
)
|
27
27
|
with writer(filename) as temp, temp.open(mode="w") as fh:
|
28
28
|
_ = fh.write(profiler.output_html())
|
utilities/traceback.py
CHANGED
@@ -31,6 +31,7 @@ from utilities.whenever import (
|
|
31
31
|
format_compact,
|
32
32
|
get_now,
|
33
33
|
get_now_local,
|
34
|
+
to_local_plain,
|
34
35
|
to_zoned_date_time,
|
35
36
|
)
|
36
37
|
|
@@ -96,8 +97,8 @@ def _yield_header_lines(
|
|
96
97
|
"""Yield the header lines."""
|
97
98
|
now = get_now_local()
|
98
99
|
start_use = to_zoned_date_time(date_time=start)
|
99
|
-
yield f"Date/time | {format_compact(now
|
100
|
-
start_str = "" if start_use is None else format_compact(start_use
|
100
|
+
yield f"Date/time | {format_compact(now)}"
|
101
|
+
start_str = "" if start_use is None else format_compact(start_use)
|
101
102
|
yield f"Started | {start_str}"
|
102
103
|
delta = None if start_use is None else (now - start_use)
|
103
104
|
delta_str = "" if delta is None else delta.format_common_iso()
|
@@ -256,7 +257,7 @@ def _make_except_hook_inner(
|
|
256
257
|
if path is not None:
|
257
258
|
path = (
|
258
259
|
get_path(path=path)
|
259
|
-
.joinpath(format_compact(
|
260
|
+
.joinpath(format_compact(to_local_plain(get_now())))
|
260
261
|
.with_suffix(".txt")
|
261
262
|
)
|
262
263
|
full = format_exception_stack(
|
utilities/whenever.py
CHANGED
@@ -33,7 +33,7 @@ from utilities.platform import get_strftime
|
|
33
33
|
from utilities.re import ExtractGroupsError, extract_groups
|
34
34
|
from utilities.sentinel import Sentinel, sentinel
|
35
35
|
from utilities.types import DateTimeRoundUnit, MaybeStr
|
36
|
-
from utilities.tzlocal import LOCAL_TIME_ZONE
|
36
|
+
from utilities.tzlocal import LOCAL_TIME_ZONE, LOCAL_TIME_ZONE_NAME
|
37
37
|
from utilities.zoneinfo import UTC, get_time_zone_name
|
38
38
|
|
39
39
|
if TYPE_CHECKING:
|
@@ -668,6 +668,14 @@ def to_date_time_delta(nanos: int, /) -> DateTimeDelta:
|
|
668
668
|
##
|
669
669
|
|
670
670
|
|
671
|
+
def to_local_plain(date_time: ZonedDateTime, /) -> PlainDateTime:
|
672
|
+
"""Convert a datetime to its local/plain variant."""
|
673
|
+
return date_time.to_tz(LOCAL_TIME_ZONE_NAME).to_plain()
|
674
|
+
|
675
|
+
|
676
|
+
##
|
677
|
+
|
678
|
+
|
671
679
|
def to_nanos(delta: DateTimeDelta, /) -> int:
|
672
680
|
"""Compute the number of nanoseconds in a date-time delta."""
|
673
681
|
months, days, _, _ = delta.in_months_days_secs_nanos()
|
@@ -901,6 +909,7 @@ __all__ = [
|
|
901
909
|
"to_date",
|
902
910
|
"to_date_time_delta",
|
903
911
|
"to_days",
|
912
|
+
"to_local_plain",
|
904
913
|
"to_nanos",
|
905
914
|
"to_zoned_date_time",
|
906
915
|
]
|
File without changes
|
File without changes
|