dycw-utilities 0.149.1__py3-none-any.whl → 0.149.3__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.149.1.dist-info → dycw_utilities-0.149.3.dist-info}/METADATA +1 -1
- {dycw_utilities-0.149.1.dist-info → dycw_utilities-0.149.3.dist-info}/RECORD +9 -9
- utilities/__init__.py +1 -1
- utilities/click.py +28 -0
- utilities/postgres.py +35 -23
- utilities/typed_settings.py +2 -0
- {dycw_utilities-0.149.1.dist-info → dycw_utilities-0.149.3.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.149.1.dist-info → dycw_utilities-0.149.3.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.149.1.dist-info → dycw_utilities-0.149.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,10 +1,10 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=ulphOQx-t4YRxHrTnJu_ukrj_lBzCm--fMhrhBgMjdo,60
|
2
2
|
utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
|
3
3
|
utilities/asyncio.py,sha256=z0w3fb-U5Ml5YXVaFFPClizXaQmjDO6YgZg-V9QL0VQ,16021
|
4
4
|
utilities/atomicwrites.py,sha256=xcOWenTBRS0oat3kg7Sqe51AohNThMQ2ixPL7QCG8hw,5795
|
5
5
|
utilities/atools.py,sha256=9im2g8OCf-Iynqa8bAv8N0Ycj9QvrJmGO7yLCZEdgII,986
|
6
6
|
utilities/cachetools.py,sha256=v1-9sXHLdOLiwmkq6NB0OUbxeKBuVVN6wmAWefWoaHI,2744
|
7
|
-
utilities/click.py,sha256=
|
7
|
+
utilities/click.py,sha256=4godcta2Ozm-s3VvIXeNgoBlK2NIz_Q0XfAq64vAfZY,17369
|
8
8
|
utilities/concurrent.py,sha256=ZdhcNeBl1-HaAPY3h7bZ5ccuYdfdq2ATHplvZdnzlhk,2858
|
9
9
|
utilities/contextlib.py,sha256=THWVU14w3kgVM7TSxn2oHqVdBbdeliABR9gRXiPpo2U,7440
|
10
10
|
utilities/contextvars.py,sha256=RsSGGrbQqqZ67rOydnM7WWIsM2lIE31UHJLejnHJPWY,505
|
@@ -48,7 +48,7 @@ utilities/pickle.py,sha256=MBT2xZCsv0pH868IXLGKnlcqNx2IRVKYNpRcqiQQqxw,653
|
|
48
48
|
utilities/platform.py,sha256=Ue9LSxYvg9yUXGKuz5aZoy_qkUEXde-v6B09exgSctU,2813
|
49
49
|
utilities/polars.py,sha256=BgiDryAVOapi41ddfJqN0wYh_sDj8BNEYtPB36LaHdo,71824
|
50
50
|
utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
|
51
|
-
utilities/postgres.py,sha256=
|
51
|
+
utilities/postgres.py,sha256=FKkivJZDz1-S7cBr7QBjsVHnSleDuDGXCthGKJEYf8U,12151
|
52
52
|
utilities/pottery.py,sha256=w2X80PXWwzdHdqSYJP6ESrPNNDP3xzpyuJn-fp-Vt3M,5969
|
53
53
|
utilities/pqdm.py,sha256=BTsYPtbKQWwX-iXF4qCkfPG7DPxIB54J989n83bXrIo,3092
|
54
54
|
utilities/psutil.py,sha256=KUlu4lrUw9Zg1V7ZGetpWpGb9DB8l_SSDWGbANFNCPU,2104
|
@@ -74,7 +74,7 @@ utilities/text.py,sha256=ymBFlP_cA8OgNnZRVNs7FAh7OG8HxE6YkiLEMZv5g_A,11297
|
|
74
74
|
utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
75
75
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
76
76
|
utilities/traceback.py,sha256=zofhzIedpUHrzDNiRJDVzm_wuu_tlTQvVqK4quxVlgM,9151
|
77
|
-
utilities/typed_settings.py,sha256
|
77
|
+
utilities/typed_settings.py,sha256=98OQQsXyfjxbGPjWqG45P_DoNgrzS4gZ7062oD2lgtE,4481
|
78
78
|
utilities/types.py,sha256=iDfk_Z96v7cIxPlgGYMap0fYmjgRUJ7uQzPPCQe1odY,18115
|
79
79
|
utilities/typing.py,sha256=Z-_XDaWyT_6wIo3qfNK-hvRlzxP2Jxa9PgXzm5rDYRA,13790
|
80
80
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
@@ -88,8 +88,8 @@ utilities/zoneinfo.py,sha256=oEH-nL3t4h9uawyZqWDtNtDAl6M-CLpLYGI_nI6DulM,1971
|
|
88
88
|
utilities/pytest_plugins/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
89
89
|
utilities/pytest_plugins/pytest_randomly.py,sha256=NXzCcGKbpgYouz5yehKb4jmxmi2SexKKpgF4M65bi10,414
|
90
90
|
utilities/pytest_plugins/pytest_regressions.py,sha256=Iwhfv_OJH7UCPZCfoh7ugZ2Xjqjil-BBBsOb8sDwiGI,1471
|
91
|
-
dycw_utilities-0.149.
|
92
|
-
dycw_utilities-0.149.
|
93
|
-
dycw_utilities-0.149.
|
94
|
-
dycw_utilities-0.149.
|
95
|
-
dycw_utilities-0.149.
|
91
|
+
dycw_utilities-0.149.3.dist-info/METADATA,sha256=7B63ESaF5MEr-Pow0RWZ8N61NxvMAnPFEo6LR2tpNCY,1697
|
92
|
+
dycw_utilities-0.149.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
93
|
+
dycw_utilities-0.149.3.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
94
|
+
dycw_utilities-0.149.3.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
95
|
+
dycw_utilities-0.149.3.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/click.py
CHANGED
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
import enum
|
4
4
|
import ipaddress
|
5
5
|
import pathlib
|
6
|
+
import uuid
|
6
7
|
from typing import TYPE_CHECKING, TypedDict, assert_never, override
|
7
8
|
|
8
9
|
import click
|
@@ -329,6 +330,32 @@ class TimeDelta(ParamType):
|
|
329
330
|
assert_never(never)
|
330
331
|
|
331
332
|
|
333
|
+
class UUID(ParamType):
|
334
|
+
"""A UUID-valued parameter."""
|
335
|
+
|
336
|
+
name = "uuid"
|
337
|
+
|
338
|
+
@override
|
339
|
+
def __repr__(self) -> str:
|
340
|
+
return self.name.upper()
|
341
|
+
|
342
|
+
@override
|
343
|
+
def convert(
|
344
|
+
self, value: uuid.UUID | str, param: Parameter | None, ctx: Context | None
|
345
|
+
) -> uuid.UUID:
|
346
|
+
"""Convert a value into the `UUID` type."""
|
347
|
+
match value:
|
348
|
+
case uuid.UUID():
|
349
|
+
return value
|
350
|
+
case str():
|
351
|
+
try:
|
352
|
+
return uuid.UUID(value)
|
353
|
+
except ValueError as error:
|
354
|
+
self.fail(str(error), param, ctx)
|
355
|
+
case _ as never:
|
356
|
+
assert_never(never)
|
357
|
+
|
358
|
+
|
332
359
|
class YearMonth(ParamType):
|
333
360
|
"""A year-month parameter."""
|
334
361
|
|
@@ -561,6 +588,7 @@ def _make_metavar(param: Parameter, desc: str, /) -> str:
|
|
561
588
|
|
562
589
|
__all__ = [
|
563
590
|
"CONTEXT_SETTINGS_HELP_OPTION_NAMES",
|
591
|
+
"UUID",
|
564
592
|
"Date",
|
565
593
|
"DateDelta",
|
566
594
|
"DateTimeDelta",
|
utilities/postgres.py
CHANGED
@@ -34,10 +34,12 @@ async def pg_dump(
|
|
34
34
|
*,
|
35
35
|
format_: _PGDumpFormat = "plain",
|
36
36
|
jobs: int | None = None,
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
data_only: bool = False,
|
38
|
+
clean: bool = False,
|
39
|
+
schema: MaybeListStr | None = None,
|
40
|
+
schema_exc: MaybeListStr | None = None,
|
41
|
+
table: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
|
42
|
+
table_exc: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
|
41
43
|
inserts: bool = False,
|
42
44
|
on_conflict_do_nothing: bool = False,
|
43
45
|
docker: str | None = None,
|
@@ -52,10 +54,12 @@ async def pg_dump(
|
|
52
54
|
path,
|
53
55
|
format_=format_,
|
54
56
|
jobs=jobs,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
data_only=data_only,
|
58
|
+
clean=clean,
|
59
|
+
schema=schema,
|
60
|
+
schema_exc=schema_exc,
|
61
|
+
table=table,
|
62
|
+
table_exc=table_exc,
|
59
63
|
inserts=inserts,
|
60
64
|
on_conflict_do_nothing=on_conflict_do_nothing,
|
61
65
|
docker=docker,
|
@@ -98,10 +102,12 @@ def _build_pg_dump(
|
|
98
102
|
*,
|
99
103
|
format_: _PGDumpFormat = "plain",
|
100
104
|
jobs: int | None = None,
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
+
data_only: bool = False,
|
106
|
+
clean: bool = False,
|
107
|
+
schema: MaybeListStr | None = None,
|
108
|
+
schema_exc: MaybeListStr | None = None,
|
109
|
+
table: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
|
110
|
+
table_exc: MaybeSequence[TableOrORMInstOrClass | str] | None = None,
|
105
111
|
inserts: bool = False,
|
106
112
|
on_conflict_do_nothing: bool = False,
|
107
113
|
docker: str | None = None,
|
@@ -117,10 +123,9 @@ def _build_pg_dump(
|
|
117
123
|
"--verbose",
|
118
124
|
# output options
|
119
125
|
"--large-objects",
|
120
|
-
"--
|
126
|
+
"--create",
|
121
127
|
"--no-owner",
|
122
128
|
"--no-privileges",
|
123
|
-
"--if-exists",
|
124
129
|
# connection options
|
125
130
|
f"--host={host}",
|
126
131
|
f"--port={port}",
|
@@ -128,15 +133,19 @@ def _build_pg_dump(
|
|
128
133
|
]
|
129
134
|
if (format_ == "directory") and (jobs is not None):
|
130
135
|
parts.append(f"--jobs={jobs}")
|
131
|
-
if
|
132
|
-
parts.
|
133
|
-
if
|
134
|
-
parts.extend([
|
135
|
-
if
|
136
|
-
parts.extend([f"--
|
137
|
-
if
|
136
|
+
if data_only:
|
137
|
+
parts.append("--data-only")
|
138
|
+
if clean:
|
139
|
+
parts.extend(["--clean", "--if-exists"])
|
140
|
+
if schema is not None:
|
141
|
+
parts.extend([f"--schema={s}" for s in always_iterable(schema)])
|
142
|
+
if schema_exc is not None:
|
143
|
+
parts.extend([f"--exclude-schema={s}" for s in always_iterable(schema_exc)])
|
144
|
+
if table is not None:
|
145
|
+
parts.extend([f"--table={_get_table_name(t)}" for t in always_iterable(table)])
|
146
|
+
if table_exc is not None:
|
138
147
|
parts.extend([
|
139
|
-
f"--exclude-table={_get_table_name(t)}" for t in always_iterable(
|
148
|
+
f"--exclude-table={_get_table_name(t)}" for t in always_iterable(table_exc)
|
140
149
|
])
|
141
150
|
if inserts:
|
142
151
|
parts.append("--inserts")
|
@@ -239,6 +248,7 @@ def _build_pg_restore_or_psql(
|
|
239
248
|
psql: bool = False,
|
240
249
|
database: str | None = None,
|
241
250
|
data_only: bool = False,
|
251
|
+
clean: bool = False,
|
242
252
|
jobs: int | None = None,
|
243
253
|
schemas: MaybeListStr | None = None,
|
244
254
|
schemas_exc: MaybeListStr | None = None,
|
@@ -253,6 +263,7 @@ def _build_pg_restore_or_psql(
|
|
253
263
|
path,
|
254
264
|
database=database,
|
255
265
|
data_only=data_only,
|
266
|
+
clean=clean,
|
256
267
|
jobs=jobs,
|
257
268
|
schemas=schemas,
|
258
269
|
schemas_exc=schemas_exc,
|
@@ -268,6 +279,7 @@ def _build_pg_restore(
|
|
268
279
|
*,
|
269
280
|
database: str | None = None,
|
270
281
|
data_only: bool = False,
|
282
|
+
clean: bool = False,
|
271
283
|
jobs: int | None = None,
|
272
284
|
schemas: MaybeListStr | None = None,
|
273
285
|
schemas_exc: MaybeListStr | None = None,
|
@@ -293,7 +305,7 @@ def _build_pg_restore(
|
|
293
305
|
]
|
294
306
|
if data_only:
|
295
307
|
parts.append("--data-only")
|
296
|
-
|
308
|
+
if clean:
|
297
309
|
parts.extend(["--clean", "--if-exists"])
|
298
310
|
if jobs is not None:
|
299
311
|
parts.append(f"--jobs={jobs}")
|
utilities/typed_settings.py
CHANGED
@@ -7,6 +7,7 @@ from os import environ
|
|
7
7
|
from pathlib import Path
|
8
8
|
from re import search
|
9
9
|
from typing import TYPE_CHECKING, Any, assert_never, override
|
10
|
+
from uuid import UUID
|
10
11
|
|
11
12
|
import typed_settings
|
12
13
|
from typed_settings import EnvLoader, FileLoader, find
|
@@ -62,6 +63,7 @@ class ExtendedTSConverter(TSConverter):
|
|
62
63
|
(PlainDateTime, PlainDateTime.parse_common_iso),
|
63
64
|
(Time, Time.parse_common_iso),
|
64
65
|
(TimeDelta, TimeDelta.parse_common_iso),
|
66
|
+
(UUID, UUID),
|
65
67
|
(YearMonth, YearMonth.parse_common_iso),
|
66
68
|
(ZonedDateTime, ZonedDateTime.parse_common_iso),
|
67
69
|
]
|
File without changes
|
File without changes
|
File without changes
|