dycw-utilities 0.162.4__py3-none-any.whl → 0.162.5__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,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.162.4
3
+ Version: 0.162.5
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
7
7
  Requires-Dist: atomicwrites<1.5,>=1.4.1
8
8
  Requires-Dist: typing-extensions<4.15,>=4.14.0
9
9
  Requires-Dist: tzlocal<5.4,>=5.3.1
10
- Requires-Dist: whenever<0.9,>=0.8.7
10
+ Requires-Dist: whenever<0.9,>=0.8.8
11
11
  Provides-Extra: logging
12
12
  Requires-Dist: coloredlogs<15.1,>=15.0.1; extra == 'logging'
13
13
  Provides-Extra: test
@@ -25,6 +25,7 @@ Requires-Dist: pytest-rng<1.1,>=1.0.0; extra == 'test'
25
25
  Requires-Dist: pytest-timeout<2.5,>=2.4.0; extra == 'test'
26
26
  Requires-Dist: pytest-xdist<3.9,>=3.8.0; extra == 'test'
27
27
  Requires-Dist: pytest<8.5,>=8.4.1; extra == 'test'
28
+ Requires-Dist: testbook<0.5,>=0.4.2; extra == 'test'
28
29
  Description-Content-Type: text/markdown
29
30
 
30
31
  [![PyPI version](https://badge.fury.io/py/dycw-utilities.svg)](https://badge.fury.io/py/dycw-utilities)
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=o6nUgPOHpIQS5SGb2XacqWt_oRNjojYulv7Rb46uZ2o,60
1
+ utilities/__init__.py,sha256=jl4cIqGO8g8C1ZH4-qgjMre-gDVM9BArkr0mK4k-V8s,60
2
2
  utilities/aeventkit.py,sha256=ddoleSwW9zdc2tjX5Ge0pMKtYwV_JMxhHYOxnWX2AGM,12609
3
3
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
4
4
  utilities/asyncio.py,sha256=PUedzQ5deqlSECQ33sam9cRzI9TnygHz3FdOqWJWPTM,15288
@@ -22,7 +22,7 @@ utilities/getpass.py,sha256=DfN5UgMAtFCqS3dSfFHUfqIMZX2shXvwphOz_6J6f6A,103
22
22
  utilities/gzip.py,sha256=fkGP3KdsBfXlstodT4wtlp-PwNyUsogpbDCVVVGdsm4,781
23
23
  utilities/hashlib.py,sha256=SVTgtguur0P4elppvzOBbLEjVM3Pea0eWB61yg2ilxo,309
24
24
  utilities/http.py,sha256=TsavEfHlRtlLaeV21Z6KZh0qbPw-kvD1zsQdZ7Kep5Q,977
25
- utilities/hypothesis.py,sha256=1cy8YDOhoMzhwZ1a3mq25oeYsJQmryR_ZULJBMvE6K8,44738
25
+ utilities/hypothesis.py,sha256=1_rYNFUAkqRhZUrMM4h_eoRv1_ZCtyD6R87SeJbZpOQ,44758
26
26
  utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
27
27
  utilities/inflect.py,sha256=v7YkOWSu8NAmVghPcf4F3YBZQoJCS47_DLf9jbfWIs0,581
28
28
  utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
@@ -69,6 +69,7 @@ utilities/sqlalchemy_polars.py,sha256=JCGhB37raSR7fqeWV5dTsciRTMVzIdVT9YSqKT0piT
69
69
  utilities/statsmodels.py,sha256=koyiBHvpMcSiBfh99wFUfSggLNx7cuAw3rwyfAhoKpQ,3410
70
70
  utilities/string.py,sha256=shmBK87zZwzGyixuNuXCiUbqzfeZ9xlrFwz6JTaRvDk,582
71
71
  utilities/tempfile.py,sha256=HxB2BF28CcecDJLQ3Bx2Ej-Pb6RJc6W9ngSpB9CnP4k,2018
72
+ utilities/testbook.py,sha256=iseyoMwMuV3h-9Xg_WCZ65o98dEbGT5pNtCe96eJHq4,1201
72
73
  utilities/text.py,sha256=uwCDgpEunYruyh6sKMfNWK3Rp5H3ndpKRAkq86CBNys,13043
73
74
  utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
74
75
  utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
@@ -87,8 +88,8 @@ utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
87
88
  utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
88
89
  utilities/pytest_plugins/pytest_randomly.py,sha256=B1qYVlExGOxTywq2r1SMi5o7btHLk2PNdY_b1p98dkE,409
89
90
  utilities/pytest_plugins/pytest_regressions.py,sha256=9v8kAXDM2ycIXJBimoiF4EgrwbUvxTycFWJiGR_GHhM,1466
90
- dycw_utilities-0.162.4.dist-info/METADATA,sha256=IKECWa-zL_Rt2lFuNserGqVQ2QgXJh83tkoYOz5MEDM,1643
91
- dycw_utilities-0.162.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
92
- dycw_utilities-0.162.4.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
93
- dycw_utilities-0.162.4.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
94
- dycw_utilities-0.162.4.dist-info/RECORD,,
91
+ dycw_utilities-0.162.5.dist-info/METADATA,sha256=IVwIU9rQxFZIJfZvOPRwW2yV--KE-OM4Bkswz3lkYA0,1696
92
+ dycw_utilities-0.162.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ dycw_utilities-0.162.5.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
+ dycw_utilities-0.162.5.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.162.5.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.162.4"
3
+ __version__ = "0.162.5"
utilities/hypothesis.py CHANGED
@@ -1483,7 +1483,7 @@ def year_months(
1483
1483
  def zone_infos(draw: DrawFn, /) -> ZoneInfo:
1484
1484
  """Strategy for generating time-zones."""
1485
1485
  time_zone = draw(timezones())
1486
- if IS_LINUX:
1486
+ if IS_LINUX: # skipif-not-linux
1487
1487
  _ = assume(time_zone.key not in {"Etc/UTC", "localtime"})
1488
1488
  with assume_does_not_raise(TimeZoneNotFoundError):
1489
1489
  _ = get_now(time_zone)
utilities/testbook.py ADDED
@@ -0,0 +1,46 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from typing import TYPE_CHECKING, Any
5
+
6
+ from testbook import testbook
7
+
8
+ from utilities.pytest import throttle
9
+
10
+ if TYPE_CHECKING:
11
+ from collections.abc import Callable
12
+
13
+ from utilities.types import Delta, PathLike
14
+
15
+
16
+ def build_notebook_tester(
17
+ path: PathLike, /, *, throttle: Delta | None = None, on_try: bool = False
18
+ ) -> object:
19
+ """Build the notebook test class."""
20
+ name = f"Test{Path(path).stem}"
21
+ notebooks = [
22
+ path_i
23
+ for path_i in Path(path).rglob("**/*.ipynb")
24
+ if all(p != ".ipynb_checkpoints" for p in path_i.parts)
25
+ ]
26
+ namespace = {
27
+ f"test_{p.stem}": _build_test_method(p, delta=throttle, on_try=on_try)
28
+ for p in notebooks
29
+ }
30
+ return type(name, (), namespace)
31
+
32
+
33
+ def _build_test_method(
34
+ path: Path, /, *, delta: Delta | None = None, on_try: bool = False
35
+ ) -> Callable[..., Any]:
36
+ def method(self: Any, tb: Any) -> None:
37
+ _ = (self, tb) # pragma: no cover
38
+
39
+ if delta is not None:
40
+ method = throttle(delta=delta, on_try=on_try)(method)
41
+
42
+ tbook = testbook(path, execute=True)
43
+ return tbook(method)
44
+
45
+
46
+ __all__ = ["build_notebook_tester"]