Encode investigation source as contiguous plain-text code blocks
This commit is contained in:
1 parent
0246feda61
commit
f4e85070c8
11 files changed
+284
-15
No files matched your search
@@ -5,17 +5,18 @@ import json
|
||||
|
||||
from viano_bug_analysis.analysis.investigation_prompt import build_prompt
|
||||
from viano_bug_analysis.analysis.investigation_view import working_view, thin_view
|
||||
from viano_bug_analysis.analysis.investigation_consolidation import consolidated_view, restore_view
|
||||
from viano_bug_analysis.analysis.investigation_consolidation import consolidated_view
|
||||
from viano_bug_analysis.analysis.investigation_blocks import block_view, restore_blocks
|
||||
from viano_bug_analysis.case.contracts import read_json
|
||||
from viano_bug_analysis.package import PackageReader
|
||||
|
||||
|
||||
def restore_tables(view):
|
||||
return restore_view(view)
|
||||
return restore_blocks(view)
|
||||
|
||||
|
||||
def measure(path, target_version='investigation_project_v6'):
|
||||
if target_version not in {'investigation_project_v5', 'investigation_project_v6'}:
|
||||
def measure(path, target_version='investigation_project_v7'):
|
||||
if target_version not in {'investigation_project_v5', 'investigation_project_v6', 'investigation_project_v7'}:
|
||||
raise ValueError('Unsupported model view version')
|
||||
records = []
|
||||
with PackageReader(path) as reader:
|
||||
@@ -30,7 +31,7 @@ def measure(path, target_version='investigation_project_v6'):
|
||||
projected['prompt_version'] = target_version
|
||||
new = build_prompt(projected)
|
||||
old_view = working_view(projected)
|
||||
new_view = consolidated_view(projected) if target_version == 'investigation_project_v6' else thin_view(projected)
|
||||
new_view = block_view(projected) if target_version == 'investigation_project_v7' else consolidated_view(projected) if target_version == 'investigation_project_v6' else thin_view(projected)
|
||||
if json.dumps(restore_tables(copy.deepcopy(new_view)), sort_keys=True) != json.dumps(old_view, sort_keys=True):
|
||||
raise ValueError('Model view roundtrip failed')
|
||||
records.append({'context_ref': ref,
|
||||
@@ -55,6 +56,6 @@ def measure(path, target_version='investigation_project_v6'):
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('package')
|
||||
parser.add_argument('--target-version', choices=['investigation_project_v5', 'investigation_project_v6'], default='investigation_project_v6')
|
||||
parser.add_argument('--target-version', choices=['investigation_project_v5', 'investigation_project_v6', 'investigation_project_v7'], default='investigation_project_v7')
|
||||
args = parser.parse_args()
|
||||
print(json.dumps(measure(args.package, args.target_version), indent=2))
|
||||
Reference in new issue
Block a user