Dataset Viewer
Auto-converted to Parquet Duplicate
mutation_id
stringlengths
1
5
task_id
stringclasses
563 values
prompt
stringclasses
563 values
response
stringlengths
26
3.13k
mutation_info
stringlengths
15
81.4k
score
float64
0
1
scores
stringclasses
839 values
solutions
stringlengths
304
18.5k
solutions_info
stringlengths
140
132k
bug_summary
stringlengths
54
514
9
BigCodeBench/19
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python if not os.path.exists(directory): raise FileNotFoundError(f"Directory '{directory}' not found.") files = [f for f in glob.glob(os.path.join(directory, '*')) if os.path.isfile(f)] if not files: return None zip_file_path = os.path.join(directory, 'files.zip') with zipfile.Zip...
["fail", {"test_exclusion_of_subdirectories": "Traceback (most recent call last):\n File \"__test__.py\", line 95, in test_exclusion_of_subdirectories\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/zipfile.py\", line 1272, in __init__\n self._RealGetContents()\n File \"/iris/u/cchoi1/miniconda3/envs/...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n return zip_file_path\n```", "```python\n return zip_file_path\n```", "```python\n return zip_file_path\n```", "```python\n with open(zip_file_path, 'w') as f:\n f.write('')\n return zip_file_path\n```", "```python\n with open(zip_file_path, 'wb') as f:\n f.write(b'')\n```",...
[["fail", {"test_empty_directory": "Traceback (most recent call last):\n File \"__test__.py\", line 68, in test_empty_directory\n File \"__test__.py\", line 31, in task_func\nNameError: name 'zip_file_path' is not defined\n", "test_exclusion_of_subdirectories": "Traceback (most recent call last):\n File \"__test__.p...
The code erroneously opens the created zip file in write mode, which empties its contents, resulting in an empty zip file.
12
BigCodeBench/23
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python combined = [val for pair in zip_longest(l1, l2) for val in pair if val is not None] differences = np.abs(np.array(combined) - THRESHOLD) closest_index = np.argmax(differences) return combined[closest_index] ```
["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 43, in test_case_1\nAssertionError: 14 != 0.5\n", "test_case_2": "Traceback (most recent call last):\n File \"__test__.py\", line 48, in test_case_2\nAssertionError: 12 != 0.4\n", "test_case_3": "Traceback (most recent call last...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n return combined[np.argmin(differences)]\n```", "```python\nclosest_index = np.argmin(differences)\nreturn combined[closest_index]\n```", "```python\nclosest_index = np.argmin(differences)\nreturn combined[closest_index]\n```", "```python\n closest_index = np.argmin(differences)\n return combined[...
[["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 40, in test_case_1\n File \"__test__.py\", line 33, in task_func\nNameError: name 'combined' is not defined\n", "test_case_2": "Traceback (most recent call last):\n File \"__test__.py\", line 45, in test_case_2\n File \"__tes...
The function incorrectly uses `np.argmax` instead of `np.argmin`, returning the element farthest from the threshold instead of the closest.
19
BigCodeBench/33
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python second_values = [pair[1] for pair in list_of_pairs] product = reduce(np.add, second_values) product_array = np.array([product]) return product_array ```
["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 40, in test_case_1\nAssertionError: False is not true\n", "test_case_2": "Traceback (most recent call last):\n File \"__test__.py\", line 47, in test_case_2\nAssertionError: False is not true\n", "test_case_3": "Traceback (most ...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\nproduct = reduce(np.multiply, second_values)\n```", "```python\nproduct = reduce(np.multiply, second_values)\n```", "```python\n product = reduce(np.multiply, second_values)\n product_array = np.array([product])\n return product_array\n```", "```python\n product = reduce(np.multiply, second_val...
[["fail", {"ALL": "name 'second_values' is not defined"}], ["fail", {"ALL": "name 'second_values' is not defined"}], ["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 37, in test_case_1\n File \"__test__.py\", line 25, in task_func\nNameError: name 'second_values' is not define...
Replaced the multiplication operation with addition, causing the function to return the sum instead of the product of the second values.
18
BigCodeBench/32
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') tag_content = soup.find_all(tag) return tag_content[0].text if tag_content else None ```
["fail", {"test_empty_tag": "Traceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/unittest/mock.py\", line 1379, in patched\n return func(*newargs, **newkeywargs)\n File \"__test__.py\", line 92, in test_empty_tag\nAssertionError: '' is not None\n", "test_malformed_html": ...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n return tag_content[0].text if tag_content else None\n```", "```python\n return tag_content[0].text if tag_content else None\n```", "```python\ntag_content = soup.find(tag)\nreturn tag_content.text if tag_content else None\n```", "```python\n tag_content = soup.find(tag)\n return tag_content.te...
[["fail", {"test_empty_tag": "Traceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/unittest/mock.py\", line 1379, in patched\n return func(*newargs, **newkeywargs)\n File \"__test__.py\", line 88, in test_empty_tag\n File \"__test__.py\", line 23, in task_func\nNameError:...
Changed `soup.find` to `soup.find_all`, which returns a list, causing an error when trying to access `.text` on a list instead of a single tag.
10
BigCodeBench/21
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python total_memory = psutil.virtual_memory().total used_memory = psutil.virtual_memory().total system_info['Memory Usage'] = f'{used_memory/total_memory*100:.2f}%' return system_info ```
["fail", {"test_memory_usage_format": "Traceback (most recent call last):\n File \"__test__.py\", line 60, in test_memory_usage_format\n File \"__test__.py\", line 37, in task_func\nNameError: name 'system_info' is not defined\n", "test_non_empty_values": "Traceback (most recent call last):\n File \"__test__.py\", l...
0.5
[0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0]
["```python\n system_info = {\n 'OS': platform.system(),\n 'Architecture': platform.architecture()[0],\n 'Memory Usage': f'{psutil.virtual_memory().percent:.2f}%'\n }\n return system_info\n```", "```python\n system_info = {\n 'OS': platform.system(),\n 'Architecture': plat...
[["pass", {}], ["pass", {}], ["fail", {"ALL": "'return' outside function (__test__.py, line 40)"}], ["fail", {"test_memory_usage_format": "Traceback (most recent call last):\n File \"__test__.py\", line 58, in test_memory_usage_format\n File \"__test__.py\", line 36, in task_func\nNameError: name 'total_memory' is no...
The function incorrectly uses the total memory value for both total and used memory calculations, resulting in a memory usage percentage of 100%.
8
BigCodeBench/13
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python download_dir = "downloaded_files" if not os.path.exists(download_dir): os.makedirs(download_dir) downloaded_files = [] for filename in ftp_obj.nlst(): command = f'wget http://{ftp_user}:{ftp_password}@{ftp_server}{ftp_dir}/{filename} -P {download_dir}' subprocess.call(c...
["fail", {"test_case_2": "Traceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/unittest/mock.py\", line 1379, in patched\n return func(*newargs, **newkeywargs)\n File \"__test__.py\", line 74, in test_case_2\nAssertionError: \"name 'ftp_obj' is not defined\" != 'Failed to ...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\nimport subprocess\nimport ftplib\nimport os\ndef task_func(ftp_server='ftp.dlptest.com', ftp_user='dlpuser', ftp_password='rNrKYTX9g7z3RgJRmxWuGHbeu', ftp_dir='/ftp/test'):\n download_dir = \"downloaded_files\"\n if not os.path.exists(download_dir):\n os.makedirs(download_dir)\n downloaded_...
[["fail", {"test_case_2": "Traceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/unittest/mock.py\", line 1379, in patched\n return func(*newargs, **newkeywargs)\n File \"__test__.py\", line 86, in test_case_2\nAssertionError: 'An unexpected error occurred: Failed to c[16 c...
The protocol in the wget command was changed from 'ftp' to 'http', causing the download to fail as it attempts to use the incorrect protocol.
7
BigCodeBench/12
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python log_data = {} if not os.path.isfile(script_name): raise FileNotFoundError(f"Script {script_name} does not exist.") start_time = datetime.now() log_data['start_time'] = start_time.strftime('%Y-%m-%d %H:%M:%S') try: exit_status = subprocess.call(['./' + script_name]) ...
["fail", {"test_non_zero_exit_status": "Traceback (most recent call last):\n File \"__test__.py\", line 44, in task_func\nRuntimeError: Script backup.sh exited with status 1\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n return log_data\n```", "```python\n json.dump(log_data, f, indent=4)\n```", "```python\n if not os.path.isfile(script_name):\n raise FileNotFoundError(f\"Script {script_name} does not exist.\")\n start_time = datetime.now()\n log_data['start_time'] = start_time.strftime('%Y-%m-%d...
[["fail", {"test_custom_values_successful_script": "Traceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/unittest/mock.py\", line 1379, in patched\n return func(*newargs, **newkeywargs)\n File \"__test__.py\", line 68, in test_custom_values_successful_script\n File \"__te...
The function now raises a `RuntimeError` if the script exits with a non-zero status, which was not part of the original implementation, potentially causing some unit tests expecting non-zero exit statuses to fail.
2
BigCodeBench/5
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python random_dict = {k: [random.randint(0, 100) for _ in range(random.randint(1, 10))] for k in LETTERS} sd_dict = { k: math.sqrt(sum((i - sum(v) / len(v)) ** 2 for i in v) / (len(v) - 1)) for k, v in random_dict.items() } return sd_dict ```
["fail", {"test_known_values": "Traceback (most recent call last):\n File \"/iris/u/cchoi1/miniconda3/envs/adv2/lib/python3.10/unittest/mock.py\", line 1379, in patched\n return func(*newargs, **newkeywargs)\n File \"__test__.py\", line 80, in test_known_values\nAssertionError: 6.363961030678928 != 4.5 within 7 pl...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n return sd_dict\n```", "```python\n return sd_dict\n```", "```python\n return sd_dict\n```", "```python\n return sd_dict\n```", "```python\nreturn sd_dict\n```", "```python\nimport random\nimport math\ndef task_func(LETTERS=[chr(i) for i in range(97, 123)]):\n random_dict = {k: [random.randi...
[["fail", {"test_custom_letters": "Traceback (most recent call last):\n File \"__test__.py\", line 48, in test_custom_letters\n File \"__test__.py\", line 30, in task_func\nNameError: name 'sd_dict' is not defined\n", "test_default_letters": "Traceback (most recent call last):\n File \"__test__.py\", line 41, in tes...
The bug changes the calculation of the standard deviation from the population standard deviation to the sample standard deviation by dividing by (len(v) - 1) instead of len(v).
16
BigCodeBench/30
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python if not os.path.isfile(file_path): raise ValueError(f'{file_path} does not exist.') with open(file_path, 'r') as f: data = json.load(f) for key in INPUT_JSON['required']: if key not in data: raise ValueError(f'{key} is missing from the JSON object.') if not isinstance(data[key], INPUT_J...
["fail", {"ALL": "'return' outside function (__test__.py, line 62)"}]
0.6
[0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0]
["```python\ndef task_func(\n file_path,\n attribute,\n INPUT_JSON={\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\"type\": str},\n \"age\": {\"type\": int},\n \"email\": {\"type\": str}\n },\n \"required\": [\"name\", \"age\", \"email\"]...
[["pass", {}], ["fail", {"ALL": "'return' outside function (__test__.py, line 53)"}], ["fail", {"ALL": "'return' outside function (__test__.py, line 62)"}], ["fail", {"ALL": "'return' outside function (__test__.py, line 62)"}], ["pass", {}], ["fail", {"test_case_retrieve_age": "Traceback (most recent call last):\n Fil...
The function now uses `data.get(attribute, None)` instead of `data[attribute]`, which returns `None` instead of raising a `KeyError` if the attribute is missing, potentially masking missing attribute errors.
4
BigCodeBench/8
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python random_nums = [randint(0, RANGE) for _ in range(total_nums + 1)] counts = Counter(random_nums) return counts ```
["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 40, in test_case_1\n File \"__test__.py\", line 31, in task_func\nNameError: name 'total_nums' is not defined\n", "test_case_2": "Traceback (most recent call last):\n File \"__test__.py\", line 46, in test_case_2\n File \"__te...
0.9
[0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n total_nums = sum(map(int, itertools.chain.from_iterable(T1)))\n random_nums = [randint(0, RANGE) for _ in range(total_nums)]\n counts = Counter(random_nums)\n return counts\n```", "```python\ntotal_nums = sum(int(num) for inner_tuple in T1 for num in inner_tuple)\nrandom_nums = [randint(0, RAN...
[["pass", {}], ["fail", {"ALL": "'return' outside function (__test__.py, line 34)"}], ["fail", {"ALL": "name 'T1' is not defined"}], ["fail", {"ALL": "'return' outside function (__test__.py, line 34)"}], ["fail", {"ALL": "'return' outside function (__test__.py, line 34)"}], ["fail", {"ALL": "'return' outside function (...
The bug adds an extra random number to the list by incrementing the range of the loop, causing the count of random numbers to be one more than expected.
13
BigCodeBench/24
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python if not password: raise ValueError salt = os.urandom(SALT_LENGTH) hashed_password = hashlib.pbkdf2_hmac('sha256', password.encode(), salt, 100000) return base64.b64encode(salt), base64.b64encode(hashed_password[::-1]) ```
["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 54, in test_case_1\nAssertionError: b'\\xbe \\xd1\\xe4\\xbe\\xf1=\\xdd\\xee\\xde\\xb8x\\xb8[45 chars]\\xa1' != b'\\xa1)Q\\xe5^\\x03\\xa1kA3Qh\\x8d\\x01L\\xb0\\x0c\\x[45 chars]\\xbe'\n", "test_case_2": "Traceback (most recent call...
1
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
["```python\n return base64.b64encode(salt), base64.b64encode(hashed_password)\n```", "```python\n return base64.b64encode(salt), base64.b64encode(hashed_password)\n```", "```python\n return base64.b64encode(salt), base64.b64encode(hashed_password)\n```", "```python\n return base64.b64encode(salt), base64.b...
[["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 47, in test_case_1\n File \"__test__.py\", line 33, in task_func\nNameError: name 'salt' is not defined\n", "test_case_2": "Traceback (most recent call last):\n File \"__test__.py\", line 53, in test_case_2\n File \"__test__....
The hashed password is reversed before encoding, altering the expected output.
3
BigCodeBench/7
Modify the given function to introduce a subtle bug that causes some unit tests to fail. Rules: 1. Keep the function signature exactly the same. 2. Only modify the function implementation (the code inside the function). 3. Do not include the function signature, docstrings, or comments. Response Format: 1. The modifie...
```python top_selling_product = min(sales_data.items(), key=operator.itemgetter(1))[0] return top_selling_product ```
["fail", {"test_case_1": "Traceback (most recent call last):\n File \"__test__.py\", line 49, in test_case_1\n File \"__test__.py\", line 30, in task_func\nNameError: name 'sales_data' is not defined\n", "test_case_2": "Traceback (most recent call last):\n File \"__test__.py\", line 54, in test_case_2\n File \"__te...
0.5
[1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0]
["```python\ntop_selling_product = max(sales_data.items(), key=operator.itemgetter(1))[0]\nreturn top_selling_product\n```", "```python\ntop_selling_product = max(sales_data.items(), key=operator.itemgetter(1))[0]\n```", "```python\n sales_data = collections.defaultdict(int)\n with open(csv_file_path, mode='r') a...
[["fail", {"ALL": "'return' outside function (__test__.py, line 31)"}], ["fail", {"ALL": "name 'sales_data' is not defined"}], ["pass", {}], ["fail", {"ALL": "'return' outside function (__test__.py, line 31)"}], ["pass", {}], ["pass", {}], ["fail", {"ALL": "'return' outside function (__test__.py, line 31)"}], ["pass", ...
The function incorrectly uses `min` instead of `max`, returning the product with the lowest sales instead of the highest.
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
3