omdev 0.0.0.dev324__py3-none-any.whl → 0.0.0.dev326__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.
- omdev/manifests/dumping.py +29 -8
- {omdev-0.0.0.dev324.dist-info → omdev-0.0.0.dev326.dist-info}/METADATA +2 -2
- {omdev-0.0.0.dev324.dist-info → omdev-0.0.0.dev326.dist-info}/RECORD +7 -7
- {omdev-0.0.0.dev324.dist-info → omdev-0.0.0.dev326.dist-info}/WHEEL +0 -0
- {omdev-0.0.0.dev324.dist-info → omdev-0.0.0.dev326.dist-info}/entry_points.txt +0 -0
- {omdev-0.0.0.dev324.dist-info → omdev-0.0.0.dev326.dist-info}/licenses/LICENSE +0 -0
- {omdev-0.0.0.dev324.dist-info → omdev-0.0.0.dev326.dist-info}/top_level.txt +0 -0
omdev/manifests/dumping.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ruff: noqa: UP006 UP007
|
1
|
+
# ruff: noqa: UP006 UP007 UP037
|
2
2
|
import typing as ta
|
3
3
|
|
4
4
|
|
@@ -7,6 +7,27 @@ class _ModuleManifestDumper:
|
|
7
7
|
super().__init__()
|
8
8
|
|
9
9
|
self._spec = spec
|
10
|
+
self._imported_mod: 'ta.Optional[ta.Any]' = None
|
11
|
+
|
12
|
+
def _mod(self) -> 'ta.Any':
|
13
|
+
if (mod := self._imported_mod) is not None:
|
14
|
+
return mod
|
15
|
+
|
16
|
+
import importlib
|
17
|
+
|
18
|
+
mod = importlib.import_module(self._spec)
|
19
|
+
|
20
|
+
self._imported_mod = mod
|
21
|
+
return mod
|
22
|
+
|
23
|
+
class _LazyGlobals(dict):
|
24
|
+
def __init__(self, get_missing: 'ta.Callable[[str], ta.Any]') -> None:
|
25
|
+
super().__init__()
|
26
|
+
|
27
|
+
self.__get_missing = get_missing
|
28
|
+
|
29
|
+
def __missing__(self, key):
|
30
|
+
return self.__get_missing(key)
|
10
31
|
|
11
32
|
def __call__(self, *targets: dict) -> None:
|
12
33
|
import collections.abc
|
@@ -15,9 +36,7 @@ class _ModuleManifestDumper:
|
|
15
36
|
import importlib
|
16
37
|
import json
|
17
38
|
|
18
|
-
|
19
|
-
|
20
|
-
cls: ta.Any
|
39
|
+
cls: 'ta.Any'
|
21
40
|
|
22
41
|
out = []
|
23
42
|
for target in targets:
|
@@ -25,7 +44,7 @@ class _ModuleManifestDumper:
|
|
25
44
|
|
26
45
|
if target['kind'] == 'attr':
|
27
46
|
attr = target['attr']
|
28
|
-
manifest = getattr(
|
47
|
+
manifest = getattr(self._mod(), attr)
|
29
48
|
|
30
49
|
if dc.is_dataclass(manifest):
|
31
50
|
# Support static dataclasses
|
@@ -70,10 +89,12 @@ class _ModuleManifestDumper:
|
|
70
89
|
|
71
90
|
cls_fac = functools.partial(cls, **target['kwargs'])
|
72
91
|
eval_attr_name = '__manifest_factory__'
|
73
|
-
|
74
|
-
|
92
|
+
|
93
|
+
inl_glo = self._LazyGlobals(lambda k: getattr(self._mod(), k))
|
94
|
+
inl_glo.update({
|
75
95
|
eval_attr_name: cls_fac,
|
76
|
-
}
|
96
|
+
})
|
97
|
+
|
77
98
|
inl_src = eval_attr_name + target['init_src']
|
78
99
|
inl_code = compile(inl_src, '<magic>', 'eval')
|
79
100
|
manifest = eval(inl_code, inl_glo) # noqa
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: omdev
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev326
|
4
4
|
Summary: omdev
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
13
13
|
Requires-Python: >=3.12
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: omlish==0.0.0.
|
15
|
+
Requires-Dist: omlish==0.0.0.dev326
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: black~=25.1; extra == "all"
|
18
18
|
Requires-Dist: pycparser~=2.22; extra == "all"
|
@@ -165,7 +165,7 @@ omdev/magic/styles.py,sha256=pYI57zFBxcaZAeyQaDtU1L6oVvdPQiB7ADaBKoUI7Q8,659
|
|
165
165
|
omdev/manifests/__init__.py,sha256=Y3l4WY4JRi2uLG6kgbGp93fuGfkxkKwZDvhsa0Rwgtk,15
|
166
166
|
omdev/manifests/__main__.py,sha256=JqyVDyV7_jo-NZ3wSs5clDU_xCMlxzJv-XFohoZWQ7E,174
|
167
167
|
omdev/manifests/build.py,sha256=1Ah6NhNylAT-bIfDlKDOVlfitxe9UNYPudOwxO0s1aY,10025
|
168
|
-
omdev/manifests/dumping.py,sha256=
|
168
|
+
omdev/manifests/dumping.py,sha256=Cj0IbuHVS_Xgvj3H7wZr76UTsDuF_LBgca0BocgMV9I,4048
|
169
169
|
omdev/manifests/main.py,sha256=7zRlyE0BDPqITEbChlTBRGulAvG1nUZPHXrerNExriE,2126
|
170
170
|
omdev/mypy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
171
171
|
omdev/mypy/debug.py,sha256=VskRcr9trNhyPG2ErZZ7IX_v1DLKTLBOjp34o-fEWaM,3294
|
@@ -295,9 +295,9 @@ omdev/tools/json/rendering.py,sha256=3HhdlKSetS6iK1tjF2aILzsl8Mb3D8wW92vYwGpRdVA
|
|
295
295
|
omdev/tools/pawk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
296
296
|
omdev/tools/pawk/__main__.py,sha256=VCqeRVnqT1RPEoIrqHFSu4PXVMg4YEgF4qCQm90-eRI,66
|
297
297
|
omdev/tools/pawk/pawk.py,sha256=zsEkfQX0jF5bn712uqPAyBSdJt2dno1LH2oeSMNfXQI,11424
|
298
|
-
omdev-0.0.0.
|
299
|
-
omdev-0.0.0.
|
300
|
-
omdev-0.0.0.
|
301
|
-
omdev-0.0.0.
|
302
|
-
omdev-0.0.0.
|
303
|
-
omdev-0.0.0.
|
298
|
+
omdev-0.0.0.dev326.dist-info/licenses/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
299
|
+
omdev-0.0.0.dev326.dist-info/METADATA,sha256=FmWy3rprjDSjibWIe6umKnDU_NTbCKFxOOx68p8JC-k,1674
|
300
|
+
omdev-0.0.0.dev326.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
301
|
+
omdev-0.0.0.dev326.dist-info/entry_points.txt,sha256=dHLXFmq5D9B8qUyhRtFqTGWGxlbx3t5ejedjrnXNYLU,33
|
302
|
+
omdev-0.0.0.dev326.dist-info/top_level.txt,sha256=1nr7j30fEWgLYHW3lGR9pkdHkb7knv1U1ES1XRNVQ6k,6
|
303
|
+
omdev-0.0.0.dev326.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|