dycw-utilities 0.148.4__py3-none-any.whl → 0.174.12__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.
Potentially problematic release.
This version of dycw-utilities might be problematic. Click here for more details.
- dycw_utilities-0.174.12.dist-info/METADATA +41 -0
- dycw_utilities-0.174.12.dist-info/RECORD +104 -0
- dycw_utilities-0.174.12.dist-info/WHEEL +4 -0
- {dycw_utilities-0.148.4.dist-info → dycw_utilities-0.174.12.dist-info}/entry_points.txt +3 -0
- utilities/__init__.py +1 -1
- utilities/{eventkit.py → aeventkit.py} +12 -11
- utilities/altair.py +7 -6
- utilities/asyncio.py +113 -64
- utilities/atomicwrites.py +1 -1
- utilities/atools.py +64 -4
- utilities/cachetools.py +9 -6
- utilities/click.py +145 -49
- utilities/concurrent.py +1 -1
- utilities/contextlib.py +4 -2
- utilities/contextvars.py +20 -1
- utilities/cryptography.py +3 -3
- utilities/dataclasses.py +15 -28
- utilities/docker.py +292 -0
- utilities/enum.py +2 -2
- utilities/errors.py +1 -1
- utilities/fastapi.py +8 -3
- utilities/fpdf2.py +2 -2
- utilities/functions.py +20 -297
- utilities/git.py +19 -0
- utilities/grp.py +28 -0
- utilities/hypothesis.py +360 -78
- utilities/inflect.py +1 -1
- utilities/iterables.py +12 -58
- utilities/jinja2.py +148 -0
- utilities/json.py +1 -1
- utilities/libcst.py +7 -7
- utilities/logging.py +74 -85
- utilities/math.py +8 -4
- utilities/more_itertools.py +4 -6
- utilities/operator.py +1 -1
- utilities/orjson.py +86 -34
- utilities/os.py +49 -2
- utilities/parse.py +2 -2
- utilities/pathlib.py +66 -34
- utilities/permissions.py +297 -0
- utilities/platform.py +5 -5
- utilities/polars.py +932 -420
- utilities/polars_ols.py +1 -1
- utilities/postgres.py +299 -174
- utilities/pottery.py +8 -73
- utilities/pqdm.py +3 -3
- utilities/pwd.py +28 -0
- utilities/pydantic.py +11 -0
- utilities/pydantic_settings.py +240 -0
- utilities/pydantic_settings_sops.py +76 -0
- utilities/pyinstrument.py +5 -5
- utilities/pytest.py +155 -46
- utilities/pytest_plugins/pytest_randomly.py +1 -1
- utilities/pytest_plugins/pytest_regressions.py +7 -3
- utilities/pytest_regressions.py +2 -3
- utilities/random.py +11 -6
- utilities/re.py +1 -1
- utilities/redis.py +101 -64
- utilities/sentinel.py +10 -0
- utilities/shelve.py +4 -1
- utilities/shutil.py +25 -0
- utilities/slack_sdk.py +8 -3
- utilities/sqlalchemy.py +422 -352
- utilities/sqlalchemy_polars.py +28 -52
- utilities/string.py +1 -1
- utilities/subprocess.py +864 -0
- utilities/tempfile.py +62 -4
- utilities/testbook.py +50 -0
- utilities/text.py +165 -42
- utilities/timer.py +2 -2
- utilities/traceback.py +46 -36
- utilities/types.py +62 -23
- utilities/typing.py +479 -19
- utilities/uuid.py +42 -5
- utilities/version.py +27 -26
- utilities/whenever.py +661 -151
- utilities/zoneinfo.py +80 -22
- dycw_utilities-0.148.4.dist-info/METADATA +0 -41
- dycw_utilities-0.148.4.dist-info/RECORD +0 -95
- dycw_utilities-0.148.4.dist-info/WHEEL +0 -4
- dycw_utilities-0.148.4.dist-info/licenses/LICENSE +0 -21
- utilities/period.py +0 -237
- utilities/typed_settings.py +0 -144
utilities/traceback.py
CHANGED
|
@@ -15,9 +15,8 @@ from typing import TYPE_CHECKING, override
|
|
|
15
15
|
|
|
16
16
|
from utilities.atomicwrites import writer
|
|
17
17
|
from utilities.errors import repr_error
|
|
18
|
-
from utilities.functions import to_bool
|
|
19
18
|
from utilities.iterables import OneEmptyError, one
|
|
20
|
-
from utilities.pathlib import
|
|
19
|
+
from utilities.pathlib import module_path, to_path
|
|
21
20
|
from utilities.reprlib import (
|
|
22
21
|
RICH_EXPAND_ALL,
|
|
23
22
|
RICH_INDENT_SIZE,
|
|
@@ -27,25 +26,26 @@ from utilities.reprlib import (
|
|
|
27
26
|
RICH_MAX_WIDTH,
|
|
28
27
|
yield_mapping_repr,
|
|
29
28
|
)
|
|
29
|
+
from utilities.text import to_bool
|
|
30
30
|
from utilities.tzlocal import LOCAL_TIME_ZONE_NAME
|
|
31
|
-
from utilities.version import
|
|
31
|
+
from utilities.version import to_version
|
|
32
32
|
from utilities.whenever import (
|
|
33
33
|
format_compact,
|
|
34
34
|
get_now,
|
|
35
35
|
get_now_local,
|
|
36
|
-
to_local_plain,
|
|
37
36
|
to_zoned_date_time,
|
|
38
37
|
)
|
|
39
38
|
|
|
40
39
|
if TYPE_CHECKING:
|
|
41
|
-
from collections.abc import Callable, Iterator
|
|
40
|
+
from collections.abc import Callable, Iterator
|
|
42
41
|
from traceback import FrameSummary
|
|
43
42
|
from types import TracebackType
|
|
44
43
|
|
|
45
44
|
from utilities.types import (
|
|
46
|
-
|
|
45
|
+
Delta,
|
|
46
|
+
MaybeCallableBoolLike,
|
|
47
47
|
MaybeCallablePathLike,
|
|
48
|
-
|
|
48
|
+
MaybeCallableZonedDateTimeLike,
|
|
49
49
|
PathLike,
|
|
50
50
|
)
|
|
51
51
|
from utilities.version import MaybeCallableVersionLike
|
|
@@ -54,15 +54,12 @@ if TYPE_CHECKING:
|
|
|
54
54
|
##
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
_START = get_now()
|
|
58
|
-
|
|
59
|
-
|
|
60
57
|
def format_exception_stack(
|
|
61
58
|
error: BaseException,
|
|
62
59
|
/,
|
|
63
60
|
*,
|
|
64
61
|
header: bool = False,
|
|
65
|
-
start:
|
|
62
|
+
start: MaybeCallableZonedDateTimeLike = get_now,
|
|
66
63
|
version: MaybeCallableVersionLike | None = None,
|
|
67
64
|
capture_locals: bool = False,
|
|
68
65
|
max_width: int = RICH_MAX_WIDTH,
|
|
@@ -73,7 +70,7 @@ def format_exception_stack(
|
|
|
73
70
|
expand_all: bool = RICH_EXPAND_ALL,
|
|
74
71
|
) -> str:
|
|
75
72
|
"""Format an exception stack."""
|
|
76
|
-
lines:
|
|
73
|
+
lines: list[str] = []
|
|
77
74
|
if header:
|
|
78
75
|
lines.extend(_yield_header_lines(start=start, version=version))
|
|
79
76
|
lines.extend(
|
|
@@ -93,25 +90,19 @@ def format_exception_stack(
|
|
|
93
90
|
|
|
94
91
|
def _yield_header_lines(
|
|
95
92
|
*,
|
|
96
|
-
start:
|
|
93
|
+
start: MaybeCallableZonedDateTimeLike = get_now,
|
|
97
94
|
version: MaybeCallableVersionLike | None = None,
|
|
98
95
|
) -> Iterator[str]:
|
|
99
96
|
"""Yield the header lines."""
|
|
100
97
|
now = get_now_local()
|
|
101
|
-
start_use = to_zoned_date_time(date_time=start)
|
|
102
98
|
yield f"Date/time | {format_compact(now)}"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
start_str = format_compact(start_use.to_tz(LOCAL_TIME_ZONE_NAME))
|
|
107
|
-
yield f"Started | {start_str}"
|
|
108
|
-
delta = None if start_use is None else (now - start_use)
|
|
109
|
-
delta_str = "" if delta is None else delta.format_common_iso()
|
|
110
|
-
yield f"Duration | {delta_str}"
|
|
99
|
+
start_use = to_zoned_date_time(start).to_tz(LOCAL_TIME_ZONE_NAME)
|
|
100
|
+
yield f"Started | {format_compact(start_use)}"
|
|
101
|
+
yield f"Duration | {(now - start_use).format_iso()}"
|
|
111
102
|
yield f"User | {getuser()}"
|
|
112
103
|
yield f"Host | {gethostname()}"
|
|
113
104
|
yield f"Process ID | {getpid()}"
|
|
114
|
-
version_use = "" if version is None else
|
|
105
|
+
version_use = "" if version is None else to_version(version)
|
|
115
106
|
yield f"Version | {version_use}"
|
|
116
107
|
yield ""
|
|
117
108
|
|
|
@@ -205,9 +196,10 @@ def _trim_path(path: PathLike, pattern: str, /) -> Path | None:
|
|
|
205
196
|
|
|
206
197
|
def make_except_hook(
|
|
207
198
|
*,
|
|
208
|
-
start:
|
|
199
|
+
start: MaybeCallableZonedDateTimeLike = get_now,
|
|
209
200
|
version: MaybeCallableVersionLike | None = None,
|
|
210
201
|
path: MaybeCallablePathLike | None = None,
|
|
202
|
+
path_max_age: Delta | None = None,
|
|
211
203
|
max_width: int = RICH_MAX_WIDTH,
|
|
212
204
|
indent_size: int = RICH_INDENT_SIZE,
|
|
213
205
|
max_length: int | None = RICH_MAX_LENGTH,
|
|
@@ -215,7 +207,7 @@ def make_except_hook(
|
|
|
215
207
|
max_depth: int | None = RICH_MAX_DEPTH,
|
|
216
208
|
expand_all: bool = RICH_EXPAND_ALL,
|
|
217
209
|
slack_url: str | None = None,
|
|
218
|
-
pudb:
|
|
210
|
+
pudb: MaybeCallableBoolLike = False,
|
|
219
211
|
) -> Callable[
|
|
220
212
|
[type[BaseException] | None, BaseException | None, TracebackType | None], None
|
|
221
213
|
]:
|
|
@@ -225,6 +217,7 @@ def make_except_hook(
|
|
|
225
217
|
start=start,
|
|
226
218
|
version=version,
|
|
227
219
|
path=path,
|
|
220
|
+
path_max_age=path_max_age,
|
|
228
221
|
max_width=max_width,
|
|
229
222
|
indent_size=indent_size,
|
|
230
223
|
max_length=max_length,
|
|
@@ -242,9 +235,10 @@ def _make_except_hook_inner(
|
|
|
242
235
|
traceback: TracebackType | None,
|
|
243
236
|
/,
|
|
244
237
|
*,
|
|
245
|
-
start:
|
|
238
|
+
start: MaybeCallableZonedDateTimeLike = get_now,
|
|
246
239
|
version: MaybeCallableVersionLike | None = None,
|
|
247
240
|
path: MaybeCallablePathLike | None = None,
|
|
241
|
+
path_max_age: Delta | None = None,
|
|
248
242
|
max_width: int = RICH_MAX_WIDTH,
|
|
249
243
|
indent_size: int = RICH_INDENT_SIZE,
|
|
250
244
|
max_length: int | None = RICH_MAX_LENGTH,
|
|
@@ -252,7 +246,7 @@ def _make_except_hook_inner(
|
|
|
252
246
|
max_depth: int | None = RICH_MAX_DEPTH,
|
|
253
247
|
expand_all: bool = RICH_EXPAND_ALL,
|
|
254
248
|
slack_url: str | None = None,
|
|
255
|
-
pudb:
|
|
249
|
+
pudb: MaybeCallableBoolLike = False,
|
|
256
250
|
) -> None:
|
|
257
251
|
"""Exception hook to log the traceback."""
|
|
258
252
|
_ = (exc_type, traceback)
|
|
@@ -261,11 +255,10 @@ def _make_except_hook_inner(
|
|
|
261
255
|
slim = format_exception_stack(exc_val, header=True, start=start, version=version)
|
|
262
256
|
_ = sys.stderr.write(f"{slim}\n") # don't 'from sys import stderr'
|
|
263
257
|
if path is not None:
|
|
264
|
-
path = (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
)
|
|
258
|
+
path = to_path(path)
|
|
259
|
+
path_log = path.joinpath(
|
|
260
|
+
format_compact(get_now_local(), path=True)
|
|
261
|
+
).with_suffix(".txt")
|
|
269
262
|
full = format_exception_stack(
|
|
270
263
|
exc_val,
|
|
271
264
|
header=True,
|
|
@@ -279,8 +272,10 @@ def _make_except_hook_inner(
|
|
|
279
272
|
max_depth=max_depth,
|
|
280
273
|
expand_all=expand_all,
|
|
281
274
|
)
|
|
282
|
-
with writer(
|
|
275
|
+
with writer(path_log, overwrite=True) as temp:
|
|
283
276
|
_ = temp.write_text(full)
|
|
277
|
+
if path_max_age is not None:
|
|
278
|
+
_make_except_hook_purge(path, path_max_age)
|
|
284
279
|
if slack_url is not None: # pragma: no cover
|
|
285
280
|
from utilities.slack_sdk import SendToSlackError, send_to_slack
|
|
286
281
|
|
|
@@ -288,13 +283,28 @@ def _make_except_hook_inner(
|
|
|
288
283
|
send_to_slack(slack_url, f"```{slim}```")
|
|
289
284
|
except SendToSlackError as error:
|
|
290
285
|
_ = stderr.write(f"{error}\n")
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
from pudb import post_mortem
|
|
286
|
+
if to_bool(pudb): # pragma: no cover
|
|
287
|
+
from pudb import post_mortem # pyright: ignore[reportMissingImports]
|
|
294
288
|
|
|
295
289
|
post_mortem(tb=traceback, e_type=exc_type, e_value=exc_val)
|
|
296
290
|
|
|
297
291
|
|
|
292
|
+
def _make_except_hook_purge(path: PathLike, max_age: Delta, /) -> None:
|
|
293
|
+
threshold = get_now_local() - max_age
|
|
294
|
+
paths: set[Path] = set()
|
|
295
|
+
for p in Path(path).iterdir():
|
|
296
|
+
if p.is_file():
|
|
297
|
+
try:
|
|
298
|
+
date_time = to_zoned_date_time(p.stem)
|
|
299
|
+
except ValueError:
|
|
300
|
+
pass
|
|
301
|
+
else:
|
|
302
|
+
if date_time <= threshold:
|
|
303
|
+
paths.add(p)
|
|
304
|
+
for p in paths:
|
|
305
|
+
p.unlink(missing_ok=True)
|
|
306
|
+
|
|
307
|
+
|
|
298
308
|
@dataclass(kw_only=True, slots=True)
|
|
299
309
|
class MakeExceptHookError(Exception):
|
|
300
310
|
@override
|
utilities/types.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import datetime as dt
|
|
4
|
-
from
|
|
5
|
-
from collections.abc import Callable, Coroutine, Hashable, Iterable, Mapping, Sequence
|
|
4
|
+
from collections.abc import Callable, Collection, Coroutine, Iterable, Mapping
|
|
6
5
|
from enum import Enum
|
|
7
6
|
from ipaddress import IPv4Address, IPv6Address
|
|
8
7
|
from logging import Logger
|
|
@@ -16,9 +15,11 @@ from typing import (
|
|
|
16
15
|
Literal,
|
|
17
16
|
Protocol,
|
|
18
17
|
TypeVar,
|
|
18
|
+
get_args,
|
|
19
19
|
overload,
|
|
20
20
|
runtime_checkable,
|
|
21
21
|
)
|
|
22
|
+
from uuid import UUID
|
|
22
23
|
from zoneinfo import ZoneInfo
|
|
23
24
|
|
|
24
25
|
from whenever import (
|
|
@@ -62,23 +63,26 @@ type OpenMode = Literal[
|
|
|
62
63
|
"a+b",
|
|
63
64
|
]
|
|
64
65
|
type MaybeCallable[T] = T | Callable[[], T]
|
|
65
|
-
type MaybeCallableBool = MaybeCallable[bool]
|
|
66
|
-
type MaybeCallableStr = MaybeCallable[str]
|
|
67
66
|
type MaybeStr[T] = T | str
|
|
68
67
|
type MaybeType[T] = T | type[T]
|
|
69
68
|
type StrMapping = Mapping[str, Any]
|
|
70
69
|
type StrStrMapping = Mapping[str, str]
|
|
71
|
-
type TypeLike[T] = type[T] | tuple[type[T], ...]
|
|
72
70
|
type TupleOrStrMapping = tuple[Any, ...] | StrMapping
|
|
71
|
+
type TypeLike[T] = type[T] | tuple[type[T], ...]
|
|
72
|
+
# basic - derived
|
|
73
|
+
type MaybeCallableBoolLike = MaybeCallable[BoolLike]
|
|
74
|
+
type BoolLike = MaybeStr[bool]
|
|
73
75
|
|
|
74
76
|
|
|
75
77
|
# asyncio
|
|
76
78
|
type Coro[T] = Coroutine[Any, Any, T]
|
|
77
|
-
type MaybeCallableEvent = MaybeCallable[Event]
|
|
78
79
|
type MaybeCoro[T] = T | Coro[T]
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
# collections.abc
|
|
83
|
+
type SupportsFloatOrIndex = SupportsFloat | SupportsIndex
|
|
84
|
+
|
|
85
|
+
|
|
82
86
|
@runtime_checkable
|
|
83
87
|
class SupportsKeysAndGetItem(Protocol[_T, _T_co]):
|
|
84
88
|
def keys(self) -> Iterable[_T]: ... # pragma: no cover
|
|
@@ -115,17 +119,23 @@ IPv6AddressLike = MaybeStr[IPv6Address]
|
|
|
115
119
|
|
|
116
120
|
|
|
117
121
|
# iterables
|
|
122
|
+
type MaybeCollection[T] = T | Collection[T]
|
|
118
123
|
type MaybeIterable[T] = T | Iterable[T]
|
|
119
|
-
type IterableHashable[T: Hashable] = tuple[T, ...] | frozenset[T]
|
|
120
124
|
type MaybeList[T] = T | list[T]
|
|
121
|
-
type
|
|
122
|
-
type
|
|
123
|
-
|
|
125
|
+
type MaybeSet[T] = T | set[T] | frozenset[T]
|
|
126
|
+
type SequenceLT[T] = list[T] | tuple[T, ...]
|
|
127
|
+
# iterables - dervied
|
|
128
|
+
type MaybeSequence[T] = T | SequenceLT[T]
|
|
129
|
+
type SequenceStr = SequenceLT[str]
|
|
130
|
+
type CollectionStr = dict[str, Any] | frozenset[str] | set[str] | SequenceStr
|
|
131
|
+
# iterables - maybe str
|
|
132
|
+
type MaybeCollectionStr = str | CollectionStr
|
|
133
|
+
type MaybeSequenceStr = str | SequenceStr
|
|
124
134
|
|
|
125
135
|
|
|
126
136
|
# logging
|
|
127
137
|
type LogLevel = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
|
|
128
|
-
type
|
|
138
|
+
type LoggerLike = MaybeStr[Logger]
|
|
129
139
|
|
|
130
140
|
|
|
131
141
|
# math
|
|
@@ -209,8 +219,8 @@ type SerializeObjectExtra = Mapping[Any, Callable[[Any], str]]
|
|
|
209
219
|
|
|
210
220
|
|
|
211
221
|
# pathlib
|
|
212
|
-
type MaybeCallablePathLike = MaybeCallable[PathLike]
|
|
213
222
|
type PathLike = MaybeStr[Path]
|
|
223
|
+
type MaybeCallablePathLike = MaybeCallable[PathLike]
|
|
214
224
|
|
|
215
225
|
|
|
216
226
|
# random
|
|
@@ -221,11 +231,24 @@ type Seed = int | float | str | bytes | bytearray | Random
|
|
|
221
231
|
type PatternLike = MaybeStr[Pattern[str]]
|
|
222
232
|
|
|
223
233
|
|
|
234
|
+
# retry
|
|
235
|
+
type Retry = tuple[int, Delta | None]
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
# text
|
|
239
|
+
type MaybeCallableStr = MaybeCallable[str]
|
|
240
|
+
|
|
241
|
+
|
|
224
242
|
# traceback
|
|
225
243
|
type ExcInfo = tuple[type[BaseException], BaseException, TracebackType]
|
|
226
244
|
type OptExcInfo = ExcInfo | tuple[None, None, None]
|
|
227
245
|
|
|
228
246
|
|
|
247
|
+
# uuid
|
|
248
|
+
type UUIDLike = MaybeStr[UUID]
|
|
249
|
+
type MaybeCallableUUIDLike = MaybeCallable[UUIDLike | Seed]
|
|
250
|
+
|
|
251
|
+
|
|
229
252
|
# whenever
|
|
230
253
|
type DateDeltaLike = MaybeStr[DateDelta]
|
|
231
254
|
type DateLike = MaybeStr[Date]
|
|
@@ -235,8 +258,9 @@ type DateTimeRoundMode = Literal[
|
|
|
235
258
|
"ceil", "floor", "half_ceil", "half_floor", "half_even"
|
|
236
259
|
]
|
|
237
260
|
type Delta = DateDelta | TimeDelta | DateTimeDelta
|
|
238
|
-
type
|
|
239
|
-
type
|
|
261
|
+
type MaybeCallableDateLike = MaybeCallable[DateLike]
|
|
262
|
+
type MaybeCallableTimeLike = MaybeCallable[TimeLike]
|
|
263
|
+
type MaybeCallableZonedDateTimeLike = MaybeCallable[ZonedDateTimeLike]
|
|
240
264
|
type MonthDayLike = MaybeStr[MonthDay]
|
|
241
265
|
type PlainDateTimeLike = MaybeStr[PlainDateTime]
|
|
242
266
|
type TimeDeltaLike = MaybeStr[TimeDelta]
|
|
@@ -253,12 +277,21 @@ type TimeZone = Literal[
|
|
|
253
277
|
"Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Asmera", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/Conakry", "Africa/Dakar", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Malabo", "Africa/Maputo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Timbuktu", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Adak", "America/Anchorage", "America/Anguilla", "America/Antigua", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/ComodRivadavia", "America/Argentina/Cordoba", "America/Argentina/Jujuy", "America/Argentina/La_Rioja", "America/Argentina/Mendoza", "America/Argentina/Rio_Gallegos", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Tucuman", "America/Argentina/Ushuaia", "America/Aruba", "America/Asuncion", "America/Atikokan", "America/Atka", "America/Bahia", "America/Bahia_Banderas", "America/Barbados", "America/Belem", "America/Belize", "America/Blanc-Sablon", "America/Boa_Vista", "America/Bogota", "America/Boise", "America/Buenos_Aires", "America/Cambridge_Bay", "America/Campo_Grande", "America/Cancun", "America/Caracas", "America/Catamarca", "America/Cayenne", "America/Cayman", "America/Chicago", "America/Chihuahua", "America/Ciudad_Juarez", "America/Coral_Harbour", "America/Cordoba", "America/Costa_Rica", "America/Coyhaique", "America/Creston", "America/Cuiaba", "America/Curacao", "America/Danmarkshavn", "America/Dawson", "America/Dawson_Creek", "America/Denver", "America/Detroit", "America/Dominica", "America/Edmonton", "America/Eirunepe", "America/El_Salvador", "America/Ensenada", "America/Fort_Nelson", "America/Fort_Wayne", "America/Fortaleza", "America/Glace_Bay", "America/Godthab", "America/Goose_Bay", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guayaquil", "America/Guyana", "America/Halifax", "America/Havana", "America/Hermosillo", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Inuvik", "America/Iqaluit", "America/Jamaica", "America/Jujuy", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Knox_IN", "America/Kralendijk", "America/La_Paz", "America/Lima", "America/Los_Angeles", "America/Louisville", "America/Lower_Princes", "America/Maceio", "America/Managua", "America/Manaus", "America/Marigot", "America/Martinique", "America/Matamoros", "America/Mazatlan", "America/Mendoza", "America/Menominee", "America/Merida", "America/Metlakatla", "America/Mexico_City", "America/Miquelon", "America/Moncton", "America/Monterrey", "America/Montevideo", "America/Montreal", "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", "America/Nome", "America/Noronha", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Nuuk", "America/Ojinaga", "America/Panama", "America/Pangnirtung", "America/Paramaribo", "America/Phoenix", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Acre", "America/Porto_Velho", "America/Puerto_Rico", "America/Punta_Arenas", "America/Rainy_River", "America/Rankin_Inlet", "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", "America/Rosario", "America/Santa_Isabel", "America/Santarem", "America/Santiago", "America/Santo_Domingo", "America/Sao_Paulo", "America/Scoresbysund", "America/Shiprock", "America/Sitka", "America/St_Barthelemy", "America/St_Johns", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Swift_Current", "America/Tegucigalpa", "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", "America/Tortola", "America/Vancouver", "America/Virgin", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", "America/Yellowknife", "Antarctica/Casey", "Antarctica/Davis", "Antarctica/DumontDUrville", "Antarctica/Macquarie", "Antarctica/Mawson", "Antarctica/McMurdo", "Antarctica/Palmer", "Antarctica/Rothera", "Antarctica/South_Pole", "Antarctica/Syowa", "Antarctica/Troll", "Antarctica/Vostok", "Arctic/Longyearbyen", "Asia/Aden", "Asia/Almaty", "Asia/Amman", "Asia/Anadyr", "Asia/Aqtau", "Asia/Aqtobe", "Asia/Ashgabat", "Asia/Ashkhabad", "Asia/Atyrau", "Asia/Baghdad", "Asia/Bahrain", "Asia/Baku", "Asia/Bangkok", "Asia/Barnaul", "Asia/Beirut", "Asia/Bishkek", "Asia/Brunei", "Asia/Calcutta", "Asia/Chita", "Asia/Choibalsan", "Asia/Chongqing", "Asia/Chungking", "Asia/Colombo", "Asia/Dacca", "Asia/Damascus", "Asia/Dhaka", "Asia/Dili", "Asia/Dubai", "Asia/Dushanbe", "Asia/Famagusta", "Asia/Gaza", "Asia/Harbin", "Asia/Hebron", "Asia/Ho_Chi_Minh", "Asia/Hong_Kong", "Asia/Hovd", "Asia/Irkutsk", "Asia/Istanbul", "Asia/Jakarta", "Asia/Jayapura", "Asia/Jerusalem", "Asia/Kabul", "Asia/Kamchatka", "Asia/Karachi", "Asia/Kashgar", "Asia/Kathmandu", "Asia/Katmandu", "Asia/Khandyga", "Asia/Kolkata", "Asia/Krasnoyarsk", "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Kuwait", "Asia/Macao", "Asia/Macau", "Asia/Magadan", "Asia/Makassar", "Asia/Manila", "Asia/Muscat", "Asia/Nicosia", "Asia/Novokuznetsk", "Asia/Novosibirsk", "Asia/Omsk", "Asia/Oral", "Asia/Phnom_Penh", "Asia/Pontianak", "Asia/Pyongyang", "Asia/Qatar", "Asia/Qostanay", "Asia/Qyzylorda", "Asia/Rangoon", "Asia/Riyadh", "Asia/Saigon", "Asia/Sakhalin", "Asia/Samarkand", "Asia/Seoul", "Asia/Shanghai", "Asia/Singapore", "Asia/Srednekolymsk", "Asia/Taipei", "Asia/Tashkent", "Asia/Tbilisi", "Asia/Tehran", "Asia/Tel_Aviv", "Asia/Thimbu", "Asia/Thimphu", "Asia/Tokyo", "Asia/Tomsk", "Asia/Ujung_Pandang", "Asia/Ulaanbaatar", "Asia/Ulan_Bator", "Asia/Urumqi", "Asia/Ust-Nera", "Asia/Vientiane", "Asia/Vladivostok", "Asia/Yakutsk", "Asia/Yangon", "Asia/Yekaterinburg", "Asia/Yerevan", "Atlantic/Azores", "Atlantic/Bermuda", "Atlantic/Canary", "Atlantic/Cape_Verde", "Atlantic/Faeroe", "Atlantic/Faroe", "Atlantic/Jan_Mayen", "Atlantic/Madeira", "Atlantic/Reykjavik", "Atlantic/South_Georgia", "Atlantic/St_Helena", "Atlantic/Stanley", "Australia/ACT", "Australia/Adelaide", "Australia/Brisbane", "Australia/Broken_Hill", "Australia/Canberra", "Australia/Currie", "Australia/Darwin", "Australia/Eucla", "Australia/Hobart", "Australia/LHI", "Australia/Lindeman", "Australia/Lord_Howe", "Australia/Melbourne", "Australia/NSW", "Australia/North", "Australia/Perth", "Australia/Queensland", "Australia/South", "Australia/Sydney", "Australia/Tasmania", "Australia/Victoria", "Australia/West", "Australia/Yancowinna", "Brazil/Acre", "Brazil/DeNoronha", "Brazil/East", "Brazil/West", "CET", "CST6CDT", "Canada/Atlantic", "Canada/Central", "Canada/Eastern", "Canada/Mountain", "Canada/Newfoundland", "Canada/Pacific", "Canada/Saskatchewan", "Canada/Yukon", "Chile/Continental", "Chile/EasterIsland", "Cuba", "EET", "EST", "EST5EDT", "Egypt", "Eire", "Etc/GMT", "Etc/GMT+0", "Etc/GMT+1", "Etc/GMT+10", "Etc/GMT+11", "Etc/GMT+12", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4", "Etc/GMT+5", "Etc/GMT+6", "Etc/GMT+7", "Etc/GMT+8", "Etc/GMT+9", "Etc/GMT-0", "Etc/GMT-1", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12", "Etc/GMT-13", "Etc/GMT-14", "Etc/GMT-2", "Etc/GMT-3", "Etc/GMT-4", "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8", "Etc/GMT-9", "Etc/GMT0", "Etc/Greenwich", "Etc/UCT", "Etc/UTC", "Etc/Universal", "Etc/Zulu", "Europe/Amsterdam", "Europe/Andorra", "Europe/Astrakhan", "Europe/Athens", "Europe/Belfast", "Europe/Belgrade", "Europe/Berlin", "Europe/Bratislava", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Busingen", "Europe/Chisinau", "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kaliningrad", "Europe/Kiev", "Europe/Kirov", "Europe/Kyiv", "Europe/Lisbon", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Madrid", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", "Europe/Monaco", "Europe/Moscow", "Europe/Nicosia", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Riga", "Europe/Rome", "Europe/Samara", "Europe/San_Marino", "Europe/Sarajevo", "Europe/Saratov", "Europe/Simferopol", "Europe/Skopje", "Europe/Sofia", "Europe/Stockholm", "Europe/Tallinn", "Europe/Tirane", "Europe/Tiraspol", "Europe/Ulyanovsk", "Europe/Uzhgorod", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Vilnius", "Europe/Volgograd", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zaporozhye", "Europe/Zurich", "Factory", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", "Greenwich", "HST", "Hongkong", "Iceland", "Indian/Antananarivo", "Indian/Chagos", "Indian/Christmas", "Indian/Cocos", "Indian/Comoro", "Indian/Kerguelen", "Indian/Mahe", "Indian/Maldives", "Indian/Mauritius", "Indian/Mayotte", "Indian/Reunion", "Iran", "Israel", "Jamaica", "Japan", "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Mexico/BajaNorte", "Mexico/BajaSur", "Mexico/General", "NZ", "NZ-CHAT", "Navajo", "PRC", "PST8PDT", "Pacific/Apia", "Pacific/Auckland", "Pacific/Bougainville", "Pacific/Chatham", "Pacific/Chuuk", "Pacific/Easter", "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Galapagos", "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", "Pacific/Johnston", "Pacific/Kanton", "Pacific/Kiritimati", "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", "Pacific/Midway", "Pacific/Nauru", "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", "Pacific/Palau", "Pacific/Pitcairn", "Pacific/Pohnpei", "Pacific/Ponape", "Pacific/Port_Moresby", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Samoa", "Pacific/Tahiti", "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Truk", "Pacific/Wake", "Pacific/Wallis", "Pacific/Yap", "Poland", "Portugal", "ROC", "ROK", "Singapore", "Turkey", "UCT", "US/Alaska", "US/Aleutian", "US/Arizona", "US/Central", "US/East-Indiana", "US/Eastern", "US/Hawaii", "US/Indiana-Starke", "US/Michigan", "US/Mountain", "US/Pacific", "US/Samoa", "UTC", "Universal", "W-SU", "WET", "Zulu"
|
|
254
278
|
]
|
|
255
279
|
# fmt: on
|
|
280
|
+
TIME_ZONES: list[TimeZone] = list(get_args(TimeZone.__value__))
|
|
281
|
+
|
|
282
|
+
|
|
256
283
|
type TimeZoneLike = (
|
|
257
|
-
ZoneInfo
|
|
284
|
+
ZoneInfo
|
|
285
|
+
| ZonedDateTime
|
|
286
|
+
| Literal["local", "localtime"]
|
|
287
|
+
| TimeZone
|
|
288
|
+
| dt.tzinfo
|
|
289
|
+
| dt.datetime
|
|
258
290
|
)
|
|
259
291
|
|
|
260
292
|
|
|
261
293
|
__all__ = [
|
|
294
|
+
"TIME_ZONES",
|
|
262
295
|
"Coro",
|
|
263
296
|
"Dataclass",
|
|
264
297
|
"DateDeltaLike",
|
|
@@ -272,23 +305,25 @@ __all__ = [
|
|
|
272
305
|
"ExceptionTypeLike",
|
|
273
306
|
"IPv4AddressLike",
|
|
274
307
|
"IPv6AddressLike",
|
|
275
|
-
"IterableHashable",
|
|
276
308
|
"LogLevel",
|
|
277
|
-
"
|
|
309
|
+
"LoggerLike",
|
|
278
310
|
"MathRoundMode",
|
|
279
311
|
"MaybeCallable",
|
|
280
|
-
"
|
|
281
|
-
"
|
|
282
|
-
"MaybeCallableEvent",
|
|
312
|
+
"MaybeCallableBoolLike",
|
|
313
|
+
"MaybeCallableDateLike",
|
|
283
314
|
"MaybeCallablePathLike",
|
|
284
315
|
"MaybeCallableStr",
|
|
285
|
-
"
|
|
316
|
+
"MaybeCallableTimeLike",
|
|
317
|
+
"MaybeCallableUUIDLike",
|
|
318
|
+
"MaybeCallableZonedDateTimeLike",
|
|
319
|
+
"MaybeCollection",
|
|
320
|
+
"MaybeCollectionStr",
|
|
286
321
|
"MaybeCoro",
|
|
287
322
|
"MaybeIterable",
|
|
288
|
-
"MaybeIterableHashable",
|
|
289
323
|
"MaybeList",
|
|
290
|
-
"MaybeListStr",
|
|
291
324
|
"MaybeSequence",
|
|
325
|
+
"MaybeSequenceStr",
|
|
326
|
+
"MaybeSet",
|
|
292
327
|
"MaybeStr",
|
|
293
328
|
"MaybeType",
|
|
294
329
|
"MonthDayLike",
|
|
@@ -301,7 +336,9 @@ __all__ = [
|
|
|
301
336
|
"PathLike",
|
|
302
337
|
"PatternLike",
|
|
303
338
|
"PlainDateTimeLike",
|
|
339
|
+
"Retry",
|
|
304
340
|
"Seed",
|
|
341
|
+
"SequenceStr",
|
|
305
342
|
"SerializeObjectExtra",
|
|
306
343
|
"Sign",
|
|
307
344
|
"StrMapping",
|
|
@@ -311,6 +348,7 @@ __all__ = [
|
|
|
311
348
|
"SupportsBytes",
|
|
312
349
|
"SupportsComplex",
|
|
313
350
|
"SupportsFloat",
|
|
351
|
+
"SupportsFloatOrIndex",
|
|
314
352
|
"SupportsGT",
|
|
315
353
|
"SupportsInt",
|
|
316
354
|
"SupportsInt",
|
|
@@ -325,6 +363,7 @@ __all__ = [
|
|
|
325
363
|
"TimeZoneLike",
|
|
326
364
|
"TupleOrStrMapping",
|
|
327
365
|
"TypeLike",
|
|
366
|
+
"UUIDLike",
|
|
328
367
|
"WeekDay",
|
|
329
368
|
"YearMonthLike",
|
|
330
369
|
"ZonedDateTimeLike",
|