dycw-utilities 0.138.13__py3-none-any.whl → 0.138.14__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.138.13
3
+ Version: 0.138.14
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=H_o_NgK-Ik1btEjTSpGwNncTNEm929ZR7pKgfRuqfHU,61
1
+ utilities/__init__.py,sha256=cONkI_IFNfSqcsGihpBZx7cXfo2yNGxHqPOWbR64rSs,61
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
@@ -85,11 +85,11 @@ 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=z2x79yEElAEaQ3roWC8LFl-rwFuv4WgcFiGQoAbSVJA,22004
88
+ utilities/whenever.py,sha256=WicmnXSFuZ64kemfULZGcV8Pt8-h6VBHJcObMHugSEo,22760
89
89
  utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
90
90
  utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
91
- dycw_utilities-0.138.13.dist-info/METADATA,sha256=XM3QnEEq6J7ZY99VLuNV6kqaRrfGabIAkgoD9eh1mUw,1639
92
- dycw_utilities-0.138.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- dycw_utilities-0.138.13.dist-info/entry_points.txt,sha256=uLj5QWWVXv8tnMaRX3ZGYpt7w1xzLWU6LxbFhELEpkc,68
94
- dycw_utilities-0.138.13.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.138.13.dist-info/RECORD,,
91
+ dycw_utilities-0.138.14.dist-info/METADATA,sha256=mFTnGB2iv53YtekLXrv-Zc1Zh1HVuwHpU9ZHrd30YXE,1639
92
+ dycw_utilities-0.138.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ dycw_utilities-0.138.14.dist-info/entry_points.txt,sha256=uLj5QWWVXv8tnMaRX3ZGYpt7w1xzLWU6LxbFhELEpkc,68
94
+ dycw_utilities-0.138.14.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.138.14.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.138.13"
3
+ __version__ = "0.138.14"
utilities/whenever.py CHANGED
@@ -155,6 +155,34 @@ def datetime_utc(
155
155
  ##
156
156
 
157
157
 
158
+ @overload
159
+ def diff_year_month(
160
+ x: YearMonth, y: YearMonth, /, *, years: Literal[True]
161
+ ) -> tuple[int, int]: ...
162
+ @overload
163
+ def diff_year_month(
164
+ x: YearMonth, y: YearMonth, /, *, years: Literal[False] = False
165
+ ) -> int: ...
166
+ @overload
167
+ def diff_year_month(
168
+ x: YearMonth, y: YearMonth, /, *, years: bool = False
169
+ ) -> int | tuple[int, int]: ...
170
+ def diff_year_month(
171
+ x: YearMonth, y: YearMonth, /, *, years: bool = False
172
+ ) -> int | tuple[int, int]:
173
+ """Compute the difference between two year-months."""
174
+ x_date, y_date = x.on_day(1), y.on_day(1)
175
+ diff = x_date - y_date
176
+ if years:
177
+ yrs, mth, _ = diff.in_years_months_days()
178
+ return yrs, mth
179
+ mth, _ = diff.in_months_days()
180
+ return mth
181
+
182
+
183
+ ##
184
+
185
+
158
186
  def format_compact(
159
187
  obj: Date | Time | PlainDateTime | ZonedDateTime, /, *, fmt: str | None = None
160
188
  ) -> str:
@@ -826,6 +854,7 @@ __all__ = [
826
854
  "ToPyTimeDeltaError",
827
855
  "WheneverLogRecord",
828
856
  "datetime_utc",
857
+ "diff_year_month",
829
858
  "format_compact",
830
859
  "from_timestamp",
831
860
  "from_timestamp_millis",