Datasets:
Download scripts/reusable_support/inventory_policy.py from CrossSWE/CrossSWE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/scripts/reusable_support/inventory_policy.py
- Command line
-
hf download hf://datasets/CrossSWE/CrossSWE-Bench/scripts/reusable_support/inventory_policy.py
-
curl -L -o inventory_policy.py https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/scripts/reusable_support/inventory_policy.py
1.18 kB
| """Allow only the upstream QUERY parametrization explicitly added by the frozen Flask gold.""" | |
| from collections import Counter | |
| import hashlib | |
| from pathlib import Path | |
| def approved_gold_addition(task, label, baseline, fixed, inputs): | |
| added=Counter(fixed)-Counter(baseline);removed=Counter(baseline)-Counter(fixed) | |
| case='tests/test_basic.py::test_method_route[query]' | |
| if task['instance_id']!='backend-flask-6133' or label!='flask-pass_to_pass' or removed or added!=Counter({case:1}): | |
| return None | |
| reference=next(r for r in task['repositories'] if r['key']=='flask')['gold_patch'] | |
| data=(Path(inputs)/reference['path']).read_bytes() | |
| if hashlib.sha256(data).hexdigest()!=reference['sha256']: | |
| return None | |
| line=b'+@pytest.mark.parametrize("method", ["get", "query", "post", "put", "delete", "patch"])' | |
| if line not in data.splitlines(): | |
| return None | |
| return {'kind':'frozen-gold-added-upstream-test','added_cases':[case],'removed_cases':[], | |
| 'gold_patch':reference,'common_case_count':len(baseline), | |
| 'reason':'The unchanged frozen gold adds the QUERY parametrization in an already selected P2P file.'} | |