hydra-python 0.17.3__tar.gz → 0.17.4__tar.gz
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.
- {hydra_python-0.17.3 → hydra_python-0.17.4}/PKG-INFO +2 -2
- hydra_python-0.17.4/build/main/digest.json +123 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/pyproject.toml +2 -2
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/dsl/python/environment.py +90 -3
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/dsl/python/names.py +10 -6
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/dsl/python/utils.py +8 -5
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/coder.py +76 -35
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/environment.py +9 -1
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/names.py +20 -10
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/serde.py +22 -10
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/testing.py +5 -2
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/utils.py +9 -7
- hydra_python-0.17.3/build/main/digest.json +0 -55
- {hydra_python-0.17.3 → hydra_python-0.17.4}/.gitignore +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/LICENSE +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/NOTICE +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/README.md +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/dsl/python/syntax.py +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/language.py +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/pyproject.py +0 -0
- {hydra_python-0.17.3 → hydra_python-0.17.4}/src/main/python/hydra/python/syntax.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hydra-python
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.4
|
|
4
4
|
Summary: Python support for Hydra
|
|
5
5
|
Project-URL: Homepage, https://github.com/CategoricalData/hydra
|
|
6
6
|
Project-URL: Repository, https://github.com/CategoricalData/hydra
|
|
@@ -9,7 +9,7 @@ License: Apache-2.0
|
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
License-File: NOTICE
|
|
11
11
|
Requires-Python: >=3.12
|
|
12
|
-
Requires-Dist: hydra-kernel==0.17.
|
|
12
|
+
Requires-Dist: hydra-kernel==0.17.4
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
|
|
15
15
|
# Hydra-Python
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"digestFormatVersion": 2,
|
|
3
|
+
"moduleFormatVersion": 1,
|
|
4
|
+
"generator": "2c0ecf5e44272577",
|
|
5
|
+
"generation": {
|
|
6
|
+
"generatorId": "2c0ecf5e44272577",
|
|
7
|
+
"mode": "published",
|
|
8
|
+
"host": "python",
|
|
9
|
+
"hydraVersion": "0.17.3",
|
|
10
|
+
"revision": "39f38e98ce",
|
|
11
|
+
"timestamp": "2026-08-10T00:06:14Z"},
|
|
12
|
+
"selfHash": "979ad9fa2784665ae8639c0a37ac80ed296d12c8524c0766c21cd7a8802e2965",
|
|
13
|
+
"dependencyHashes": [{"key": "hydra-kernel", "value": "2af6a4dff2fbf02f4859ca5f0c222c44c9ab9ce5345d26abcf7c6e39f90b5bcb"}],
|
|
14
|
+
"inputs": [
|
|
15
|
+
{
|
|
16
|
+
"key": "hydra.python.coder",
|
|
17
|
+
"value": {"kind": "other", "hash": "33c5deb31968c9c0d41834301852b38d617cdcf7453d0115b75e693c8683401a"}},
|
|
18
|
+
{
|
|
19
|
+
"key": "hydra.python.environment",
|
|
20
|
+
"value": {"kind": "other", "hash": "663b02271ddd4a6ad9ab8a2bdc152a64802a675a59280909f605d6dedcc4017e"}},
|
|
21
|
+
{
|
|
22
|
+
"key": "hydra.python.language",
|
|
23
|
+
"value": {"kind": "other", "hash": "78fb867a1d0fa6654f46f5d9fd72c2c5607d2934b7c7fbd5f5d830786b4ad91e"}},
|
|
24
|
+
{
|
|
25
|
+
"key": "hydra.python.names",
|
|
26
|
+
"value": {"kind": "other", "hash": "87bfa00de69547fcb4a14b69a56be98d3f612dcd52b76063153365c375ce91e4"}},
|
|
27
|
+
{
|
|
28
|
+
"key": "hydra.python.pyproject",
|
|
29
|
+
"value": {"kind": "other", "hash": "249512648b2b008db234ee348a72056d4d625cfeb0a80d8caacbda95002569a2"}},
|
|
30
|
+
{
|
|
31
|
+
"key": "hydra.python.serde",
|
|
32
|
+
"value": {"kind": "other", "hash": "9285fa0296e940da1de51a53465598455c46404851aefc2ce15220fc6ee7efc6"}},
|
|
33
|
+
{
|
|
34
|
+
"key": "hydra.python.syntax",
|
|
35
|
+
"value": {"kind": "other", "hash": "88a9154b48fd429f06efa0ba8981bdf12af3fed4de5a057b3304fadc623dbc19"}},
|
|
36
|
+
{
|
|
37
|
+
"key": "hydra.python.testing",
|
|
38
|
+
"value": {"kind": "other", "hash": "a40b949c594c81f8925ba423a89e46964b2b1475d44a486aa07c792c2c7f807b"}},
|
|
39
|
+
{
|
|
40
|
+
"key": "hydra.python.utils",
|
|
41
|
+
"value": {"kind": "other", "hash": "b026355e1174d4573e14ee1a932a17e1d28cef3559f2f85a330d279b543598a3"}},
|
|
42
|
+
{
|
|
43
|
+
"key": "jsonContent:hydra/dsl/python/environment.json",
|
|
44
|
+
"value": {"kind": "other", "hash": "684965cea67ad57d492b50f408c6575f679b073c5de5e76826fb0941da86ec21"}},
|
|
45
|
+
{
|
|
46
|
+
"key": "jsonContent:hydra/dsl/python/names.json",
|
|
47
|
+
"value": {"kind": "other", "hash": "2118b0194fde923feeda9877728e6a50813601ad5892dc122f3cf577e35bff6f"}},
|
|
48
|
+
{
|
|
49
|
+
"key": "jsonContent:hydra/dsl/python/syntax.json",
|
|
50
|
+
"value": {"kind": "other", "hash": "a99b94b1f3e542d606da15fd6dafa32d858ce7d71ba02f7b21d8bb4881daa4e3"}},
|
|
51
|
+
{
|
|
52
|
+
"key": "jsonContent:hydra/dsl/python/utils.json",
|
|
53
|
+
"value": {"kind": "other", "hash": "7a3b84d522c420db0db03a77f9e54635b33544f73eb49ed67cdc3a4d5dac04ae"}},
|
|
54
|
+
{
|
|
55
|
+
"key": "jsonContent:hydra/python/coder.json",
|
|
56
|
+
"value": {"kind": "other", "hash": "ec4263eccf7a8dd826d44cea6aa4fc112cf7a6eda6c4d1ffd54cda0387e60729"}},
|
|
57
|
+
{
|
|
58
|
+
"key": "jsonContent:hydra/python/environment.json",
|
|
59
|
+
"value": {"kind": "other", "hash": "889380dd3664c763437475b2e5146b38f865f4a20a308332633a33a4d038fce1"}},
|
|
60
|
+
{
|
|
61
|
+
"key": "jsonContent:hydra/python/language.json",
|
|
62
|
+
"value": {"kind": "other", "hash": "221e68d68030945db181fdd079be4ff619cb4cd1ad5d4b72b4e70f2aa1bd5230"}},
|
|
63
|
+
{
|
|
64
|
+
"key": "jsonContent:hydra/python/names.json",
|
|
65
|
+
"value": {"kind": "other", "hash": "7af58464067c990f8acdeb9399a217ee8b345e712927619b163eb18a1fd18a4a"}},
|
|
66
|
+
{
|
|
67
|
+
"key": "jsonContent:hydra/python/pyproject.json",
|
|
68
|
+
"value": {"kind": "other", "hash": "c94de46f1615e6e82d2f706d01ef04293373f6241a9a42882bb394d51b4f7f53"}},
|
|
69
|
+
{
|
|
70
|
+
"key": "jsonContent:hydra/python/serde.json",
|
|
71
|
+
"value": {"kind": "other", "hash": "648d34f63d2336972d5e0a59d4871332a07bd35c88eb38c28236e16a7fd48601"}},
|
|
72
|
+
{
|
|
73
|
+
"key": "jsonContent:hydra/python/syntax.json",
|
|
74
|
+
"value": {"kind": "other", "hash": "8dc3a26ac927fa338b273c9deee6317906977a2deec4c2df1e44ff0bbe0a64cd"}},
|
|
75
|
+
{
|
|
76
|
+
"key": "jsonContent:hydra/python/testing.json",
|
|
77
|
+
"value": {"kind": "other", "hash": "9c75b534004194396935b1dd3331bae4d8d5cbb31c3959fa3794dda00960c09a"}},
|
|
78
|
+
{
|
|
79
|
+
"key": "jsonContent:hydra/python/utils.json",
|
|
80
|
+
"value": {"kind": "other", "hash": "9fe5863fa3b3fb7b87b97041336ac5ff947f69e9bc7a8c2667f0bfc217bed724"}},
|
|
81
|
+
{
|
|
82
|
+
"key": "jsonContent:manifest.json",
|
|
83
|
+
"value": {"kind": "other", "hash": "3f94b521766d042381d7bee84596308ea4e35c7e8fb45f8fd8338a8dbe27a0ac"}}],
|
|
84
|
+
"outputs": [
|
|
85
|
+
{
|
|
86
|
+
"key": "hydra/dsl/python/environment.py",
|
|
87
|
+
"value": {"kind": "targetFile", "hash": "17b22fcaf759f776c959d41a749f506ff3c302815791e189a506c3f1af344f2c"}},
|
|
88
|
+
{
|
|
89
|
+
"key": "hydra/dsl/python/names.py",
|
|
90
|
+
"value": {"kind": "targetFile", "hash": "c571b01c5d149d3e6f587ef4524c5b065dae0ffba1b44617197f68fc1a6122fb"}},
|
|
91
|
+
{
|
|
92
|
+
"key": "hydra/dsl/python/syntax.py",
|
|
93
|
+
"value": {"kind": "targetFile", "hash": "5fe1c0c739cdac68d1b90d768153e23ebe7c805bafb96ac698a95425e2d7d7b5"}},
|
|
94
|
+
{
|
|
95
|
+
"key": "hydra/dsl/python/utils.py",
|
|
96
|
+
"value": {"kind": "targetFile", "hash": "3fed9996a3f875a53675b6c8620884949adf7d155b0e68cacfba9007d5d07b29"}},
|
|
97
|
+
{
|
|
98
|
+
"key": "hydra/python/coder.py",
|
|
99
|
+
"value": {"kind": "targetFile", "hash": "5dc0e92942be490ab049f187918a038b39c40ded8975445966c626eae6f32753"}},
|
|
100
|
+
{
|
|
101
|
+
"key": "hydra/python/environment.py",
|
|
102
|
+
"value": {"kind": "targetFile", "hash": "1036eb9d285ba3e98c85095820f2e77900334340c9f0223fd4dfd6b3e847f4df"}},
|
|
103
|
+
{
|
|
104
|
+
"key": "hydra/python/language.py",
|
|
105
|
+
"value": {"kind": "targetFile", "hash": "7ea0c3a6015ec1de92aebeed0963c1af9f3b70c8d57815e477c528c795383604"}},
|
|
106
|
+
{
|
|
107
|
+
"key": "hydra/python/names.py",
|
|
108
|
+
"value": {"kind": "targetFile", "hash": "13c7f477a13848ed7636bf773aac098599466964c2db5c35472f53b1152b05a2"}},
|
|
109
|
+
{
|
|
110
|
+
"key": "hydra/python/pyproject.py",
|
|
111
|
+
"value": {"kind": "targetFile", "hash": "1f9001d8d2273d4783105e099b874c273ce520b58456f9b447cb8d5e9a6a37d7"}},
|
|
112
|
+
{
|
|
113
|
+
"key": "hydra/python/serde.py",
|
|
114
|
+
"value": {"kind": "targetFile", "hash": "43864d35b843e14c2ee78fc5ee22e88f61d049ace6d9e951d34dbdfa242662f9"}},
|
|
115
|
+
{
|
|
116
|
+
"key": "hydra/python/syntax.py",
|
|
117
|
+
"value": {"kind": "targetFile", "hash": "24a72af882b47d80cc930f16f51a3e9c1a71c9d8da47a921829f40e847459fca"}},
|
|
118
|
+
{
|
|
119
|
+
"key": "hydra/python/testing.py",
|
|
120
|
+
"value": {"kind": "targetFile", "hash": "069c706253e0c41695c8becd42c27c84b7f6ac54b14be14975757ff09416ba92"}},
|
|
121
|
+
{
|
|
122
|
+
"key": "hydra/python/utils.py",
|
|
123
|
+
"value": {"kind": "targetFile", "hash": "7264b5ca536314e0523ccf46f069ab06dea099d68b2c3459d58ab2c989dc51c6"}}]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
[project]
|
|
15
15
|
name = "hydra-python"
|
|
16
|
-
version = "0.17.
|
|
16
|
+
version = "0.17.4"
|
|
17
17
|
description = "Python support for Hydra"
|
|
18
18
|
readme = "README.md"
|
|
19
19
|
requires-python = ">=3.12"
|
|
@@ -22,7 +22,7 @@ authors = [
|
|
|
22
22
|
{ name = "Joshua Shinavier", email = "josh@fortytwo.net" },
|
|
23
23
|
]
|
|
24
24
|
dependencies = [
|
|
25
|
-
"hydra-kernel == 0.17.
|
|
25
|
+
"hydra-kernel == 0.17.4",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.urls]
|
|
@@ -68,7 +68,8 @@ graph: hydra.typed.TypedTerm[hydra.graph.Graph],
|
|
|
68
68
|
nullary_bindings: hydra.typed.TypedTerm[Set[hydra.core.Name]],
|
|
69
69
|
version: hydra.typed.TypedTerm[hydra.python.environment.PythonVersion],
|
|
70
70
|
skip_casts: hydra.typed.TypedTerm[bool],
|
|
71
|
-
inline_variables: hydra.typed.TypedTerm[Set[hydra.core.Name]]
|
|
71
|
+
inline_variables: hydra.typed.TypedTerm[Set[hydra.core.Name]],
|
|
72
|
+
overlay_subs: hydra.typed.TypedTerm[Set[str]]) -> hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment]:
|
|
72
73
|
r"""DSL constructor for hydra.python.environment.PythonEnvironment."""
|
|
73
74
|
|
|
74
75
|
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
@@ -79,7 +80,8 @@ inline_variables: hydra.typed.TypedTerm[Set[hydra.core.Name]]) -> hydra.typed.Ty
|
|
|
79
80
|
hydra.core.Field(hydra.core.Name("nullaryBindings"), nullary_bindings.value),
|
|
80
81
|
hydra.core.Field(hydra.core.Name("version"), version.value),
|
|
81
82
|
hydra.core.Field(hydra.core.Name("skipCasts"), skip_casts.value),
|
|
82
|
-
hydra.core.Field(hydra.core.Name("inlineVariables"), inline_variables.value)
|
|
83
|
+
hydra.core.Field(hydra.core.Name("inlineVariables"), inline_variables.value),
|
|
84
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"), overlay_subs.value))))))
|
|
83
85
|
|
|
84
86
|
def python_environment_bound_type_variables(x: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment]) -> hydra.typed.TypedTerm[tuple[Sequence[hydra.core.Name], Mapping[hydra.core.Name, hydra.python.syntax.Name]]]:
|
|
85
87
|
r"""DSL accessor for the boundTypeVariables field of hydra.python.environment.PythonEnvironment."""
|
|
@@ -121,6 +123,14 @@ def python_environment_nullary_bindings(x: hydra.typed.TypedTerm[hydra.python.en
|
|
|
121
123
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("nullaryBindings")))),
|
|
122
124
|
x.value))))
|
|
123
125
|
|
|
126
|
+
def python_environment_overlay_subs(x: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment]) -> hydra.typed.TypedTerm[Set[str]]:
|
|
127
|
+
r"""DSL accessor for the overlaySubs field of hydra.python.environment.PythonEnvironment."""
|
|
128
|
+
|
|
129
|
+
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
130
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
131
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
132
|
+
x.value))))
|
|
133
|
+
|
|
124
134
|
# DSL name token for hydra.python.environment.PythonEnvironment.
|
|
125
135
|
python_environment_python_environment = hydra.typed.TypedName(hydra.core.Name("hydra.python.environment.PythonEnvironment"))
|
|
126
136
|
|
|
@@ -176,6 +186,11 @@ new_val: hydra.typed.TypedTerm[tuple[Sequence[hydra.core.Name], Mapping[hydra.co
|
|
|
176
186
|
cast(hydra.core.Term,
|
|
177
187
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
178
188
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
189
|
+
original.value)))),
|
|
190
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
191
|
+
cast(hydra.core.Term,
|
|
192
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
193
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
179
194
|
original.value)))))))))
|
|
180
195
|
|
|
181
196
|
def python_environment_with_graph(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment],
|
|
@@ -214,6 +229,11 @@ new_val: hydra.typed.TypedTerm[hydra.graph.Graph]) -> hydra.typed.TypedTerm[hydr
|
|
|
214
229
|
cast(hydra.core.Term,
|
|
215
230
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
216
231
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
232
|
+
original.value)))),
|
|
233
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
234
|
+
cast(hydra.core.Term,
|
|
235
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
236
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
217
237
|
original.value)))))))))
|
|
218
238
|
|
|
219
239
|
def python_environment_with_inline_variables(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment],
|
|
@@ -252,7 +272,12 @@ new_val: hydra.typed.TypedTerm[Set[hydra.core.Name]]) -> hydra.typed.TypedTerm[h
|
|
|
252
272
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
253
273
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("skipCasts")))),
|
|
254
274
|
original.value)))),
|
|
255
|
-
hydra.core.Field(hydra.core.Name("inlineVariables"), new_val.value)
|
|
275
|
+
hydra.core.Field(hydra.core.Name("inlineVariables"), new_val.value),
|
|
276
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
277
|
+
cast(hydra.core.Term,
|
|
278
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
279
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
280
|
+
original.value)))))))))
|
|
256
281
|
|
|
257
282
|
def python_environment_with_namespaces(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment],
|
|
258
283
|
new_val: hydra.typed.TypedTerm[hydra.util.ModuleNames[hydra.python.syntax.DottedName]]) -> hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment]:
|
|
@@ -290,6 +315,11 @@ new_val: hydra.typed.TypedTerm[hydra.util.ModuleNames[hydra.python.syntax.Dotted
|
|
|
290
315
|
cast(hydra.core.Term,
|
|
291
316
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
292
317
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
318
|
+
original.value)))),
|
|
319
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
320
|
+
cast(hydra.core.Term,
|
|
321
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
322
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
293
323
|
original.value)))))))))
|
|
294
324
|
|
|
295
325
|
def python_environment_with_nullary_bindings(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment],
|
|
@@ -328,8 +358,55 @@ new_val: hydra.typed.TypedTerm[Set[hydra.core.Name]]) -> hydra.typed.TypedTerm[h
|
|
|
328
358
|
cast(hydra.core.Term,
|
|
329
359
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
330
360
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
361
|
+
original.value)))),
|
|
362
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
363
|
+
cast(hydra.core.Term,
|
|
364
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
365
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
331
366
|
original.value)))))))))
|
|
332
367
|
|
|
368
|
+
def python_environment_with_overlay_subs(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment], new_val: hydra.typed.TypedTerm[Set[str]]) -> hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment]:
|
|
369
|
+
r"""DSL updater for the overlaySubs field of hydra.python.environment.PythonEnvironment."""
|
|
370
|
+
|
|
371
|
+
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
372
|
+
hydra.core.TermRecord(hydra.core.Record(hydra.core.Name("hydra.python.environment.PythonEnvironment"),
|
|
373
|
+
ConsList.of(hydra.core.Field(hydra.core.Name("namespaces"),
|
|
374
|
+
cast(hydra.core.Term,
|
|
375
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
376
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("namespaces")))),
|
|
377
|
+
original.value)))),
|
|
378
|
+
hydra.core.Field(hydra.core.Name("boundTypeVariables"),
|
|
379
|
+
cast(hydra.core.Term,
|
|
380
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
381
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("boundTypeVariables")))),
|
|
382
|
+
original.value)))),
|
|
383
|
+
hydra.core.Field(hydra.core.Name("graph"),
|
|
384
|
+
cast(hydra.core.Term,
|
|
385
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
386
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("graph")))),
|
|
387
|
+
original.value)))),
|
|
388
|
+
hydra.core.Field(hydra.core.Name("nullaryBindings"),
|
|
389
|
+
cast(hydra.core.Term,
|
|
390
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
391
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("nullaryBindings")))),
|
|
392
|
+
original.value)))),
|
|
393
|
+
hydra.core.Field(hydra.core.Name("version"),
|
|
394
|
+
cast(hydra.core.Term,
|
|
395
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
396
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("version")))),
|
|
397
|
+
original.value)))),
|
|
398
|
+
hydra.core.Field(hydra.core.Name("skipCasts"),
|
|
399
|
+
cast(hydra.core.Term,
|
|
400
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
401
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("skipCasts")))),
|
|
402
|
+
original.value)))),
|
|
403
|
+
hydra.core.Field(hydra.core.Name("inlineVariables"),
|
|
404
|
+
cast(hydra.core.Term,
|
|
405
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
406
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
407
|
+
original.value)))),
|
|
408
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"), new_val.value))))))
|
|
409
|
+
|
|
333
410
|
def python_environment_with_skip_casts(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment], new_val: hydra.typed.TypedTerm[bool]) -> hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment]:
|
|
334
411
|
r"""DSL updater for the skipCasts field of hydra.python.environment.PythonEnvironment."""
|
|
335
412
|
|
|
@@ -365,6 +442,11 @@ def python_environment_with_skip_casts(original: hydra.typed.TypedTerm[hydra.pyt
|
|
|
365
442
|
cast(hydra.core.Term,
|
|
366
443
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
367
444
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
445
|
+
original.value)))),
|
|
446
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
447
|
+
cast(hydra.core.Term,
|
|
448
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
449
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
368
450
|
original.value)))))))))
|
|
369
451
|
|
|
370
452
|
def python_environment_with_version(original: hydra.typed.TypedTerm[hydra.python.environment.PythonEnvironment],
|
|
@@ -403,6 +485,11 @@ new_val: hydra.typed.TypedTerm[hydra.python.environment.PythonVersion]) -> hydra
|
|
|
403
485
|
cast(hydra.core.Term,
|
|
404
486
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
405
487
|
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("inlineVariables")))),
|
|
488
|
+
original.value)))),
|
|
489
|
+
hydra.core.Field(hydra.core.Name("overlaySubs"),
|
|
490
|
+
cast(hydra.core.Term,
|
|
491
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
492
|
+
hydra.core.TermProject(hydra.core.Projection(hydra.core.Name("hydra.python.environment.PythonEnvironment"), hydra.core.Name("overlaySubs")))),
|
|
406
493
|
original.value)))))))))
|
|
407
494
|
|
|
408
495
|
def python_module_metadata(namespaces: hydra.typed.TypedTerm[hydra.util.ModuleNames[hydra.python.syntax.DottedName]],
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
r"""DSL functions for hydra.python.names."""
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
|
-
from collections.abc import Callable, Mapping
|
|
6
|
+
from collections.abc import Callable, Mapping, Set
|
|
7
7
|
from functools import lru_cache
|
|
8
|
-
from hydra.overlay.python.util import Lazy, PersistentMap
|
|
8
|
+
from hydra.overlay.python.util import Lazy, PersistentMap, PersistentSet
|
|
9
9
|
from typing import TypeVar, cast
|
|
10
10
|
import hydra.core
|
|
11
11
|
import hydra.typed
|
|
@@ -78,19 +78,23 @@ def encode_namespace(arg0: hydra.typed.TypedTerm[hydra.packaging.ModuleName]) ->
|
|
|
78
78
|
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
79
79
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term, hydra.core.TermVariable(hydra.core.Name("hydra.python.names.encodeNamespace"))), arg0.value))))
|
|
80
80
|
|
|
81
|
-
def encode_namespace_string_with_overrides(arg0: hydra.typed.TypedTerm[hydra.packaging.ModuleName]) -> hydra.typed.TypedTerm[str]:
|
|
81
|
+
def encode_namespace_string_with_overrides(arg0: hydra.typed.TypedTerm[Set[str]], arg1: hydra.typed.TypedTerm[hydra.packaging.ModuleName]) -> hydra.typed.TypedTerm[str]:
|
|
82
82
|
r"""DSL reference to hydra.python.names.encodeNamespaceStringWithOverrides."""
|
|
83
83
|
|
|
84
84
|
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
85
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
85
86
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term, hydra.core.TermVariable(hydra.core.Name("hydra.python.names.encodeNamespaceStringWithOverrides"))),
|
|
86
|
-
arg0.value)))
|
|
87
|
+
arg0.value))),
|
|
88
|
+
arg1.value))))
|
|
87
89
|
|
|
88
|
-
def encode_namespace_with_overrides(arg0: hydra.typed.TypedTerm[hydra.packaging.ModuleName]) -> hydra.typed.TypedTerm[hydra.python.syntax.DottedName]:
|
|
90
|
+
def encode_namespace_with_overrides(arg0: hydra.typed.TypedTerm[Set[str]], arg1: hydra.typed.TypedTerm[hydra.packaging.ModuleName]) -> hydra.typed.TypedTerm[hydra.python.syntax.DottedName]:
|
|
89
91
|
r"""DSL reference to hydra.python.names.encodeNamespaceWithOverrides."""
|
|
90
92
|
|
|
91
93
|
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
94
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
92
95
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term, hydra.core.TermVariable(hydra.core.Name("hydra.python.names.encodeNamespaceWithOverrides"))),
|
|
93
|
-
arg0.value)))
|
|
96
|
+
arg0.value))),
|
|
97
|
+
arg1.value))))
|
|
94
98
|
|
|
95
99
|
def encode_type_variable(arg0: hydra.typed.TypedTerm[hydra.core.Name]) -> hydra.typed.TypedTerm[hydra.python.syntax.Name]:
|
|
96
100
|
r"""DSL reference to hydra.python.names.encodeTypeVariable."""
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
r"""DSL functions for hydra.python.utils."""
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
|
-
from collections.abc import Callable, Sequence
|
|
6
|
+
from collections.abc import Callable, Sequence, Set
|
|
7
7
|
from functools import lru_cache
|
|
8
8
|
from hydra.overlay.python.dsl.python import Optional
|
|
9
|
-
from hydra.overlay.python.util import ConsList, Lazy
|
|
9
|
+
from hydra.overlay.python.util import ConsList, Lazy, PersistentSet
|
|
10
10
|
from typing import TypeVar, cast
|
|
11
11
|
import hydra.core
|
|
12
12
|
import hydra.typed
|
|
@@ -113,14 +113,17 @@ def double_quoted_string(arg0: hydra.typed.TypedTerm[str]) -> hydra.typed.TypedT
|
|
|
113
113
|
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
114
114
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term, hydra.core.TermVariable(hydra.core.Name("hydra.python.utils.doubleQuotedString"))), arg0.value))))
|
|
115
115
|
|
|
116
|
-
def find_namespaces(arg0: hydra.typed.TypedTerm[
|
|
117
|
-
arg1: hydra.typed.TypedTerm[
|
|
116
|
+
def find_namespaces(arg0: hydra.typed.TypedTerm[Set[str]],
|
|
117
|
+
arg1: hydra.typed.TypedTerm[hydra.packaging.ModuleName],
|
|
118
|
+
arg2: hydra.typed.TypedTerm[Sequence[hydra.packaging.Definition]]) -> hydra.typed.TypedTerm[hydra.util.ModuleNames[hydra.python.syntax.DottedName]]:
|
|
118
119
|
r"""DSL reference to hydra.python.utils.findNamespaces."""
|
|
119
120
|
|
|
120
121
|
return hydra.typed.TypedTerm(cast(hydra.core.Term,
|
|
121
122
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
123
|
+
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term,
|
|
122
124
|
hydra.core.TermApplication(hydra.core.Application(cast(hydra.core.Term, hydra.core.TermVariable(hydra.core.Name("hydra.python.utils.findNamespaces"))), arg0.value))),
|
|
123
|
-
arg1.value)))
|
|
125
|
+
arg1.value))),
|
|
126
|
+
arg2.value))))
|
|
124
127
|
|
|
125
128
|
def function_call(arg0: hydra.typed.TypedTerm[hydra.python.syntax.Primary],
|
|
126
129
|
arg1: hydra.typed.TypedTerm[Sequence[hydra.python.syntax.Expression]]) -> hydra.typed.TypedTerm[hydra.python.syntax.Expression]:
|
|
@@ -22,6 +22,7 @@ import hydra.file
|
|
|
22
22
|
import hydra.formatting
|
|
23
23
|
import hydra.graph
|
|
24
24
|
import hydra.lexical
|
|
25
|
+
import hydra.names
|
|
25
26
|
import hydra.overlay.python.lib.eithers
|
|
26
27
|
import hydra.overlay.python.lib.equality
|
|
27
28
|
import hydra.overlay.python.lib.lists
|
|
@@ -34,7 +35,6 @@ import hydra.overlay.python.lib.ordering
|
|
|
34
35
|
import hydra.overlay.python.lib.pairs
|
|
35
36
|
import hydra.overlay.python.lib.sets
|
|
36
37
|
import hydra.overlay.python.lib.strings
|
|
37
|
-
import hydra.names
|
|
38
38
|
import hydra.packaging
|
|
39
39
|
import hydra.predicates
|
|
40
40
|
import hydra.print.core
|
|
@@ -80,7 +80,14 @@ def python_environment_get_graph(env: hydra.python.environment.PythonEnvironment
|
|
|
80
80
|
def python_environment_set_graph(tc: hydra.graph.Graph, env: hydra.python.environment.PythonEnvironment) -> hydra.python.environment.PythonEnvironment:
|
|
81
81
|
r"""Set the Graph in a PythonEnvironment."""
|
|
82
82
|
|
|
83
|
-
return hydra.python.environment.PythonEnvironment(env.namespaces,
|
|
83
|
+
return hydra.python.environment.PythonEnvironment(env.namespaces,
|
|
84
|
+
env.bound_type_variables,
|
|
85
|
+
tc,
|
|
86
|
+
env.nullary_bindings,
|
|
87
|
+
env.version,
|
|
88
|
+
env.skip_casts,
|
|
89
|
+
env.inline_variables,
|
|
90
|
+
env.overlay_subs)
|
|
84
91
|
|
|
85
92
|
def analyze_python_function(cx: hydra.typing.InferenceContext, env: hydra.python.environment.PythonEnvironment, term: hydra.core.Term) -> Either[T0, hydra.typing.FunctionStructure[hydra.python.environment.PythonEnvironment]]:
|
|
86
93
|
r"""Analyze a function term with Python-specific Graph management."""
|
|
@@ -156,7 +163,8 @@ def eliminate_unit_var(v: hydra.core.Name, term0: hydra.core.Term) -> hydra.core
|
|
|
156
163
|
|
|
157
164
|
case hydra.core.TermMap(value=m):
|
|
158
165
|
return cast(hydra.core.Term,
|
|
159
|
-
hydra.core.TermMap(hydra.overlay.python.lib.maps.from_list(hydra.overlay.python.lib.lists.map((lambda kv: (recurse(hydra.overlay.python.lib.pairs.first(kv)), recurse(hydra.overlay.python.lib.pairs.second(kv)))),
|
|
166
|
+
hydra.core.TermMap(hydra.overlay.python.lib.maps.from_list(hydra.overlay.python.lib.lists.map((lambda kv: (recurse(hydra.overlay.python.lib.pairs.first(kv)), recurse(hydra.overlay.python.lib.pairs.second(kv)))),
|
|
167
|
+
hydra.overlay.python.lib.maps.to_list(m)))))
|
|
160
168
|
|
|
161
169
|
case hydra.core.TermRecord(value=rec):
|
|
162
170
|
return cast(hydra.core.Term,
|
|
@@ -172,7 +180,8 @@ def eliminate_unit_var(v: hydra.core.Name, term0: hydra.core.Term) -> hydra.core
|
|
|
172
180
|
return cast(hydra.core.Term, hydra.core.TermOptional(hydra.overlay.python.lib.optionals.map(recurse, mt)))
|
|
173
181
|
|
|
174
182
|
case hydra.core.TermPair(value=p):
|
|
175
|
-
return cast(hydra.core.Term,
|
|
183
|
+
return cast(hydra.core.Term,
|
|
184
|
+
hydra.core.TermPair((recurse(hydra.overlay.python.lib.pairs.first(p)), recurse(hydra.overlay.python.lib.pairs.second(p)))))
|
|
176
185
|
|
|
177
186
|
case hydra.core.TermWrap(value=wt):
|
|
178
187
|
return cast(hydra.core.Term, hydra.core.TermWrap(hydra.core.WrappedTerm(wt.type_name, recurse(wt.body))))
|
|
@@ -285,7 +294,9 @@ def collect_type_variables(initial: Set[hydra.core.Name], typ: hydra.core.Type)
|
|
|
285
294
|
case hydra.core.TypeForall(value=ft):
|
|
286
295
|
return (
|
|
287
296
|
v := Lazy((lambda : ft.parameter)),
|
|
288
|
-
(
|
|
297
|
+
(
|
|
298
|
+
body := Lazy((lambda : ft.body)),
|
|
299
|
+
collect_type_variables(hydra.overlay.python.lib.sets.insert(v.get(), initial), body.get()))[1])[1]
|
|
289
300
|
|
|
290
301
|
case _:
|
|
291
302
|
return (
|
|
@@ -337,7 +348,9 @@ def deduplicate_case_variables(cases_: Sequence[hydra.core.CaseAlternative]) ->
|
|
|
337
348
|
new_lam := Lazy((lambda : hydra.core.Lambda(v2.get(), mdom, new_body.get()))),
|
|
338
349
|
new_term := Lazy((lambda : cast(hydra.core.Term, hydra.core.TermLambda(new_lam.get())))),
|
|
339
350
|
new_field := Lazy((lambda : hydra.core.CaseAlternative(fname, new_term.get()))),
|
|
340
|
-
(
|
|
351
|
+
(
|
|
352
|
+
hydra.overlay.python.lib.maps.insert(v, count2.get(), count_by_name()),
|
|
353
|
+
hydra.overlay.python.lib.lists.cons(new_field.get(), done())))[6]))
|
|
341
354
|
|
|
342
355
|
case _:
|
|
343
356
|
return (count_by_name(), hydra.overlay.python.lib.lists.cons(field, done()))
|
|
@@ -514,7 +527,8 @@ def encode_literal(lit: hydra.core.Literal) -> Either[T0, hydra.python.syntax.Ex
|
|
|
514
527
|
hydra.python.syntax.PrimarySimple(cast(hydra.python.syntax.Atom, hydra.python.syntax.AtomName(hydra.python.syntax.Name("bytes"))))),
|
|
515
528
|
ConsList.of(hydra.python.utils.py_atom_to_py_expression(cast(hydra.python.syntax.Atom,
|
|
516
529
|
hydra.python.syntax.AtomList(hydra.python.utils.py_list(hydra.overlay.python.lib.lists.map((lambda byte_val: hydra.python.utils.py_atom_to_py_expression(cast(hydra.python.syntax.Atom,
|
|
517
|
-
hydra.python.syntax.AtomNumber(cast(hydra.python.syntax.Number,
|
|
530
|
+
hydra.python.syntax.AtomNumber(cast(hydra.python.syntax.Number,
|
|
531
|
+
hydra.python.syntax.NumberInteger(hydra.overlay.python.lib.literals.int32_to_bigint(byte_val))))))),
|
|
518
532
|
byte_values()))))))))
|
|
519
533
|
|
|
520
534
|
case hydra.core.LiteralBoolean(value=b):
|
|
@@ -882,7 +896,10 @@ def make_simple_lambda(arity: int, lhs: hydra.python.syntax.Expression) -> hydra
|
|
|
882
896
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(arity, 0),
|
|
883
897
|
(lambda : lhs),
|
|
884
898
|
(lambda : cast(hydra.python.syntax.Expression,
|
|
885
|
-
hydra.python.syntax.ExpressionLambda(hydra.python.syntax.Lambda(hydra.python.syntax.LambdaParameters(None_(),
|
|
899
|
+
hydra.python.syntax.ExpressionLambda(hydra.python.syntax.Lambda(hydra.python.syntax.LambdaParameters(None_(),
|
|
900
|
+
hydra.overlay.python.lib.lists.map((lambda a: hydra.python.syntax.LambdaParamNoDefault(a)), args()),
|
|
901
|
+
ConsList.of(),
|
|
902
|
+
None_()),
|
|
886
903
|
hydra.python.utils.function_call(hydra.python.utils.py_expression_to_py_primary(lhs),
|
|
887
904
|
hydra.overlay.python.lib.lists.map((lambda a: cast(hydra.python.syntax.Expression,
|
|
888
905
|
hydra.python.syntax.ExpressionSimple(hydra.python.syntax.Disjunction(ConsList.of(hydra.python.syntax.Conjunction(ConsList.of(cast(hydra.python.syntax.Inversion,
|
|
@@ -904,7 +921,10 @@ def make_uncurried_lambda(params: Sequence[hydra.python.syntax.Name], body: hydr
|
|
|
904
921
|
r"""Create an uncurried lambda with multiple parameters."""
|
|
905
922
|
|
|
906
923
|
return cast(hydra.python.syntax.Expression,
|
|
907
|
-
hydra.python.syntax.ExpressionLambda(hydra.python.syntax.Lambda(hydra.python.syntax.LambdaParameters(None_(),
|
|
924
|
+
hydra.python.syntax.ExpressionLambda(hydra.python.syntax.Lambda(hydra.python.syntax.LambdaParameters(None_(),
|
|
925
|
+
hydra.overlay.python.lib.lists.map((lambda p: hydra.python.syntax.LambdaParamNoDefault(p)), params),
|
|
926
|
+
ConsList.of(),
|
|
927
|
+
None_()),
|
|
908
928
|
body)))
|
|
909
929
|
|
|
910
930
|
def encode_variable(cx: T0,
|
|
@@ -976,7 +996,8 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
976
996
|
el_trivial1 := Lazy((lambda : hydra.predicates.is_trivial_term(el.term))),
|
|
977
997
|
hydra.overlay.python.lib.optionals.cases(el.type_scheme,
|
|
978
998
|
(lambda : Right(as_variable())),
|
|
979
|
-
(lambda ts: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.equality.equal(hydra.arity.type_scheme_arity(ts), 0),
|
|
999
|
+
(lambda ts: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.equality.equal(hydra.arity.type_scheme_arity(ts), 0),
|
|
1000
|
+
hydra.predicates.is_complex_binding(tc, el)),
|
|
980
1001
|
hydra.overlay.python.lib.logic.not_(el_trivial1.get())),
|
|
981
1002
|
(lambda : Right(as_function_call())),
|
|
982
1003
|
(lambda : (
|
|
@@ -1015,7 +1036,8 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
1015
1036
|
(lambda el: (
|
|
1016
1037
|
el_trivial := Lazy((lambda : hydra.predicates.is_trivial_term(el.term))),
|
|
1017
1038
|
hydra.overlay.python.lib.optionals.cases(el.type_scheme,
|
|
1018
|
-
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.equality.equal(hydra.arity.type_arity(typ), 0),
|
|
1039
|
+
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.equality.equal(hydra.arity.type_arity(typ), 0),
|
|
1040
|
+
hydra.overlay.python.lib.logic.not_(el_trivial.get())),
|
|
1019
1041
|
(lambda : Right(as_function_call())),
|
|
1020
1042
|
(lambda : (
|
|
1021
1043
|
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.null(hydra.variables.free_variables_in_type(typ))),
|
|
@@ -1092,7 +1114,8 @@ body: Callable[[hydra.python.environment.PythonEnvironment], T0]) -> T0:
|
|
|
1092
1114
|
inner_env.nullary_bindings,
|
|
1093
1115
|
inner_env.version,
|
|
1094
1116
|
inner_env.skip_casts,
|
|
1095
|
-
hydra.overlay.python.lib.sets.union(inline_vars(), inner_env.inline_variables)
|
|
1117
|
+
hydra.overlay.python.lib.sets.union(inline_vars(), inner_env.inline_variables),
|
|
1118
|
+
inner_env.overlay_subs))),
|
|
1096
1119
|
body(updated_env.get()))[1]))
|
|
1097
1120
|
|
|
1098
1121
|
def with_type_lambda(v1: hydra.python.environment.PythonEnvironment,
|
|
@@ -1178,7 +1201,8 @@ hargs: Sequence[hydra.python.syntax.Expression],
|
|
|
1178
1201
|
rargs: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, tuple[hydra.python.syntax.Expression, Sequence[hydra.python.syntax.Expression]]]:
|
|
1179
1202
|
r"""Inner helper for encodeApplication."""
|
|
1180
1203
|
|
|
1181
|
-
first_arg = Lazy((lambda : hydra.overlay.python.lib.optionals.with_default((lambda : hydra.python.utils.py_name_to_py_expression(hydra.python.syntax.Name(""))),
|
|
1204
|
+
first_arg = Lazy((lambda : hydra.overlay.python.lib.optionals.with_default((lambda : hydra.python.utils.py_name_to_py_expression(hydra.python.syntax.Name(""))),
|
|
1205
|
+
hydra.overlay.python.lib.lists.head(hargs))))
|
|
1182
1206
|
rest_args = Lazy((lambda : hydra.overlay.python.lib.lists.drop(1, hargs)))
|
|
1183
1207
|
def with_rest(e: hydra.python.syntax.Expression) -> hydra.python.syntax.Expression:
|
|
1184
1208
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.null(rest_args()),
|
|
@@ -1320,7 +1344,8 @@ def encode_term_inline(cx: hydra.typing.InferenceContext, env: hydra.python.envi
|
|
|
1320
1344
|
inner_env0.get().nullary_bindings,
|
|
1321
1345
|
inner_env0.get().version,
|
|
1322
1346
|
inner_env0.get().skip_casts,
|
|
1323
|
-
hydra.overlay.python.lib.sets.union(hydra.overlay.python.lib.sets.from_list(binding_names.get()), inner_env0.get().inline_variables)
|
|
1347
|
+
hydra.overlay.python.lib.sets.union(hydra.overlay.python.lib.sets.from_list(binding_names.get()), inner_env0.get().inline_variables),
|
|
1348
|
+
inner_env0.get().overlay_subs))),
|
|
1324
1349
|
hydra.overlay.python.lib.eithers.bind(encode_term_inline(cx, inner_env.get(), False, inner_body.get()),
|
|
1325
1350
|
(lambda pbody: (
|
|
1326
1351
|
pparams := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda v1: hydra.python.names.encode_name(False, hydra.util.CaseConvention.LOWER_SNAKE, inner_env.get(), v1)),
|
|
@@ -1592,7 +1617,8 @@ term: hydra.core.Term) -> Either[hydra.errors.Error, Sequence[hydra.python.synta
|
|
|
1592
1617
|
gather_fun = Lazy((lambda : hydra.overlay.python.lib.pairs.second(gathered())))
|
|
1593
1618
|
stripped_fun = Lazy((lambda : hydra.strip.deannotate_and_detype_term(gather_fun())))
|
|
1594
1619
|
is_self_call = Lazy((lambda : (lambda n: hydra.overlay.python.lib.equality.equal(n, func_name))(stripped_fun().value) if isinstance(stripped_fun(), hydra.core.TermVariable) else False))
|
|
1595
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(is_self_call(),
|
|
1620
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(is_self_call(),
|
|
1621
|
+
hydra.overlay.python.lib.equality.equal(hydra.overlay.python.lib.lists.length(gather_args()), hydra.overlay.python.lib.lists.length(param_names))),
|
|
1596
1622
|
(lambda : hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.eithers.map_list((lambda a: encode_term_inline(cx, env, False, a)), gather_args()),
|
|
1597
1623
|
(lambda py_args: (
|
|
1598
1624
|
assignments := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda pair: (
|
|
@@ -1962,7 +1988,8 @@ prefixes: Sequence[hydra.python.syntax.Statement]) -> Either[hydra.errors.Error,
|
|
|
1962
1988
|
(lambda py_args: (
|
|
1963
1989
|
py_params := Lazy((lambda : cast(hydra.python.syntax.Parameters,
|
|
1964
1990
|
hydra.python.syntax.ParametersParamNoDefault(hydra.python.syntax.ParamNoDefaultParameters(py_args, ConsList.of(), None_()))))),
|
|
1965
|
-
is_t_c_o := Lazy((lambda : hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.null(args)),
|
|
1991
|
+
is_t_c_o := Lazy((lambda : hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.null(args)),
|
|
1992
|
+
hydra.analysis.is_self_tail_recursive(name, body)))),
|
|
1966
1993
|
hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.logic.if_else(is_t_c_o.get(),
|
|
1967
1994
|
(lambda : hydra.overlay.python.lib.eithers.bind(encode_term_multiline_t_c_o(cx, env, name, args, body),
|
|
1968
1995
|
(lambda tco_stmts: (
|
|
@@ -2368,7 +2395,8 @@ def extend_env_with_type_var(env: hydra.python.environment.PythonEnvironment, va
|
|
|
2368
2395
|
env.nullary_bindings,
|
|
2369
2396
|
env.version,
|
|
2370
2397
|
env.skip_casts,
|
|
2371
|
-
env.inline_variables
|
|
2398
|
+
env.inline_variables,
|
|
2399
|
+
env.overlay_subs)
|
|
2372
2400
|
|
|
2373
2401
|
def encode_type_assignment_inner(cx: T0,
|
|
2374
2402
|
env: hydra.python.environment.PythonEnvironment,
|
|
@@ -3074,10 +3102,10 @@ def set_meta_uses_type_var(m: hydra.python.environment.PythonModuleMetadata, b:
|
|
|
3074
3102
|
m.uses_right,
|
|
3075
3103
|
b)
|
|
3076
3104
|
|
|
3077
|
-
def gather_metadata(focus_ns: hydra.packaging.ModuleName, defs: Sequence[hydra.packaging.Definition]) -> hydra.python.environment.PythonModuleMetadata:
|
|
3105
|
+
def gather_metadata(overlay_subs: Set[str], focus_ns: hydra.packaging.ModuleName, defs: Sequence[hydra.packaging.Definition]) -> hydra.python.environment.PythonModuleMetadata:
|
|
3078
3106
|
r"""Gather metadata from definitions."""
|
|
3079
3107
|
|
|
3080
|
-
start = Lazy((lambda : empty_metadata(hydra.python.utils.find_namespaces(focus_ns, defs))))
|
|
3108
|
+
start = Lazy((lambda : empty_metadata(hydra.python.utils.find_namespaces(overlay_subs, focus_ns, defs))))
|
|
3081
3109
|
def add_def(meta: hydra.python.environment.PythonModuleMetadata, def_: hydra.packaging.Definition) -> hydra.python.environment.PythonModuleMetadata:
|
|
3082
3110
|
match def_:
|
|
3083
3111
|
case hydra.packaging.DefinitionTerm(value=term_def):
|
|
@@ -3103,8 +3131,8 @@ def gather_metadata(focus_ns: hydra.packaging.ModuleName, defs: Sequence[hydra.p
|
|
|
3103
3131
|
# The target Python version for code generation.
|
|
3104
3132
|
target_python_version = hydra.python.utils.target_python_version
|
|
3105
3133
|
|
|
3106
|
-
def initial_environment(namespaces: hydra.util.ModuleNames[hydra.python.syntax.DottedName], tcontext: hydra.graph.Graph) -> hydra.python.environment.PythonEnvironment:
|
|
3107
|
-
r"""Create an initial Python environment for code generation."""
|
|
3134
|
+
def initial_environment(namespaces: hydra.util.ModuleNames[hydra.python.syntax.DottedName], tcontext: hydra.graph.Graph, overlay_subs: Set[str]) -> hydra.python.environment.PythonEnvironment:
|
|
3135
|
+
r"""Create an initial Python environment for code generation, given the on-disk overlay-existence set (#630) driving emission-time primitive-reference redirects."""
|
|
3108
3136
|
|
|
3109
3137
|
return hydra.python.environment.PythonEnvironment(namespaces,
|
|
3110
3138
|
(ConsList.of(), hydra.overlay.python.lib.maps.empty()),
|
|
@@ -3112,7 +3140,8 @@ def initial_environment(namespaces: hydra.util.ModuleNames[hydra.python.syntax.D
|
|
|
3112
3140
|
hydra.overlay.python.lib.sets.empty(),
|
|
3113
3141
|
target_python_version,
|
|
3114
3142
|
True,
|
|
3115
|
-
hydra.overlay.python.lib.sets.empty()
|
|
3143
|
+
hydra.overlay.python.lib.sets.empty(),
|
|
3144
|
+
overlay_subs)
|
|
3116
3145
|
|
|
3117
3146
|
def is_type_module_check(defs: Sequence[hydra.packaging.Definition]) -> bool:
|
|
3118
3147
|
r"""Check whether a list of definitions contains any type definitions."""
|
|
@@ -3184,9 +3213,12 @@ def module_standard_imports(meta: hydra.python.environment.PythonModuleMetadata)
|
|
|
3184
3213
|
simplified = Lazy((lambda : hydra.overlay.python.lib.optionals.givens(hydra.overlay.python.lib.lists.map((lambda p: (
|
|
3185
3214
|
mod_name := Lazy((lambda : hydra.overlay.python.lib.pairs.first(p))),
|
|
3186
3215
|
symbols := Lazy((lambda : hydra.overlay.python.lib.optionals.givens(hydra.overlay.python.lib.pairs.second(p)))),
|
|
3187
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.null(symbols.get()),
|
|
3216
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.null(symbols.get()),
|
|
3217
|
+
(lambda : None_()),
|
|
3218
|
+
(lambda : Given((mod_name.get(), symbols.get())))))[2]),
|
|
3188
3219
|
pairs()))))
|
|
3189
|
-
return hydra.overlay.python.lib.lists.map((lambda p: standard_import_statement(hydra.overlay.python.lib.pairs.first(p), hydra.overlay.python.lib.pairs.second(p))),
|
|
3220
|
+
return hydra.overlay.python.lib.lists.map((lambda p: standard_import_statement(hydra.overlay.python.lib.pairs.first(p), hydra.overlay.python.lib.pairs.second(p))),
|
|
3221
|
+
simplified())
|
|
3190
3222
|
|
|
3191
3223
|
def module_imports(namespaces: hydra.util.ModuleNames[hydra.python.syntax.DottedName], meta: hydra.python.environment.PythonModuleMetadata) -> Sequence[hydra.python.syntax.Statement]:
|
|
3192
3224
|
r"""Generate all import statements for a Python module."""
|
|
@@ -3245,30 +3277,35 @@ body: Callable[[hydra.python.environment.PythonEnvironment], T0]) -> T0:
|
|
|
3245
3277
|
r"""Execute a computation with definitions in scope."""
|
|
3246
3278
|
|
|
3247
3279
|
bindings = Lazy((lambda : (
|
|
3248
|
-
_hoist_bindings_1 := Lazy((lambda : (lambda v1: (lambda td: Given(hydra.core.Binding(td.name,
|
|
3280
|
+
_hoist_bindings_1 := Lazy((lambda : (lambda v1: (lambda td: Given(hydra.core.Binding(td.name,
|
|
3281
|
+
td.body,
|
|
3282
|
+
hydra.overlay.python.lib.optionals.map((lambda sig: hydra.scoping.term_signature_to_type_scheme(sig)), td.signature))))(v1.value) if isinstance(v1, hydra.packaging.DefinitionTerm) else (lambda _: None_())(v1.value) if isinstance(v1, hydra.packaging.DefinitionType) else None_()))),
|
|
3249
3283
|
hydra.overlay.python.lib.optionals.givens(hydra.overlay.python.lib.lists.map((lambda def_: _hoist_bindings_1.get()(def_)), defs)))[1]))
|
|
3250
3284
|
dummy_let = Lazy((lambda : hydra.core.Let(bindings(), cast(hydra.core.Term, hydra.core.TermLiteral(cast(hydra.core.Literal, hydra.core.LiteralString("dummy")))))))
|
|
3251
3285
|
return with_let(env, dummy_let(), body)
|
|
3252
3286
|
|
|
3253
|
-
def encode_python_module(
|
|
3287
|
+
def encode_python_module(overlay_subs: Set[str],
|
|
3288
|
+
cx: hydra.typing.InferenceContext,
|
|
3254
3289
|
g: hydra.graph.Graph,
|
|
3255
3290
|
mod: hydra.packaging.Module,
|
|
3256
3291
|
defs0: Sequence[hydra.packaging.Definition]) -> Either[hydra.errors.Error, hydra.python.syntax.Module]:
|
|
3257
|
-
r"""Encode a Hydra module to a Python module AST."""
|
|
3292
|
+
r"""Encode a Hydra module to a Python module AST, given the on-disk overlay-existence set (#630) driving emission-time primitive-reference redirects."""
|
|
3258
3293
|
|
|
3259
3294
|
defs = Lazy((lambda : hydra.environment.reorder_defs(defs0)))
|
|
3260
|
-
meta0 = Lazy((lambda : gather_metadata(mod.name, defs())))
|
|
3295
|
+
meta0 = Lazy((lambda : gather_metadata(overlay_subs, mod.name, defs())))
|
|
3261
3296
|
namespaces0 = meta0().namespaces
|
|
3262
|
-
env0 = Lazy((lambda : initial_environment(namespaces0, g)))
|
|
3297
|
+
env0 = Lazy((lambda : initial_environment(namespaces0, g, overlay_subs)))
|
|
3263
3298
|
is_type_mod = Lazy((lambda : is_type_module_check(defs0)))
|
|
3264
3299
|
return with_definitions(env0(),
|
|
3265
3300
|
defs(),
|
|
3266
|
-
(lambda env: hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.eithers.map((lambda xs: hydra.overlay.python.lib.lists.concat(xs)),
|
|
3301
|
+
(lambda env: hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.eithers.map((lambda xs: hydra.overlay.python.lib.lists.concat(xs)),
|
|
3302
|
+
hydra.overlay.python.lib.eithers.map_list((lambda d: encode_definition(cx, env, d)), defs())),
|
|
3267
3303
|
(lambda def_stmts: (
|
|
3268
3304
|
meta2 := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(is_type_mod()), use_inline_type_params()),
|
|
3269
3305
|
(lambda : set_meta_uses_type_var(meta0(), False)),
|
|
3270
3306
|
(lambda : meta0())))),
|
|
3271
|
-
meta := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(is_type_mod(),
|
|
3307
|
+
meta := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(is_type_mod(),
|
|
3308
|
+
hydra.overlay.python.lib.equality.equal(target_python_version, hydra.python.environment.PythonVersion.PYTHON310)),
|
|
3272
3309
|
(lambda : set_meta_uses_type_alias(meta2.get(), True)),
|
|
3273
3310
|
(lambda : meta2.get())))),
|
|
3274
3311
|
namespaces := Lazy((lambda : meta0().namespaces)),
|
|
@@ -3279,7 +3316,8 @@ defs0: Sequence[hydra.packaging.Definition]) -> Either[hydra.errors.Error, hydra
|
|
|
3279
3316
|
tvars := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.or_(is_type_mod(), hydra.overlay.python.lib.logic.not_(use_inline_type_params())),
|
|
3280
3317
|
(lambda : meta.get().type_variables),
|
|
3281
3318
|
(lambda : hydra.overlay.python.lib.sets.empty())))),
|
|
3282
|
-
tvar_stmts := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda tv: tvar_statement(hydra.python.names.encode_type_variable(tv))),
|
|
3319
|
+
tvar_stmts := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda tv: tvar_statement(hydra.python.names.encode_type_variable(tv))),
|
|
3320
|
+
hydra.overlay.python.lib.sets.to_list(tvars.get())))),
|
|
3283
3321
|
body := Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda group: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.null(group))),
|
|
3284
3322
|
hydra.overlay.python.lib.lists.concat(ConsList.of(ConsList.of(comment_stmts.get(), import_stmts.get(), tvar_stmts.get()), def_stmts))))),
|
|
3285
3323
|
Right(hydra.python.syntax.Module(body.get())))[8]))))
|
|
@@ -3314,7 +3352,9 @@ def extend_meta_for_types(types: Sequence[hydra.core.Type], meta: hydra.python.e
|
|
|
3314
3352
|
|
|
3315
3353
|
names = Lazy((lambda : hydra.overlay.python.lib.sets.unions(hydra.overlay.python.lib.lists.map((lambda t: hydra.dependencies.type_dependency_names(False, t)), types))))
|
|
3316
3354
|
current_ns = meta.namespaces
|
|
3317
|
-
updated_ns = Lazy((lambda : hydra.analysis.add_names_to_module_names((lambda
|
|
3355
|
+
updated_ns = Lazy((lambda : hydra.analysis.add_names_to_module_names((lambda v1: hydra.python.names.encode_namespace_with_overrides(hydra.overlay.python.lib.sets.empty(), v1)),
|
|
3356
|
+
names(),
|
|
3357
|
+
current_ns)))
|
|
3318
3358
|
meta1 = Lazy((lambda : set_meta_namespaces(updated_ns(), meta)))
|
|
3319
3359
|
return hydra.overlay.python.lib.lists.foldl((lambda m, t: extend_meta_for_type(True, False, t, m)), meta1(), types)
|
|
3320
3360
|
|
|
@@ -3360,13 +3400,14 @@ def make_thunk(pbody: hydra.python.syntax.Expression) -> hydra.python.syntax.Exp
|
|
|
3360
3400
|
ConsList.of(py_int(1)))),
|
|
3361
3401
|
ConsList.of(wrap_in_nullary_lambda(pbody)))
|
|
3362
3402
|
|
|
3363
|
-
def module_to_python(
|
|
3403
|
+
def module_to_python(overlay_subs: Set[str],
|
|
3404
|
+
mod: hydra.packaging.Module,
|
|
3364
3405
|
defs: Sequence[hydra.packaging.Definition],
|
|
3365
3406
|
cx: hydra.typing.InferenceContext,
|
|
3366
3407
|
g: hydra.graph.Graph) -> Either[hydra.errors.Error, Mapping[str, str]]:
|
|
3367
3408
|
r"""Convert a Hydra module to Python source files."""
|
|
3368
3409
|
|
|
3369
|
-
return hydra.overlay.python.lib.eithers.bind(encode_python_module(cx, g, mod, defs),
|
|
3410
|
+
return hydra.overlay.python.lib.eithers.bind(encode_python_module(overlay_subs, cx, g, mod, defs),
|
|
3370
3411
|
(lambda file: (
|
|
3371
3412
|
s := Lazy((lambda : hydra.serialization.print_expr(hydra.serialization.parenthesize(hydra.python.serde.module_to_expr(file))))),
|
|
3372
3413
|
path := Lazy((lambda : hydra.names.module_name_to_file_path(hydra.util.CaseConvention.LOWER_SNAKE, hydra.file.FileExtension("py"), mod.name))),
|
|
@@ -34,6 +34,7 @@ class PythonEnvironment:
|
|
|
34
34
|
version: Annotated[PythonVersion, "Target Python version"]
|
|
35
35
|
skip_casts: Annotated[bool, "When True, skip generating cast() calls for reduced memory usage"]
|
|
36
36
|
inline_variables: Annotated[Set[hydra.core.Name], "Variables that are inline let bindings (walrus operators)"]
|
|
37
|
+
overlay_subs: Annotated[Set[str], "hydra.lib.<sub> sub-namespaces that have an overlay implementation on this host (#630) -- the on-disk existence signal driving emission-time redirect of primitive references to hydra.overlay.python.lib.<sub>"]
|
|
37
38
|
|
|
38
39
|
TYPE_ = hydra.core.Name("hydra.python.environment.PythonEnvironment")
|
|
39
40
|
NAMESPACES = hydra.core.Name("namespaces")
|
|
@@ -43,6 +44,7 @@ class PythonEnvironment:
|
|
|
43
44
|
VERSION = hydra.core.Name("version")
|
|
44
45
|
SKIP_CASTS = hydra.core.Name("skipCasts")
|
|
45
46
|
INLINE_VARIABLES = hydra.core.Name("inlineVariables")
|
|
47
|
+
OVERLAY_SUBS = hydra.core.Name("overlaySubs")
|
|
46
48
|
|
|
47
49
|
def with_namespaces(self, namespaces):
|
|
48
50
|
return replace(self, namespaces=namespaces)
|
|
@@ -58,6 +60,8 @@ class PythonEnvironment:
|
|
|
58
60
|
return replace(self, skip_casts=skip_casts)
|
|
59
61
|
def with_inline_variables(self, inline_variables):
|
|
60
62
|
return replace(self, inline_variables=inline_variables)
|
|
63
|
+
def with_overlay_subs(self, overlay_subs):
|
|
64
|
+
return replace(self, overlay_subs=overlay_subs)
|
|
61
65
|
|
|
62
66
|
@staticmethod
|
|
63
67
|
def builder():
|
|
@@ -71,6 +75,7 @@ class PythonEnvironment:
|
|
|
71
75
|
_version: PythonVersion = None
|
|
72
76
|
_skip_casts: bool = None
|
|
73
77
|
_inline_variables: Set[hydra.core.Name] = None
|
|
78
|
+
_overlay_subs: Set[str] = None
|
|
74
79
|
def namespaces(self, namespaces):
|
|
75
80
|
return replace(self, _namespaces=namespaces)
|
|
76
81
|
def bound_type_variables(self, bound_type_variables):
|
|
@@ -85,6 +90,8 @@ class PythonEnvironment:
|
|
|
85
90
|
return replace(self, _skip_casts=skip_casts)
|
|
86
91
|
def inline_variables(self, inline_variables):
|
|
87
92
|
return replace(self, _inline_variables=inline_variables)
|
|
93
|
+
def overlay_subs(self, overlay_subs):
|
|
94
|
+
return replace(self, _overlay_subs=overlay_subs)
|
|
88
95
|
def build(self):
|
|
89
96
|
return PythonEnvironment(namespaces=self._namespaces,
|
|
90
97
|
bound_type_variables=self._bound_type_variables,
|
|
@@ -92,7 +99,8 @@ class PythonEnvironment:
|
|
|
92
99
|
nullary_bindings=self._nullary_bindings,
|
|
93
100
|
version=self._version,
|
|
94
101
|
skip_casts=self._skip_casts,
|
|
95
|
-
inline_variables=self._inline_variables
|
|
102
|
+
inline_variables=self._inline_variables,
|
|
103
|
+
overlay_subs=self._overlay_subs)
|
|
96
104
|
|
|
97
105
|
@dataclass(frozen=True)
|
|
98
106
|
class PythonModuleMetadata:
|
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
r"""Python naming utilities: encoding Hydra names as Python names."""
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
|
-
from collections.abc import Callable, Mapping, Sequence
|
|
6
|
+
from collections.abc import Callable, Mapping, Sequence, Set
|
|
7
7
|
from functools import lru_cache
|
|
8
8
|
from hydra.overlay.python.dsl.python import Given, None_
|
|
9
|
-
from hydra.overlay.python.util import ConsList, Lazy, PersistentMap
|
|
9
|
+
from hydra.overlay.python.util import ConsList, Lazy, PersistentMap, PersistentSet
|
|
10
10
|
from typing import TypeVar, cast
|
|
11
11
|
import hydra.core
|
|
12
12
|
import hydra.formatting
|
|
13
|
+
import hydra.names
|
|
13
14
|
import hydra.overlay.python.lib.equality
|
|
14
15
|
import hydra.overlay.python.lib.lists
|
|
15
16
|
import hydra.overlay.python.lib.logic
|
|
16
17
|
import hydra.overlay.python.lib.maps
|
|
17
18
|
import hydra.overlay.python.lib.optionals
|
|
18
19
|
import hydra.overlay.python.lib.pairs
|
|
20
|
+
import hydra.overlay.python.lib.sets
|
|
19
21
|
import hydra.overlay.python.lib.strings
|
|
20
|
-
import hydra.names
|
|
21
22
|
import hydra.packaging
|
|
22
23
|
import hydra.python.environment
|
|
23
24
|
import hydra.python.language
|
|
@@ -46,13 +47,22 @@ def overlay_python_module_aliases() -> Mapping[hydra.packaging.ModuleName, str]:
|
|
|
46
47
|
|
|
47
48
|
return hydra.overlay.python.lib.maps.from_list(ConsList.of((hydra.packaging.ModuleName("hydra.test.testEnv"), "hydra.overlay.python.test_env")))
|
|
48
49
|
|
|
49
|
-
def encode_namespace_string_with_overrides(ns_val: hydra.packaging.ModuleName) -> str:
|
|
50
|
+
def encode_namespace_string_with_overrides(overlay_subs: Set[str], ns_val: hydra.packaging.ModuleName) -> str:
|
|
50
51
|
r"""Convert a ModuleName to its Python dotted import string, routing overlay modules to hydra.overlay.python.*."""
|
|
51
52
|
|
|
52
|
-
return hydra.overlay.python.lib.optionals.
|
|
53
|
+
return hydra.overlay.python.lib.optionals.cases(hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.equality.equal(hydra.overlay.python.lib.lists.length(hydra.overlay.python.lib.strings.split_on(".", ns_val.value)), 3),
|
|
54
|
+
hydra.overlay.python.lib.equality.equal(hydra.overlay.python.lib.lists.take(2, hydra.overlay.python.lib.strings.split_on(".", ns_val.value)),
|
|
55
|
+
ConsList.of("hydra", "lib"))),
|
|
56
|
+
hydra.overlay.python.lib.sets.member(hydra.overlay.python.lib.strings.join(".", hydra.overlay.python.lib.lists.drop(2, hydra.overlay.python.lib.strings.split_on(".", ns_val.value))),
|
|
57
|
+
overlay_subs)),
|
|
58
|
+
(lambda : Given(hydra.overlay.python.lib.strings.concat2("hydra.overlay.python.lib.",
|
|
59
|
+
hydra.overlay.python.lib.strings.join(".", hydra.overlay.python.lib.lists.drop(2, hydra.overlay.python.lib.strings.split_on(".", ns_val.value)))))),
|
|
60
|
+
(lambda : None_())),
|
|
61
|
+
(lambda : hydra.overlay.python.lib.optionals.with_default((lambda : hydra.overlay.python.lib.strings.join(".",
|
|
53
62
|
hydra.overlay.python.lib.lists.map((lambda v1: hydra.formatting.convert_case(hydra.util.CaseConvention.CAMEL, hydra.util.CaseConvention.LOWER_SNAKE, v1)),
|
|
54
63
|
hydra.overlay.python.lib.strings.split_on(".", ns_val.value)))),
|
|
55
|
-
hydra.overlay.python.lib.maps.lookup(ns_val, overlay_python_module_aliases()))
|
|
64
|
+
hydra.overlay.python.lib.maps.lookup(ns_val, overlay_python_module_aliases()))),
|
|
65
|
+
(lambda redirected: redirected))
|
|
56
66
|
|
|
57
67
|
def sanitize_python_name(v1: str) -> str:
|
|
58
68
|
r"""Sanitize a string to be a valid Python name."""
|
|
@@ -77,7 +87,7 @@ name: hydra.core.Name) -> hydra.python.syntax.Name:
|
|
|
77
87
|
local = qual_name().local
|
|
78
88
|
py_local = Lazy((lambda : sanitize_python_name(hydra.formatting.convert_case(hydra.util.CaseConvention.CAMEL, conv, local))))
|
|
79
89
|
def py_ns(ns_val: hydra.packaging.ModuleName) -> str:
|
|
80
|
-
return encode_namespace_string_with_overrides(ns_val)
|
|
90
|
+
return encode_namespace_string_with_overrides(env.overlay_subs, ns_val)
|
|
81
91
|
return hydra.overlay.python.lib.logic.if_else(is_qualified,
|
|
82
92
|
(lambda : hydra.overlay.python.lib.optionals.cases(hydra.overlay.python.lib.maps.lookup(name, bound_vars()),
|
|
83
93
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(mns, Given(focus_ns())),
|
|
@@ -109,7 +119,7 @@ def encode_name_qualified(env: hydra.python.environment.PythonEnvironment, name:
|
|
|
109
119
|
mns = qual_name().module_name
|
|
110
120
|
local = qual_name().local
|
|
111
121
|
def py_ns(ns_val: hydra.packaging.ModuleName) -> str:
|
|
112
|
-
return encode_namespace_string_with_overrides(ns_val)
|
|
122
|
+
return encode_namespace_string_with_overrides(env.overlay_subs, ns_val)
|
|
113
123
|
return hydra.overlay.python.lib.optionals.cases(hydra.overlay.python.lib.maps.lookup(name, bound_vars()),
|
|
114
124
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(mns, Given(focus_ns())),
|
|
115
125
|
(lambda : hydra.python.syntax.Name(hydra.overlay.python.lib.logic.if_else(use_future_annotations, (lambda : local), (lambda : hydra.python.serde.escape_python_string(True, local))))),
|
|
@@ -124,11 +134,11 @@ def encode_namespace(ns_val: hydra.packaging.ModuleName) -> hydra.python.syntax.
|
|
|
124
134
|
return hydra.python.syntax.DottedName(hydra.overlay.python.lib.lists.map((lambda part: hydra.python.syntax.Name(hydra.formatting.convert_case(hydra.util.CaseConvention.CAMEL, hydra.util.CaseConvention.LOWER_SNAKE, part))),
|
|
125
135
|
hydra.overlay.python.lib.strings.split_on(".", ns_val.value)))
|
|
126
136
|
|
|
127
|
-
def encode_namespace_with_overrides(ns_val: hydra.packaging.ModuleName) -> hydra.python.syntax.DottedName:
|
|
137
|
+
def encode_namespace_with_overrides(overlay_subs: Set[str], ns_val: hydra.packaging.ModuleName) -> hydra.python.syntax.DottedName:
|
|
128
138
|
r"""Encode a namespace as a Python dotted name, routing overlay modules to their hydra.overlay.python.* paths."""
|
|
129
139
|
|
|
130
140
|
return hydra.python.syntax.DottedName(hydra.overlay.python.lib.lists.map((lambda part: hydra.python.syntax.Name(part)),
|
|
131
|
-
hydra.overlay.python.lib.strings.split_on(".", encode_namespace_string_with_overrides(ns_val))))
|
|
141
|
+
hydra.overlay.python.lib.strings.split_on(".", encode_namespace_string_with_overrides(overlay_subs, ns_val))))
|
|
132
142
|
|
|
133
143
|
def encode_type_variable(name: hydra.core.Name) -> hydra.python.syntax.Name:
|
|
134
144
|
r"""Encode a type variable name (capitalized)."""
|
|
@@ -10,13 +10,13 @@ from hydra.overlay.python.util import ConsList, Lazy
|
|
|
10
10
|
from typing import cast
|
|
11
11
|
import hydra.constants
|
|
12
12
|
import hydra.core
|
|
13
|
+
import hydra.names
|
|
13
14
|
import hydra.overlay.python.lib.equality
|
|
14
15
|
import hydra.overlay.python.lib.lists
|
|
15
16
|
import hydra.overlay.python.lib.literals
|
|
16
17
|
import hydra.overlay.python.lib.logic
|
|
17
18
|
import hydra.overlay.python.lib.optionals
|
|
18
19
|
import hydra.overlay.python.lib.strings
|
|
19
|
-
import hydra.names
|
|
20
20
|
import hydra.packaging
|
|
21
21
|
import hydra.print.docs
|
|
22
22
|
import hydra.python.syntax
|
|
@@ -73,7 +73,8 @@ def lambda_parameters_to_expr(lp: hydra.python.syntax.LambdaParameters) -> hydra
|
|
|
73
73
|
r"""Serialize lambda parameters."""
|
|
74
74
|
|
|
75
75
|
nodef = lp.param_no_default
|
|
76
|
-
return hydra.serialization.comma_sep(hydra.serialization.inline_style,
|
|
76
|
+
return hydra.serialization.comma_sep(hydra.serialization.inline_style,
|
|
77
|
+
hydra.overlay.python.lib.lists.map((lambda x1: lambda_param_no_default_to_expr(x1)), nodef))
|
|
77
78
|
|
|
78
79
|
def python_float_literal_text(s: str) -> str:
|
|
79
80
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(s, "NaN"),
|
|
@@ -303,7 +304,9 @@ def dict_to_expr(d: hydra.python.syntax.Dict) -> hydra.ast.Expr:
|
|
|
303
304
|
def disjunction_to_expr(d: hydra.python.syntax.Disjunction) -> hydra.ast.Expr:
|
|
304
305
|
r"""Serialize a disjunction (or expression)."""
|
|
305
306
|
|
|
306
|
-
return hydra.serialization.symbol_sep("or",
|
|
307
|
+
return hydra.serialization.symbol_sep("or",
|
|
308
|
+
hydra.serialization.inline_style,
|
|
309
|
+
hydra.overlay.python.lib.lists.map((lambda x1: conjunction_to_expr(x1)), d.value))
|
|
307
310
|
|
|
308
311
|
def double_starred_kvpair_to_expr(dskv: hydra.python.syntax.DoubleStarredKvpair) -> hydra.ast.Expr:
|
|
309
312
|
r"""Serialize a double-starred key-value pair."""
|
|
@@ -727,7 +730,8 @@ def untyped_assignment_to_expr(ua: hydra.python.syntax.UntypedAssignment) -> hyd
|
|
|
727
730
|
|
|
728
731
|
targets = ua.targets
|
|
729
732
|
rhs = ua.rhs
|
|
730
|
-
return hydra.serialization.space_sep(hydra.overlay.python.lib.lists.concat(ConsList.of(hydra.overlay.python.lib.lists.map((lambda x1: star_target_to_expr(x1)), targets),
|
|
733
|
+
return hydra.serialization.space_sep(hydra.overlay.python.lib.lists.concat(ConsList.of(hydra.overlay.python.lib.lists.map((lambda x1: star_target_to_expr(x1)), targets),
|
|
734
|
+
ConsList.of(annotated_rhs_to_expr(rhs)))))
|
|
731
735
|
|
|
732
736
|
def assignment_to_expr(a: hydra.python.syntax.Assignment) -> hydra.ast.Expr:
|
|
733
737
|
r"""Serialize an assignment."""
|
|
@@ -764,11 +768,13 @@ def import_from_targets_to_expr(t: hydra.python.syntax.ImportFromTargets) -> hyd
|
|
|
764
768
|
|
|
765
769
|
match t:
|
|
766
770
|
case hydra.python.syntax.ImportFromTargetsSimple(value=names):
|
|
767
|
-
return hydra.serialization.comma_sep(hydra.serialization.inline_style,
|
|
771
|
+
return hydra.serialization.comma_sep(hydra.serialization.inline_style,
|
|
772
|
+
hydra.overlay.python.lib.lists.map((lambda x1: import_from_as_name_to_expr(x1)), names))
|
|
768
773
|
|
|
769
774
|
case hydra.python.syntax.ImportFromTargetsParens(value=names2):
|
|
770
775
|
return hydra.serialization.no_sep(ConsList.of(hydra.serialization.cst("("),
|
|
771
|
-
hydra.serialization.comma_sep(hydra.serialization.inline_style,
|
|
776
|
+
hydra.serialization.comma_sep(hydra.serialization.inline_style,
|
|
777
|
+
hydra.overlay.python.lib.lists.map((lambda x1: import_from_as_name_to_expr(x1)), names2)),
|
|
772
778
|
hydra.serialization.cst(")")))
|
|
773
779
|
|
|
774
780
|
case hydra.python.syntax.ImportFromTargetsStar():
|
|
@@ -838,7 +844,8 @@ def raise_expression_to_expr(re: hydra.python.syntax.RaiseExpression) -> hydra.a
|
|
|
838
844
|
def raise_statement_to_expr(rs: hydra.python.syntax.RaiseStatement) -> hydra.ast.Expr:
|
|
839
845
|
r"""Serialize a raise statement."""
|
|
840
846
|
|
|
841
|
-
return hydra.serialization.space_sep(hydra.overlay.python.lib.optionals.givens(ConsList.of(Given(hydra.serialization.cst("raise")),
|
|
847
|
+
return hydra.serialization.space_sep(hydra.overlay.python.lib.optionals.givens(ConsList.of(Given(hydra.serialization.cst("raise")),
|
|
848
|
+
hydra.overlay.python.lib.optionals.map((lambda x1: raise_expression_to_expr(x1)), rs.value))))
|
|
842
849
|
|
|
843
850
|
def return_statement_to_expr(rs: hydra.python.syntax.ReturnStatement) -> hydra.ast.Expr:
|
|
844
851
|
r"""Serialize a return statement."""
|
|
@@ -1058,7 +1065,9 @@ def keyword_patterns_to_expr(kp: hydra.python.syntax.KeywordPatterns) -> hydra.a
|
|
|
1058
1065
|
def or_pattern_to_expr(op: hydra.python.syntax.OrPattern) -> hydra.ast.Expr:
|
|
1059
1066
|
r"""Serialize an or pattern."""
|
|
1060
1067
|
|
|
1061
|
-
return hydra.serialization.symbol_sep("|",
|
|
1068
|
+
return hydra.serialization.symbol_sep("|",
|
|
1069
|
+
hydra.serialization.inline_style,
|
|
1070
|
+
hydra.overlay.python.lib.lists.map((lambda x1: closed_pattern_to_expr(x1)), op.value))
|
|
1062
1071
|
|
|
1063
1072
|
def pattern_to_expr(p: hydra.python.syntax.Pattern) -> hydra.ast.Expr:
|
|
1064
1073
|
r"""Serialize a pattern."""
|
|
@@ -1145,7 +1154,9 @@ def to_python_comments(doc_: str) -> str:
|
|
|
1145
1154
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(doc_, ""),
|
|
1146
1155
|
(lambda : ""),
|
|
1147
1156
|
(lambda : hydra.overlay.python.lib.strings.join("\n",
|
|
1148
|
-
hydra.overlay.python.lib.lists.map((lambda line: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(line, ""),
|
|
1157
|
+
hydra.overlay.python.lib.lists.map((lambda line: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(line, ""),
|
|
1158
|
+
(lambda : "#"),
|
|
1159
|
+
(lambda : hydra.overlay.python.lib.strings.concat2("# ", line)))),
|
|
1149
1160
|
hydra.overlay.python.lib.strings.lines(hydra.print.docs.render_doc_string_with((lambda x1: python_doc_entity_ref(x1)), doc_))))))
|
|
1150
1161
|
|
|
1151
1162
|
def annotated_statement_to_expr(as_: hydra.python.syntax.AnnotatedStatement) -> hydra.ast.Expr:
|
|
@@ -1160,7 +1171,8 @@ def block_to_expr(b: hydra.python.syntax.Block) -> hydra.ast.Expr:
|
|
|
1160
1171
|
|
|
1161
1172
|
match b:
|
|
1162
1173
|
case hydra.python.syntax.BlockIndented(value=groups):
|
|
1163
|
-
return hydra.serialization.tab_indent_double_space(hydra.overlay.python.lib.lists.map((lambda stmts: hydra.serialization.newline_sep(hydra.overlay.python.lib.lists.map((lambda x1: statement_to_expr(x1)), stmts))),
|
|
1174
|
+
return hydra.serialization.tab_indent_double_space(hydra.overlay.python.lib.lists.map((lambda stmts: hydra.serialization.newline_sep(hydra.overlay.python.lib.lists.map((lambda x1: statement_to_expr(x1)), stmts))),
|
|
1175
|
+
groups))
|
|
1164
1176
|
|
|
1165
1177
|
case hydra.python.syntax.BlockSimple(value=ss):
|
|
1166
1178
|
return hydra.serialization.semicolon_sep(hydra.overlay.python.lib.lists.map((lambda x1: simple_statement_to_expr(x1)), ss))
|
|
@@ -75,7 +75,8 @@ def generate_python_test_group_hierarchy(group_path: Sequence[str], test_group:
|
|
|
75
75
|
test_cases_str := Lazy((lambda : hydra.overlay.python.lib.strings.join("\n\n", hydra.overlay.python.lib.lists.concat(test_case_lines)))),
|
|
76
76
|
subgroups_str := Lazy((lambda : hydra.overlay.python.lib.strings.join("\n\n", subgroup_blocks))),
|
|
77
77
|
Right(hydra.overlay.python.lib.strings.concat(ConsList.of(test_cases_str.get(),
|
|
78
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.or_(hydra.overlay.python.lib.equality.equal(test_cases_str.get(), ""),
|
|
78
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.or_(hydra.overlay.python.lib.equality.equal(test_cases_str.get(), ""),
|
|
79
|
+
hydra.overlay.python.lib.equality.equal(subgroups_str.get(), "")),
|
|
79
80
|
(lambda : ""),
|
|
80
81
|
(lambda : "\n\n")),
|
|
81
82
|
subgroups_str.get()))))[2]))))
|
|
@@ -88,7 +89,9 @@ def generate_test_file_with_python_codec(test_module: hydra.packaging.Module, te
|
|
|
88
89
|
ns_ := Lazy((lambda : test_module.name)),
|
|
89
90
|
parts := Lazy((lambda : hydra.overlay.python.lib.strings.split_on(".", ns_.get().value))),
|
|
90
91
|
dir_parts := Lazy((lambda : hydra.overlay.python.lib.optionals.with_default((lambda : ConsList.of()), hydra.overlay.python.lib.lists.init(parts.get())))),
|
|
91
|
-
file_name := Lazy((lambda : hydra.overlay.python.lib.strings.concat(ConsList.of("test_",
|
|
92
|
+
file_name := Lazy((lambda : hydra.overlay.python.lib.strings.concat(ConsList.of("test_",
|
|
93
|
+
hydra.overlay.python.lib.optionals.with_default((lambda : ""), hydra.overlay.python.lib.lists.last(parts.get())),
|
|
94
|
+
".py")))),
|
|
92
95
|
file_path := Lazy((lambda : hydra.overlay.python.lib.strings.concat(ConsList.of(hydra.overlay.python.lib.strings.join("/", dir_parts.get()), "/", file_name.get())))),
|
|
93
96
|
(file_path.get(), test_module_content.get()))[6]),
|
|
94
97
|
generate_python_test_group_hierarchy(ConsList.of(), test_group))
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
r"""Python utilities for constructing Python syntax trees."""
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
|
-
from collections.abc import Callable, Sequence
|
|
6
|
+
from collections.abc import Callable, Sequence, Set
|
|
7
7
|
from functools import lru_cache
|
|
8
8
|
from hydra.overlay.python.dsl.python import Given, None_, Optional
|
|
9
|
-
from hydra.overlay.python.util import ConsList, Lazy
|
|
9
|
+
from hydra.overlay.python.util import ConsList, Lazy, PersistentSet
|
|
10
10
|
from typing import TypeVar, cast
|
|
11
11
|
import hydra.analysis
|
|
12
12
|
import hydra.core
|
|
@@ -285,14 +285,15 @@ def dotted_assignment_statement(obj: hydra.python.syntax.Name, attr: hydra.pytho
|
|
|
285
285
|
return py_assignment_to_py_statement(cast(hydra.python.syntax.Assignment,
|
|
286
286
|
hydra.python.syntax.AssignmentUntyped(hydra.python.syntax.UntypedAssignment(ConsList.of(target()), py_expression_to_py_annotated_rhs(expr), None_()))))
|
|
287
287
|
|
|
288
|
-
def find_namespaces(focus_ns: hydra.packaging.ModuleName, defs: Sequence[hydra.packaging.Definition]) -> hydra.util.ModuleNames[hydra.python.syntax.DottedName]:
|
|
289
|
-
r"""Find all namespaces referenced by a list of definitions, plus the core namespace."""
|
|
288
|
+
def find_namespaces(overlay_subs: Set[str], focus_ns: hydra.packaging.ModuleName, defs: Sequence[hydra.packaging.Definition]) -> hydra.util.ModuleNames[hydra.python.syntax.DottedName]:
|
|
289
|
+
r"""Find all namespaces referenced by a list of definitions, plus the core namespace (#630: overlaySubs drives emission-time hydra.lib.<sub> redirect for these namespace refs)."""
|
|
290
290
|
|
|
291
291
|
core_ns = hydra.packaging.ModuleName("hydra.core")
|
|
292
|
-
namespaces = Lazy((lambda : hydra.analysis.module_names_for_definitions((lambda
|
|
292
|
+
namespaces = Lazy((lambda : hydra.analysis.module_names_for_definitions((lambda v1: hydra.python.names.encode_namespace_with_overrides(overlay_subs, v1)), focus_ns, defs)))
|
|
293
293
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(hydra.overlay.python.lib.pairs.first(namespaces().focus).value, core_ns.value),
|
|
294
294
|
(lambda : namespaces()),
|
|
295
|
-
(lambda : hydra.util.ModuleNames(namespaces().focus,
|
|
295
|
+
(lambda : hydra.util.ModuleNames(namespaces().focus,
|
|
296
|
+
hydra.overlay.python.lib.maps.insert(core_ns, hydra.python.names.encode_namespace(core_ns), namespaces().mapping))))
|
|
296
297
|
|
|
297
298
|
@lru_cache(1)
|
|
298
299
|
def get_item_params() -> hydra.python.syntax.Parameters:
|
|
@@ -306,7 +307,8 @@ def indented_block(mcomment: Optional[str], stmts: Sequence[Sequence[hydra.pytho
|
|
|
306
307
|
r"""Create an indented block with optional comment."""
|
|
307
308
|
|
|
308
309
|
comment_group = Lazy((lambda : hydra.overlay.python.lib.optionals.cases(mcomment, (lambda : ConsList.of()), (lambda s: ConsList.of(comment_statement(s))))))
|
|
309
|
-
groups = Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda g: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.null(g))),
|
|
310
|
+
groups = Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda g: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.null(g))),
|
|
311
|
+
hydra.overlay.python.lib.lists.cons(comment_group(), stmts))))
|
|
310
312
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.null(groups()),
|
|
311
313
|
(lambda : cast(hydra.python.syntax.Block,
|
|
312
314
|
hydra.python.syntax.BlockIndented(ConsList.of(ConsList.of(cast(hydra.python.syntax.Statement,
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"digestFormatVersion": 1,
|
|
3
|
-
"moduleFormatVersion": 1,
|
|
4
|
-
"generator": "983e925152c14e7d",
|
|
5
|
-
"generation": {
|
|
6
|
-
"generatorId": "983e925152c14e7d",
|
|
7
|
-
"mode": "published",
|
|
8
|
-
"hydraVersion": "0.17.2",
|
|
9
|
-
"revision": "fa099dc0f8",
|
|
10
|
-
"timestamp": "2026-07-31T15:44:34Z",
|
|
11
|
-
"host": "python"
|
|
12
|
-
},
|
|
13
|
-
"selfHash": "8f12cad96047b0fe5cef599a843cbf5dd50d077d099b2a8462568a9b9064536b",
|
|
14
|
-
"depHash:hydra-kernel": "331eaf0751864ad00dbe4f2d53a1bf6c95709e006df1c87c98284a5efb306708",
|
|
15
|
-
"inputs": {
|
|
16
|
-
"hydra.python.coder": { "kind": "Other", "hash": "784bf72060179ad7c64e71008b68892b98b081a2826fc337768bf0b0e97cfc6f" },
|
|
17
|
-
"hydra.python.environment": { "kind": "Other", "hash": "e14b76188ef4da15c8f011740ed2751e9b55cd0e13f9d9e9d6917cb644526ac9" },
|
|
18
|
-
"hydra.python.language": { "kind": "Other", "hash": "78fb867a1d0fa6654f46f5d9fd72c2c5607d2934b7c7fbd5f5d830786b4ad91e" },
|
|
19
|
-
"hydra.python.names": { "kind": "Other", "hash": "f0e81d57cda13bc617185cc2d09240091e816ba9fb2e1c9e6091ef888ea34e22" },
|
|
20
|
-
"hydra.python.pyproject": { "kind": "Other", "hash": "249512648b2b008db234ee348a72056d4d625cfeb0a80d8caacbda95002569a2" },
|
|
21
|
-
"hydra.python.serde": { "kind": "Other", "hash": "9285fa0296e940da1de51a53465598455c46404851aefc2ce15220fc6ee7efc6" },
|
|
22
|
-
"hydra.python.syntax": { "kind": "Other", "hash": "88a9154b48fd429f06efa0ba8981bdf12af3fed4de5a057b3304fadc623dbc19" },
|
|
23
|
-
"hydra.python.testing": { "kind": "Other", "hash": "a40b949c594c81f8925ba423a89e46964b2b1475d44a486aa07c792c2c7f807b" },
|
|
24
|
-
"hydra.python.utils": { "kind": "Other", "hash": "d5769b4f1a6952f8786b77a7e9e1699b278eb514879174b5a9dd7b08e4b55686" },
|
|
25
|
-
"jsonContent:hydra/dsl/python/environment.json": { "kind": "Other", "hash": "670d83127f7a308b11a577e3481eb9926d366a1046ab99a5e1578b0bf72159c4" },
|
|
26
|
-
"jsonContent:hydra/dsl/python/names.json": { "kind": "Other", "hash": "244d73ec6a140f89bafcbb87dc8570a09f50151508aa0443708e7070749be876" },
|
|
27
|
-
"jsonContent:hydra/dsl/python/syntax.json": { "kind": "Other", "hash": "a99b94b1f3e542d606da15fd6dafa32d858ce7d71ba02f7b21d8bb4881daa4e3" },
|
|
28
|
-
"jsonContent:hydra/dsl/python/utils.json": { "kind": "Other", "hash": "5464cb8e1db43a03b98327746b668050f4159a90f13ce5334c32e6d7dbbceb4c" },
|
|
29
|
-
"jsonContent:hydra/python/coder.json": { "kind": "Other", "hash": "7bd00830dda91a23bddb7d1fd36ea48e79821a81778b809a50924ac959619b61" },
|
|
30
|
-
"jsonContent:hydra/python/environment.json": { "kind": "Other", "hash": "b5bc63f7d18f47262c90738cb793098f88a97376fd52088b3c8661c1d9ea5cbd" },
|
|
31
|
-
"jsonContent:hydra/python/language.json": { "kind": "Other", "hash": "221e68d68030945db181fdd079be4ff619cb4cd1ad5d4b72b4e70f2aa1bd5230" },
|
|
32
|
-
"jsonContent:hydra/python/names.json": { "kind": "Other", "hash": "51a59a9f21446bb6cfb128e4830c74e33a42ddaffbe67afddfa55d9fee610fb9" },
|
|
33
|
-
"jsonContent:hydra/python/pyproject.json": { "kind": "Other", "hash": "c94de46f1615e6e82d2f706d01ef04293373f6241a9a42882bb394d51b4f7f53" },
|
|
34
|
-
"jsonContent:hydra/python/serde.json": { "kind": "Other", "hash": "648d34f63d2336972d5e0a59d4871332a07bd35c88eb38c28236e16a7fd48601" },
|
|
35
|
-
"jsonContent:hydra/python/syntax.json": { "kind": "Other", "hash": "8dc3a26ac927fa338b273c9deee6317906977a2deec4c2df1e44ff0bbe0a64cd" },
|
|
36
|
-
"jsonContent:hydra/python/testing.json": { "kind": "Other", "hash": "9c75b534004194396935b1dd3331bae4d8d5cbb31c3959fa3794dda00960c09a" },
|
|
37
|
-
"jsonContent:hydra/python/utils.json": { "kind": "Other", "hash": "fea597ac6c71916255914f8196c377b780d32b475b5b81cd1c0a087b8abe87c3" },
|
|
38
|
-
"jsonContent:manifest.json": { "kind": "Other", "hash": "3f94b521766d042381d7bee84596308ea4e35c7e8fb45f8fd8338a8dbe27a0ac" }
|
|
39
|
-
},
|
|
40
|
-
"outputs": {
|
|
41
|
-
"hydra/dsl/python/environment.py": { "kind": "TargetFile", "hash": "b209619140e3be5a139672944bed98f4de87b6ca48ab93981722d158fde1f424" },
|
|
42
|
-
"hydra/dsl/python/names.py": { "kind": "TargetFile", "hash": "3733bed7b32e56239c4c2dd5a748e66ee0f5b9eff629687648a5ebe232508a93" },
|
|
43
|
-
"hydra/dsl/python/syntax.py": { "kind": "TargetFile", "hash": "5fe1c0c739cdac68d1b90d768153e23ebe7c805bafb96ac698a95425e2d7d7b5" },
|
|
44
|
-
"hydra/dsl/python/utils.py": { "kind": "TargetFile", "hash": "fbf8522b1d5c64eb570027d579b512caf7ae3853f010b4e4666746df6d262812" },
|
|
45
|
-
"hydra/python/coder.py": { "kind": "TargetFile", "hash": "8a2d415e5e026b13d6c7fd620dcce839443f028cc34720a79e6a2de482f06238" },
|
|
46
|
-
"hydra/python/environment.py": { "kind": "TargetFile", "hash": "240979735f3a2d479403834c1a4d7a16f060ad447eb4f3b05fbb2db591d7ad0b" },
|
|
47
|
-
"hydra/python/language.py": { "kind": "TargetFile", "hash": "7ea0c3a6015ec1de92aebeed0963c1af9f3b70c8d57815e477c528c795383604" },
|
|
48
|
-
"hydra/python/names.py": { "kind": "TargetFile", "hash": "09490cd34e878fa3c9ad7940171b86a60843fe7591f78d7bb57eb3c52c4edc2e" },
|
|
49
|
-
"hydra/python/pyproject.py": { "kind": "TargetFile", "hash": "1f9001d8d2273d4783105e099b874c273ce520b58456f9b447cb8d5e9a6a37d7" },
|
|
50
|
-
"hydra/python/serde.py": { "kind": "TargetFile", "hash": "ad1714baddb710cd3f345c339a9e6a55862197660cd065ac84d3736716792cbf" },
|
|
51
|
-
"hydra/python/syntax.py": { "kind": "TargetFile", "hash": "24a72af882b47d80cc930f16f51a3e9c1a71c9d8da47a921829f40e847459fca" },
|
|
52
|
-
"hydra/python/testing.py": { "kind": "TargetFile", "hash": "2b9137ccd1449a8c636c59df9dc5d83662ed1e9547802ba6b8c2c5db5ee29710" },
|
|
53
|
-
"hydra/python/utils.py": { "kind": "TargetFile", "hash": "05504b0be6dff96d72997295abd89a5510bbc8580b48f85bd25575b313e19645" }
|
|
54
|
-
}
|
|
55
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|