dycw-utilities 0.153.4__py3-none-any.whl → 0.153.6__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.153.4.dist-info → dycw_utilities-0.153.6.dist-info}/METADATA +1 -1
- {dycw_utilities-0.153.4.dist-info → dycw_utilities-0.153.6.dist-info}/RECORD +8 -8
- utilities/__init__.py +1 -1
- utilities/postgres.py +31 -35
- utilities/types.py +2 -0
- {dycw_utilities-0.153.4.dist-info → dycw_utilities-0.153.6.dist-info}/WHEEL +0 -0
- {dycw_utilities-0.153.4.dist-info → dycw_utilities-0.153.6.dist-info}/entry_points.txt +0 -0
- {dycw_utilities-0.153.4.dist-info → dycw_utilities-0.153.6.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
utilities/__init__.py,sha256=
|
1
|
+
utilities/__init__.py,sha256=gelDBvNPti9WhOMyN_KBRYuYlRRQPEiso1hUP-4cRqk,60
|
2
2
|
utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
|
3
3
|
utilities/asyncio.py,sha256=QXkTtugXkqtYt7Do23zgYErqzdp6jwzPpV_SP9fJ1gI,16780
|
4
4
|
utilities/atomicwrites.py,sha256=tPo6r-Rypd9u99u66B9z86YBPpnLrlHtwox_8Z7T34Y,5790
|
@@ -47,7 +47,7 @@ utilities/pickle.py,sha256=MBT2xZCsv0pH868IXLGKnlcqNx2IRVKYNpRcqiQQqxw,653
|
|
47
47
|
utilities/platform.py,sha256=pTn7gw6N4T6LdKrf0virwarof_mze9WtoQlrGMzhGVI,2798
|
48
48
|
utilities/polars.py,sha256=jNUs038dJMZ0-r3rmHFClIzHlx3naA9klgYBvRDJi9w,77738
|
49
49
|
utilities/polars_ols.py,sha256=Uc9V5kvlWZ5cU93lKZ-cfAKdVFFw81tqwLW9PxtUvMs,5618
|
50
|
-
utilities/postgres.py,sha256=
|
50
|
+
utilities/postgres.py,sha256=ynCTTaF-bVEOSW-KEAR-dlLh_hYjeVVjm__-4pEU8Zk,12269
|
51
51
|
utilities/pottery.py,sha256=HJ96oLRarTP37Vhg0WTyB3yAu2hETeg6HgRmpDIqyUs,6581
|
52
52
|
utilities/pqdm.py,sha256=z8bSMS7QJmWun65FQZruAqT-R3wqPAzNzhWcX9Nvr0A,3087
|
53
53
|
utilities/psutil.py,sha256=KUlu4lrUw9Zg1V7ZGetpWpGb9DB8l_SSDWGbANFNCPU,2104
|
@@ -74,7 +74,7 @@ utilities/threading.py,sha256=GvBOp4CyhHfN90wGXZuA2VKe9fGzMaEa7oCl4f3nnPU,1009
|
|
74
74
|
utilities/timer.py,sha256=oXfTii6ymu57niP0BDGZjFD55LEHi2a19kqZKiTgaFQ,2588
|
75
75
|
utilities/traceback.py,sha256=e0BpxNMybVmELHGsYM5N6LVbfmn0jLhefLoa81NjZBg,9100
|
76
76
|
utilities/typed_settings.py,sha256=SFWqS3lAzV7IfNRwqFcTk0YynTcQ7BmrcW2mr_KUnos,4466
|
77
|
-
utilities/types.py,sha256=
|
77
|
+
utilities/types.py,sha256=L4cjFPyFZX58Urfw0S_i-XRywPIFyuSLOieewj0qqsM,18516
|
78
78
|
utilities/typing.py,sha256=Z-_XDaWyT_6wIo3qfNK-hvRlzxP2Jxa9PgXzm5rDYRA,13790
|
79
79
|
utilities/tzdata.py,sha256=fgNVj66yUbCSI_-vrRVzSD3gtf-L_8IEJEPjP_Jel5Y,266
|
80
80
|
utilities/tzlocal.py,sha256=KyCXEgCTjqGFx-389JdTuhMRUaT06U1RCMdWoED-qro,728
|
@@ -87,8 +87,8 @@ utilities/zoneinfo.py,sha256=FBMcUQ4662Aq8SsuCL1OAhDQiyANmVjtb-C30DRrWoE,1966
|
|
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.153.
|
91
|
-
dycw_utilities-0.153.
|
92
|
-
dycw_utilities-0.153.
|
93
|
-
dycw_utilities-0.153.
|
94
|
-
dycw_utilities-0.153.
|
90
|
+
dycw_utilities-0.153.6.dist-info/METADATA,sha256=AGj_Bwrc6MkIwihO_NZQdNmOwEWLp1tNiN5Voz2g3So,1696
|
91
|
+
dycw_utilities-0.153.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
92
|
+
dycw_utilities-0.153.6.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
|
93
|
+
dycw_utilities-0.153.6.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
|
94
|
+
dycw_utilities-0.153.6.dist-info/RECORD,,
|
utilities/__init__.py
CHANGED
utilities/postgres.py
CHANGED
@@ -54,7 +54,7 @@ async def pg_dump(
|
|
54
54
|
docker: str | None = None,
|
55
55
|
dry_run: bool = False,
|
56
56
|
logger: LoggerLike | None = None,
|
57
|
-
) ->
|
57
|
+
) -> bool:
|
58
58
|
"""Run `pg_dump`."""
|
59
59
|
path = _path_pg_dump(path, format_=format_)
|
60
60
|
path.parent.mkdir(parents=True, exist_ok=True)
|
@@ -80,7 +80,7 @@ async def pg_dump(
|
|
80
80
|
if dry_run:
|
81
81
|
if logger is not None:
|
82
82
|
to_logger(logger).info("Would run:\n\t%r", str(cmd))
|
83
|
-
return
|
83
|
+
return True
|
84
84
|
with temp_environ(PGPASSWORD=url.password), Timer() as timer: # pragma: no cover
|
85
85
|
try:
|
86
86
|
output = await stream_command(cmd)
|
@@ -90,22 +90,20 @@ async def pg_dump(
|
|
90
90
|
"Cancelled backup to %r after %s", str(path), timer
|
91
91
|
)
|
92
92
|
rmtree(path, ignore_errors=True)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
)
|
108
|
-
rmtree(path, ignore_errors=True)
|
93
|
+
return False
|
94
|
+
if output.return_code != 0:
|
95
|
+
if logger is not None:
|
96
|
+
to_logger(logger).exception(
|
97
|
+
"Backup to %r failed after %s\nstderr:\n%s",
|
98
|
+
str(path),
|
99
|
+
timer,
|
100
|
+
output.stderr,
|
101
|
+
)
|
102
|
+
rmtree(path, ignore_errors=True)
|
103
|
+
return False
|
104
|
+
if logger is not None: # pragma: no cover
|
105
|
+
to_logger(logger).info("Backup to %r finished after %s", str(path), timer)
|
106
|
+
return True # pragma: no cover
|
109
107
|
|
110
108
|
|
111
109
|
def _build_pg_dump(
|
@@ -218,7 +216,7 @@ async def restore(
|
|
218
216
|
docker: str | None = None,
|
219
217
|
dry_run: bool = False,
|
220
218
|
logger: LoggerLike | None = None,
|
221
|
-
) ->
|
219
|
+
) -> bool:
|
222
220
|
"""Run `pg_restore`/`psql`."""
|
223
221
|
cmd = _build_pg_restore_or_psql(
|
224
222
|
url,
|
@@ -237,7 +235,7 @@ async def restore(
|
|
237
235
|
if dry_run:
|
238
236
|
if logger is not None:
|
239
237
|
to_logger(logger).info("Would run:\n\t%r", str(cmd))
|
240
|
-
return
|
238
|
+
return True
|
241
239
|
with temp_environ(PGPASSWORD=url.password), Timer() as timer: # pragma: no cover
|
242
240
|
try:
|
243
241
|
output = await stream_command(cmd)
|
@@ -246,21 +244,19 @@ async def restore(
|
|
246
244
|
to_logger(logger).info(
|
247
245
|
"Cancelled restore from %r after %s", str(path), timer
|
248
246
|
)
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
output.stderr,
|
263
|
-
)
|
247
|
+
return False
|
248
|
+
if output.return_code != 0:
|
249
|
+
if logger is not None:
|
250
|
+
to_logger(logger).exception(
|
251
|
+
"Restore from %r failed after %s\nstderr:\n%s",
|
252
|
+
str(path),
|
253
|
+
timer,
|
254
|
+
output.stderr,
|
255
|
+
)
|
256
|
+
return False
|
257
|
+
if logger is not None: # pragma: no cover
|
258
|
+
to_logger(logger).info("Restore from %r finished after %s", str(path), timer)
|
259
|
+
return True # pragma: no cover
|
264
260
|
|
265
261
|
|
266
262
|
##
|
utilities/types.py
CHANGED
@@ -118,6 +118,7 @@ IPv6AddressLike = MaybeStr[IPv6Address]
|
|
118
118
|
type MaybeCollection[T] = T | Collection[T]
|
119
119
|
type MaybeIterable[T] = T | Iterable[T]
|
120
120
|
type MaybeList[T] = T | list[T]
|
121
|
+
type MaybeSet[T] = T | set[T] | frozenset[T]
|
121
122
|
type SequenceLT[T] = list[T] | tuple[T, ...]
|
122
123
|
# iterables - dervied
|
123
124
|
type MaybeSequence[T] = T | SequenceLT[T]
|
@@ -303,6 +304,7 @@ __all__ = [
|
|
303
304
|
"MaybeList",
|
304
305
|
"MaybeSequence",
|
305
306
|
"MaybeSequenceStr",
|
307
|
+
"MaybeSet",
|
306
308
|
"MaybeStr",
|
307
309
|
"MaybeType",
|
308
310
|
"MonthDayLike",
|
File without changes
|
File without changes
|
File without changes
|