Download tasks/codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792/patch.diff from Benchanything/checkerbench: direct link, hf CLI and curl.
- Browser
- Download file 2.05 kB
-
https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792/patch.diff
- Command line
-
hf download hf://datasets/Benchanything/checkerbench/tasks/codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792/patch.diff
-
curl -L -o patch.diff https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-4e31b8fba29687b8d792/patch.diff
2.05 kB
| diff --git a/psiturk/experiment.py b/psiturk/experiment.py | |
| index a6904f6..7ba1c1e 100644 | |
| --- a/psiturk/experiment.py | |
| +++ b/psiturk/experiment.py | |
| def advertisement(): | |
| # even have accepted the HIT. | |
| with open('templates/ad.html', 'r') as temp_file: | |
| ad_string = temp_file.read() | |
| - ad_string = insert_mode(ad_string, mode) | |
| + ad_string = insert_mode(ad_string) | |
| return render_template_string( | |
| ad_string, | |
| + mode=mode, | |
| hitid=hit_id, | |
| assignmentid=assignment_id, | |
| workerid=worker_id | |
| def give_consent(): | |
| mode = request.args['mode'] | |
| with open('templates/consent.html', 'r') as temp_file: | |
| consent_string = temp_file.read() | |
| - consent_string = insert_mode(consent_string, mode) | |
| + consent_string = insert_mode(consent_string) | |
| return render_template_string( | |
| consent_string, | |
| + mode=mode, | |
| hitid=hit_id, | |
| assignmentid=assignment_id, | |
| workerid=worker_id | |
| def ppid(): | |
| # to avoid breaking backwards compatibility with old templates. | |
| -def insert_mode(page_html, mode): | |
| +def insert_mode(page_html): | |
| """ Insert mode """ | |
| page_html = page_html | |
| match_found = False | |
| def insert_mode(page_html, mode): | |
| for match in matches: | |
| match_found = True | |
| if match_found: | |
| - new_html = page_html[:match.end()] + "&mode=" + mode +\ | |
| + new_html = page_html[:match.end()] + '&mode={{ mode }}' +\ | |
| page_html[match.end():] | |
| return new_html | |
| else: | |
| diff --git a/tests/test_psiturk.py b/tests/test_psiturk.py | |
| index 497f0a5..5229962 100644 | |
| --- a/tests/test_psiturk.py | |
| +++ b/tests/test_psiturk.py | |
| def test_insert_mode(psiturk_test_client): | |
| ad_string = temp_file.read() | |
| from psiturk.experiment import insert_mode | |
| - insert_mode(ad_string, 'debug') | |
| + insert_mode(ad_string) | |
| class PsiTurkStandardTests(PsiturkUnitTest): | |