arxo-codegen 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- arxo_codegen/__init__.py +5 -0
- arxo_codegen/__main__.py +7 -0
- arxo_codegen/active-outcomes.json +6837 -0
- arxo_codegen/check.py +158 -0
- arxo_codegen/check_active_canaries.py +262 -0
- arxo_codegen/check_api.py +76 -0
- arxo_codegen/check_conformance.py +414 -0
- arxo_codegen/check_matrix.py +131 -0
- arxo_codegen/check_packages.py +281 -0
- arxo_codegen/check_semantic_probes.py +293 -0
- arxo_codegen/check_xlsx.py +320 -0
- arxo_codegen/consumer_runner.py +316 -0
- arxo_codegen/core_support.py +203 -0
- arxo_codegen/coverage.py +341 -0
- arxo_codegen/deliver.py +180 -0
- arxo_codegen/examples/xlsx/pricing.lawir.json +409 -0
- arxo_codegen/examples/xlsx/pricing.xlsx.json +52 -0
- arxo_codegen/excel_plan.py +602 -0
- arxo_codegen/harness/verify/ci/gates/backends/check_backends.py +1248 -0
- arxo_codegen/harness/verify/ci/gates/backends/l1_fixtures.py +463 -0
- arxo_codegen/inert-nodes.json +62 -0
- arxo_codegen/inert.py +91 -0
- arxo_codegen/inputs.py +59 -0
- arxo_codegen/package.py +565 -0
- arxo_codegen/plan.py +4053 -0
- arxo_codegen/recertify_registry.py +100 -0
- arxo_codegen/runtime-cert.json +5259 -0
- arxo_codegen/runtime_cert.py +233 -0
- arxo_codegen/survey.py +272 -0
- arxo_codegen/target_runner.py +101 -0
- arxo_codegen/targets/bsl/cert.bsl +113 -0
- arxo_codegen/targets/bsl/emit.py +356 -0
- arxo_codegen/targets/bsl/json.bsl +243 -0
- arxo_codegen/targets/bsl/runner.bsl +210 -0
- arxo_codegen/targets/bsl/runtime.bsl +858 -0
- arxo_codegen/targets/cs/Cert.cs +90 -0
- arxo_codegen/targets/cs/Runner.cs +154 -0
- arxo_codegen/targets/cs/Runtime.cs +243 -0
- arxo_codegen/targets/cs/emit.py +223 -0
- arxo_codegen/targets/dart/cert.dart +99 -0
- arxo_codegen/targets/dart/emit.py +206 -0
- arxo_codegen/targets/dart/json.dart +166 -0
- arxo_codegen/targets/dart/runner.dart +154 -0
- arxo_codegen/targets/dart/runtime.dart +293 -0
- arxo_codegen/targets/erl/cert.erl +64 -0
- arxo_codegen/targets/erl/emit.py +216 -0
- arxo_codegen/targets/erl/rt.erl +238 -0
- arxo_codegen/targets/erl/runner.erl +130 -0
- arxo_codegen/targets/ex/cert.exs +62 -0
- arxo_codegen/targets/ex/emit.py +204 -0
- arxo_codegen/targets/ex/runner.exs +124 -0
- arxo_codegen/targets/ex/runtime.ex +227 -0
- arxo_codegen/targets/go/apiBase.go +483 -0
- arxo_codegen/targets/go/apicheck.go +97 -0
- arxo_codegen/targets/go/cert.go +218 -0
- arxo_codegen/targets/go/emit.py +1806 -0
- arxo_codegen/targets/go/evaluate.go +1826 -0
- arxo_codegen/targets/go/runner.go +38 -0
- arxo_codegen/targets/go/runtime.go +2612 -0
- arxo_codegen/targets/java/Cert.java +91 -0
- arxo_codegen/targets/java/Json.java +148 -0
- arxo_codegen/targets/java/Runner.java +151 -0
- arxo_codegen/targets/java/Runtime.java +243 -0
- arxo_codegen/targets/java/emit.py +198 -0
- arxo_codegen/targets/kt/Cert.kt +67 -0
- arxo_codegen/targets/kt/Json.kt +103 -0
- arxo_codegen/targets/kt/Runner.kt +126 -0
- arxo_codegen/targets/kt/Runtime.kt +196 -0
- arxo_codegen/targets/kt/emit.py +195 -0
- arxo_codegen/targets/lua/cert.lua +82 -0
- arxo_codegen/targets/lua/emit.py +250 -0
- arxo_codegen/targets/lua/json.lua +133 -0
- arxo_codegen/targets/lua/runner.lua +167 -0
- arxo_codegen/targets/lua/runtime.lua +541 -0
- arxo_codegen/targets/php/cert.php +84 -0
- arxo_codegen/targets/php/emit.py +229 -0
- arxo_codegen/targets/php/json.php +144 -0
- arxo_codegen/targets/php/runner.php +189 -0
- arxo_codegen/targets/php/runtime.php +660 -0
- arxo_codegen/targets/py/api_base.py +334 -0
- arxo_codegen/targets/py/apicheck.py +51 -0
- arxo_codegen/targets/py/cert.py +140 -0
- arxo_codegen/targets/py/emit.py +1140 -0
- arxo_codegen/targets/py/evaluate.py +980 -0
- arxo_codegen/targets/py/runner.py +38 -0
- arxo_codegen/targets/py/runtime.py +1634 -0
- arxo_codegen/targets/rb/cert.rb +73 -0
- arxo_codegen/targets/rb/emit.py +203 -0
- arxo_codegen/targets/rb/runner.rb +130 -0
- arxo_codegen/targets/rb/runtime.rb +255 -0
- arxo_codegen/targets/rs/Cargo.lock +142 -0
- arxo_codegen/targets/rs/Cargo.toml +16 -0
- arxo_codegen/targets/rs/cert.rs +106 -0
- arxo_codegen/targets/rs/emit.py +233 -0
- arxo_codegen/targets/rs/prefetch.rs +1 -0
- arxo_codegen/targets/rs/runner.rs +181 -0
- arxo_codegen/targets/rs/runtime.rs +448 -0
- arxo_codegen/targets/scala/Cert.scala +77 -0
- arxo_codegen/targets/scala/Json.scala +140 -0
- arxo_codegen/targets/scala/Runner.scala +121 -0
- arxo_codegen/targets/scala/Runtime.scala +269 -0
- arxo_codegen/targets/scala/emit.py +193 -0
- arxo_codegen/targets/swift/cert.swift +105 -0
- arxo_codegen/targets/swift/emit.py +231 -0
- arxo_codegen/targets/swift/json.swift +208 -0
- arxo_codegen/targets/swift/runner.swift +133 -0
- arxo_codegen/targets/swift/runtime.swift +528 -0
- arxo_codegen/targets/ts/apiBase.ts +250 -0
- arxo_codegen/targets/ts/apicheck.ts +37 -0
- arxo_codegen/targets/ts/cert.ts +96 -0
- arxo_codegen/targets/ts/emit.py +1214 -0
- arxo_codegen/targets/ts/evaluate.ts +894 -0
- arxo_codegen/targets/ts/package-lock.json +45 -0
- arxo_codegen/targets/ts/package.json +9 -0
- arxo_codegen/targets/ts/runner.ts +31 -0
- arxo_codegen/targets/ts/runtime.ts +1369 -0
- arxo_codegen/targets/xlsx/README.ru.md +176 -0
- arxo_codegen/targets/xlsx/emit.py +198 -0
- arxo_codegen/temporal.py +59 -0
- arxo_codegen/test_alias_types.py +171 -0
- arxo_codegen/test_api_contract.py +89 -0
- arxo_codegen/test_calendar_policy.py +48 -0
- arxo_codegen/test_check.py +49 -0
- arxo_codegen/test_check_active_canaries.py +96 -0
- arxo_codegen/test_check_conformance.py +132 -0
- arxo_codegen/test_check_semantic_probes.py +85 -0
- arxo_codegen/test_check_xlsx.py +52 -0
- arxo_codegen/test_consumer_runner.py +175 -0
- arxo_codegen/test_core_support.py +80 -0
- arxo_codegen/test_e0212_decision_time.py +63 -0
- arxo_codegen/test_head_aggregate.py +71 -0
- arxo_codegen/test_inert.py +143 -0
- arxo_codegen/test_instant_types.py +113 -0
- arxo_codegen/test_key_conflict_scope.py +92 -0
- arxo_codegen/test_key_conflict_targets.py +17 -0
- arxo_codegen/test_package_layout.py +163 -0
- arxo_codegen/test_plan_language_version.py +44 -0
- arxo_codegen/test_positions_refusal.py +43 -0
- arxo_codegen/test_recertify_registry.py +77 -0
- arxo_codegen/test_ruby_target.py +41 -0
- arxo_codegen/test_runtime_cert.py +83 -0
- arxo_codegen/test_secondary_key_conflict_scope.py +17 -0
- arxo_codegen/test_stage_r.py +108 -0
- arxo_codegen/test_standalone_inputs.py +71 -0
- arxo_codegen/test_support.py +150 -0
- arxo_codegen/test_survey_inputs.py +115 -0
- arxo_codegen-0.4.0.dist-info/LICENSE +202 -0
- arxo_codegen-0.4.0.dist-info/METADATA +1673 -0
- arxo_codegen-0.4.0.dist-info/RECORD +152 -0
- arxo_codegen-0.4.0.dist-info/WHEEL +5 -0
- arxo_codegen-0.4.0.dist-info/entry_points.txt +13 -0
- arxo_codegen-0.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
// Харнесс сертификации рантайма: исполняет runtime-cert.json и печатает,
|
|
4
|
+
// что получилось. Ожидания сверяют ворота, харнесс их не читает.
|
|
5
|
+
|
|
6
|
+
import (
|
|
7
|
+
"encoding/json"
|
|
8
|
+
"fmt"
|
|
9
|
+
"math/big"
|
|
10
|
+
"os"
|
|
11
|
+
"strconv"
|
|
12
|
+
"strings"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
func lit(x interface{}) interface{} {
|
|
16
|
+
switch v := x.(type) {
|
|
17
|
+
case string:
|
|
18
|
+
return v
|
|
19
|
+
case map[string]interface{}:
|
|
20
|
+
if d, ok := v["dec"]; ok {
|
|
21
|
+
return dec(d.(string))
|
|
22
|
+
}
|
|
23
|
+
if m, ok := v["money"]; ok {
|
|
24
|
+
return money(m.(string), v["cur"].(string))
|
|
25
|
+
}
|
|
26
|
+
if t, ok := v["text"]; ok {
|
|
27
|
+
return t.(string)
|
|
28
|
+
}
|
|
29
|
+
if d, ok := v["date"]; ok {
|
|
30
|
+
return date(d.(string))
|
|
31
|
+
}
|
|
32
|
+
if d, ok := v["instant"]; ok {
|
|
33
|
+
return instant(d.(string))
|
|
34
|
+
}
|
|
35
|
+
if y, ok := v["sym"]; ok {
|
|
36
|
+
return sym(y.(string))
|
|
37
|
+
}
|
|
38
|
+
if q, ok := v["rat"]; ok {
|
|
39
|
+
return rat(q.(string))
|
|
40
|
+
}
|
|
41
|
+
if q, ok := v["qty"]; ok {
|
|
42
|
+
return qty(q.(string), v["unit"].(string))
|
|
43
|
+
}
|
|
44
|
+
if b, ok := v["bool"]; ok {
|
|
45
|
+
return b.(bool)
|
|
46
|
+
}
|
|
47
|
+
if r, ok := v["row"]; ok {
|
|
48
|
+
items := r.([]interface{})
|
|
49
|
+
row := make([]Val, len(items))
|
|
50
|
+
for i, it := range items {
|
|
51
|
+
row[i] = lit(it)
|
|
52
|
+
}
|
|
53
|
+
return row
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
panic(fmt.Sprintf("литерал фикстуры: %v", x))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Отображение с ЯВНЫМ масштабом: 2.00 и 2 — разные записи одного значения.
|
|
60
|
+
func digits(u *big.Int, s int) string {
|
|
61
|
+
neg := u.Sign() < 0
|
|
62
|
+
body := new(big.Int).Abs(u).String()
|
|
63
|
+
if len(body) < s+1 {
|
|
64
|
+
body = strings.Repeat("0", s+1-len(body)) + body
|
|
65
|
+
}
|
|
66
|
+
text := body
|
|
67
|
+
if s > 0 {
|
|
68
|
+
text = body[:len(body)-s] + "." + body[len(body)-s:]
|
|
69
|
+
}
|
|
70
|
+
if neg {
|
|
71
|
+
return "-" + text
|
|
72
|
+
}
|
|
73
|
+
return text
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
func render(v interface{}) interface{} {
|
|
77
|
+
switch x := v.(type) {
|
|
78
|
+
case nil, bool, string:
|
|
79
|
+
return x
|
|
80
|
+
case Money:
|
|
81
|
+
return digits(x.U, x.S) + " " + x.Cur
|
|
82
|
+
case Date:
|
|
83
|
+
return string(x)
|
|
84
|
+
case Instant:
|
|
85
|
+
return string(x)
|
|
86
|
+
case Sym:
|
|
87
|
+
return string(x)
|
|
88
|
+
case Rational:
|
|
89
|
+
return x.N.String() + "/" + x.D.String()
|
|
90
|
+
case Qty:
|
|
91
|
+
return digits(x.U, x.S) + " [" + x.Unit + "]"
|
|
92
|
+
case Dec:
|
|
93
|
+
return digits(x.U, x.S)
|
|
94
|
+
}
|
|
95
|
+
panic(fmt.Sprintf("отображение: %T", v))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Контекст вычисления харнесса: случаи фикстуры идут подряд в одном контексте
|
|
99
|
+
// (`setLegalTime`, затем `legalTime`), как вызовы внутри одного `evaluate`.
|
|
100
|
+
var certCtx = &evalContext{}
|
|
101
|
+
|
|
102
|
+
func run(op string, raw []interface{}) interface{} {
|
|
103
|
+
a := make([]interface{}, len(raw))
|
|
104
|
+
for i, x := range raw {
|
|
105
|
+
a[i] = lit(x)
|
|
106
|
+
}
|
|
107
|
+
switch op {
|
|
108
|
+
case "dec":
|
|
109
|
+
return dec(a[0].(string))
|
|
110
|
+
case "money":
|
|
111
|
+
return money(a[0].(string), a[1].(string))
|
|
112
|
+
case "date":
|
|
113
|
+
return date(a[0].(string))
|
|
114
|
+
case "instant":
|
|
115
|
+
return instant(a[0].(string))
|
|
116
|
+
case "hoursBetween":
|
|
117
|
+
return hours_between(a[0], a[1])
|
|
118
|
+
case "minutesBetween":
|
|
119
|
+
return minutes_between(a[0], a[1])
|
|
120
|
+
case "addDuration":
|
|
121
|
+
n, _ := strconv.Atoi(a[1].(string))
|
|
122
|
+
return add_duration(a[0], n, a[2].(string))
|
|
123
|
+
case "sym":
|
|
124
|
+
return sym(a[0].(string))
|
|
125
|
+
case "rat":
|
|
126
|
+
return rat(a[0].(string))
|
|
127
|
+
case "ratTerm":
|
|
128
|
+
return ratTerm(a[0].(string))
|
|
129
|
+
case "qty":
|
|
130
|
+
return qty(a[0].(string), a[1].(string))
|
|
131
|
+
case "counter":
|
|
132
|
+
n, unit := counter(a[0], a[1].(string))
|
|
133
|
+
return fmt.Sprintf("%d %s", n, unit)
|
|
134
|
+
case "arith":
|
|
135
|
+
return arith(a[0].(string), a[1], a[2], a[3].(string), a[4].(string))
|
|
136
|
+
case "mul":
|
|
137
|
+
return mul(a[0], a[1])
|
|
138
|
+
case "round":
|
|
139
|
+
return round(a[0], a[1], a[2].(string))
|
|
140
|
+
case "roundMode":
|
|
141
|
+
return roundMode(a[0], a[1], a[2], a[3].(string), a[4].(string))
|
|
142
|
+
case "divRound":
|
|
143
|
+
return divRound(a[0], a[1], a[2], a[3], a[4].(string), a[5].(string), a[6].(string))
|
|
144
|
+
case "cmp":
|
|
145
|
+
return cmp(a[0], a[1].(string), a[2])
|
|
146
|
+
case "eq":
|
|
147
|
+
return eq(a[0], a[1])
|
|
148
|
+
case "add":
|
|
149
|
+
return add(a[0], a[1])
|
|
150
|
+
case "sub":
|
|
151
|
+
return sub(a[0], a[1])
|
|
152
|
+
case "div":
|
|
153
|
+
return div(a[0], a[1])
|
|
154
|
+
case "mod":
|
|
155
|
+
return mod(a[0], a[1])
|
|
156
|
+
case "min":
|
|
157
|
+
return min(a[0], a[1])
|
|
158
|
+
case "max":
|
|
159
|
+
return max(a[0], a[1])
|
|
160
|
+
case "abs":
|
|
161
|
+
return abs(a[0])
|
|
162
|
+
case "pow":
|
|
163
|
+
return pow(a[0], a[1])
|
|
164
|
+
case "monthStart":
|
|
165
|
+
return month_start(lit(raw[0]))
|
|
166
|
+
case "monthEnd":
|
|
167
|
+
return month_end(lit(raw[0]))
|
|
168
|
+
case "keyEq":
|
|
169
|
+
return key(a[0].([]Val)) == key(a[1].([]Val))
|
|
170
|
+
case "legalTime":
|
|
171
|
+
return certCtx.legalTime()
|
|
172
|
+
case "setLegalTime":
|
|
173
|
+
certCtx.setLegalTime(a[0].(string))
|
|
174
|
+
return nil
|
|
175
|
+
}
|
|
176
|
+
panic("неизвестная операция фикстуры: " + op)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
func one(op string, args []interface{}) (got interface{}) {
|
|
180
|
+
defer func() {
|
|
181
|
+
if r := recover(); r != nil {
|
|
182
|
+
if msg, ok := r.(Refused); ok {
|
|
183
|
+
got = map[string]string{"refused": string(msg)}
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
if e, ok := r.(termError); ok {
|
|
187
|
+
// Ошибка значения §58 с кодом оракула (DECISION-0252 п. 4).
|
|
188
|
+
got = map[string]string{"termError": e.code}
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
panic(r)
|
|
192
|
+
}
|
|
193
|
+
}()
|
|
194
|
+
return render(run(op, args))
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
func main() {
|
|
198
|
+
b, err := os.ReadFile(os.Args[1])
|
|
199
|
+
if err != nil {
|
|
200
|
+
panic(err)
|
|
201
|
+
}
|
|
202
|
+
var fixture struct {
|
|
203
|
+
Cases []struct {
|
|
204
|
+
ID string `json:"id"`
|
|
205
|
+
Op string `json:"op"`
|
|
206
|
+
Args []interface{} `json:"args"`
|
|
207
|
+
} `json:"cases"`
|
|
208
|
+
}
|
|
209
|
+
if err := json.Unmarshal(b, &fixture); err != nil {
|
|
210
|
+
panic(err)
|
|
211
|
+
}
|
|
212
|
+
out := make([]map[string]interface{}, 0, len(fixture.Cases))
|
|
213
|
+
for _, c := range fixture.Cases {
|
|
214
|
+
out = append(out, map[string]interface{}{"id": c.ID, "got": one(c.Op, c.Args)})
|
|
215
|
+
}
|
|
216
|
+
enc, _ := json.Marshal(out)
|
|
217
|
+
fmt.Println(string(enc))
|
|
218
|
+
}
|