gdp-wired 0.31.1 → 0.32.0
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.
- package/README.md +82 -6
- package/dist/core/c/reader.d.ts +86 -0
- package/dist/core/c/reader.js +860 -0
- package/dist/core/cli.d.ts +66 -0
- package/dist/core/cli.js +582 -0
- package/dist/core/dsl.d.ts +4 -2
- package/dist/core/dsl.js +22 -12
- package/dist/core/effect.d.ts +6 -4
- package/dist/core/effect.js +48 -10
- package/dist/core/ex/harness.exs +177 -0
- package/dist/core/ex/json.exs +46 -0
- package/dist/core/ex/reader.exs +462 -0
- package/dist/core/exists.d.ts +3 -0
- package/dist/core/exists.js +3 -1
- package/dist/core/extract-c.d.ts +35 -0
- package/dist/core/extract-c.js +424 -0
- package/dist/core/extract-check.js +27 -6
- package/dist/core/extract-ex.d.ts +16 -0
- package/dist/core/extract-ex.js +33 -0
- package/dist/core/extract-go-check.d.ts +28 -0
- package/dist/core/extract-go-check.js +639 -0
- package/dist/core/extract-go.d.ts +231 -0
- package/dist/core/extract-go.js +1166 -0
- package/dist/core/extract-jvm.d.ts +23 -0
- package/dist/core/extract-jvm.js +220 -0
- package/dist/core/extract-print.js +17 -7
- package/dist/core/extract-py.d.ts +15 -0
- package/dist/core/extract-py.js +31 -0
- package/dist/core/extract-rb.d.ts +17 -0
- package/dist/core/extract-rb.js +31 -0
- package/dist/core/extract-read.d.ts +20 -0
- package/dist/core/extract-read.js +46 -6
- package/dist/core/extract-rs.d.ts +12 -0
- package/dist/core/extract-rs.js +306 -0
- package/dist/core/extract-shapes.d.ts +2 -0
- package/dist/core/extract-shapes.js +6 -5
- package/dist/core/extract-step.d.ts +806 -0
- package/dist/core/extract-step.js +4141 -0
- package/dist/core/extract-swift.d.ts +27 -0
- package/dist/core/extract-swift.js +484 -0
- package/dist/core/extract-xstate.d.ts +10 -3
- package/dist/core/extract-xstate.js +50 -4
- package/dist/core/extract.d.ts +22 -3
- package/dist/core/extract.js +107 -18
- package/dist/core/go/go.mod +3 -0
- package/dist/core/go/reader.go +901 -0
- package/dist/core/infer.js +1770 -52
- package/dist/core/jvm/Harness.java +361 -0
- package/dist/core/jvm/JavaReader.java +825 -0
- package/dist/core/jvm/Jvm.java +332 -0
- package/dist/core/jvm/KtReader.java +960 -0
- package/dist/core/jvm/Rt.java +10 -0
- package/dist/core/laws.d.ts +66 -0
- package/dist/core/laws.js +522 -0
- package/dist/core/py/harness.py +328 -0
- package/dist/core/py/reader.py +447 -0
- package/dist/core/rb/harness.rb +233 -0
- package/dist/core/rb/reader.rb +375 -0
- package/dist/core/rs/Cargo.lock +108 -0
- package/dist/core/rs/Cargo.toml +14 -0
- package/dist/core/rs/src/main.rs +681 -0
- package/dist/core/swift/Harness.swift +124 -0
- package/dist/core/swift/Main.swift +34 -0
- package/dist/core/swift/Package.swift +13 -0
- package/dist/core/swift/Sources/gdp-swiftreader/main.swift +1341 -0
- package/dist/kernel/epr.d.ts +35 -0
- package/dist/kernel/epr.js +1676 -0
- package/dist/kernel/prove.d.ts +44 -0
- package/dist/kernel/prove.js +657 -50
- package/dist/lean-kernel/emit.d.ts +1 -0
- package/dist/lean-kernel/emit.js +21 -4
- package/package.json +53 -2
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# The Python side of the extractor's check (core/extract-step.ts's checkStep): the module imported as it ships, its
|
|
2
|
+
# object made, set to a state, called with the rule's requests and read back, one JSON line a request over two named
|
|
3
|
+
# pipes. What the caller stated is enforced here: an answered call stubbed with the request's input, a store given as
|
|
4
|
+
# one that keeps what is set, the clock read as the request's time. Line events count the branch arms reached.
|
|
5
|
+
#
|
|
6
|
+
# python3 core/py/harness.py <in-fifo> <out-fifo>
|
|
7
|
+
import asyncio, dataclasses, importlib, inspect, json, os, sys, types
|
|
8
|
+
|
|
9
|
+
NOW = [0]
|
|
10
|
+
CUR = {}
|
|
11
|
+
HIT = set()
|
|
12
|
+
S = {}
|
|
13
|
+
|
|
14
|
+
def enc_num(v):
|
|
15
|
+
if isinstance(v, bool): return v
|
|
16
|
+
if isinstance(v, int): return str(v)
|
|
17
|
+
if isinstance(v, float):
|
|
18
|
+
return str(int(v)) if v.is_integer() and abs(v) < 2 ** 63 else f"f:{v!r}"
|
|
19
|
+
return f"?:{type(v).__name__}"
|
|
20
|
+
|
|
21
|
+
def tag(v):
|
|
22
|
+
if v is None or isinstance(v, bool): return v
|
|
23
|
+
if isinstance(v, (int, float)): return {'n': enc_num(v)}
|
|
24
|
+
if isinstance(v, str): return {'s': v}
|
|
25
|
+
return {'o': type(v).__name__}
|
|
26
|
+
|
|
27
|
+
class Inert:
|
|
28
|
+
"""A value of a type outside the subset the rule never reads: any attribute an inert value, a call a no-op."""
|
|
29
|
+
def __getattr__(self, n):
|
|
30
|
+
if n.startswith('__'): raise AttributeError(n)
|
|
31
|
+
return Inert()
|
|
32
|
+
def __call__(self, *a, **k):
|
|
33
|
+
async def noop(): return None
|
|
34
|
+
return noop()
|
|
35
|
+
|
|
36
|
+
def resolve(q):
|
|
37
|
+
mod, _, name = q.rpartition('.')
|
|
38
|
+
return getattr(importlib.import_module(mod), name)
|
|
39
|
+
|
|
40
|
+
class FakeStore:
|
|
41
|
+
"""A store as the caller stated it: get, set and delete over a dict that keeps what is set (no expiry)."""
|
|
42
|
+
def __init__(self, decl, name=None):
|
|
43
|
+
self.data = {}
|
|
44
|
+
for path, v in (decl.get('attrs') or {}).items():
|
|
45
|
+
o, parts = self, path.split('.')
|
|
46
|
+
for p in parts[:-1]:
|
|
47
|
+
if not hasattr(o, p): setattr(o, p, types.SimpleNamespace())
|
|
48
|
+
o = getattr(o, p)
|
|
49
|
+
setattr(o, parts[-1], v)
|
|
50
|
+
asyncs = decl.get('async') or {}
|
|
51
|
+
def mk(kind, name):
|
|
52
|
+
def get(*a, **k): return self.data.get(k.get('key', a[0] if a else None))
|
|
53
|
+
def set_(*a, **k):
|
|
54
|
+
key = k.get('key', a[0] if a else None); val = k.get('value', a[1] if len(a) > 1 else None)
|
|
55
|
+
self.data[key] = val
|
|
56
|
+
def delete(*a, **k): self.data.pop(k.get('key', a[0] if a else None), None)
|
|
57
|
+
f = {'get': get, 'set': set_, 'delete': delete}[kind]
|
|
58
|
+
if asyncs.get(name):
|
|
59
|
+
async def af(*a, **k): return f(*a, **k)
|
|
60
|
+
return af
|
|
61
|
+
return f
|
|
62
|
+
for kind, dflt in (('get', ['get', 'async_get_cache', 'get_cache']), ('set', ['set', 'async_set_cache', 'set_cache']), ('delete', ['delete', 'delete_cache', 'async_delete_cache'])):
|
|
63
|
+
for m in decl.get(kind) or dflt: setattr(self, m, mk(kind, m))
|
|
64
|
+
# (a method left out: nothing, as the rule takes it; any other is no method of this store, and fails)
|
|
65
|
+
for m in decl.get('skip') or []:
|
|
66
|
+
async def anop(*a, **k): return None
|
|
67
|
+
setattr(self, m, (lambda *a, **k: anop()) if asyncs.get(m) else (lambda *a, **k: None))
|
|
68
|
+
# (an injected dependency's other methods: each answered by the request's input)
|
|
69
|
+
for a in S.get('answers') or []:
|
|
70
|
+
if a['patch'].get('store') == name: setattr(self, a['patch']['path'][-1], stub(a['key'], a['async']))
|
|
71
|
+
|
|
72
|
+
def build(spec, stores):
|
|
73
|
+
if 'in' in spec:
|
|
74
|
+
v = spec['in']
|
|
75
|
+
return float(v) if spec.get('float') and isinstance(v, int) and not isinstance(v, bool) else v
|
|
76
|
+
if spec.get('none'): return None
|
|
77
|
+
if spec.get('inert'): return Inert()
|
|
78
|
+
if 'store' in spec: return stores.setdefault(spec['store'], FakeStore(S['stores'].get(spec['store'], {}), spec['store']))
|
|
79
|
+
if 'rec' in spec:
|
|
80
|
+
cls = resolve(spec['rec'])
|
|
81
|
+
f = {k: build(v, stores) for k, v in spec['f'].items()}
|
|
82
|
+
return make_rec(cls, f)
|
|
83
|
+
raise ValueError(f"an argument spec {spec}")
|
|
84
|
+
|
|
85
|
+
SUBS = {}
|
|
86
|
+
def make_rec(cls, f):
|
|
87
|
+
# A record of the inputs the rule reads: every other field inert (the code may read it, the rule claims nothing of it).
|
|
88
|
+
if hasattr(cls, 'model_construct'):
|
|
89
|
+
fields = getattr(cls, 'model_fields', {}) or {}
|
|
90
|
+
rest = {n: Inert() for n, fi in fields.items() if n not in f and getattr(fi, 'is_required', lambda: False)()}
|
|
91
|
+
return cls.model_construct(**rest, **f)
|
|
92
|
+
if getattr(cls, '__annotations__', None) is not None and isinstance(cls, type) and issubclass(cls, dict): return dict(f)
|
|
93
|
+
if dataclasses.is_dataclass(cls):
|
|
94
|
+
o = object.__new__(cls)
|
|
95
|
+
for k, v in f.items(): object.__setattr__(o, k, v)
|
|
96
|
+
return o
|
|
97
|
+
sub = SUBS.get(cls)
|
|
98
|
+
if sub is None:
|
|
99
|
+
try: sub = SUBS[cls] = type(cls.__name__, (cls,), {'__getattr__': lambda self, n: Inert() if not n.startswith('__') else object.__getattribute__(self, n), '__module__': cls.__module__})
|
|
100
|
+
except TypeError: sub = SUBS[cls] = cls
|
|
101
|
+
o = object.__new__(sub)
|
|
102
|
+
for k, v in f.items(): setattr(o, k, v)
|
|
103
|
+
return o
|
|
104
|
+
|
|
105
|
+
def fixed_args(spec_list, inputs):
|
|
106
|
+
"""Arguments from their specs, the string inputs kept strings where the leaf is a string."""
|
|
107
|
+
out = {}
|
|
108
|
+
for name, spec in spec_list:
|
|
109
|
+
if spec.get('dflt'): continue
|
|
110
|
+
out[name] = build(spec, OBJ_STORES)
|
|
111
|
+
return out
|
|
112
|
+
|
|
113
|
+
OBJS = {}
|
|
114
|
+
OBJ_STORES = {}
|
|
115
|
+
|
|
116
|
+
def walk(o, path):
|
|
117
|
+
for p in path: o = o[p] if isinstance(o, dict) else getattr(o, p)
|
|
118
|
+
return o
|
|
119
|
+
|
|
120
|
+
def put(o, path, v):
|
|
121
|
+
parent = walk(o, path[:-1])
|
|
122
|
+
if isinstance(parent, dict): parent[path[-1]] = v
|
|
123
|
+
elif dataclasses.is_dataclass(parent) and getattr(type(parent), '__dataclass_params__', None) and type(parent).__dataclass_params__.frozen: object.__setattr__(parent, path[-1], v)
|
|
124
|
+
else: setattr(parent, path[-1], v)
|
|
125
|
+
|
|
126
|
+
def tpl_match(tpl, key):
|
|
127
|
+
pre, _, post = tpl.partition('{}')
|
|
128
|
+
if not isinstance(key, str) or not key.startswith(pre) or not key.endswith(post) or len(key) < len(pre) + len(post): return None
|
|
129
|
+
return key[len(pre): len(key) - len(post)] if '{}' in tpl else ('' if key == tpl else None)
|
|
130
|
+
|
|
131
|
+
def state_of(obj, stores):
|
|
132
|
+
s = {}
|
|
133
|
+
for l in S['leaves']:
|
|
134
|
+
k = l['kind']
|
|
135
|
+
if k == 'frame': continue
|
|
136
|
+
if l.get('store'):
|
|
137
|
+
st = stores.get(l['store'])
|
|
138
|
+
cells = {}
|
|
139
|
+
for key, v in (st.data.items() if st else []):
|
|
140
|
+
h = tpl_match(l['tpl'], key)
|
|
141
|
+
if h is None: continue
|
|
142
|
+
cells[h] = {'value': enc_num(v)}
|
|
143
|
+
s[l['name']] = cells
|
|
144
|
+
continue
|
|
145
|
+
v = walk(obj, l['path'])
|
|
146
|
+
if k == 'none': s[l['name']] = v is None
|
|
147
|
+
elif k == 'num': s[l['name']] = '0' if v is None else enc_num(v)
|
|
148
|
+
elif k in ('str', 'choice'): s[l['name']] = '' if v is None else v
|
|
149
|
+
elif k == 'bool': s[l['name']] = False if v is None else v
|
|
150
|
+
elif k == 'map':
|
|
151
|
+
cells = {}
|
|
152
|
+
for key, x in (v or {}).items():
|
|
153
|
+
if l.get('fields'): cells[str(key)] = {f['name']: (enc_num(x[f['name']] if isinstance(x, dict) else getattr(x, f['name']))) for f in l['fields']}
|
|
154
|
+
else: cells[str(key)] = {'value': enc_num(x)}
|
|
155
|
+
s[l['name']] = cells
|
|
156
|
+
# A store's key no template names: the code keeps state the rule has no place for.
|
|
157
|
+
for name, st in stores.items():
|
|
158
|
+
tpls = [l['tpl'] for l in S['leaves'] if l.get('store') == name]
|
|
159
|
+
for key in st.data:
|
|
160
|
+
if not any(tpl_match(t, key) is not None for t in tpls): raise ValueError(f"the store {name} holds {key!r}, a key no template of the rule names")
|
|
161
|
+
return s
|
|
162
|
+
|
|
163
|
+
def num_in(x, flt):
|
|
164
|
+
return float(int(x)) if flt else int(x)
|
|
165
|
+
|
|
166
|
+
def set_state(obj, stores, state):
|
|
167
|
+
for l in S['leaves']:
|
|
168
|
+
k = l['kind']
|
|
169
|
+
if k in ('frame', 'none'): continue
|
|
170
|
+
v = state.get(l['name'])
|
|
171
|
+
if l.get('store'):
|
|
172
|
+
st = stores[l['store']]
|
|
173
|
+
pre, _, post = l['tpl'].partition('{}')
|
|
174
|
+
for key in [kk for kk in st.data if tpl_match(l['tpl'], kk) is not None]: del st.data[key]
|
|
175
|
+
for h, c in (v or {}).items(): st.data[pre + h + post if '{}' in l['tpl'] else l['tpl']] = num_in(c['value'], l.get('float'))
|
|
176
|
+
continue
|
|
177
|
+
if k == 'num': put(obj, l['path'], num_in(v, l.get('float')))
|
|
178
|
+
elif k in ('str', 'choice', 'bool'): put(obj, l['path'], v)
|
|
179
|
+
elif k == 'map':
|
|
180
|
+
d = {}
|
|
181
|
+
for key, c in (v or {}).items():
|
|
182
|
+
kk = int(key) if l.get('key') == 'num' else key
|
|
183
|
+
if l.get('fields'):
|
|
184
|
+
d[kk] = make_rec(resolve(l['cls']), {f['name']: (num_in(c[f['name']], f.get('float')) if isinstance(c[f['name']], str) else c[f['name']]) for f in l['fields']})
|
|
185
|
+
else: d[kk] = num_in(c['value'], l.get('float')) if isinstance(c['value'], str) else c['value']
|
|
186
|
+
put(obj, l['path'], d)
|
|
187
|
+
for l in S['leaves']:
|
|
188
|
+
if l['kind'] == 'none' and state.get(l['name']) is True: put(obj, l['path'], None)
|
|
189
|
+
|
|
190
|
+
def frames(obj):
|
|
191
|
+
out = {}
|
|
192
|
+
if obj is None: return out
|
|
193
|
+
for l in S['leaves']:
|
|
194
|
+
if l['kind'] == 'frame' and not l.get('cls'):
|
|
195
|
+
try:
|
|
196
|
+
v = walk(obj, l['path'])
|
|
197
|
+
out['.'.join(l['path'])] = json.dumps(v, sort_keys=True)
|
|
198
|
+
except Exception: pass
|
|
199
|
+
return out
|
|
200
|
+
|
|
201
|
+
REAL = {}
|
|
202
|
+
def tracer(frame, event, arg):
|
|
203
|
+
f = frame.f_code.co_filename
|
|
204
|
+
if f not in REAL: REAL[f] = os.path.realpath(f)
|
|
205
|
+
if REAL[f] == S['path']:
|
|
206
|
+
def local(fr, ev, a):
|
|
207
|
+
if ev == 'line': HIT.add(fr.f_lineno)
|
|
208
|
+
return local
|
|
209
|
+
return local
|
|
210
|
+
return None
|
|
211
|
+
|
|
212
|
+
class Clock:
|
|
213
|
+
def __init__(self, real): self.real = real
|
|
214
|
+
def time(self): return float(NOW[0])
|
|
215
|
+
def monotonic(self): return float(NOW[0])
|
|
216
|
+
def perf_counter(self): return float(NOW[0])
|
|
217
|
+
def __getattr__(self, n): return getattr(self.real, n)
|
|
218
|
+
|
|
219
|
+
def stub(key, is_async):
|
|
220
|
+
def value():
|
|
221
|
+
a = CUR.get(key)
|
|
222
|
+
if a is None or a.get('none'): return None
|
|
223
|
+
return build(a, {})
|
|
224
|
+
if is_async:
|
|
225
|
+
async def f(*a, **k): return value()
|
|
226
|
+
return f
|
|
227
|
+
def g(*a, **k): return value()
|
|
228
|
+
return g
|
|
229
|
+
|
|
230
|
+
def patch_target(p):
|
|
231
|
+
mod = importlib.import_module(p['mod'])
|
|
232
|
+
o = mod
|
|
233
|
+
for part in p['path'][:-1]: o = getattr(o, part)
|
|
234
|
+
return o, p['path'][-1]
|
|
235
|
+
|
|
236
|
+
def hello(req):
|
|
237
|
+
S.update(req)
|
|
238
|
+
S['path'] = os.path.realpath(req['path'])
|
|
239
|
+
sys.path.insert(0, req['root'])
|
|
240
|
+
S['mod'] = importlib.import_module(req['module'])
|
|
241
|
+
mod = S['mod']
|
|
242
|
+
if isinstance(getattr(mod, 'time', None), types.ModuleType): mod.time = Clock(mod.time)
|
|
243
|
+
S['self_stubs'] = []
|
|
244
|
+
for a in req['answers']:
|
|
245
|
+
p = a['patch']
|
|
246
|
+
if p.get('store'): continue
|
|
247
|
+
if p.get('self'): S['self_stubs'].append((p['self'], stub(a['key'], a['async'])))
|
|
248
|
+
else:
|
|
249
|
+
o, name = patch_target(p)
|
|
250
|
+
raw = inspect.getattr_static(o, name, None)
|
|
251
|
+
f = stub(a['key'], a['async'])
|
|
252
|
+
setattr(o, name, staticmethod(f) if isinstance(raw, staticmethod) else classmethod(lambda cls, *x, **k: f(*x, **k)) if isinstance(raw, classmethod) else f)
|
|
253
|
+
S['cls'] = getattr(mod, req['cls'].rpartition('.')[2]) if req.get('cls') else None
|
|
254
|
+
S['loop'] = asyncio.new_event_loop()
|
|
255
|
+
asyncio.set_event_loop(S['loop'])
|
|
256
|
+
return {'ok': True}
|
|
257
|
+
|
|
258
|
+
def make(args):
|
|
259
|
+
global OBJ_STORES
|
|
260
|
+
OBJ_STORES = {}
|
|
261
|
+
if S['cls'] is None: obj = types.SimpleNamespace()
|
|
262
|
+
else:
|
|
263
|
+
kw = fixed_args(args, {})
|
|
264
|
+
sys.settrace(tracer)
|
|
265
|
+
try: obj = run(S['cls'](**kw))
|
|
266
|
+
finally: sys.settrace(None)
|
|
267
|
+
for name, f in S['self_stubs']: obj.__dict__[name] = f
|
|
268
|
+
for name in S.get('inject') or []: setattr(obj, name, build({'store': name}, OBJ_STORES))
|
|
269
|
+
i = len(OBJS) + 1
|
|
270
|
+
OBJS[i] = (obj, OBJ_STORES)
|
|
271
|
+
return i
|
|
272
|
+
|
|
273
|
+
def run(x):
|
|
274
|
+
return S['loop'].run_until_complete(x) if inspect.isawaitable(x) else x
|
|
275
|
+
|
|
276
|
+
def call(req):
|
|
277
|
+
obj, stores = OBJS[req['id']]
|
|
278
|
+
global OBJ_STORES
|
|
279
|
+
OBJ_STORES = stores
|
|
280
|
+
NOW[0] = int(req.get('now') or 0)
|
|
281
|
+
CUR.clear(); CUR.update(req.get('answers') or {})
|
|
282
|
+
fn = getattr(obj, req['m']) if S['cls'] is not None else getattr(S['mod'], req['m'])
|
|
283
|
+
kwargs = fixed_args(req['a'], {})
|
|
284
|
+
before = frames(obj if S['cls'] is not None else None)
|
|
285
|
+
snap = state_of(obj, stores) if S.get('discard') and S['cls'] is not None else None
|
|
286
|
+
sys.settrace(tracer)
|
|
287
|
+
try:
|
|
288
|
+
out = run(fn(**kwargs))
|
|
289
|
+
err = None
|
|
290
|
+
except Exception as e:
|
|
291
|
+
out, err = None, f"{type(e).__name__}: {e}"[:300]
|
|
292
|
+
finally:
|
|
293
|
+
sys.settrace(None)
|
|
294
|
+
if err is not None and snap is not None: set_state(obj, stores, snap)
|
|
295
|
+
after = frames(obj if S['cls'] is not None else None)
|
|
296
|
+
for k in before:
|
|
297
|
+
if after.get(k) != before[k]: return {'frame': k}
|
|
298
|
+
return {'out': tag(out), **({'err': err} if err is not None else {})}
|
|
299
|
+
|
|
300
|
+
def main():
|
|
301
|
+
fin = open(sys.argv[1], 'r'); fout = open(sys.argv[2], 'w')
|
|
302
|
+
for line in fin:
|
|
303
|
+
req = json.loads(line)
|
|
304
|
+
op = req['op']
|
|
305
|
+
try:
|
|
306
|
+
if op in ('new', 'at'): NOW[0] = int(req.get('now') or 0)
|
|
307
|
+
if op == 'hello': res = hello(req)
|
|
308
|
+
elif op == 'new':
|
|
309
|
+
try: res = {'id': make(req['a'])}
|
|
310
|
+
except Exception as e: res = {'err': f"{type(e).__name__}: {e}"[:300]}
|
|
311
|
+
elif op == 'at':
|
|
312
|
+
try:
|
|
313
|
+
i = make(req['a'])
|
|
314
|
+
set_state(OBJS[i][0], OBJS[i][1], req['state'])
|
|
315
|
+
res = {'id': i}
|
|
316
|
+
except Exception as e: res = {'bad': f"{type(e).__name__}: {e}"[:300]}
|
|
317
|
+
elif op == 'get':
|
|
318
|
+
obj, stores = OBJS[req['id']]
|
|
319
|
+
res = {'state': state_of(obj, stores)}
|
|
320
|
+
elif op == 'call': res = call(req)
|
|
321
|
+
elif op == 'coverage': res = {'hit': [[os.path.basename(S['path']), n] for n in sorted(HIT)]}
|
|
322
|
+
else: res = {'error': f"no op {op}"}
|
|
323
|
+
except Exception as e:
|
|
324
|
+
res = {'error': f"{type(e).__name__}: {e}"[:500]}
|
|
325
|
+
fout.write(json.dumps(res) + '\n'); fout.flush()
|
|
326
|
+
|
|
327
|
+
if __name__ == '__main__':
|
|
328
|
+
main()
|