dycw-utilities 0.131.6__py3-none-any.whl → 0.131.7__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.131.6.dist-info → dycw_utilities-0.131.7.dist-info}/METADATA +1 -1
- {dycw_utilities-0.131.6.dist-info → dycw_utilities-0.131.7.dist-info}/RECORD +6 -6
- utilities/__init__.py +1 -1
- utilities/hypothesis.py +89 -15
- {dycw_utilities-0.131.6.dist-info → dycw_utilities-0.131.7.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.131.6.dist-info → dycw_utilities-0.131.7.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=8vYsYB_QS775vHWdWRbA5PoQsxv9xMVXwDnzye5-mJc,60
|
2
2
|
utilities/aiolimiter.py,sha256=mD0wEiqMgwpty4XTbawFpnkkmJS6R4JRsVXFUaoitSU,628
|
3
3
|
utilities/altair.py,sha256=HeZBVUocjkrTNwwKrClppsIqgNFF-ykv05HfZSoHYno,9104
|
4
4
|
utilities/asyncio.py,sha256=lvdgBhuMtxq0dpiwF9g2WMMrit3kqXibN1V5NZ4xdbo,38046
|
@@ -24,7 +24,7 @@ utilities/getpass.py,sha256=DfN5UgMAtFCqS3dSfFHUfqIMZX2shXvwphOz_6J6f6A,103
|
|
24
24
|
utilities/git.py,sha256=oi7-_l5e9haSANSCvQw25ufYGoNahuUPHAZ6114s3JQ,1191
|
25
25
|
utilities/hashlib.py,sha256=SVTgtguur0P4elppvzOBbLEjVM3Pea0eWB61yg2ilxo,309
|
26
26
|
utilities/http.py,sha256=WcahTcKYRtZ04WXQoWt5EGCgFPcyHD3EJdlMfxvDt-0,946
|
27
|
-
utilities/hypothesis.py,sha256
|
27
|
+
utilities/hypothesis.py,sha256=-m9YWVgDkKdBfPkZHJ4-vCOGORVHqgtDhbXllfPrr7o,49873
|
28
28
|
utilities/importlib.py,sha256=mV1xT_O_zt_GnZZ36tl3xOmMaN_3jErDWY54fX39F6Y,429
|
29
29
|
utilities/inflect.py,sha256=DbqB5Q9FbRGJ1NbvEiZBirRMxCxgrz91zy5jCO9ZIs0,347
|
30
30
|
utilities/ipython.py,sha256=V2oMYHvEKvlNBzxDXdLvKi48oUq2SclRg5xasjaXStw,763
|
@@ -91,7 +91,7 @@ utilities/whenever.py,sha256=jS31ZAY5OMxFxLja_Yo5Fidi87Pd-GoVZ7Vi_teqVDA,16743
|
|
91
91
|
utilities/whenever2.py,sha256=XxiAEp4onJNhIi6G7L2HuzkMJZGA3j-I_fuXxmb5vtY,5432
|
92
92
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
93
93
|
utilities/zoneinfo.py,sha256=tvcgu3QzDxe2suTexi2QzRGpin7VK1TjHa0JYYxT69I,1862
|
94
|
-
dycw_utilities-0.131.
|
95
|
-
dycw_utilities-0.131.
|
96
|
-
dycw_utilities-0.131.
|
97
|
-
dycw_utilities-0.131.
|
94
|
+
dycw_utilities-0.131.7.dist-info/METADATA,sha256=LY97kj9T58_Fg3RF7GpooTy1HfTHyI0XV3PMZnOEw9E,1584
|
95
|
+
dycw_utilities-0.131.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
96
|
+
dycw_utilities-0.131.7.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
97
|
+
dycw_utilities-0.131.7.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/hypothesis.py
CHANGED
@@ -24,6 +24,7 @@ from typing import (
|
|
24
24
|
override,
|
25
25
|
)
|
26
26
|
|
27
|
+
import hypothesis.strategies
|
27
28
|
from hypothesis import HealthCheck, Phase, Verbosity, assume, settings
|
28
29
|
from hypothesis.errors import InvalidArgument
|
29
30
|
from hypothesis.strategies import (
|
@@ -47,7 +48,7 @@ from hypothesis.strategies import (
|
|
47
48
|
uuids,
|
48
49
|
)
|
49
50
|
from hypothesis.utils.conventions import not_set
|
50
|
-
from whenever import Date, DateDelta
|
51
|
+
from whenever import Date, DateDelta, PlainDateTime, Time, TimeDelta
|
51
52
|
|
52
53
|
from utilities.datetime import (
|
53
54
|
DATETIME_MAX_NAIVE,
|
@@ -89,6 +90,20 @@ from utilities.platform import IS_WINDOWS
|
|
89
90
|
from utilities.sentinel import Sentinel, sentinel
|
90
91
|
from utilities.tempfile import TEMP_DIR, TemporaryDirectory
|
91
92
|
from utilities.version import Version
|
93
|
+
from utilities.whenever2 import (
|
94
|
+
DATE_DELTA_MAX,
|
95
|
+
DATE_DELTA_MIN,
|
96
|
+
DATE_DELTA_PARSABLE_MAX,
|
97
|
+
DATE_DELTA_PARSABLE_MIN,
|
98
|
+
DATE_MAX,
|
99
|
+
DATE_MIN,
|
100
|
+
PLAIN_DATE_TIME_MAX,
|
101
|
+
PLAIN_DATE_TIME_MIN,
|
102
|
+
TIME_DELTA_MAX,
|
103
|
+
TIME_DELTA_MIN,
|
104
|
+
TIME_MAX,
|
105
|
+
TIME_MIN,
|
106
|
+
)
|
92
107
|
from utilities.zoneinfo import UTC, ensure_time_zone
|
93
108
|
|
94
109
|
if TYPE_CHECKING:
|
@@ -97,7 +112,7 @@ if TYPE_CHECKING:
|
|
97
112
|
|
98
113
|
from hypothesis.database import ExampleDatabase
|
99
114
|
from numpy.random import RandomState
|
100
|
-
from whenever import
|
115
|
+
from whenever import ZonedDateTime
|
101
116
|
|
102
117
|
from utilities.numpy import NDArrayB, NDArrayF, NDArrayI, NDArrayO
|
103
118
|
from utilities.types import Duration, Number, RoundMode, TimeZoneLike
|
@@ -170,13 +185,6 @@ def date_deltas_whenever(
|
|
170
185
|
parsable: MaybeSearchStrategy[bool] = False,
|
171
186
|
) -> DateDelta:
|
172
187
|
"""Strategy for generating date deltas."""
|
173
|
-
from utilities.whenever2 import (
|
174
|
-
DATE_DELTA_MAX,
|
175
|
-
DATE_DELTA_MIN,
|
176
|
-
DATE_DELTA_PARSABLE_MAX,
|
177
|
-
DATE_DELTA_PARSABLE_MIN,
|
178
|
-
)
|
179
|
-
|
180
188
|
min_value_, max_value_ = [draw2(draw, v) for v in [min_value, max_value]]
|
181
189
|
match min_value_:
|
182
190
|
case None:
|
@@ -307,8 +315,6 @@ def dates_whenever(
|
|
307
315
|
max_value: MaybeSearchStrategy[Date | None] = None,
|
308
316
|
) -> Date:
|
309
317
|
"""Strategy for generating dates."""
|
310
|
-
from utilities.whenever2 import DATE_MAX, DATE_MIN
|
311
|
-
|
312
318
|
min_value_, max_value_ = [draw2(draw, v) for v in [min_value, max_value]]
|
313
319
|
match min_value_:
|
314
320
|
case None:
|
@@ -1069,10 +1075,6 @@ def plain_datetimes_whenever(
|
|
1069
1075
|
max_value: MaybeSearchStrategy[PlainDateTime | None] = None,
|
1070
1076
|
) -> PlainDateTime:
|
1071
1077
|
"""Strategy for generating plain datetimes."""
|
1072
|
-
from whenever import PlainDateTime
|
1073
|
-
|
1074
|
-
from utilities.whenever2 import PLAIN_DATE_TIME_MAX, PLAIN_DATE_TIME_MIN
|
1075
|
-
|
1076
1078
|
min_value_, max_value_ = [draw2(draw, v) for v in [min_value, max_value]]
|
1077
1079
|
match min_value_:
|
1078
1080
|
case None:
|
@@ -1405,6 +1407,41 @@ def text_printable(
|
|
1405
1407
|
##
|
1406
1408
|
|
1407
1409
|
|
1410
|
+
@composite
|
1411
|
+
def time_deltas_whenever(
|
1412
|
+
draw: DrawFn,
|
1413
|
+
/,
|
1414
|
+
*,
|
1415
|
+
min_value: MaybeSearchStrategy[TimeDelta | None] = None,
|
1416
|
+
max_value: MaybeSearchStrategy[TimeDelta | None] = None,
|
1417
|
+
) -> TimeDelta:
|
1418
|
+
"""Strategy for generating time deltas."""
|
1419
|
+
min_value_, max_value_ = [draw2(draw, v) for v in [min_value, max_value]]
|
1420
|
+
match min_value_:
|
1421
|
+
case None:
|
1422
|
+
min_value_ = TIME_DELTA_MIN
|
1423
|
+
case TimeDelta():
|
1424
|
+
...
|
1425
|
+
case _ as never:
|
1426
|
+
assert_never(never)
|
1427
|
+
match max_value_:
|
1428
|
+
case None:
|
1429
|
+
max_value_ = TIME_DELTA_MAX
|
1430
|
+
case TimeDelta():
|
1431
|
+
...
|
1432
|
+
case _ as never:
|
1433
|
+
assert_never(never)
|
1434
|
+
py_time = draw(
|
1435
|
+
hypothesis.strategies.timedeltas(
|
1436
|
+
min_value=min_value_.py_timedelta(), max_value=max_value_.py_timedelta()
|
1437
|
+
)
|
1438
|
+
)
|
1439
|
+
return TimeDelta.from_py_timedelta(py_time)
|
1440
|
+
|
1441
|
+
|
1442
|
+
##
|
1443
|
+
|
1444
|
+
|
1408
1445
|
@composite
|
1409
1446
|
def timedeltas_2w(
|
1410
1447
|
draw: DrawFn,
|
@@ -1431,6 +1468,41 @@ def timedeltas_2w(
|
|
1431
1468
|
##
|
1432
1469
|
|
1433
1470
|
|
1471
|
+
@composite
|
1472
|
+
def times_whenever(
|
1473
|
+
draw: DrawFn,
|
1474
|
+
/,
|
1475
|
+
*,
|
1476
|
+
min_value: MaybeSearchStrategy[Time | None] = None,
|
1477
|
+
max_value: MaybeSearchStrategy[Time | None] = None,
|
1478
|
+
) -> Time:
|
1479
|
+
"""Strategy for generating times."""
|
1480
|
+
min_value_, max_value_ = [draw2(draw, v) for v in [min_value, max_value]]
|
1481
|
+
match min_value_:
|
1482
|
+
case None:
|
1483
|
+
min_value_ = TIME_MIN
|
1484
|
+
case Time():
|
1485
|
+
...
|
1486
|
+
case _ as never:
|
1487
|
+
assert_never(never)
|
1488
|
+
match max_value_:
|
1489
|
+
case None:
|
1490
|
+
max_value_ = TIME_MAX
|
1491
|
+
case Time():
|
1492
|
+
...
|
1493
|
+
case _ as never:
|
1494
|
+
assert_never(never)
|
1495
|
+
py_time = draw(
|
1496
|
+
hypothesis.strategies.times(
|
1497
|
+
min_value=min_value_.py_time(), max_value=max_value_.py_time()
|
1498
|
+
)
|
1499
|
+
)
|
1500
|
+
return Time.from_py_time(py_time)
|
1501
|
+
|
1502
|
+
|
1503
|
+
##
|
1504
|
+
|
1505
|
+
|
1434
1506
|
def triples(
|
1435
1507
|
strategy: SearchStrategy[_T],
|
1436
1508
|
/,
|
@@ -1651,7 +1723,9 @@ __all__ = [
|
|
1651
1723
|
"text_clean",
|
1652
1724
|
"text_digits",
|
1653
1725
|
"text_printable",
|
1726
|
+
"time_deltas_whenever",
|
1654
1727
|
"timedeltas_2w",
|
1728
|
+
"times_whenever",
|
1655
1729
|
"triples",
|
1656
1730
|
"uint32s",
|
1657
1731
|
"uint64s",
|
File without changes
|
File without changes
|