hydra-python 0.17.5__tar.gz → 0.17.6__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.5 → hydra_python-0.17.6}/PKG-INFO +3 -3
- {hydra_python-0.17.5 → hydra_python-0.17.6}/README.md +1 -1
- {hydra_python-0.17.5 → hydra_python-0.17.6}/build/main/digest.json +24 -24
- {hydra_python-0.17.5 → hydra_python-0.17.6}/pyproject.toml +2 -2
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/coder.py +36 -34
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/serde.py +6 -6
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/testing.py +1 -1
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/utils.py +5 -5
- {hydra_python-0.17.5 → hydra_python-0.17.6}/.gitignore +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/LICENSE +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/NOTICE +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/dsl/python/environment.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/dsl/python/names.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/dsl/python/syntax.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/dsl/python/utils.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/environment.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/language.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/names.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/pyproject.py +0 -0
- {hydra_python-0.17.5 → hydra_python-0.17.6}/src/main/python/hydra/python/syntax.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: hydra-python
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.6
|
|
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.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
|
|
15
15
|
# Hydra-Python
|
|
@@ -398,7 +398,7 @@ of kwargs + explicit `field()`.
|
|
|
398
398
|
```python
|
|
399
399
|
@hydra_element(my_module, type_=T.function(T.int32(), T.string()))
|
|
400
400
|
def show_number(x):
|
|
401
|
-
return Strings.
|
|
401
|
+
return Strings.print_int32(x)
|
|
402
402
|
```
|
|
403
403
|
|
|
404
404
|
Idiomatic Python metadata mechanism. Risk: users may expect the
|
|
@@ -384,7 +384,7 @@ of kwargs + explicit `field()`.
|
|
|
384
384
|
```python
|
|
385
385
|
@hydra_element(my_module, type_=T.function(T.int32(), T.string()))
|
|
386
386
|
def show_number(x):
|
|
387
|
-
return Strings.
|
|
387
|
+
return Strings.print_int32(x)
|
|
388
388
|
```
|
|
389
389
|
|
|
390
390
|
Idiomatic Python metadata mechanism. Risk: users may expect the
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"digestFormatVersion": 2,
|
|
3
3
|
"moduleFormatVersion": 1,
|
|
4
|
-
"generator": "
|
|
4
|
+
"generator": "3fcbb2c3eed9a625",
|
|
5
5
|
"generation": {
|
|
6
|
-
"generatorId": "
|
|
6
|
+
"generatorId": "3fcbb2c3eed9a625",
|
|
7
7
|
"mode": "published",
|
|
8
8
|
"host": "python",
|
|
9
|
-
"hydraVersion": "0.17.
|
|
10
|
-
"revision": "
|
|
11
|
-
"timestamp": "2026-08-
|
|
12
|
-
"selfHash": "
|
|
13
|
-
"dependencyHashes": [{"key": "hydra-kernel", "value": "
|
|
9
|
+
"hydraVersion": "0.17.5",
|
|
10
|
+
"revision": "b0b667ab7e",
|
|
11
|
+
"timestamp": "2026-08-30T21:12:52Z"},
|
|
12
|
+
"selfHash": "9d63be6fefd1f95d501eb1ca75f52604f6b5ef6a37d02fe79ac24ae4608433e9",
|
|
13
|
+
"dependencyHashes": [{"key": "hydra-kernel", "value": "21db6cd59e90695a747e6be08ce6759422f84c88efd511d09ecd00fae34e4c7a"}],
|
|
14
14
|
"inputs": [
|
|
15
15
|
{
|
|
16
16
|
"key": "hydra.python.coder",
|
|
17
|
-
"value": {"kind": "other", "hash": "
|
|
17
|
+
"value": {"kind": "other", "hash": "0f6f038ef11ca726af501d1483716d1d5adff54e3c03e9a1f2cb61875260f4f7"}},
|
|
18
18
|
{
|
|
19
19
|
"key": "hydra.python.environment",
|
|
20
20
|
"value": {"kind": "other", "hash": "663b02271ddd4a6ad9ab8a2bdc152a64802a675a59280909f605d6dedcc4017e"}},
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"value": {"kind": "other", "hash": "249512648b2b008db234ee348a72056d4d625cfeb0a80d8caacbda95002569a2"}},
|
|
30
30
|
{
|
|
31
31
|
"key": "hydra.python.serde",
|
|
32
|
-
"value": {"kind": "other", "hash": "
|
|
32
|
+
"value": {"kind": "other", "hash": "8d35f12f8ef3aa33db2064a266d6c97a31e2c8675a6f77005cdb011b01597b8a"}},
|
|
33
33
|
{
|
|
34
34
|
"key": "hydra.python.syntax",
|
|
35
35
|
"value": {"kind": "other", "hash": "88a9154b48fd429f06efa0ba8981bdf12af3fed4de5a057b3304fadc623dbc19"}},
|
|
36
36
|
{
|
|
37
37
|
"key": "hydra.python.testing",
|
|
38
|
-
"value": {"kind": "other", "hash": "
|
|
38
|
+
"value": {"kind": "other", "hash": "52629d9f9aba82fbae03c9250b42d962eea9b2cdfde77c02466282ab95c51b5b"}},
|
|
39
39
|
{
|
|
40
40
|
"key": "hydra.python.utils",
|
|
41
|
-
"value": {"kind": "other", "hash": "
|
|
41
|
+
"value": {"kind": "other", "hash": "dee99428120e9ed4b418ca438480434cc967a13ac1d918385d9fb2b1d76afeb7"}},
|
|
42
42
|
{
|
|
43
43
|
"key": "jsonContent:hydra/dsl/python/environment.json",
|
|
44
44
|
"value": {"kind": "other", "hash": "684965cea67ad57d492b50f408c6575f679b073c5de5e76826fb0941da86ec21"}},
|
|
@@ -53,31 +53,31 @@
|
|
|
53
53
|
"value": {"kind": "other", "hash": "7a3b84d522c420db0db03a77f9e54635b33544f73eb49ed67cdc3a4d5dac04ae"}},
|
|
54
54
|
{
|
|
55
55
|
"key": "jsonContent:hydra/python/coder.json",
|
|
56
|
-
"value": {"kind": "other", "hash": "
|
|
56
|
+
"value": {"kind": "other", "hash": "ebc4bdd1c21d9af2f90f408414d22313b1d1c2750f6c792c2ebed8ea9793336e"}},
|
|
57
57
|
{
|
|
58
58
|
"key": "jsonContent:hydra/python/environment.json",
|
|
59
|
-
"value": {"kind": "other", "hash": "
|
|
59
|
+
"value": {"kind": "other", "hash": "27b358d874d0de0b7cd8b2ded9194c6ae0ac30069f26eb6d658e768ff9414825"}},
|
|
60
60
|
{
|
|
61
61
|
"key": "jsonContent:hydra/python/language.json",
|
|
62
|
-
"value": {"kind": "other", "hash": "
|
|
62
|
+
"value": {"kind": "other", "hash": "f5f154079126771b9af2a4df8e53a4e9c75bb44ee3f154f4f0ce762744785b88"}},
|
|
63
63
|
{
|
|
64
64
|
"key": "jsonContent:hydra/python/names.json",
|
|
65
|
-
"value": {"kind": "other", "hash": "
|
|
65
|
+
"value": {"kind": "other", "hash": "6997d344c45c2a774b8e5d354f67c06358a7f06c91317d6100b25573cb11b7ab"}},
|
|
66
66
|
{
|
|
67
67
|
"key": "jsonContent:hydra/python/pyproject.json",
|
|
68
|
-
"value": {"kind": "other", "hash": "
|
|
68
|
+
"value": {"kind": "other", "hash": "eacea3b3d38c4890c693a012d3cd71f02e96c25c131cef8a0aa90a30442f8a7f"}},
|
|
69
69
|
{
|
|
70
70
|
"key": "jsonContent:hydra/python/serde.json",
|
|
71
|
-
"value": {"kind": "other", "hash": "
|
|
71
|
+
"value": {"kind": "other", "hash": "1428720f350e9f76ab293116b4ebf7d384d8e78dc6b62f5220d3ef30c26f9585"}},
|
|
72
72
|
{
|
|
73
73
|
"key": "jsonContent:hydra/python/syntax.json",
|
|
74
|
-
"value": {"kind": "other", "hash": "
|
|
74
|
+
"value": {"kind": "other", "hash": "a6ddfec03413c23fd3830501c58eb4350b046b6b654faa51f49ffe9aab5b995c"}},
|
|
75
75
|
{
|
|
76
76
|
"key": "jsonContent:hydra/python/testing.json",
|
|
77
|
-
"value": {"kind": "other", "hash": "
|
|
77
|
+
"value": {"kind": "other", "hash": "eb35348cdf17021c1480d2b3ec001d4e5326f7d5b934325cb7294553d2ff64d2"}},
|
|
78
78
|
{
|
|
79
79
|
"key": "jsonContent:hydra/python/utils.json",
|
|
80
|
-
"value": {"kind": "other", "hash": "
|
|
80
|
+
"value": {"kind": "other", "hash": "cae0b4fac77fdae05b5592f671b9c58f84d3374f94acbe3d49f27962096d1a5e"}},
|
|
81
81
|
{
|
|
82
82
|
"key": "jsonContent:manifest.json",
|
|
83
83
|
"value": {"kind": "other", "hash": "3f94b521766d042381d7bee84596308ea4e35c7e8fb45f8fd8338a8dbe27a0ac"}}],
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"value": {"kind": "targetFile", "hash": "3fed9996a3f875a53675b6c8620884949adf7d155b0e68cacfba9007d5d07b29"}},
|
|
97
97
|
{
|
|
98
98
|
"key": "hydra/python/coder.py",
|
|
99
|
-
"value": {"kind": "targetFile", "hash": "
|
|
99
|
+
"value": {"kind": "targetFile", "hash": "d7e39526e1f7802a5af9d6ea57596766be03b9e16505095c57597f8903683461"}},
|
|
100
100
|
{
|
|
101
101
|
"key": "hydra/python/environment.py",
|
|
102
102
|
"value": {"kind": "targetFile", "hash": "1036eb9d285ba3e98c85095820f2e77900334340c9f0223fd4dfd6b3e847f4df"}},
|
|
@@ -111,13 +111,13 @@
|
|
|
111
111
|
"value": {"kind": "targetFile", "hash": "1f9001d8d2273d4783105e099b874c273ce520b58456f9b447cb8d5e9a6a37d7"}},
|
|
112
112
|
{
|
|
113
113
|
"key": "hydra/python/serde.py",
|
|
114
|
-
"value": {"kind": "targetFile", "hash": "
|
|
114
|
+
"value": {"kind": "targetFile", "hash": "1f36ea2dc8c50df72abe464cd395689c71f0af70a9f78e68d26013f9b436c383"}},
|
|
115
115
|
{
|
|
116
116
|
"key": "hydra/python/syntax.py",
|
|
117
117
|
"value": {"kind": "targetFile", "hash": "24a72af882b47d80cc930f16f51a3e9c1a71c9d8da47a921829f40e847459fca"}},
|
|
118
118
|
{
|
|
119
119
|
"key": "hydra/python/testing.py",
|
|
120
|
-
"value": {"kind": "targetFile", "hash": "
|
|
120
|
+
"value": {"kind": "targetFile", "hash": "5c8f352d976eeeebf14974e9df208b53c8db59810fdbd76e6454868627122635"}},
|
|
121
121
|
{
|
|
122
122
|
"key": "hydra/python/utils.py",
|
|
123
|
-
"value": {"kind": "targetFile", "hash": "
|
|
123
|
+
"value": {"kind": "targetFile", "hash": "2cfa00436ebc27925f9b45380792aa817921bb7dbaf88e0c17cfb51bbe3c82fc"}}]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
[project]
|
|
15
15
|
name = "hydra-python"
|
|
16
|
-
version = "0.17.
|
|
16
|
+
version = "0.17.6"
|
|
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.6",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.urls]
|
|
@@ -343,7 +343,7 @@ def deduplicate_case_variables(cases_: Sequence[hydra.core.CaseAlternative]) ->
|
|
|
343
343
|
(lambda : (hydra.overlay.python.lib.maps.insert(v, 1, count_by_name()), hydra.overlay.python.lib.lists.cons(field, done()))),
|
|
344
344
|
(lambda count: (
|
|
345
345
|
count2 := Lazy((lambda : hydra.overlay.python.lib.math.add(count, 1))),
|
|
346
|
-
v2 := Lazy((lambda : hydra.core.Name(hydra.overlay.python.lib.strings.concat2(v.value, hydra.overlay.python.lib.literals.
|
|
346
|
+
v2 := Lazy((lambda : hydra.core.Name(hydra.overlay.python.lib.strings.concat2(v.value, hydra.overlay.python.lib.literals.print_int32(count2.get()))))),
|
|
347
347
|
new_body := Lazy((lambda : hydra.reduction.alpha_convert(v, v2.get(), body))),
|
|
348
348
|
new_lam := Lazy((lambda : hydra.core.Lambda(v2.get(), mdom, new_body.get()))),
|
|
349
349
|
new_term := Lazy((lambda : cast(hydra.core.Term, hydra.core.TermLambda(new_lam.get())))),
|
|
@@ -444,7 +444,7 @@ def encode_float_value_py_special_float(value: str) -> hydra.python.syntax.Expre
|
|
|
444
444
|
ConsList.of(hydra.python.utils.single_quoted_string(value)))
|
|
445
445
|
|
|
446
446
|
def encode_float_value_encode_float32(v: float) -> Either[T0, hydra.python.syntax.Expression]:
|
|
447
|
-
s = Lazy((lambda : hydra.overlay.python.lib.literals.
|
|
447
|
+
s = Lazy((lambda : hydra.overlay.python.lib.literals.print_float32(v)))
|
|
448
448
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(s(), "NaN"),
|
|
449
449
|
(lambda : Right(encode_float_value_py_special_float("nan"))),
|
|
450
450
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(s(), "Infinity"),
|
|
@@ -455,7 +455,7 @@ def encode_float_value_encode_float32(v: float) -> Either[T0, hydra.python.synta
|
|
|
455
455
|
hydra.python.syntax.AtomNumber(cast(hydra.python.syntax.Number, hydra.python.syntax.NumberFloat(hydra.overlay.python.lib.literals.float32_to_float64(v)))))))))))))
|
|
456
456
|
|
|
457
457
|
def encode_float_value_encode_float64(v: float) -> Either[T0, hydra.python.syntax.Expression]:
|
|
458
|
-
s = Lazy((lambda : hydra.overlay.python.lib.literals.
|
|
458
|
+
s = Lazy((lambda : hydra.overlay.python.lib.literals.print_float64(v)))
|
|
459
459
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(s(), "NaN"),
|
|
460
460
|
(lambda : Right(encode_float_value_py_special_float("nan"))),
|
|
461
461
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(s(), "Infinity"),
|
|
@@ -538,7 +538,7 @@ def encode_literal(lit: hydra.core.Literal) -> Either[T0, hydra.python.syntax.Ex
|
|
|
538
538
|
|
|
539
539
|
case hydra.core.LiteralDecimal(value=d):
|
|
540
540
|
return Right(hydra.python.utils.function_call(hydra.python.utils.py_name_to_py_primary(hydra.python.syntax.Name("Decimal")),
|
|
541
|
-
ConsList.of(hydra.python.utils.single_quoted_string(hydra.overlay.python.lib.literals.
|
|
541
|
+
ConsList.of(hydra.python.utils.single_quoted_string(hydra.overlay.python.lib.literals.print_decimal(d)))))
|
|
542
542
|
|
|
543
543
|
case hydra.core.LiteralFloat(value=f):
|
|
544
544
|
return encode_float_value(f)
|
|
@@ -891,7 +891,7 @@ def lazy_dot_get(expr: hydra.python.syntax.Expression) -> hydra.python.syntax.Ex
|
|
|
891
891
|
def make_simple_lambda(arity: int, lhs: hydra.python.syntax.Expression) -> hydra.python.syntax.Expression:
|
|
892
892
|
r"""Wrap a bare reference to a polymorphic function in an uncurried lambda."""
|
|
893
893
|
|
|
894
|
-
args = Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda i: hydra.python.syntax.Name(hydra.overlay.python.lib.strings.concat2("x", hydra.overlay.python.lib.literals.
|
|
894
|
+
args = Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda i: hydra.python.syntax.Name(hydra.overlay.python.lib.strings.concat2("x", hydra.overlay.python.lib.literals.print_int32(i)))),
|
|
895
895
|
hydra.overlay.python.lib.math.range_(1, hydra.overlay.python.lib.math.add(arity, 1)))))
|
|
896
896
|
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.equality.equal(arity, 0),
|
|
897
897
|
(lambda : lhs),
|
|
@@ -945,7 +945,7 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
945
945
|
as_function_call = Lazy((lambda : hydra.python.utils.function_call(hydra.python.utils.py_name_to_py_primary(hydra.python.names.encode_name(True, hydra.util.CaseConvention.LOWER_SNAKE, env, name)),
|
|
946
946
|
args)))
|
|
947
947
|
as_lazy_call = Lazy((lambda : hydra.python.utils.function_call(hydra.python.utils.py_expression_to_py_primary(lazy_dot_get(as_variable())), args)))
|
|
948
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
948
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(args)),
|
|
949
949
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.sets.member(name, inline_vars),
|
|
950
950
|
(lambda : Right(as_lazy_call())),
|
|
951
951
|
(lambda : hydra.overlay.python.lib.optionals.match(hydra.lexical.lookup_primitive(g(), name),
|
|
@@ -957,7 +957,7 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
957
957
|
(lambda : (
|
|
958
958
|
num_remaining := Lazy((lambda : hydra.overlay.python.lib.math.sub(prim_arity.get(), hydra.overlay.python.lib.lists.length(args)))),
|
|
959
959
|
(
|
|
960
|
-
remaining_params := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda i: hydra.python.syntax.Name(hydra.overlay.python.lib.strings.concat2("x", hydra.overlay.python.lib.literals.
|
|
960
|
+
remaining_params := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda i: hydra.python.syntax.Name(hydra.overlay.python.lib.strings.concat2("x", hydra.overlay.python.lib.literals.print_int32(i)))),
|
|
961
961
|
hydra.overlay.python.lib.math.range_(1, hydra.overlay.python.lib.math.add(num_remaining.get(), 1))))),
|
|
962
962
|
(
|
|
963
963
|
remaining_exprs := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda n: cast(hydra.python.syntax.Expression,
|
|
@@ -1001,7 +1001,7 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
1001
1001
|
hydra.overlay.python.lib.logic.not_(el_trivial1.get())),
|
|
1002
1002
|
(lambda : Right(as_function_call())),
|
|
1003
1003
|
(lambda : (
|
|
1004
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
1004
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(ts.variables)),
|
|
1005
1005
|
(lambda : make_simple_lambda(hydra.arity.type_arity(ts.body), as_variable())),
|
|
1006
1006
|
(lambda : as_variable())))),
|
|
1007
1007
|
Right(as_function_ref.get()))[1])))))[1]))),
|
|
@@ -1012,7 +1012,7 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
1012
1012
|
(lambda : (
|
|
1013
1013
|
ts := Lazy((lambda : hydra.scoping.term_signature_to_type_scheme(prim.definition.signature))),
|
|
1014
1014
|
(
|
|
1015
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
1015
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(ts.get().variables)),
|
|
1016
1016
|
(lambda : make_simple_lambda(hydra.arity.type_arity(ts.get().body), as_variable())),
|
|
1017
1017
|
(lambda : as_variable())))),
|
|
1018
1018
|
Right(as_function_ref.get()))[1])[1])))[1]))))))),
|
|
@@ -1022,14 +1022,14 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
1022
1022
|
(lambda : (
|
|
1023
1023
|
unwrapped := Lazy((lambda : lazy_dot_get(as_variable()))),
|
|
1024
1024
|
(
|
|
1025
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.
|
|
1025
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.is_empty(hydra.variables.free_variables_in_type(typ))),
|
|
1026
1026
|
(lambda : make_simple_lambda(hydra.arity.type_arity(typ), unwrapped.get())),
|
|
1027
1027
|
(lambda : unwrapped.get())))),
|
|
1028
1028
|
Right(as_function_ref.get()))[1])[1]),
|
|
1029
1029
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.maps.member(name, tc_metadata)),
|
|
1030
1030
|
(lambda : hydra.overlay.python.lib.optionals.match(hydra.lexical.lookup_binding(g(), name),
|
|
1031
1031
|
(lambda : (
|
|
1032
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.
|
|
1032
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.is_empty(hydra.variables.free_variables_in_type(typ))),
|
|
1033
1033
|
(lambda : make_simple_lambda(hydra.arity.type_arity(typ), as_variable())),
|
|
1034
1034
|
(lambda : as_variable())))),
|
|
1035
1035
|
Right(as_function_ref.get()))[1]),
|
|
@@ -1040,7 +1040,7 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
1040
1040
|
hydra.overlay.python.lib.logic.not_(el_trivial.get())),
|
|
1041
1041
|
(lambda : Right(as_function_call())),
|
|
1042
1042
|
(lambda : (
|
|
1043
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.
|
|
1043
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.is_empty(hydra.variables.free_variables_in_type(typ))),
|
|
1044
1044
|
(lambda : make_simple_lambda(hydra.arity.type_arity(typ), as_variable())),
|
|
1045
1045
|
(lambda : as_variable())))),
|
|
1046
1046
|
Right(as_function_ref.get()))[1]))),
|
|
@@ -1048,14 +1048,14 @@ args: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, hy
|
|
|
1048
1048
|
hydra.overlay.python.lib.logic.not_(el_trivial.get())),
|
|
1049
1049
|
(lambda : Right(as_function_call())),
|
|
1050
1050
|
(lambda : (
|
|
1051
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.
|
|
1051
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.is_empty(hydra.variables.free_variables_in_type(typ))),
|
|
1052
1052
|
(lambda : make_simple_lambda(hydra.arity.type_arity(typ), as_variable())),
|
|
1053
1053
|
(lambda : as_variable())))),
|
|
1054
1054
|
Right(as_function_ref.get()))[1])))))[1]))),
|
|
1055
1055
|
(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), hydra.predicates.is_complex_variable(tc, name)),
|
|
1056
1056
|
(lambda : Right(as_function_call())),
|
|
1057
1057
|
(lambda : (
|
|
1058
|
-
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.
|
|
1058
|
+
as_function_ref := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.is_empty(hydra.variables.free_variables_in_type(typ))),
|
|
1059
1059
|
(lambda : make_simple_lambda(hydra.arity.type_arity(typ), as_variable())),
|
|
1060
1060
|
(lambda : as_variable())))),
|
|
1061
1061
|
Right(as_function_ref.get()))[1]))))))))))))
|
|
@@ -1205,7 +1205,7 @@ rargs: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, t
|
|
|
1205
1205
|
hydra.overlay.python.lib.lists.head(hargs))))
|
|
1206
1206
|
rest_args = Lazy((lambda : hydra.overlay.python.lib.lists.drop(1, hargs)))
|
|
1207
1207
|
def with_rest(e: hydra.python.syntax.Expression) -> hydra.python.syntax.Expression:
|
|
1208
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1208
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(rest_args()),
|
|
1209
1209
|
(lambda : e),
|
|
1210
1210
|
(lambda : hydra.python.utils.function_call(hydra.python.utils.py_expression_to_py_primary(e), rest_args())))
|
|
1211
1211
|
default_case = Lazy((lambda : hydra.overlay.python.lib.eithers.bind(encode_term_inline(cx, env, False, fun),
|
|
@@ -1222,7 +1222,7 @@ rargs: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, t
|
|
|
1222
1222
|
case hydra.core.TermUnwrap():
|
|
1223
1223
|
value_expr = Lazy((lambda : hydra.python.utils.project_from_expression(first_arg(), hydra.python.syntax.Name("value"))))
|
|
1224
1224
|
all_args = Lazy((lambda : hydra.overlay.python.lib.lists.concat2(rest_args(), rargs)))
|
|
1225
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1225
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(all_args()),
|
|
1226
1226
|
(lambda : Right((value_expr(), ConsList.of()))),
|
|
1227
1227
|
(lambda : Right((
|
|
1228
1228
|
hydra.python.utils.function_call(hydra.python.utils.py_expression_to_py_primary(value_expr()), all_args()),
|
|
@@ -1246,7 +1246,7 @@ rargs: Sequence[hydra.python.syntax.Expression]) -> Either[hydra.errors.Error, t
|
|
|
1246
1246
|
consume_count := Lazy((lambda : hydra.overlay.python.lib.ordering.min(el_arity.get(), hydra.overlay.python.lib.lists.length(all_args())))),
|
|
1247
1247
|
consumed_args := Lazy((lambda : hydra.overlay.python.lib.lists.take(consume_count.get(), all_args()))),
|
|
1248
1248
|
remaining_args := Lazy((lambda : hydra.overlay.python.lib.lists.drop(consume_count.get(), all_args()))),
|
|
1249
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1249
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(consumed_args.get()),
|
|
1250
1250
|
(lambda : hydra.overlay.python.lib.eithers.bind(encode_variable(cx, env, name, ConsList.of()), (lambda expr: Right((expr, rargs))))),
|
|
1251
1251
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.sets.member(name, inline_vars),
|
|
1252
1252
|
(lambda : Right((
|
|
@@ -1350,7 +1350,7 @@ def encode_term_inline(cx: hydra.typing.InferenceContext, env: hydra.python.envi
|
|
|
1350
1350
|
(lambda pbody: (
|
|
1351
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)),
|
|
1352
1352
|
params.get()))),
|
|
1353
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1353
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(bindings.get()),
|
|
1354
1354
|
(lambda : Right(make_uncurried_lambda(pparams.get(), pbody))),
|
|
1355
1355
|
(lambda : hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.eithers.map_list((lambda v1: encode_binding_as_assignment(cx, False, inner_env.get(), v1)), bindings.get()),
|
|
1356
1356
|
(lambda pbinding_exprs: (
|
|
@@ -1408,7 +1408,7 @@ def encode_term_inline(cx: hydra.typing.InferenceContext, env: hydra.python.envi
|
|
|
1408
1408
|
case hydra.core.TermLet(value=lt):
|
|
1409
1409
|
bindings = lt.bindings
|
|
1410
1410
|
body = lt.body
|
|
1411
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1411
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(bindings),
|
|
1412
1412
|
(lambda : encode_term_inline(cx, env, False, body)),
|
|
1413
1413
|
(lambda : with_let_inline(env,
|
|
1414
1414
|
lt,
|
|
@@ -1799,7 +1799,7 @@ def encode_binding_as(cx: hydra.typing.InferenceContext, env: hydra.python.envir
|
|
|
1799
1799
|
Right(cast(hydra.python.syntax.Statement,
|
|
1800
1800
|
hydra.python.syntax.StatementCompound(cast(hydra.python.syntax.CompoundStatement,
|
|
1801
1801
|
hydra.python.syntax.CompoundStatementFunction(hydra.python.syntax.FunctionDefinition(None_(), func_def_raw.get())))))))[5])))))[5])))[3])))[1]),
|
|
1802
|
-
(lambda csa: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1802
|
+
(lambda csa: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(lambda_params.get()),
|
|
1803
1803
|
(lambda : (
|
|
1804
1804
|
mcs := Lazy((lambda : extract_case_elimination(term1))),
|
|
1805
1805
|
hydra.overlay.python.lib.optionals.match(mcs.get(),
|
|
@@ -1909,7 +1909,7 @@ comment: Optional[str]) -> Either[hydra.errors.Error, hydra.python.syntax.Statem
|
|
|
1909
1909
|
is_complex := Lazy((lambda : hydra.predicates.is_complex_binding(tc.get(), binding.get()))),
|
|
1910
1910
|
is_trivial := Lazy((lambda : hydra.predicates.is_trivial_term(term))),
|
|
1911
1911
|
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(is_complex.get(), hydra.overlay.python.lib.logic.not_(is_trivial.get())),
|
|
1912
|
-
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(top_level), hydra.overlay.python.lib.lists.
|
|
1912
|
+
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(top_level), hydra.overlay.python.lib.lists.is_empty(params.get())),
|
|
1913
1913
|
(lambda : hydra.overlay.python.lib.eithers.bind(encode_term_inline(cx, env2.get(), False, term),
|
|
1914
1914
|
(lambda body_expr: (
|
|
1915
1915
|
py_name := Lazy((lambda : hydra.python.names.encode_name(False, hydra.util.CaseConvention.LOWER_SNAKE, env2.get(), name))),
|
|
@@ -1931,7 +1931,7 @@ def encode_term_multiline(cx: hydra.typing.InferenceContext, env: hydra.python.e
|
|
|
1931
1931
|
bindings := Lazy((lambda : fs.bindings)),
|
|
1932
1932
|
inner_body := Lazy((lambda : fs.body)),
|
|
1933
1933
|
env2 := Lazy((lambda : fs.environment)),
|
|
1934
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1934
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(bindings.get()),
|
|
1935
1935
|
(lambda : hydra.overlay.python.lib.eithers.bind(encode_term_inline(cx, env, False, term), (lambda expr: Right(ConsList.of(hydra.python.utils.return_single(expr)))))),
|
|
1936
1936
|
(lambda : hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.eithers.map_list((lambda v1: encode_binding_as(cx, env2.get(), v1)), bindings.get()),
|
|
1937
1937
|
(lambda binding_stmts: hydra.overlay.python.lib.eithers.bind(encode_term_multiline(cx, env2.get(), inner_body.get()),
|
|
@@ -1988,7 +1988,7 @@ prefixes: Sequence[hydra.python.syntax.Statement]) -> Either[hydra.errors.Error,
|
|
|
1988
1988
|
(lambda py_args: (
|
|
1989
1989
|
py_params := Lazy((lambda : cast(hydra.python.syntax.Parameters,
|
|
1990
1990
|
hydra.python.syntax.ParametersParamNoDefault(hydra.python.syntax.ParamNoDefaultParameters(py_args, ConsList.of(), None_()))))),
|
|
1991
|
-
is_t_c_o := Lazy((lambda : hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
1991
|
+
is_t_c_o := Lazy((lambda : hydra.overlay.python.lib.logic.and_(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(args)),
|
|
1992
1992
|
hydra.analysis.is_self_tail_recursive(name, body)))),
|
|
1993
1993
|
hydra.overlay.python.lib.eithers.bind(hydra.overlay.python.lib.logic.if_else(is_t_c_o.get(),
|
|
1994
1994
|
(lambda : hydra.overlay.python.lib.eithers.bind(encode_term_multiline_t_c_o(cx, env, name, args, body),
|
|
@@ -2009,7 +2009,7 @@ prefixes: Sequence[hydra.python.syntax.Statement]) -> Either[hydra.errors.Error,
|
|
|
2009
2009
|
py_tparams := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(use_inline_type_params(),
|
|
2010
2010
|
(lambda : hydra.overlay.python.lib.lists.map((lambda arg_: hydra.python.utils.py_name_to_py_type_parameter(hydra.python.names.encode_type_variable(arg_))), tparams)),
|
|
2011
2011
|
(lambda : ConsList.of())))),
|
|
2012
|
-
is_thunk := Lazy((lambda : hydra.overlay.python.lib.lists.
|
|
2012
|
+
is_thunk := Lazy((lambda : hydra.overlay.python.lib.lists.is_empty(args))),
|
|
2013
2013
|
m_decorators := Lazy((lambda : hydra.overlay.python.lib.logic.if_else(is_thunk.get(), (lambda : Given(hydra.python.syntax.Decorators(ConsList.of(lru_cache_decorator())))), (lambda : None_())))),
|
|
2014
2014
|
py_name := Lazy((lambda : hydra.python.names.encode_name(False, hydra.util.CaseConvention.LOWER_SNAKE, env, name))),
|
|
2015
2015
|
Right(cast(hydra.python.syntax.Statement,
|
|
@@ -2050,7 +2050,7 @@ def encode_name_constants(env: hydra.python.environment.PythonEnvironment, name:
|
|
|
2050
2050
|
def generic_arg(tparam_list: Sequence[hydra.core.Name]) -> Optional[hydra.python.syntax.Expression]:
|
|
2051
2051
|
r"""Create Generic[...] argument expression for class definition."""
|
|
2052
2052
|
|
|
2053
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
2053
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(tparam_list),
|
|
2054
2054
|
(lambda : None_()),
|
|
2055
2055
|
(lambda : Given(hydra.python.utils.py_primary_to_py_expression(hydra.python.utils.primary_with_expression_slices(cast(hydra.python.syntax.Primary,
|
|
2056
2056
|
hydra.python.syntax.PrimarySimple(cast(hydra.python.syntax.Atom, hydra.python.syntax.AtomName(hydra.python.syntax.Name("Generic"))))),
|
|
@@ -2261,7 +2261,7 @@ def encode_type_quoted(env: hydra.python.environment.PythonEnvironment, typ: hyd
|
|
|
2261
2261
|
r"""Encode a type to a Python expression, quoting if the type has free variables."""
|
|
2262
2262
|
|
|
2263
2263
|
return hydra.overlay.python.lib.eithers.bind(encode_type(env, typ),
|
|
2264
|
-
(lambda pytype: Right(hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.sets.
|
|
2264
|
+
(lambda pytype: Right(hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.sets.is_empty(hydra.variables.free_variables_in_type(typ)),
|
|
2265
2265
|
(lambda : pytype),
|
|
2266
2266
|
(lambda : hydra.python.utils.double_quoted_string(hydra.serialization.print_expr(hydra.python.serde.expression_to_expr(pytype))))))))
|
|
2267
2267
|
|
|
@@ -2309,7 +2309,7 @@ def encode_union_field_alt(env: hydra.python.environment.PythonEnvironment, unio
|
|
|
2309
2309
|
tparam_names = Lazy((lambda : find_type_params(env, ftype)))
|
|
2310
2310
|
tparams = Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda x1: hydra.python.names.encode_type_variable(x1)), tparam_names())))
|
|
2311
2311
|
name_prim = Lazy((lambda : hydra.python.utils.py_name_to_py_primary(hydra.python.names.variant_name(False, env, union_name, fname))))
|
|
2312
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
2312
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(tparams()),
|
|
2313
2313
|
(lambda : name_prim()),
|
|
2314
2314
|
(lambda : (
|
|
2315
2315
|
tparam_exprs := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda x1: hydra.python.utils.py_name_to_py_expression(x1)), tparams()))),
|
|
@@ -2448,7 +2448,9 @@ def encode_definition(cx: hydra.typing.InferenceContext, env: hydra.python.envir
|
|
|
2448
2448
|
name = td.name
|
|
2449
2449
|
term = td.body
|
|
2450
2450
|
typ = Lazy((lambda : hydra.overlay.python.lib.optionals.match(td.signature,
|
|
2451
|
-
(lambda : hydra.core.TypeScheme(ConsList.of(),
|
|
2451
|
+
(lambda : hydra.core.TypeScheme(ConsList.of(),
|
|
2452
|
+
cast(hydra.core.Type, hydra.core.TypeVariable(hydra.core.Name("hydra.core.Unit"))),
|
|
2453
|
+
hydra.overlay.python.lib.maps.empty())),
|
|
2452
2454
|
(lambda sig: hydra.scoping.term_signature_to_type_scheme(sig)))))
|
|
2453
2455
|
return hydra.overlay.python.lib.eithers.bind(hydra.annotations.get_term_description(cx, python_environment_get_graph(env), term),
|
|
2454
2456
|
(lambda comment: (
|
|
@@ -2818,7 +2820,7 @@ def extend_meta_for_type(top_level: bool, is_term_annot: bool, typ: hydra.core.T
|
|
|
2818
2820
|
case hydra.core.TypeUnion(value=rt):
|
|
2819
2821
|
return hydra.overlay.python.lib.logic.if_else(hydra.predicates.is_enum_row_type(rt),
|
|
2820
2822
|
(lambda : set_meta_uses_enum(meta_with_subtypes(), True)),
|
|
2821
|
-
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
2823
|
+
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(rt)),
|
|
2822
2824
|
(lambda : set_meta_uses_node(meta_with_subtypes(), True)),
|
|
2823
2825
|
(lambda : meta_with_subtypes()))))
|
|
2824
2826
|
|
|
@@ -2836,7 +2838,7 @@ def extend_meta_for_type(top_level: bool, is_term_annot: bool, typ: hydra.core.T
|
|
|
2836
2838
|
|
|
2837
2839
|
case hydra.core.TypeRecord(value=rt2):
|
|
2838
2840
|
has_annotated = Lazy((lambda : hydra.overlay.python.lib.lists.foldl((lambda b, ft: hydra.overlay.python.lib.logic.or_(b, hydra.annotations.has_type_description(ft.type))), False, rt2)))
|
|
2839
|
-
meta1 = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
2841
|
+
meta1 = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(rt2),
|
|
2840
2842
|
(lambda : meta_with_subtypes()),
|
|
2841
2843
|
(lambda : set_meta_uses_dataclass(meta_with_subtypes(), True)))))
|
|
2842
2844
|
return hydra.overlay.python.lib.logic.if_else(has_annotated(), (lambda : set_meta_uses_annotated(meta1(), True)), (lambda : meta1()))
|
|
@@ -3126,7 +3128,7 @@ def gather_metadata(overlay_subs: Set[str], focus_ns: hydra.packaging.ModuleName
|
|
|
3126
3128
|
result = Lazy((lambda : hydra.overlay.python.lib.lists.foldl((lambda x1, x2: add_def(x1, x2)), start(), defs)))
|
|
3127
3129
|
tvars = result().type_variables
|
|
3128
3130
|
result2 = Lazy((lambda : set_meta_uses_cast(True, set_meta_uses_lru_cache(True, result()))))
|
|
3129
|
-
return set_meta_uses_type_var(result2(), hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.
|
|
3131
|
+
return set_meta_uses_type_var(result2(), hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.sets.is_empty(tvars)))
|
|
3130
3132
|
|
|
3131
3133
|
# The target Python version for code generation.
|
|
3132
3134
|
target_python_version = hydra.python.utils.target_python_version
|
|
@@ -3153,7 +3155,7 @@ def is_type_module_check(defs: Sequence[hydra.packaging.Definition]) -> bool:
|
|
|
3153
3155
|
|
|
3154
3156
|
case _:
|
|
3155
3157
|
return False
|
|
3156
|
-
return hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
3158
|
+
return hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(hydra.overlay.python.lib.lists.filter((lambda d: _hoist_hydra_python_coder_is_type_module_check_1(d)), defs)))
|
|
3157
3159
|
|
|
3158
3160
|
def module_domain_imports(namespaces: hydra.util.ModuleNames[hydra.python.syntax.DottedName]) -> Sequence[hydra.python.syntax.ImportStatement]:
|
|
3159
3161
|
r"""Generate domain import statements from namespace mappings."""
|
|
@@ -3213,7 +3215,7 @@ def module_standard_imports(meta: hydra.python.environment.PythonModuleMetadata)
|
|
|
3213
3215
|
simplified = Lazy((lambda : hydra.overlay.python.lib.optionals.givens(hydra.overlay.python.lib.lists.map((lambda p: (
|
|
3214
3216
|
mod_name := Lazy((lambda : hydra.overlay.python.lib.pairs.first(p))),
|
|
3215
3217
|
symbols := Lazy((lambda : hydra.overlay.python.lib.optionals.givens(hydra.overlay.python.lib.pairs.second(p)))),
|
|
3216
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
3218
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(symbols.get()),
|
|
3217
3219
|
(lambda : None_()),
|
|
3218
3220
|
(lambda : Given((mod_name.get(), symbols.get())))))[2]),
|
|
3219
3221
|
pairs()))))
|
|
@@ -3318,7 +3320,7 @@ defs0: Sequence[hydra.packaging.Definition]) -> Either[hydra.errors.Error, hydra
|
|
|
3318
3320
|
(lambda : hydra.overlay.python.lib.sets.empty())))),
|
|
3319
3321
|
tvar_stmts := Lazy((lambda : hydra.overlay.python.lib.lists.map((lambda tv: tvar_statement(hydra.python.names.encode_type_variable(tv))),
|
|
3320
3322
|
hydra.overlay.python.lib.sets.to_list(tvars.get())))),
|
|
3321
|
-
body := Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda group: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
3323
|
+
body := Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda group: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(group))),
|
|
3322
3324
|
hydra.overlay.python.lib.lists.concat(ConsList.of(ConsList.of(comment_stmts.get(), import_stmts.get(), tvar_stmts.get()), def_stmts))))),
|
|
3323
3325
|
Right(hydra.python.syntax.Module(body.get())))[8]))))
|
|
3324
3326
|
|
|
@@ -89,13 +89,13 @@ def number_to_expr(num: hydra.python.syntax.Number) -> hydra.ast.Expr:
|
|
|
89
89
|
|
|
90
90
|
match num:
|
|
91
91
|
case hydra.python.syntax.NumberFloat(value=f):
|
|
92
|
-
return hydra.serialization.cst(python_float_literal_text(hydra.overlay.python.lib.literals.
|
|
92
|
+
return hydra.serialization.cst(python_float_literal_text(hydra.overlay.python.lib.literals.print_float64(f)))
|
|
93
93
|
|
|
94
94
|
case hydra.python.syntax.NumberImaginary(value=f2):
|
|
95
|
-
return hydra.serialization.cst(hydra.overlay.python.lib.strings.concat2(python_float_literal_text(hydra.overlay.python.lib.literals.
|
|
95
|
+
return hydra.serialization.cst(hydra.overlay.python.lib.strings.concat2(python_float_literal_text(hydra.overlay.python.lib.literals.print_float64(f2)), "j"))
|
|
96
96
|
|
|
97
97
|
case hydra.python.syntax.NumberInteger(value=i):
|
|
98
|
-
return hydra.serialization.cst(hydra.overlay.python.lib.literals.
|
|
98
|
+
return hydra.serialization.cst(hydra.overlay.python.lib.literals.print_bigint(i))
|
|
99
99
|
|
|
100
100
|
case _:
|
|
101
101
|
raise AssertionError("Unreachable: all variants handled")
|
|
@@ -274,7 +274,7 @@ def comparison_to_expr(cmp: hydra.python.syntax.Comparison) -> hydra.ast.Expr:
|
|
|
274
274
|
|
|
275
275
|
lhs = cmp.lhs
|
|
276
276
|
rhs = cmp.rhs
|
|
277
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
277
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(rhs),
|
|
278
278
|
(lambda : bitwise_or_to_expr(lhs)),
|
|
279
279
|
(lambda : hydra.serialization.space_sep(hydra.overlay.python.lib.lists.cons(bitwise_or_to_expr(lhs), hydra.overlay.python.lib.lists.map((lambda x1: compare_op_bitwise_or_pair_to_expr(x1)), rhs)))))
|
|
280
280
|
|
|
@@ -882,7 +882,7 @@ def type_alias_to_expr(ta: hydra.python.syntax.TypeAlias) -> hydra.ast.Expr:
|
|
|
882
882
|
tparams = ta.type_params
|
|
883
883
|
expr = ta.expression
|
|
884
884
|
alias = Lazy((lambda : hydra.serialization.no_sep(hydra.overlay.python.lib.optionals.givens(ConsList.of(Given(name_to_expr(name)),
|
|
885
|
-
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
885
|
+
hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(tparams),
|
|
886
886
|
(lambda : None_()),
|
|
887
887
|
(lambda : Given(hydra.serialization.bracket_list(hydra.serialization.inline_style, hydra.overlay.python.lib.lists.map((lambda x1: type_parameter_to_expr(x1)), tparams))))))))))
|
|
888
888
|
return hydra.serialization.space_sep(ConsList.of(hydra.serialization.cst("type"), alias(), hydra.serialization.cst("="), expression_to_expr(expr)))
|
|
@@ -1249,7 +1249,7 @@ def function_def_raw_to_expr(fdr: hydra.python.syntax.FunctionDefRaw) -> hydra.a
|
|
|
1249
1249
|
ret_type = fdr.return_type
|
|
1250
1250
|
block = fdr.block
|
|
1251
1251
|
async_kw = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(async_, (lambda : Given(hydra.serialization.cst("async"))), (lambda : None_()))))
|
|
1252
|
-
tparam_part = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
1252
|
+
tparam_part = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(tparams),
|
|
1253
1253
|
(lambda : None_()),
|
|
1254
1254
|
(lambda : Given(hydra.serialization.bracket_list(hydra.serialization.inline_style, hydra.overlay.python.lib.lists.map((lambda x1: type_parameter_to_expr(x1)), tparams)))))))
|
|
1255
1255
|
param_part = Lazy((lambda : hydra.overlay.python.lib.optionals.map((lambda x1: parameters_to_expr(x1)), params)))
|
|
@@ -49,7 +49,7 @@ def generate_python_test_case(group_path: Sequence[str], tcm: hydra.testing.Test
|
|
|
49
49
|
case hydra.testing.TestCaseUniversal(value=ucase):
|
|
50
50
|
actual_ = Lazy((lambda : ucase.actual(None)))
|
|
51
51
|
expected_ = Lazy((lambda : ucase.expected(None)))
|
|
52
|
-
full_name = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
52
|
+
full_name = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(group_path),
|
|
53
53
|
(lambda : name_),
|
|
54
54
|
(lambda : hydra.overlay.python.lib.strings.join("__", hydra.overlay.python.lib.lists.concat2(group_path, ConsList.of(name_)))))))
|
|
55
55
|
formatted_name = Lazy((lambda : format_python_test_name(full_name())))
|
|
@@ -229,7 +229,7 @@ def decode_py_comparison_to_py_await_primary(c: hydra.python.syntax.Comparison)
|
|
|
229
229
|
|
|
230
230
|
case _:
|
|
231
231
|
return None_()
|
|
232
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
232
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(rhs)),
|
|
233
233
|
(lambda : None_()),
|
|
234
234
|
(lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.optionals.is_given(or_lhs),
|
|
235
235
|
(lambda : None_()),
|
|
@@ -307,9 +307,9 @@ def indented_block(mcomment: Optional[str], stmts: Sequence[Sequence[hydra.pytho
|
|
|
307
307
|
r"""Create an indented block with optional comment."""
|
|
308
308
|
|
|
309
309
|
comment_group = Lazy((lambda : hydra.overlay.python.lib.optionals.match(mcomment, (lambda : ConsList.of()), (lambda s: ConsList.of(comment_statement(s))))))
|
|
310
|
-
groups = Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda g: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.
|
|
310
|
+
groups = Lazy((lambda : hydra.overlay.python.lib.lists.filter((lambda g: hydra.overlay.python.lib.logic.not_(hydra.overlay.python.lib.lists.is_empty(g))),
|
|
311
311
|
hydra.overlay.python.lib.lists.cons(comment_group(), stmts))))
|
|
312
|
-
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
312
|
+
return hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(groups()),
|
|
313
313
|
(lambda : cast(hydra.python.syntax.Block,
|
|
314
314
|
hydra.python.syntax.BlockIndented(ConsList.of(ConsList.of(cast(hydra.python.syntax.Statement,
|
|
315
315
|
hydra.python.syntax.StatementSimple(ConsList.of(py_expression_to_py_simple_statement(py_atom_to_py_expression(cast(hydra.python.syntax.Atom, hydra.python.syntax.AtomEllipsis()))))))))))),
|
|
@@ -358,7 +358,7 @@ def or_expression(prims: Sequence[hydra.python.syntax.Primary]) -> hydra.python.
|
|
|
358
358
|
(lambda : hydra.python.syntax.BitwiseOr(prev,
|
|
359
359
|
py_primary_to_py_bitwise_xor(cast(hydra.python.syntax.Primary,
|
|
360
360
|
hydra.python.syntax.PrimarySimple(cast(hydra.python.syntax.Atom, hydra.python.syntax.AtomEllipsis())))))),
|
|
361
|
-
(lambda p: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
361
|
+
(lambda p: hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(hydra.overlay.python.lib.pairs.second(p)),
|
|
362
362
|
(lambda : hydra.python.syntax.BitwiseOr(prev, py_primary_to_py_bitwise_xor(hydra.overlay.python.lib.pairs.first(p)))),
|
|
363
363
|
(lambda : build(Given(hydra.python.syntax.BitwiseOr(prev, py_primary_to_py_bitwise_xor(hydra.overlay.python.lib.pairs.first(p)))),
|
|
364
364
|
hydra.overlay.python.lib.pairs.second(p))))))
|
|
@@ -595,7 +595,7 @@ extra_stmts: Sequence[hydra.python.syntax.Statement]) -> Sequence[hydra.python.s
|
|
|
595
595
|
ConsList.of())))))))))))),
|
|
596
596
|
indented_block(None_(), ConsList.of(ConsList.of(get_item_method())))))))
|
|
597
597
|
doc_stmt = Lazy((lambda : py_expression_to_py_statement(triple_quoted_string(doc_string()))))
|
|
598
|
-
body_groups = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.
|
|
598
|
+
body_groups = Lazy((lambda : hydra.overlay.python.lib.logic.if_else(hydra.overlay.python.lib.lists.is_empty(extra_stmts),
|
|
599
599
|
(lambda : (
|
|
600
600
|
pass_stmt := Lazy((lambda : py_simple_statement_to_py_statement(cast(hydra.python.syntax.SimpleStatement, hydra.python.syntax.SimpleStatementPass())))),
|
|
601
601
|
ConsList.of(ConsList.of(doc_stmt()), ConsList.of(pass_stmt.get())))[1]),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|