Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /promptdriven_pdd /context /checkup_interactive_session_example.py
| from pathlib import Path | |
| import sys | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from pdd.checkup_interactive_session import ( | |
| ApprovedPatch, | |
| FakeInteractiveSession, | |
| RepairOption, | |
| ) | |
| patch = ApprovedPatch( | |
| kind="vocab_definition", | |
| target=Path("prompts/refund_python.prompt"), | |
| anchor={"finding_id": "R2-missing-vocabulary", "line": 42}, | |
| replacement="- Remaining refundable amount: captured minus refunded.", | |
| ) | |
| option = RepairOption( | |
| label="A", | |
| preview="--- prompt\n+++ prompt\n@@\n+definition", | |
| patch=patch, | |
| ) | |
| session = FakeInteractiveSession( | |
| options_by_finding={"R2-missing-vocabulary": [option]}, | |
| answers=["approve"], | |
| ) | |
| session.seed({"findings": []}) | |
| presented = session.present_finding("R2-missing-vocabulary") | |
| session.record_choice("R2-missing-vocabulary", presented[0]) | |
| assert session.ask("Apply option A?") == "approve" | |
| patches = session.approved_patches() | |
| assert len(patches) == 1 | |
| assert patches[0].kind == patch.kind | |
| assert patches[0].finding_id == "R2-missing-vocabulary" | |
Xet Storage Details
- Size:
- 1.05 kB
- Xet hash:
- 68081c89c8b40bcc71e24206df2567ce36b4f0f7aa67fbbc9c7dc6942ae90205
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.