half-orm-dev 1.0.0a38__py3-none-any.whl → 1.2.0a1__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.
- half_orm_dev/database.py +14 -2
- half_orm_dev/modules.py +68 -21
- half_orm_dev/version.txt +1 -1
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/METADATA +2 -2
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/RECORD +10 -10
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/WHEEL +1 -1
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/entry_points.txt +0 -0
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/licenses/AUTHORS +0 -0
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/licenses/LICENSE +0 -0
- {half_orm_dev-1.0.0a38.dist-info → half_orm_dev-1.2.0a1.dist-info}/top_level.txt +0 -0
half_orm_dev/database.py
CHANGED
|
@@ -1222,8 +1222,20 @@ class Database:
|
|
|
1222
1222
|
if password_input == '':
|
|
1223
1223
|
# Empty password - assume trust/ident authentication
|
|
1224
1224
|
complete_params['password'] = None # Explicitly None for trust mode
|
|
1225
|
-
|
|
1226
|
-
|
|
1225
|
+
|
|
1226
|
+
# A local socket is the default that goes with peer/trust
|
|
1227
|
+
# auth, but a default only: an explicit --host, or PGHOST,
|
|
1228
|
+
# still wins. And the port is left alone so it is resolved
|
|
1229
|
+
# below like every other client tool resolves it - a socket
|
|
1230
|
+
# connection needs it too, since it selects which
|
|
1231
|
+
# .s.PGSQL.<port> to talk to. Forcing both to '' here made
|
|
1232
|
+
# `clone`/`init` ignore --port and PGPORT outright, and
|
|
1233
|
+
# wrote a configuration that named no cluster at all: the
|
|
1234
|
+
# cloned project then only worked in a shell that happened
|
|
1235
|
+
# to export PGPORT.
|
|
1236
|
+
if (complete_params.get('host') is None
|
|
1237
|
+
and os.environ.get('PGHOST') is None):
|
|
1238
|
+
complete_params['host'] = '' # Local socket connection
|
|
1227
1239
|
else:
|
|
1228
1240
|
complete_params['password'] = password_input
|
|
1229
1241
|
|
half_orm_dev/modules.py
CHANGED
|
@@ -645,6 +645,64 @@ def __gen_dc_relation() -> tuple:
|
|
|
645
645
|
return class_str, needed_typing
|
|
646
646
|
|
|
647
647
|
|
|
648
|
+
# The BC_* overrides exist for one reason: narrow the return type to the
|
|
649
|
+
# table's own TypedDict so an IDE resolves it. Everything else about them —
|
|
650
|
+
# the parameter list and the super() call — is Relation's, and is therefore
|
|
651
|
+
# read off Relation itself rather than hand-copied. Hand-copying is what
|
|
652
|
+
# broke: json_agg, added to Relation.ho_select/.ho_aselect in half_orm
|
|
653
|
+
# 0.18.6, was transcribed into the ho_select override only, and since an
|
|
654
|
+
# override shadows the real method, every async list query passing
|
|
655
|
+
# json_agg= raised TypeError.
|
|
656
|
+
#
|
|
657
|
+
# (method, narrowed return annotation, needs `# type: ignore[override]`)
|
|
658
|
+
_BC_OVERRIDES = (
|
|
659
|
+
('ho_select', 'Iterator[{d}]', False),
|
|
660
|
+
('ho_get', '{d}', True),
|
|
661
|
+
('ho_insert', '{d}', True),
|
|
662
|
+
('ho_aselect', 'List[{d}]', False),
|
|
663
|
+
('ho_aget', '{d}', True),
|
|
664
|
+
('ho_ainsert', '{d}', True),
|
|
665
|
+
)
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
def _bc_override(name: str, return_annotation: str, override_ignore: bool) -> str:
|
|
669
|
+
"""One BC_ override: Relation's own parameter list, the narrowed return
|
|
670
|
+
annotation, and a super() call forwarding every parameter it declares.
|
|
671
|
+
|
|
672
|
+
Annotations are rendered by inspect, exactly as __gen_dc_relation does,
|
|
673
|
+
and are safe under the `from __future__ import annotations` the
|
|
674
|
+
generated module starts with — they are never evaluated at runtime.
|
|
675
|
+
"""
|
|
676
|
+
from half_orm.relation import Relation
|
|
677
|
+
|
|
678
|
+
underlying = inspect.getattr_static(Relation, name)
|
|
679
|
+
sig = inspect.signature(underlying)
|
|
680
|
+
params = str(sig.replace(return_annotation=inspect.Signature.empty))
|
|
681
|
+
|
|
682
|
+
forwarded = []
|
|
683
|
+
for param in sig.parameters.values():
|
|
684
|
+
if param.name == 'self':
|
|
685
|
+
continue
|
|
686
|
+
if param.kind is param.VAR_POSITIONAL:
|
|
687
|
+
forwarded.append(f'*{param.name}')
|
|
688
|
+
elif param.kind is param.VAR_KEYWORD:
|
|
689
|
+
forwarded.append(f'**{param.name}')
|
|
690
|
+
elif param.kind is param.KEYWORD_ONLY:
|
|
691
|
+
forwarded.append(f'{param.name}={param.name}')
|
|
692
|
+
else:
|
|
693
|
+
forwarded.append(param.name)
|
|
694
|
+
|
|
695
|
+
is_async = inspect.iscoroutinefunction(underlying)
|
|
696
|
+
def_ = 'async def' if is_async else 'def'
|
|
697
|
+
await_ = 'await ' if is_async else ''
|
|
698
|
+
ignore = ' # type: ignore[override]' if override_ignore else ''
|
|
699
|
+
return '\n'.join([
|
|
700
|
+
f' {def_} {name}{params} -> {return_annotation}:{ignore}',
|
|
701
|
+
f' return {await_}super().{name}({", ".join(forwarded)})'
|
|
702
|
+
f' # type: ignore[return-value]',
|
|
703
|
+
])
|
|
704
|
+
|
|
705
|
+
|
|
648
706
|
def __gen_baseclass(relation, fkeys) -> str:
|
|
649
707
|
"""Generate a BC_* base class string with TypedDict-typed method overrides."""
|
|
650
708
|
rel = relation()
|
|
@@ -656,33 +714,22 @@ def __gen_baseclass(relation, fkeys) -> str:
|
|
|
656
714
|
d = f'{full_name}Dict'
|
|
657
715
|
HO_BASECLASSES_DICT_NAMES.add(d)
|
|
658
716
|
|
|
659
|
-
|
|
717
|
+
header = [
|
|
660
718
|
f"class {bc_name}(",
|
|
661
719
|
f" MODEL.get_relation_class('{fqtn}', fields_aliases=None), # type: ignore[misc]",
|
|
662
720
|
f" {dc_name}",
|
|
663
721
|
f"):",
|
|
664
|
-
|
|
722
|
+
]
|
|
723
|
+
# __iter__ is not a Relation ho_* method — no signature to inherit.
|
|
724
|
+
blocks = [
|
|
725
|
+
f" def __iter__(self) -> Iterator[{d}]:\n"
|
|
665
726
|
f" return super().__iter__() # type: ignore[return-value]",
|
|
666
|
-
f"",
|
|
667
|
-
f" def ho_select(self, *args, distinct: bool = False, order_by: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, json_agg=None) -> Iterator[{d}]:",
|
|
668
|
-
f" return super().ho_select(*args, distinct=distinct, order_by=order_by, limit=limit, offset=offset, json_agg=json_agg) # type: ignore[return-value]",
|
|
669
|
-
f"",
|
|
670
|
-
f" def ho_get(self, *args) -> {d}: # type: ignore[override]",
|
|
671
|
-
f" return super().ho_get(*args) # type: ignore[return-value]",
|
|
672
|
-
f"",
|
|
673
|
-
f" def ho_insert(self, *args, upsert: Optional[bool] = False) -> {d}: # type: ignore[override]",
|
|
674
|
-
f" return super().ho_insert(*args, upsert=upsert) # type: ignore[return-value]",
|
|
675
|
-
f"",
|
|
676
|
-
f" async def ho_aselect(self, *args, distinct: bool = False, order_by: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None) -> List[{d}]:",
|
|
677
|
-
f" return await super().ho_aselect(*args, distinct=distinct, order_by=order_by, limit=limit, offset=offset) # type: ignore[return-value]",
|
|
678
|
-
f"",
|
|
679
|
-
f" async def ho_aget(self, *args) -> {d}: # type: ignore[override]",
|
|
680
|
-
f" return await super().ho_aget(*args) # type: ignore[return-value]",
|
|
681
|
-
f"",
|
|
682
|
-
f" async def ho_ainsert(self, *args, upsert: bool = False) -> {d}: # type: ignore[override]",
|
|
683
|
-
f" return await super().ho_ainsert(*args, upsert=upsert) # type: ignore[return-value]",
|
|
684
727
|
]
|
|
685
|
-
|
|
728
|
+
blocks += [
|
|
729
|
+
_bc_override(name, ret.format(d=d), override_ignore)
|
|
730
|
+
for name, ret, override_ignore in _BC_OVERRIDES
|
|
731
|
+
]
|
|
732
|
+
return '\n'.join(header + ['\n\n'.join(blocks)])
|
|
686
733
|
|
|
687
734
|
|
|
688
735
|
def __reset_baseclasses(repo, package_dir):
|
half_orm_dev/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.2.0-a1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: half_orm_dev
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0a1
|
|
4
4
|
Summary: half_orm development Framework.
|
|
5
5
|
Author-email: Joël Maïzi <joel.maizi@collorg.org>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -25,7 +25,7 @@ Requires-Dist: packaging
|
|
|
25
25
|
Requires-Dist: pydash
|
|
26
26
|
Requires-Dist: pytest
|
|
27
27
|
Requires-Dist: pytest-asyncio
|
|
28
|
-
Requires-Dist: half_orm<1.
|
|
28
|
+
Requires-Dist: half_orm<1.3.0,>=1.2.0a1
|
|
29
29
|
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
30
30
|
Requires-Dist: tomli_w>=1.0.0
|
|
31
31
|
Dynamic: license-file
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
half_orm_dev/__init__.py,sha256=0JpUPey1gacxXuIFGcpD2nTGso73fkak72qzTHttAJk,18
|
|
2
2
|
half_orm_dev/_bootstrap_runner.py,sha256=6SyAXEMvALMA3MFtkoCxQ8hAIDHk_SOmjv8yTsMHg_g,1214
|
|
3
3
|
half_orm_dev/cli_extension.py,sha256=AZ5BxNGzXZcM3_Q7FdRvCNL9Qgr2RYS00GiTgj7cARo,1325
|
|
4
|
-
half_orm_dev/database.py,sha256=
|
|
4
|
+
half_orm_dev/database.py,sha256=1oD8tW-vefS_XWvuG50r-99ogwiwZYpgEYRhTh3LjO8,61777
|
|
5
5
|
half_orm_dev/decorators.py,sha256=xz04vhz34bOLC8tS_0Pd_dr0oScr7lC9VDfPmIcMOp0,6825
|
|
6
6
|
half_orm_dev/file_executor.py,sha256=M6um5wHsiPNPLvndkgbGj__J48zEVeZuGbtKqKukHjQ,11675
|
|
7
7
|
half_orm_dev/hgit.py,sha256=Uw24OQ__O7ViNMJsIgYocaKFpKLkIYGr_RJat87AbGA,71346
|
|
8
8
|
half_orm_dev/migration_manager.py,sha256=cP-LOiX7e9SGrvoBIk2qItqFLXdEBWS0zYOUSq5p87k,30856
|
|
9
|
-
half_orm_dev/modules.py,sha256=
|
|
9
|
+
half_orm_dev/modules.py,sha256=DcxO8KQwyBNawagw54LRjeK9n3PPvaqmUTT3rPu27LU,32911
|
|
10
10
|
half_orm_dev/patch_manager.py,sha256=k1bICZx3zGYqroSqJy4hXlwUOiTlrQ7pgwiEb0F8fyI,124300
|
|
11
11
|
half_orm_dev/patch_validator.py,sha256=QNe1L6k_xwsnrOTcb3vkW2D0LbqrCRcZOGPnVyspVRk,10871
|
|
12
12
|
half_orm_dev/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -15,7 +15,7 @@ half_orm_dev/release_manager.py,sha256=LoF3f5wyCqFV210G_ysJPlVwJ_o21BDP-vYiBc0Xn
|
|
|
15
15
|
half_orm_dev/repo.py,sha256=yNBarqMxwoqh26Wu84v9tANvPC-ZPO4svaMy65xgnLY,124430
|
|
16
16
|
half_orm_dev/utils.py,sha256=5NV9JJZfiTZaWtgvkbbEGJhgVPtyZeXlDkl-RobnHJI,1625
|
|
17
17
|
half_orm_dev/venv_setup.py,sha256=baC8KWzrJ1pll1HL1QMy7zceilMVBduhLuPpC4VMKTc,2238
|
|
18
|
-
half_orm_dev/version.txt,sha256=
|
|
18
|
+
half_orm_dev/version.txt,sha256=NjRXdYws7lsaZ4WYLnX3bIbeVtYled1kTOccNCIXdJ0,9
|
|
19
19
|
half_orm_dev/cli/__init__.py,sha256=0CbMj8OIhZmglWakK7NhYPn302erUTEg2VHOdm1hRTQ,163
|
|
20
20
|
half_orm_dev/cli/main.py,sha256=9QWqSw004tAIh2UDN36HuZhXmznSesHTQV7oczKC0H0,14767
|
|
21
21
|
half_orm_dev/cli/commands/__init__.py,sha256=X-0RWsRIeqTBV03G_VK0fAmeZUcWdNy_LCkEeyNHBQs,1669
|
|
@@ -69,10 +69,10 @@ half_orm_dev/templates/git-hooks/pre-commit,sha256=V0uFzmxDK1jAYZzY_qWx6VuUwTUPI
|
|
|
69
69
|
half_orm_dev/templates/git-hooks/pre-push,sha256=7TsdE7oo7eMT7R_Tlu5P_WhHAx1aTHVFb9y-RdRB1q0,660
|
|
70
70
|
half_orm_dev/templates/git-hooks/prepare-commit-msg,sha256=zknOGGoaWKC97zfga2Xl2i_psnNo9MJbrEBuN91eHNw,1070
|
|
71
71
|
half_orm_dev/templates/git-hooks/reference-transaction,sha256=NfOCL7GOVpUPydNd3KxNKrZcLL1xfyPIPnH-hym1Ezc,908
|
|
72
|
-
half_orm_dev-1.
|
|
73
|
-
half_orm_dev-1.
|
|
74
|
-
half_orm_dev-1.
|
|
75
|
-
half_orm_dev-1.
|
|
76
|
-
half_orm_dev-1.
|
|
77
|
-
half_orm_dev-1.
|
|
78
|
-
half_orm_dev-1.
|
|
72
|
+
half_orm_dev-1.2.0a1.dist-info/licenses/AUTHORS,sha256=eWxqzRdLOt2gX0FMQj_wui03Od3jdlwa8xNe9tl84g0,113
|
|
73
|
+
half_orm_dev-1.2.0a1.dist-info/licenses/LICENSE,sha256=ufhxlSi6mttkGQTsGWrEoB3WA_fCPJ6-k07GSVBgyPw,644
|
|
74
|
+
half_orm_dev-1.2.0a1.dist-info/METADATA,sha256=_6ZHMdRPGsw4KPpmuVKeSnw6RJb4OgE3Zym7f7b_8Tk,18998
|
|
75
|
+
half_orm_dev-1.2.0a1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
76
|
+
half_orm_dev-1.2.0a1.dist-info/entry_points.txt,sha256=nqKmPzobb2XqO-y-rsh0nKL4peBvzLmo2mQID9Jrxpw,47
|
|
77
|
+
half_orm_dev-1.2.0a1.dist-info/top_level.txt,sha256=M5hEsWfn5Kw0HL-VnNmS6Jw-3cwRyjims5a8cr18eTM,13
|
|
78
|
+
half_orm_dev-1.2.0a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|