dycw-utilities 0.161.0__py3-none-any.whl → 0.161.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.161.0.dist-info → dycw_utilities-0.161.1.dist-info}/METADATA +1 -1
- {dycw_utilities-0.161.0.dist-info → dycw_utilities-0.161.1.dist-info}/RECORD +10 -10
- utilities/__init__.py +1 -1
- utilities/hypothesis.py +18 -2
- utilities/types.py +6 -1
- utilities/whenever.py +13 -8
- utilities/zoneinfo.py +2 -2
- {dycw_utilities-0.161.0.dist-info → dycw_utilities-0.161.1.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.161.0.dist-info → dycw_utilities-0.161.1.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.161.0.dist-info → dycw_utilities-0.161.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=jY0RY-L8TPNjene684G3NClFiC50ebICzq4ZwFdaOpY,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
|
@@ -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=
|
25
|
+
utilities/hypothesis.py,sha256=irMs8oG5d0IlR9-D1Oz9CyAHwbzJL2k9BXIaSSfm2rE,44707
|
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
|
@@ -74,21 +74,21 @@ utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
|
74
74
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
75
75
|
utilities/traceback.py,sha256=1k5JgumSMaqAGLd0dZ36CtPS0EGaglxTr29r2Dz4D60,9457
|
76
76
|
utilities/typed_settings.py,sha256=SFWqS3lAzV7IfNRwqFcTk0YynTcQ7BmrcW2mr_KUnos,4466
|
77
|
-
utilities/types.py,sha256=
|
77
|
+
utilities/types.py,sha256=oeH-hEC3-67Eja4nLz-Nj9WvK6Z9-3T1zobO_XJpuVg,18735
|
78
78
|
utilities/typing.py,sha256=7ZgCNZwA6oaiwpSJIS9Rj3i3MbRBYHMqbC3jMe5KiNg,13992
|
79
79
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
80
80
|
utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
|
81
81
|
utilities/uuid.py,sha256=nQZs6tFX4mqtc2Ku3KqjloYCqwpTKeTj8eKwQwh3FQI,1572
|
82
82
|
utilities/version.py,sha256=ipBj5-WYY_nelp2uwFlApfWWCzTLzPwpovUi9x_OBMs,5085
|
83
83
|
utilities/warnings.py,sha256=un1LvHv70PU-LLv8RxPVmugTzDJkkGXRMZTE2-fTQHw,1771
|
84
|
-
utilities/whenever.py,sha256
|
84
|
+
utilities/whenever.py,sha256=-ayK89OHscEUk8xc-mR6Zj2vefyPdYlTuX2g6PQbCvQ,57432
|
85
85
|
utilities/zipfile.py,sha256=24lQc9ATcJxHXBPc_tBDiJk48pWyRrlxO2fIsFxU0A8,699
|
86
|
-
utilities/zoneinfo.py,sha256=
|
86
|
+
utilities/zoneinfo.py,sha256=tdIScrTB2-B-LH0ukb1HUXKooLknOfJNwHk10MuMYvA,3619
|
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.161.
|
91
|
-
dycw_utilities-0.161.
|
92
|
-
dycw_utilities-0.161.
|
93
|
-
dycw_utilities-0.161.
|
94
|
-
dycw_utilities-0.161.
|
90
|
+
dycw_utilities-0.161.1.dist-info/METADATA,sha256=VYgMxuV4wPeDXwmYkWnEkL4MkWU8cM8xC-lNqqIFII0,1643
|
91
|
+
dycw_utilities-0.161.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
92
|
+
dycw_utilities-0.161.1.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
93
|
+
dycw_utilities-0.161.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.161.1.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/hypothesis.py
CHANGED
@@ -32,6 +32,7 @@ from hypothesis.strategies import (
|
|
32
32
|
sampled_from,
|
33
33
|
sets,
|
34
34
|
text,
|
35
|
+
timezones,
|
35
36
|
uuids,
|
36
37
|
)
|
37
38
|
from hypothesis.utils.conventions import not_set
|
@@ -97,6 +98,7 @@ from utilities.whenever import (
|
|
97
98
|
DatePeriod,
|
98
99
|
TimePeriod,
|
99
100
|
ZonedDateTimePeriod,
|
101
|
+
get_now,
|
100
102
|
to_date_time_delta,
|
101
103
|
to_days,
|
102
104
|
to_nanoseconds,
|
@@ -105,6 +107,7 @@ from utilities.zoneinfo import UTC, to_zone_info
|
|
105
107
|
|
106
108
|
if TYPE_CHECKING:
|
107
109
|
from collections.abc import Collection, Hashable, Iterable, Iterator
|
110
|
+
from zoneinfo import ZoneInfo
|
108
111
|
|
109
112
|
from hypothesis.database import ExampleDatabase
|
110
113
|
from libcst import Import, ImportFrom
|
@@ -835,7 +838,7 @@ def paths(
|
|
835
838
|
@composite
|
836
839
|
def _path_parts(draw: DrawFn, /) -> str:
|
837
840
|
part = draw(text_ascii(min_size=1, max_size=10))
|
838
|
-
reserved = {"AUX", "NUL", "nuL"}
|
841
|
+
reserved = {"AUX", "NUL", "nuL", "pRn"}
|
839
842
|
_ = assume(part not in reserved)
|
840
843
|
return part
|
841
844
|
|
@@ -1476,6 +1479,19 @@ def year_months(
|
|
1476
1479
|
##
|
1477
1480
|
|
1478
1481
|
|
1482
|
+
@composite
|
1483
|
+
def zone_infos(draw: DrawFn, /) -> ZoneInfo:
|
1484
|
+
"""Strategy for generating time-zones."""
|
1485
|
+
time_zone = draw(timezones())
|
1486
|
+
_ = assume(time_zone.key not in {"Etc/UTC", "localtime"})
|
1487
|
+
with assume_does_not_raise(TimeZoneNotFoundError):
|
1488
|
+
_ = get_now(time_zone)
|
1489
|
+
return time_zone
|
1490
|
+
|
1491
|
+
|
1492
|
+
##
|
1493
|
+
|
1494
|
+
|
1479
1495
|
@composite
|
1480
1496
|
def zoned_date_time_periods(
|
1481
1497
|
draw: DrawFn,
|
@@ -1530,7 +1546,6 @@ def zoned_date_times(
|
|
1530
1546
|
with (
|
1531
1547
|
assume_does_not_raise(RepeatedTime),
|
1532
1548
|
assume_does_not_raise(SkippedTime),
|
1533
|
-
assume_does_not_raise(TimeZoneNotFoundError),
|
1534
1549
|
assume_does_not_raise(ValueError, match="Resulting datetime is out of range"),
|
1535
1550
|
):
|
1536
1551
|
zoned = plain.assume_tz(time_zone_.key, disambiguate="raise")
|
@@ -1602,6 +1617,7 @@ __all__ = [
|
|
1602
1617
|
"urls",
|
1603
1618
|
"versions",
|
1604
1619
|
"year_months",
|
1620
|
+
"zone_infos",
|
1605
1621
|
"zoned_date_time_periods",
|
1606
1622
|
"zoned_date_times",
|
1607
1623
|
"zoned_date_times_2000",
|
utilities/types.py
CHANGED
@@ -276,7 +276,12 @@ TIME_ZONES: list[TimeZone] = list(get_args(TimeZone.__value__))
|
|
276
276
|
|
277
277
|
|
278
278
|
type TimeZoneLike = (
|
279
|
-
ZoneInfo
|
279
|
+
ZoneInfo
|
280
|
+
| ZonedDateTime
|
281
|
+
| Literal["local", "localtime"]
|
282
|
+
| TimeZone
|
283
|
+
| dt.tzinfo
|
284
|
+
| dt.datetime
|
280
285
|
)
|
281
286
|
|
282
287
|
|
utilities/whenever.py
CHANGED
@@ -1638,22 +1638,27 @@ def to_zoned_date_time(
|
|
1638
1638
|
) -> ZonedDateTime | Sentinel:
|
1639
1639
|
"""Convert to a zoned date-time."""
|
1640
1640
|
match date_time:
|
1641
|
-
case ZonedDateTime()
|
1642
|
-
|
1641
|
+
case ZonedDateTime() as date_time_use:
|
1642
|
+
...
|
1643
|
+
case Sentinel():
|
1644
|
+
return sentinel
|
1643
1645
|
case None:
|
1644
1646
|
return get_now(time_zone)
|
1645
1647
|
case str():
|
1646
|
-
|
1647
|
-
case dt.datetime():
|
1648
|
+
date_time_use = ZonedDateTime.parse_common_iso(date_time)
|
1649
|
+
case dt.datetime() as py_date_time:
|
1648
1650
|
if isinstance(date_time.tzinfo, ZoneInfo):
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1651
|
+
py_date_time_use = py_date_time
|
1652
|
+
elif date_time.tzinfo is dt.UTC:
|
1653
|
+
py_date_time_use = py_date_time.astimezone(UTC)
|
1654
|
+
else:
|
1655
|
+
raise ToZonedDateTimeError(date_time=date_time)
|
1656
|
+
date_time_use = ZonedDateTime.from_py_datetime(py_date_time_use)
|
1653
1657
|
case Callable() as func:
|
1654
1658
|
return to_zoned_date_time(func(), time_zone=time_zone)
|
1655
1659
|
case never:
|
1656
1660
|
assert_never(never)
|
1661
|
+
return date_time_use.to_tz(to_time_zone_name(time_zone))
|
1657
1662
|
|
1658
1663
|
|
1659
1664
|
@dataclass(kw_only=True, slots=True)
|
utilities/zoneinfo.py
CHANGED
@@ -27,7 +27,7 @@ def to_zone_info(obj: TimeZoneLike, /) -> ZoneInfo:
|
|
27
27
|
return zone_info
|
28
28
|
case ZonedDateTime() as date_time:
|
29
29
|
return ZoneInfo(date_time.tz)
|
30
|
-
case "local":
|
30
|
+
case "local" | "localtime":
|
31
31
|
return LOCAL_TIME_ZONE
|
32
32
|
case str() as key:
|
33
33
|
return ZoneInfo(key)
|
@@ -75,7 +75,7 @@ def to_time_zone_name(obj: TimeZoneLike, /) -> TimeZone:
|
|
75
75
|
return cast("TimeZone", zone_info.key)
|
76
76
|
case ZonedDateTime() as date_time:
|
77
77
|
return cast("TimeZone", date_time.tz)
|
78
|
-
case "local":
|
78
|
+
case "local" | "localtime":
|
79
79
|
return LOCAL_TIME_ZONE_NAME
|
80
80
|
case str() as time_zone:
|
81
81
|
if time_zone in TIME_ZONES:
|
File without changes
|
File without changes
|
File without changes
|