gdp-wired 0.45.0 → 0.47.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 +61 -8
- package/dist/core/bitsets.d.ts +2 -0
- package/dist/core/bitsets.js +23 -0
- package/dist/core/bmc.js +6 -2
- package/dist/core/c/reader.d.ts +9 -1
- package/dist/core/c/reader.js +423 -31
- package/dist/core/calendar.d.ts +29 -0
- package/dist/core/calendar.js +82 -0
- package/dist/core/cli.d.ts +4 -0
- package/dist/core/cli.js +206 -40
- package/dist/core/compose.js +3 -1
- package/dist/core/counts.d.ts +4 -1
- package/dist/core/counts.js +314 -85
- package/dist/core/cycles.js +8 -1
- package/dist/core/cyclic.d.ts +1 -0
- package/dist/core/cyclic.js +13 -7
- package/dist/core/data-synth.d.ts +3 -0
- package/dist/core/data-synth.js +252 -0
- package/dist/core/data.d.ts +2 -1
- package/dist/core/data.js +223 -24
- package/dist/core/discover.js +3 -1
- package/dist/core/draft.d.ts +19 -0
- package/dist/core/draft.js +53 -0
- package/dist/core/dsl.d.ts +37 -3
- package/dist/core/dsl.js +167 -26
- package/dist/core/effect-schema.d.ts +90 -0
- package/dist/core/effect-schema.js +500 -0
- package/dist/core/effect.d.ts +4 -11
- package/dist/core/effect.js +3 -79
- package/dist/core/exists.d.ts +1 -0
- package/dist/core/exists.js +191 -16
- package/dist/core/extract-c.d.ts +2 -0
- package/dist/core/extract-c.js +169 -22
- package/dist/core/extract-check.d.ts +1 -0
- package/dist/core/extract-check.js +97 -6
- package/dist/core/extract-go-check.d.ts +1 -1
- package/dist/core/extract-go-check.js +26 -5
- package/dist/core/extract-go.d.ts +8 -0
- package/dist/core/extract-go.js +67 -6
- package/dist/core/extract-ir.d.ts +1 -0
- package/dist/core/extract-ir.js +15 -0
- package/dist/core/extract-jvm.d.ts +1 -1
- package/dist/core/extract-jvm.js +2 -0
- package/dist/core/extract-orm.d.ts +12 -0
- package/dist/core/extract-orm.js +244 -0
- package/dist/core/extract-print.js +20 -1
- package/dist/core/extract-py.d.ts +1 -0
- package/dist/core/extract-py.js +1 -1
- package/dist/core/extract-read.d.ts +26 -1
- package/dist/core/extract-read.js +14 -7
- package/dist/core/extract-rs.js +63 -15
- package/dist/core/extract-shapes.d.ts +1 -0
- package/dist/core/extract-shapes.js +84 -0
- package/dist/core/extract-sol.d.ts +10 -1
- package/dist/core/extract-sol.js +70 -22
- package/dist/core/extract-standalone.d.ts +3 -0
- package/dist/core/extract-standalone.js +221 -0
- package/dist/core/extract-step.d.ts +151 -1
- package/dist/core/extract-step.js +1232 -60
- package/dist/core/extract-swift.js +6 -2
- package/dist/core/extract.d.ts +9 -0
- package/dist/core/extract.js +77 -7
- package/dist/core/fiber-run.d.ts +5 -0
- package/dist/core/fiber-run.js +18 -0
- package/dist/core/infer.d.ts +4 -1
- package/dist/core/infer.js +918 -217
- package/dist/core/jvm/JavaReader.java +23 -6
- package/dist/core/jvm/Jvm.java +3 -0
- package/dist/core/jvm/KtReader.java +6 -5
- package/dist/core/laws.d.ts +10 -3
- package/dist/core/laws.js +226 -23
- package/dist/core/machine.d.ts +15 -1
- package/dist/core/machine.js +187 -15
- package/dist/core/nonterm.js +14 -1
- package/dist/core/orm/harness.js +61 -0
- package/dist/core/orm-fixtures/schema.prisma +5 -0
- package/dist/core/py/harness.py +183 -10
- package/dist/core/py/reader.py +234 -40
- package/dist/core/reader-fixtures/README.md +28 -0
- package/dist/core/reader-fixtures/c-693042.cpp +8 -0
- package/dist/core/reader-fixtures/go-685506.go +14 -0
- package/dist/core/reader-fixtures/jvm-724362.kt +8 -0
- package/dist/core/reader-fixtures/jvm-737430.kt +7 -0
- package/dist/core/reader-fixtures/jvm-765282.kt +3 -0
- package/dist/core/reader-fixtures/swift-735726.swift +15 -0
- package/dist/core/reader-fixtures/swift-735990.swift +15 -0
- package/dist/core/reader-fixtures/swift-739158.swift +4 -0
- package/dist/core/reader-fixtures/swift-744834.swift +15 -0
- package/dist/core/reader-fixtures/swift-746946.swift +31 -0
- package/dist/core/reader-fixtures/typescript-673062.ts.txt +2 -0
- package/dist/core/relation.d.ts +1 -1
- package/dist/core/relation.js +29 -2
- package/dist/core/relational.js +4 -2
- package/dist/core/rs/Cargo.toml +1 -1
- package/dist/core/rs/src/main.rs +466 -11
- package/dist/core/sample-cache.d.ts +8 -0
- package/dist/core/sample-cache.js +46 -0
- package/dist/core/security.d.ts +38 -0
- package/dist/core/security.js +88 -0
- package/dist/core/sol/harness.py +57 -4
- package/dist/core/sol-concrete.d.ts +23 -0
- package/dist/core/sol-concrete.js +195 -0
- package/dist/core/solver.js +3 -1
- package/dist/core/swift/Sources/gdp-swiftreader/main.swift +50 -7
- package/dist/core/system.js +1 -1
- package/dist/core/transfer.js +22 -9
- package/dist/core/translate.js +39 -10
- package/dist/core/watch.js +50 -5
- package/dist/interchange/format.js +11 -1
- package/dist/kernel/cdcl.d.ts +5 -0
- package/dist/kernel/cdcl.js +56 -9
- package/dist/kernel/epr.js +108 -26
- package/dist/kernel/kernel.d.ts +29 -1
- package/dist/kernel/kernel.js +325 -62
- package/dist/kernel/model-sequence.d.ts +3 -0
- package/dist/kernel/model-sequence.js +34 -0
- package/dist/kernel/prove.d.ts +10 -3
- package/dist/kernel/prove.js +332 -71
- package/dist/kernel/reader.d.ts +3 -0
- package/dist/kernel/reader.js +101 -14
- package/dist/kernel/share.d.ts +1 -0
- package/dist/kernel/share.js +27 -0
- package/dist/lean-kernel/emit.js +30 -37
- package/dist/lean-kernel/lean-terms.js +5 -0
- package/dist/lean-kernel/library.js +10 -10
- package/package.json +6 -1
package/dist/core/py/harness.py
CHANGED
|
@@ -13,7 +13,15 @@ EFF = {}
|
|
|
13
13
|
HIT = set()
|
|
14
14
|
S = {}
|
|
15
15
|
|
|
16
|
+
def datetime_in(v, unit):
|
|
17
|
+
epoch = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc if unit == 'datetime-utc' else None)
|
|
18
|
+
return epoch + datetime.timedelta(milliseconds=int(v))
|
|
19
|
+
|
|
16
20
|
def enc_num(v):
|
|
21
|
+
if isinstance(v, datetime.datetime):
|
|
22
|
+
epoch = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc if v.tzinfo is not None else None)
|
|
23
|
+
delta = v - epoch
|
|
24
|
+
return str(delta.days * 86400000 + delta.seconds * 1000 + delta.microseconds // 1000) if delta.microseconds % 1000 == 0 else '?:sub-millisecond datetime'
|
|
17
25
|
if isinstance(v, bool): return v
|
|
18
26
|
if isinstance(v, int): return str(v)
|
|
19
27
|
if isinstance(v, float):
|
|
@@ -118,14 +126,141 @@ class FakeStore:
|
|
|
118
126
|
setattr(self, m, rec(a['key'], a['async']))
|
|
119
127
|
elif a['patch'].get('store') == name and not (a.get('pass') and m in own): setattr(self, m, stub(a['key'], a['async'], (lambda *x, **k: None) if a.get('pass') else None))
|
|
120
128
|
|
|
129
|
+
ORM_VALIDATED = set()
|
|
130
|
+
|
|
131
|
+
class ORMTable:
|
|
132
|
+
"""Only the persistence boundary is faked; methods execute on the real model class.
|
|
133
|
+
Reads detach copies, and save snapshots a row. No schema or database is created.
|
|
134
|
+
"""
|
|
135
|
+
def __init__(self, leaf):
|
|
136
|
+
self.leaf, self.meta, self.data = leaf, leaf['orm'], {}
|
|
137
|
+
self.cls = resolve(self.meta['rec'])
|
|
138
|
+
self.key = self.meta['key']
|
|
139
|
+
if self.cls not in ORM_VALIDATED:
|
|
140
|
+
access = {'__getattribute__', '__getattr__', '__setattr__', '__delattr__'}
|
|
141
|
+
if self.meta['framework'] == 'django':
|
|
142
|
+
from django.db.models import Model, Manager
|
|
143
|
+
# Display methods are retained, never replaced by persistence stubs. The
|
|
144
|
+
# reader refuses implicit object display, including discarded results.
|
|
145
|
+
methods = ({n for n, v in vars(Model).items() if inspect.isfunction(v) or isinstance(v, (staticmethod, classmethod, property))} - {'__str__', '__repr__'}) | access
|
|
146
|
+
unsafe = any(inspect.getattr_static(self.cls, n, None) is not inspect.getattr_static(Model, n, None) for n in methods) or type(self.cls.objects) is not Manager
|
|
147
|
+
else:
|
|
148
|
+
from sqlalchemy.orm.decl_base import _declarative_constructor
|
|
149
|
+
manager = self.cls._sa_class_manager
|
|
150
|
+
unsafe = manager.original_init is not _declarative_constructor or self.cls.__init__ is not manager.new_init or any(inspect.getattr_static(self.cls, n, None) is not inspect.getattr_static(object, n, None) for n in access)
|
|
151
|
+
if unsafe: raise ValueError('custom or inherited ORM persistence behavior is outside the table boundary')
|
|
152
|
+
ORM_VALIDATED.add(self.cls)
|
|
153
|
+
def install(self):
|
|
154
|
+
if self.meta['framework'] == 'django': self.cls.objects = self
|
|
155
|
+
table = self
|
|
156
|
+
def save(row, *args, **kw):
|
|
157
|
+
if args or kw: raise ValueError('ORM save options outside boundary')
|
|
158
|
+
table.data[getattr(row, table.key)] = {f['name']: getattr(row, f['name']) for f in table.meta['fields']}
|
|
159
|
+
def delete(row, *args, **kw):
|
|
160
|
+
if args or kw: raise ValueError('ORM delete options outside boundary')
|
|
161
|
+
key = getattr(row, table.key)
|
|
162
|
+
n = int(key in table.data)
|
|
163
|
+
table.data.pop(key, None)
|
|
164
|
+
setattr(row, table.key, None)
|
|
165
|
+
return n, {table.cls._meta.label: n}
|
|
166
|
+
self.cls.save = save
|
|
167
|
+
self.cls.delete = delete
|
|
168
|
+
def lookup(self, kw):
|
|
169
|
+
if len(kw) != 1: raise ValueError('one primary key required')
|
|
170
|
+
name, value = next(iter(kw.items()))
|
|
171
|
+
if name not in ('pk', self.key): raise ValueError('non-key filter')
|
|
172
|
+
return value
|
|
173
|
+
def get(self, **kw):
|
|
174
|
+
key = self.lookup(kw)
|
|
175
|
+
if key not in self.data: raise self.cls.DoesNotExist()
|
|
176
|
+
return self.cls(**self.data[key])
|
|
177
|
+
def create(self, **kw):
|
|
178
|
+
from django.db import IntegrityError
|
|
179
|
+
key = kw[self.key]
|
|
180
|
+
if key in self.data: raise IntegrityError('duplicate primary key')
|
|
181
|
+
row = self.cls(**kw)
|
|
182
|
+
row.save()
|
|
183
|
+
return row
|
|
184
|
+
def filter(self, **kw):
|
|
185
|
+
table, key = self, self.lookup(kw)
|
|
186
|
+
class Query:
|
|
187
|
+
def exists(self): return key in table.data
|
|
188
|
+
def first(self): return table.cls(**table.data[key]) if key in table.data else None
|
|
189
|
+
def delete(self):
|
|
190
|
+
n = int(key in table.data)
|
|
191
|
+
table.data.pop(key, None)
|
|
192
|
+
return n, {table.cls._meta.label: n}
|
|
193
|
+
return Query()
|
|
194
|
+
|
|
195
|
+
class ORMSession:
|
|
196
|
+
def __init__(self): self.loaded, self.added, self.data = [], [], {}
|
|
197
|
+
def table(self, cls):
|
|
198
|
+
return next(t for t in OBJ_STORES.values() if isinstance(t, ORMTable) and t.cls is cls)
|
|
199
|
+
def get(self, cls, key):
|
|
200
|
+
table = self.table(cls)
|
|
201
|
+
if key not in table.data: return None
|
|
202
|
+
row = cls(**table.data[key]); self.loaded.append((row, False))
|
|
203
|
+
return row
|
|
204
|
+
def add(self, row):
|
|
205
|
+
if any(r is row for r, _ in self.loaded): return
|
|
206
|
+
self.added.append(row)
|
|
207
|
+
self.loaded.append((row, False))
|
|
208
|
+
def delete(self, row):
|
|
209
|
+
self.loaded = [(r, d) for r, d in self.loaded if r is not row]
|
|
210
|
+
self.loaded.append((row, True))
|
|
211
|
+
def commit(self):
|
|
212
|
+
pending = set()
|
|
213
|
+
for row in self.added:
|
|
214
|
+
table = self.table(type(row)); key = getattr(row, table.key)
|
|
215
|
+
if key in table.data or (table, key) in pending: raise ValueError('duplicate primary key')
|
|
216
|
+
pending.add((table, key))
|
|
217
|
+
for row, deleted in self.loaded:
|
|
218
|
+
table = self.table(type(row))
|
|
219
|
+
if deleted: table.data.pop(getattr(row, table.key), None)
|
|
220
|
+
else: table.data[getattr(row, table.key)] = {f['name']: getattr(row, f['name']) for f in table.meta['fields']}
|
|
221
|
+
self.loaded.clear()
|
|
222
|
+
|
|
223
|
+
def orm_snapshot(table):
|
|
224
|
+
out = {}
|
|
225
|
+
for key, row in table.data.items():
|
|
226
|
+
cell = {}
|
|
227
|
+
for field in table.meta['fields']:
|
|
228
|
+
name, t = field['name'], field['t']
|
|
229
|
+
if name == table.key: continue
|
|
230
|
+
value = row[name]
|
|
231
|
+
if t['k'] == 'opt':
|
|
232
|
+
cell[name + '_has'] = value is not None
|
|
233
|
+
t = t['of']
|
|
234
|
+
if value is None: value = '' if t['k'] == 'str' else False if t['k'] == 'bool' else 0
|
|
235
|
+
cell[name] = value if t['k'] in ('str', 'bool', 'choice') else enc_num(value)
|
|
236
|
+
out[str(key)] = cell
|
|
237
|
+
return out
|
|
238
|
+
|
|
239
|
+
def orm_restore(table, cells):
|
|
240
|
+
table.data.clear()
|
|
241
|
+
for key, cell in cells.items():
|
|
242
|
+
key = int(key) if table.leaf['key'] == 'num' else key
|
|
243
|
+
row = {table.key: key}
|
|
244
|
+
for field in table.meta['fields']:
|
|
245
|
+
name, t = field['name'], field['t']
|
|
246
|
+
if name == table.key: continue
|
|
247
|
+
optional = t['k'] == 'opt'
|
|
248
|
+
if optional: t = t['of']
|
|
249
|
+
row[name] = None if optional and not cell[name + '_has'] else datetime_in(cell[name], t['unit']) if t.get('unit', '').startswith('datetime-') else int(cell[name]) if t['k'] == 'int' else cell[name]
|
|
250
|
+
table.data[key] = row
|
|
251
|
+
|
|
121
252
|
def build(spec, stores):
|
|
122
253
|
if 'in' in spec:
|
|
123
254
|
v = spec['in']
|
|
255
|
+
if spec.get('time'): return datetime_in(v, spec['time'])
|
|
124
256
|
if spec.get('bytes') and isinstance(v, str): return v.encode('latin-1')
|
|
125
257
|
return float(v) if spec.get('float') and isinstance(v, int) and not isinstance(v, bool) else v
|
|
126
258
|
if spec.get('none'): return None
|
|
127
259
|
if spec.get('inert'): return {} if spec.get('dict') else Inert()
|
|
128
|
-
if 'store' in spec:
|
|
260
|
+
if 'store' in spec:
|
|
261
|
+
name = spec['store']
|
|
262
|
+
if name not in stores: stores[name] = ORMSession() if S['stores'].get(name, {}).get('ormSession') else FakeStore(S['stores'].get(name, {}), name)
|
|
263
|
+
return stores[name]
|
|
129
264
|
if 'list' in spec: return [build(x, stores) for x in spec['list']]
|
|
130
265
|
if 'rec' in spec:
|
|
131
266
|
cls = resolve(spec['rec'])
|
|
@@ -193,6 +328,9 @@ def state_of(obj, stores):
|
|
|
193
328
|
for l in S['leaves']:
|
|
194
329
|
k = l['kind']
|
|
195
330
|
if k == 'frame': continue
|
|
331
|
+
if l.get('orm'):
|
|
332
|
+
s[l['name']] = orm_snapshot(stores[l['name']])
|
|
333
|
+
continue
|
|
196
334
|
if l.get('store'):
|
|
197
335
|
st = stores.get(l['store'])
|
|
198
336
|
cells = {}
|
|
@@ -226,6 +364,7 @@ def state_of(obj, stores):
|
|
|
226
364
|
s[l['name']] = cells
|
|
227
365
|
# A store's key no template names: the code keeps state the rule has no place for.
|
|
228
366
|
for name, st in stores.items():
|
|
367
|
+
if isinstance(st, ORMTable): continue
|
|
229
368
|
tpls = [l['tpl'] for l in S['leaves'] if l.get('store') == name]
|
|
230
369
|
for key in st.data:
|
|
231
370
|
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")
|
|
@@ -243,6 +382,9 @@ def set_state(obj, stores, state):
|
|
|
243
382
|
k = l['kind']
|
|
244
383
|
if k in ('frame', 'none'): continue
|
|
245
384
|
v = state.get(l['name'])
|
|
385
|
+
if l.get('orm'):
|
|
386
|
+
orm_restore(stores[l['name']], v or {})
|
|
387
|
+
continue
|
|
246
388
|
if l.get('store'):
|
|
247
389
|
st = stores[l['store']]
|
|
248
390
|
pre, _, post = l['tpl'].partition('{}')
|
|
@@ -252,7 +394,10 @@ def set_state(obj, stores, state):
|
|
|
252
394
|
if l.get('json'): st.data[at] = json.dumps({f['name']: (c[f['name']] if f.get('choice') else num_in(c[f['name']], False)) for f in l['json'] if not f.get('out') and (not f.get('opt') or c.get(f['name'] + '_has'))})
|
|
253
395
|
else: st.data[at] = c['value'] if l.get('choice') or l.get('str') else num_in(c['value'], l.get('float'))
|
|
254
396
|
continue
|
|
255
|
-
if k == 'num':
|
|
397
|
+
if k == 'num':
|
|
398
|
+
t = l.get('t') or {}
|
|
399
|
+
if t.get('k') == 'opt': t = t['of']
|
|
400
|
+
put(obj, l['path'], datetime_in(v, t['unit']) if t.get('unit', '').startswith('datetime-') else num_in(v, l.get('float')))
|
|
256
401
|
elif k in ('str', 'choice', 'bool'): put(obj, l['path'], v.encode('latin-1') if k == 'str' and is_bytes(l) and isinstance(v, str) else v)
|
|
257
402
|
elif k == 'map':
|
|
258
403
|
d = {}
|
|
@@ -280,10 +425,11 @@ def frames(obj):
|
|
|
280
425
|
REAL = {}
|
|
281
426
|
def tracer(frame, event, arg):
|
|
282
427
|
f = frame.f_code.co_filename
|
|
283
|
-
if f not in REAL: REAL[f] = os.path.realpath(f)
|
|
284
|
-
|
|
428
|
+
if f not in REAL: REAL[f] = S['sources'].get(os.path.realpath(f))
|
|
429
|
+
source = REAL[f]
|
|
430
|
+
if source is not None:
|
|
285
431
|
def local(fr, ev, a):
|
|
286
|
-
if ev == 'line': HIT.add(fr.f_lineno)
|
|
432
|
+
if ev == 'line': HIT.add((source, fr.f_lineno))
|
|
287
433
|
return local
|
|
288
434
|
return local
|
|
289
435
|
return None
|
|
@@ -298,7 +444,10 @@ class Clock:
|
|
|
298
444
|
class _Now(datetime.datetime):
|
|
299
445
|
"""datetime.datetime with now() the request's time (local, naive, as the code's own now())."""
|
|
300
446
|
@classmethod
|
|
301
|
-
def now(cls, tz=None):
|
|
447
|
+
def now(cls, tz=None):
|
|
448
|
+
if tz is None and (time_module.timezone != 0 or time_module.altzone != 0):
|
|
449
|
+
raise ValueError('naive datetime clocks require a UTC process timezone')
|
|
450
|
+
return datetime.datetime.fromtimestamp(NOW[0], tz)
|
|
302
451
|
# (where it is seen anyway, a type read while the clock is pinned, pydantic's: a datetime)
|
|
303
452
|
@classmethod
|
|
304
453
|
def __get_pydantic_core_schema__(cls, source, handler): return handler(datetime.datetime)
|
|
@@ -358,9 +507,11 @@ def raises_here(key):
|
|
|
358
507
|
f = sys._getframe(1)
|
|
359
508
|
while f is not None and os.path.realpath(f.f_code.co_filename) == os.path.realpath(__file__): f = f.f_back
|
|
360
509
|
if f is None: return True
|
|
361
|
-
here
|
|
510
|
+
here = os.path.relpath(os.path.realpath(f.f_code.co_filename), S['root']).replace(os.sep, '/')
|
|
511
|
+
line = f.f_lineno
|
|
362
512
|
for site in a['at']:
|
|
363
|
-
|
|
513
|
+
parts = site['p'].rsplit(':', 2)
|
|
514
|
+
file, l0 = parts[0], int(parts[1])
|
|
364
515
|
l1 = int(site['end'].split(':')[0]) if site.get('end') and site['end'].split(':')[0].isdigit() else l0
|
|
365
516
|
if file == here and l0 <= line <= l1: return True
|
|
366
517
|
return False
|
|
@@ -395,9 +546,22 @@ def patch_target(p):
|
|
|
395
546
|
return o, p['path'][-1]
|
|
396
547
|
|
|
397
548
|
def hello(req):
|
|
549
|
+
def has_naive(v):
|
|
550
|
+
if isinstance(v, dict):
|
|
551
|
+
return v.get('unit') == 'datetime-naive' or v.get('time') == 'datetime-naive' or any(has_naive(x) for x in v.values())
|
|
552
|
+
return isinstance(v, list) and any(has_naive(x) for x in v)
|
|
553
|
+
if (req.get('naiveUtc') or has_naive(req)) and (time_module.timezone != 0 or time_module.altzone != 0):
|
|
554
|
+
raise ValueError('stated naive datetime values require a UTC process timezone')
|
|
398
555
|
S.update(req)
|
|
399
556
|
S['path'] = os.path.realpath(req['path'])
|
|
557
|
+
S['root'] = os.path.realpath(req['root'])
|
|
558
|
+
# Only files the reader actually used, including imported bases; never arbitrary repository imports.
|
|
559
|
+
S['sources'] = {os.path.realpath(os.path.join(S['root'], name)): name for name, _ in req['arms']}
|
|
560
|
+
REAL.clear(); HIT.clear()
|
|
400
561
|
sys.path.insert(0, req['root'])
|
|
562
|
+
if os.environ.get('DJANGO_SETTINGS_MODULE'):
|
|
563
|
+
import django
|
|
564
|
+
django.setup()
|
|
401
565
|
S['mod'] = importlib.import_module(req['module'])
|
|
402
566
|
mod = S['mod']
|
|
403
567
|
pin_clocks(req['root'])
|
|
@@ -432,6 +596,9 @@ def hello(req):
|
|
|
432
596
|
def make(args):
|
|
433
597
|
global OBJ_STORES
|
|
434
598
|
OBJ_STORES = {}
|
|
599
|
+
for leaf in S['leaves']:
|
|
600
|
+
if leaf.get('orm'): OBJ_STORES[leaf['name']] = ORMTable(leaf)
|
|
601
|
+
for table in OBJ_STORES.values(): table.install()
|
|
435
602
|
if S['cls'] is None: obj = types.SimpleNamespace()
|
|
436
603
|
else:
|
|
437
604
|
kw = fixed_args(args, {})
|
|
@@ -454,6 +621,8 @@ def run(x):
|
|
|
454
621
|
return S['loop'].run_until_complete(x) if inspect.isawaitable(x) else x
|
|
455
622
|
|
|
456
623
|
def set_globals(stores):
|
|
624
|
+
for table in stores.values():
|
|
625
|
+
if isinstance(table, ORMTable): table.install()
|
|
457
626
|
for g in S.get('globals') or []: setattr(importlib.import_module(g['mod']), g['name'], stores[g['name']])
|
|
458
627
|
|
|
459
628
|
def call(req):
|
|
@@ -462,10 +631,14 @@ def call(req):
|
|
|
462
631
|
OBJ_STORES = stores
|
|
463
632
|
set_globals(stores)
|
|
464
633
|
NOW[0] = int(req.get('now') or 0)
|
|
634
|
+
for store in stores.values():
|
|
635
|
+
if isinstance(store, ORMSession): store.loaded.clear(); store.added.clear()
|
|
465
636
|
CUR.clear(); CUR.update(req.get('answers') or {})
|
|
466
637
|
EFF.clear()
|
|
467
638
|
fn = getattr(obj, req['m']) if S['cls'] is not None else getattr(S['mod'], req['m'])
|
|
468
|
-
kwargs = fixed_args(req['a'], {})
|
|
639
|
+
try: kwargs = fixed_args(req['a'], {})
|
|
640
|
+
except OverflowError as e:
|
|
641
|
+
return {'outside': f'argument outside the declared runtime domain: {e}'}
|
|
469
642
|
before = frames(obj if S['cls'] is not None else None)
|
|
470
643
|
snap = state_of(obj, stores) if S.get('discard') and S['cls'] is not None else None
|
|
471
644
|
sys.settrace(tracer)
|
|
@@ -511,7 +684,7 @@ def main():
|
|
|
511
684
|
obj, stores = OBJS[req['id']]
|
|
512
685
|
res = {'state': state_of(obj, stores)}
|
|
513
686
|
elif op == 'call': res = call(req)
|
|
514
|
-
elif op == 'coverage': res = {'hit':
|
|
687
|
+
elif op == 'coverage': res = {'hit': sorted(HIT)}
|
|
515
688
|
else: res = {'error': f"no op {op}"}
|
|
516
689
|
except Exception as e:
|
|
517
690
|
res = {'error': f"{type(e).__name__}: {e}"[:500]}
|