dycw-utilities 0.147.1__py3-none-any.whl → 0.147.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.147.1
3
+ Version: 0.147.3
4
4
  Author-email: Derek Wan <d.wan@icloud.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -1,4 +1,4 @@
1
- utilities/__init__.py,sha256=J75bM8p_57A3_ySjPtqrNeaMUduKbBl5noITru0C5Ig,60
1
+ utilities/__init__.py,sha256=CYx_3txVREoGWejJRJBItmHBOZ94QymP1DKxtNU8fIo,60
2
2
  utilities/altair.py,sha256=92E2lCdyHY4Zb-vCw6rEJIsWdKipuu-Tu2ab1ufUfAk,9079
3
3
  utilities/asyncio.py,sha256=aB0EtUbUJ5ZKQ5ET-Xfyx6wfUJG2G4vihEX0blK4TGE,14964
4
4
  utilities/atomicwrites.py,sha256=xcOWenTBRS0oat3kg7Sqe51AohNThMQ2ixPL7QCG8hw,5795
@@ -48,8 +48,8 @@ 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=jAxd0ouhpt5J42JuegcTsR95nFFEYpQw3rYgQQKGFpU,7607
52
- utilities/pottery.py,sha256=doqA59CMGvErUTK3vubTUe1sYqY90VvdnIjws4W5Ta0,6953
51
+ utilities/postgres.py,sha256=dbQrUFOoV6huNeuYTnSpNhSNq-QhXkBfrJPMtoAGJtY,7877
52
+ utilities/pottery.py,sha256=JluZG7SUSw-JnN73_7QV-vJyPrTsct3q86p8eqVUasc,7019
53
53
  utilities/pqdm.py,sha256=BTsYPtbKQWwX-iXF4qCkfPG7DPxIB54J989n83bXrIo,3092
54
54
  utilities/psutil.py,sha256=KUlu4lrUw9Zg1V7ZGetpWpGb9DB8l_SSDWGbANFNCPU,2104
55
55
  utilities/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.147.1.dist-info/METADATA,sha256=eMrWFM8cz1gqxHYD9FBko7fpl62DYiU4auzbbUWXXIA,1697
92
- dycw_utilities-0.147.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- dycw_utilities-0.147.1.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
- dycw_utilities-0.147.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.147.1.dist-info/RECORD,,
91
+ dycw_utilities-0.147.3.dist-info/METADATA,sha256=0s33DB1w4KCYCicIAaLfq_aP_xxUUqvwFV9rpelm0R0,1697
92
+ dycw_utilities-0.147.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ dycw_utilities-0.147.3.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
+ dycw_utilities-0.147.3.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.147.3.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.147.1"
3
+ __version__ = "0.147.3"
utilities/postgres.py CHANGED
@@ -27,6 +27,7 @@ async def pg_dump(
27
27
  path: PathLike,
28
28
  /,
29
29
  *,
30
+ docker: str | None = None,
30
31
  format_: _PGDumpFormat = "plain",
31
32
  jobs: int | None = None,
32
33
  schemas: MaybeListStr | None = None,
@@ -43,7 +44,10 @@ async def pg_dump(
43
44
  raise _PGDumpHostError(url=url)
44
45
  if url.port is None:
45
46
  raise _PGDumpPortError(url=url)
46
- parts: list[str] = [
47
+ parts: list[str] = []
48
+ if docker is not None:
49
+ parts.extend(["docker", "exec", "-it", docker])
50
+ parts.extend([
47
51
  "pg_dump",
48
52
  # general options
49
53
  f"--dbname={url.database}",
@@ -60,7 +64,7 @@ async def pg_dump(
60
64
  f"--host={url.host}",
61
65
  f"--port={url.port}",
62
66
  "--no-password",
63
- ]
67
+ ])
64
68
  if (format_ == "directory") and (jobs is not None):
65
69
  parts.append(f"--jobs={jobs}")
66
70
  if schemas is not None:
@@ -136,6 +140,7 @@ async def pg_restore(
136
140
  /,
137
141
  *,
138
142
  database: str | None = None,
143
+ docker: str | None = None,
139
144
  data_only: bool = False,
140
145
  jobs: int | None = None,
141
146
  schemas: MaybeListStr | None = None,
@@ -157,7 +162,10 @@ async def pg_restore(
157
162
  raise _PGRestoreHostError(url=url)
158
163
  if url.port is None:
159
164
  raise _PGRestorePortError(url=url)
160
- parts: list[str] = [
165
+ parts: list[str] = []
166
+ if docker is not None:
167
+ parts.extend(["docker", "exec", "-it", docker])
168
+ parts.extend([
161
169
  "pg_restore",
162
170
  # general options
163
171
  f"--dbname={database_use}",
@@ -171,7 +179,7 @@ async def pg_restore(
171
179
  f"--host={url.host}",
172
180
  f"--port={url.port}",
173
181
  "--no-password",
174
- ]
182
+ ])
175
183
  if data_only:
176
184
  parts.append("--data-only")
177
185
  else:
utilities/pottery.py CHANGED
@@ -175,7 +175,9 @@ async def _get_first_available_lock(
175
175
  )
176
176
  async with timeout_td(timeout, error=error): # skipif-ci-and-not-linux
177
177
  while True:
178
- if (result := await _get_first_available_lock_if_any(locks)) is not None:
178
+ if (
179
+ (result := await _get_first_available_lock_if_any(locks)) is not None
180
+ ) and (await result.locked() > 0.0):
179
181
  return result
180
182
  await sleep_td(sleep)
181
183