dycw-utilities 0.149.0__py3-none-any.whl → 0.149.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dycw-utilities
3
- Version: 0.149.0
3
+ Version: 0.149.1
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=k25MoUA4CILG827gfaydYpGoUHao6zPu9nXCDQDr9DE,60
1
+ utilities/__init__.py,sha256=JP1_vDjx7triKVpffufyRF4tTLDTrHerAtlEopa1IYA,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
@@ -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=ctSaVXmkMwdjpi90tbC8O-08_30Nck99tdykgJQa8Wo,11672
51
+ utilities/postgres.py,sha256=rMJ2Bp5IzPz365qKy0r80usa7p_3F0bhNjgFDUHA8CY,11847
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
@@ -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.0.dist-info/METADATA,sha256=AYiiL1k_AquVfj8pssxVFgjD65kqRMCb2DEJMXNAz28,1697
92
- dycw_utilities-0.149.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
- dycw_utilities-0.149.0.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
- dycw_utilities-0.149.0.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
- dycw_utilities-0.149.0.dist-info/RECORD,,
91
+ dycw_utilities-0.149.1.dist-info/METADATA,sha256=4gXdqC0JM7T2UI9VWjQkJxq3-eqcaDG3SAEGsoRO01c,1697
92
+ dycw_utilities-0.149.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
93
+ dycw_utilities-0.149.1.dist-info/entry_points.txt,sha256=BOD_SoDxwsfJYOLxhrSXhHP_T7iw-HXI9f2WVkzYxvQ,135
94
+ dycw_utilities-0.149.1.dist-info/licenses/LICENSE,sha256=gppZp16M6nSVpBbUBrNL6JuYfvKwZiKgV7XoKKsHzqo,1066
95
+ dycw_utilities-0.149.1.dist-info/RECORD,,
utilities/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.149.0"
3
+ __version__ = "0.149.1"
utilities/postgres.py CHANGED
@@ -45,7 +45,7 @@ async def pg_dump(
45
45
  logger: LoggerOrName | None = None,
46
46
  ) -> None:
47
47
  """Run `pg_dump`."""
48
- path = Path(path)
48
+ path = _path_pg_dump(path, format_=format_)
49
49
  path.parent.mkdir(parents=True, exist_ok=True)
50
50
  cmd = _build_pg_dump(
51
51
  url,
@@ -107,25 +107,12 @@ def _build_pg_dump(
107
107
  docker: str | None = None,
108
108
  ) -> str:
109
109
  database, host, port = _extract_url(url)
110
- match format_:
111
- case "plain":
112
- suffix = ".sql"
113
- case "custom":
114
- suffix = ".pgdump"
115
- case "directory":
116
- suffix = None
117
- case "tar":
118
- suffix = ".tar"
119
- case _ as never:
120
- assert_never(never)
121
- file = Path(path)
122
- if suffix is not None:
123
- file = ensure_suffix(file, suffix)
110
+ path = _path_pg_dump(path, format_=format_)
124
111
  parts: list[str] = [
125
112
  "pg_dump",
126
113
  # general options
127
114
  f"--dbname={database}",
128
- f"--file={str(file)!r}",
115
+ f"--file={str(path)!r}",
129
116
  f"--format={format_}",
130
117
  "--verbose",
131
118
  # output options
@@ -162,6 +149,24 @@ def _build_pg_dump(
162
149
  return " ".join(parts)
163
150
 
164
151
 
152
+ def _path_pg_dump(path: PathLike, /, *, format_: _PGDumpFormat = "plain") -> Path:
153
+ match format_:
154
+ case "plain":
155
+ suffix = ".sql"
156
+ case "custom":
157
+ suffix = ".pgdump"
158
+ case "directory":
159
+ suffix = None
160
+ case "tar":
161
+ suffix = ".tar"
162
+ case _ as never:
163
+ assert_never(never)
164
+ path = Path(path)
165
+ if suffix is not None:
166
+ path = ensure_suffix(path, suffix)
167
+ return path
168
+
169
+
165
170
  ##
166
171
 
167
172