Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyk updates #1874

Merged
merged 6 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion k-distribution/src/main/scripts/lib/pyk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,19 @@ def kastJSON(definition, inputJSON, kastArgs = [], teeOutput = True, kRelease =
tempf.flush()
return kast(definition, tempf.name, kastArgs = kastArgs, teeOutput = teeOutput, kRelease = kRelease)

def krunJSON(definition, inputJSON, krunArgs = [], teeOutput = True, kRelease = None, keepTemp = False):
def krunJSON(definition, inputJSON, kastArgs = [], krunArgs = [], teeOutput = True, kRelease = None, keepTemp = False):
with tempfile.NamedTemporaryFile(mode = 'w', delete = not keepTemp) as tempJSON:
tempJSON.write(json.dumps(inputJSON))
tempJSON.flush()
(rC, kore, err) = kast(definition, tempJSON.name, kastArgs = ['--output', 'kore', '--input', 'json'] + kastArgs, teeOutput = teeOutput, kRelease = kRelease)
with tempfile.NamedTemporaryFile(mode = 'w', delete = not keepTemp) as tempKore:
tempKore.write(kore)
tempKore.flush()
(rC, out, err) = krun(definition, tempKore.name, krunArgs = krunArgs + ['--output', 'json', '--parser', 'cat'], teeOutput = teeOutput, kRelease = kRelease)
out = None if out == '' else json.loads(out)['term']
return (rC, out, err)

def krunJSONLegacy(definition, inputJSON, krunArgs = [], teeOutput = True, kRelease = None, keepTemp = False):
with tempfile.NamedTemporaryFile(mode = 'w', delete = not keepTemp) as tempf:
tempf.write(json.dumps(inputJSON))
tempf.flush()
Expand Down
4 changes: 1 addition & 3 deletions k-distribution/src/main/scripts/lib/pyk/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ def translateCoverage(src_all_rules, dst_all_rules, dst_definition, src_rules_li
_fatal('COULD NOT FIND RULE LOCATION IN dst_rule_map: ' + src_rule_loc)
dst_rule = dst_rule_map[src_rule_loc]

if dst_rule not in dst_non_function_rules:
_notif('Skipping non-semantic rule: ' + dst_rule)
else:
if dst_rule in dst_non_function_rules:
dst_rule_list.append(dst_rule)

return dst_rule_list
Expand Down