Upload dataset_base.jsonl with huggingface_hub
Browse files- dataset_base.jsonl +86 -15
dataset_base.jsonl
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
{"id":"base_java_01","dataset_type":"base","language":"Java","task_category":"scaffolding",
|
| 2 |
-
"prompt_en":"write a method createScaffold in java that creates a basic project structure for maven. Return ONLY the method",
|
| 3 |
-
"prompt_nl":"
|
| 4 |
"code_snippet_input":"",
|
| 5 |
-
"canonical_solution":"public static void createScaffold() throws IOException {\n Files.createDirectories(
|
| 6 |
-
"unit_test_setup":"import org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.
|
| 7 |
-
"unit_test_assertion":"@Test\n public void testDirectoryCreation() throws IOException {\n
|
| 8 |
"comment":"the folder structure should contain AT LEAST src/main/java/ and src/test/java/ directories since they're required for every maven project"
|
| 9 |
}
|
| 10 |
{"id":"base_java_02","dataset_type":"base","language":"Java","task_category":"elem_func",
|
|
@@ -36,7 +36,7 @@
|
|
| 36 |
}
|
| 37 |
{"id":"base_java_05","dataset_type":"base","language":"Java","task_category":"fix_bug",
|
| 38 |
"prompt_en":"why am I getting a compilation error in this code? I want to use the process from printer. Output only the fixed class.",
|
| 39 |
-
"prompt_nl":"
|
| 40 |
"code_snippet_input":"/*class OfficeMachine inherits unrelated defaults for process() from types Printer and Scanner*/\npublic class OfficeMachine implements Printer, Scanner {\n \n}",
|
| 41 |
"canonical_solution":"public class OfficeMachine implements Printer, Scanner {\n @Override\n public String process() {\n return Printer.super.process();\n }\n}",
|
| 42 |
"unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\ninterface Printer {\n default String process() { return \"Printing document...\"; }\n}\n\ninterface Scanner {\n default String process() { return \"Scanning document...\"; }\n}\n",
|
|
@@ -116,13 +116,69 @@
|
|
| 116 |
{"id":"base_javascript_07","dataset_type":"base","language":"JavaScript","task_category":"refactoring","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 117 |
{"id":"base_javascript_08","dataset_type":"base","language":"JavaScript","task_category":"refactoring","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 118 |
|
| 119 |
-
{"id":"base_python_01","dataset_type":"base","language":"Python","task_category":"scaffolding",
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
{"id":"base_python_08","dataset_type":"base","language":"Python","task_category":"fix_bug","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 127 |
{"id":"base_python_09","dataset_type":"base","language":"Python","task_category":"fix_bug","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 128 |
{"id":"base_python_10","dataset_type":"base","language":"Python","task_category":"fix_bug","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
|
@@ -151,8 +207,23 @@
|
|
| 151 |
"unit_test_setup":"",
|
| 152 |
"unit_test_assertion":""
|
| 153 |
}
|
| 154 |
-
{"id":"base_python_14","dataset_type":"base","language":"Python","task_category":"refactoring",
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
{"id":"base_sql_01","dataset_type":"base","language":"SQL","dialect": "mssql","task_category":"queries",
|
| 158 |
"prompt_en":"I am calculating and retrieving data for a tableau chart using an MSSQL query. Above the chart is AGG (average number of customer hours cost center), which is SUM([Direct Time In Hours])/[numberofclients].[Sum unique clients cost center]. Sum unique clients cost center is in Tableau with the following calculation: SUM({FIXED [Year], [Month], [Cost Center Name]: COUNTD([Client])}) I want the tableau to have a row per cost center per month, and all the data comes from the numberofclients table. Can you convert this to an MSSQL database query?",
|
|
|
|
| 1 |
{"id":"base_java_01","dataset_type":"base","language":"Java","task_category":"scaffolding",
|
| 2 |
+
"prompt_en":"write a static method createScaffold(String rootDir) in java that creates a basic project structure for maven. Return ONLY the method",
|
| 3 |
+
"prompt_nl":"Schrijf een statische methode createScaffold(String rootDir) in Java die een basisprojectstructuur voor Maven creëert. Retourneer ALLEEN de methode.",
|
| 4 |
"code_snippet_input":"",
|
| 5 |
+
"canonical_solution":"public static void createScaffold(String rootDir) throws IOException {\n Path root = Paths.get(rootDir);\n Files.createDirectories(root.resolve(\"src/main/java\"));\n Files.createDirectories(root.resolve(\"src/test/java\"));\n}",
|
| 6 |
+
"unit_test_setup": "import org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.io.TempDir;\nimport java.io.IOException;\nimport java.nio.file.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\npublic class ScaffoldTest {\n",
|
| 7 |
+
"unit_test_assertion": " @Test\n public void testDirectoryCreation(@TempDir Path tempDir) throws IOException {\n createScaffold(tempDir.toString());\n\n assertTrue(Files.exists(tempDir.resolve(\"src/main/java\")), \"src/main/java should exist\");\n assertTrue(Files.exists(tempDir.resolve(\"src/test/java\")), \"src/test/java should exist\");\n assertTrue(Files.isDirectory(tempDir.resolve(\"src/main/java\")), \"Should be a directory\");\n }\n}",
|
| 8 |
"comment":"the folder structure should contain AT LEAST src/main/java/ and src/test/java/ directories since they're required for every maven project"
|
| 9 |
}
|
| 10 |
{"id":"base_java_02","dataset_type":"base","language":"Java","task_category":"elem_func",
|
|
|
|
| 36 |
}
|
| 37 |
{"id":"base_java_05","dataset_type":"base","language":"Java","task_category":"fix_bug",
|
| 38 |
"prompt_en":"why am I getting a compilation error in this code? I want to use the process from printer. Output only the fixed class.",
|
| 39 |
+
"prompt_nl":"Waarom krijg ik een compilatiefout in deze code? Ik wil het proces van printer gebruiken. Geef alleen de vaste klasse weer.",
|
| 40 |
"code_snippet_input":"/*class OfficeMachine inherits unrelated defaults for process() from types Printer and Scanner*/\npublic class OfficeMachine implements Printer, Scanner {\n \n}",
|
| 41 |
"canonical_solution":"public class OfficeMachine implements Printer, Scanner {\n @Override\n public String process() {\n return Printer.super.process();\n }\n}",
|
| 42 |
"unit_test_setup":"import org.junit.jupiter.api.Test;\nimport static org.junit.jupiter.api.Assertions.*;\ninterface Printer {\n default String process() { return \"Printing document...\"; }\n}\n\ninterface Scanner {\n default String process() { return \"Scanning document...\"; }\n}\n",
|
|
|
|
| 116 |
{"id":"base_javascript_07","dataset_type":"base","language":"JavaScript","task_category":"refactoring","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 117 |
{"id":"base_javascript_08","dataset_type":"base","language":"JavaScript","task_category":"refactoring","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 118 |
|
| 119 |
+
{"id":"base_python_01","dataset_type":"base","language":"Python","task_category":"scaffolding",
|
| 120 |
+
"prompt_en":"Write a method createScaffold(project_name, root_dir) in python that creates a basic project structure for a kotlin project using gradle. Return ONLY the method",
|
| 121 |
+
"prompt_nl":"Schrijf een methode createScaffold in Python die een basisprojectstructuur voor een Kotlin-project maakt met behulp van Gradle. Retourneer ALLEEN de methode.",
|
| 122 |
+
"code_snippet_input":"",
|
| 123 |
+
"canonical_solution":"from pathlib import Path\n\ndef createScaffold(project_name: str, root_dir: str = \".\"):\n base_path = Path(root_dir) / project_name\n \n directories = [\n base_path / \"src/main/kotlin\",\n base_path / \"src/main/resources\",\n base_path / \"src/test/kotlin\",\n base_path / \"src/test/resources\",\n base_path / \"gradle/wrapper\"\n ]\n \n files = {\n base_path / \"settings.gradle.kts\": f'rootProject.name = \"{project_name}\"\\n',\n base_path / \"build.gradle.kts\": \"\"\"plugins {\n kotlin(\"jvm\") version \"1.9.22\"\n}\ngroup = \"org.example\"\nversion = \"1.0-SNAPSHOT\"\nrepositories {\n mavenCentral()\n}\ndependencies {\n testImplementation(kotlin(\"test\"))\n}\ntasks.test {\n useJUnitPlatform()\n}\n\"\"\",\n base_path / \".gitignore\": \"\"\"\n.gradle/\nbuild/\nout/\n.idea/\n*.iml\n.DS_Store\n\"\"\",\n base_path / \"README.md\": f\"# {project_name}\\n\\nGenerated Kotlin/Gradle Project.\",\n base_path / \"gradle/wrapper/gradle-wrapper.properties\": \"\"\"distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-8.5-bin.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n\"\"\"\n }\n\n print(f\"Creating Kotlin/Gradle scaffold for '{project_name}'...\")\n for d in directories:\n d.mkdir(parents=True, exist_ok=True)\n \n for path, content in files.items():\n path.write_text(content, encoding=\"utf-8\")\n \n print(f\"Project created at {base_path.resolve()}\")",
|
| 124 |
+
"unit_test_setup":"import unittest\nimport tempfile\nimport shutil\nfrom pathlib import Path\nimport os\n\n",
|
| 125 |
+
"unit_test_assertion":"class TestKotlinScaffold(unittest.TestCase):\n def setUp(self):\n self.test_dir = tempfile.mkdtemp()\n\n def tearDown(self):\n shutil.rmtree(self.test_dir)\n\n def test_directory_structure(self):\n project_name = \"MyKotlinApp\"\n createScaffold(project_name, self.test_dir)\n \n base = Path(self.test_dir) / project_name\n \n required_dirs = [\n \"src/main/kotlin\",\n \"src/test/kotlin\",\n \"gradle/wrapper\"\n ]\n for d in required_dirs:\n self.assertTrue((base / d).exists(), f\"Directory missing: {d}\")\n self.assertTrue((base / d).is_dir(), f\"Path is not a directory: {d}\")\n \n required_files = [\n \"build.gradle.kts\",\n \"settings.gradle.kts\",\n \".gitignore\"\n ]\n for f in required_files:\n self.assertTrue((base / f).exists(), f\"File missing: {f}\")\n \n settings_content = (base / \"settings.gradle.kts\").read_text()\n self.assertIn(f'rootProject.name = \"{project_name}\"', settings_content, \"settings.gradle.kts has wrong project name\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 126 |
+
"comment":"the solution MUST create src/main/kotlin, src/test/kotlin, gradle/wrapper directories and settings.gradle.kts, build.gradle.kts, .gitignore files, the root project name MUST be correctly assigned in settings.gradle.kts."
|
| 127 |
+
}
|
| 128 |
+
{"id":"base_python_02","dataset_type":"base","language":"Python","task_category":"scaffolding",
|
| 129 |
+
"prompt_en":"write a function called create_vue_scaffold(project_name: str) that creates a basic project structure for a Vue 3 project using Vite. Return ONLY the function.",
|
| 130 |
+
"prompt_nl":"Schrijf een functie met de naam create_vue_scaffold(project_name: str) die een basisprojectstructuur voor een Vue 3-project maakt met behulp van Vite. Geef ALLEEN de functie terug.",
|
| 131 |
+
"code_snippet_input":"",
|
| 132 |
+
"canonical_solution":"from pathlib import Path\n\ndef create_vue_scaffold(project_name: str):\n base = Path(project_name)\n src = base / \"src\"\n \n dirs = [\n base / \"public\",\n src / \"assets\",\n src / \"components\",\n src / \"views\",\n src / \"stores\",\n src / \"router\",\n ]\n \n files = {\n base / \"index.html\": \"\"\"<!DOCTYPE html>\n<html lang=\"en\">\n <body>\n <div id=\"app\"></div>\n <script type=\"module\" src=\"/src/main.js\"></script>\n </body>\n</html>\"\"\",\n base / \"vite.config.js\": \"\"\"import { fileURLToPath, URL } from 'node:url'\nimport { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nexport default defineConfig({\n plugins: [vue()],\n resolve: {\n alias: {\n '@': fileURLToPath(new URL('./src', import.meta.url))\n }\n }\n})\"\"\",\n base / \"package.json\": f\"\"\"{{\n \"name\": \"{project_name}\",\n \"version\": \"0.0.0\",\n \"scripts\": {{\n \"dev\": \"vite\",\n \"build\": \"vite build\"\n }},\n \"dependencies\": {{\n \"vue\": \"^3.4.0\",\n \"pinia\": \"^2.1.0\",\n \"vue-router\": \"^4.2.0\"\n }},\n \"devDependencies\": {{\n \"@vitejs/plugin-vue\": \"^5.0.0\",\n \"vite\": \"^5.0.0\"\n }}\n}}\"\"\",\n src / \"main.js\": \"\"\"import { createApp } from 'vue'\nimport { createPinia } from 'pinia'\nimport App from './App.vue'\nimport router from './router'\nconst app = createApp(App)\napp.use(createPinia())\napp.use(router)\napp.mount('#app')\n\"\"\",\n src / \"App.vue\": \"\"\"<script setup>\nimport { RouterView } from 'vue-router'\n</script>\n<template>\n <header>\n <nav>\n <RouterLink to=\"/\">Home</RouterLink>\n <RouterLink to=\"/about\">About</RouterLink>\n </nav>\n </header>\n <RouterView />\n</template>\n\"\"\"\n }\n\n # Execution\n print(f\"Scaffolding Vue project: {project_name}\")\n for d in dirs:\n d.mkdir(parents=True, exist_ok=True)\n \n for path, content in files.items():\n path.write_text(content, encoding=\"utf-8\")",
|
| 133 |
+
"unit_test_setup":"import unittest\nimport tempfile\nimport shutil\nimport os\nfrom pathlib import Path\n\n",
|
| 134 |
+
"unit_test_assertion":"class TestVueScaffold(unittest.TestCase):\n def setUp(self):\n self.test_dir = tempfile.mkdtemp()\n self.original_cwd = os.getcwd()\n os.chdir(self.test_dir)\n\n def tearDown(self):\n os.chdir(self.original_cwd)\n shutil.rmtree(self.test_dir)\n\n def test_vue_structure(self):\n project_name = \"frontend-app\"\n create_vue_scaffold(project_name)\n \n base = Path(project_name)\n \n self.assertTrue((base / \"src/components\").is_dir(), \"Missing src/components\")\n self.assertTrue((base / \"src/views\").is_dir(), \"Missing src/views\")\n self.assertTrue((base / \"public\").is_dir(), \"Missing public folder\")\n \n # Check vital files\n self.assertTrue((base / \"vite.config.js\").exists(), \"Missing vite.config.js\")\n self.assertTrue((base / \"package.json\").exists(), \"Missing package.json\")\n self.assertTrue((base / \"src/App.vue\").exists(), \"Missing App.vue\")\n \n pkg_json = (base / \"package.json\").read_text()\n self.assertIn('\"name\": \"frontend-app\"', pkg_json, \"package.json name not set correctly\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 135 |
+
"comment":"solution MUST create src/components, src/views, public directories and vite.config.js, package.json, src/App.vue files, the project name MUST be correctly assigned in package.json."
|
| 136 |
+
}
|
| 137 |
+
{"id":"base_python_03","dataset_type":"base","language":"Python","task_category":"elem_func",
|
| 138 |
+
"prompt_en":"make a patient class in python with fields patient_id (int), first_name (str), last_name (str), birth_date (str in YYYY-MM-DD format), is_active (bool), gp_id (int), zip_code (str), with pythonic setters, getters and contructor.",
|
| 139 |
+
"prompt_nl":"Maak een patiëntklasse in Python met de velden patient_id (int), first_name (str), last_name (str), birth_date (str in YYYY-MM-DD-formaat), is_active (bool), gp_id (int), zip_code (str), met pythonic setters, getters en constructor.",
|
| 140 |
+
"code_snippet_input":"",
|
| 141 |
+
"canonical_solution": "class Patient:\n def __init__(self, patient_id: int, first_name: str, last_name: str, birth_date: str, is_active: bool, gp_id: int, zip_code: str):\n self._patient_id = patient_id\n self._first_name = first_name\n self._last_name = last_name\n self._birth_date = birth_date\n self._is_active = is_active\n self._gp_id = gp_id\n self._zip_code = zip_code\n\n @property\n def patient_id(self):\n return self._patient_id\n\n @patient_id.setter\n def patient_id(self, value):\n self._patient_id = value\n\n @property\n def first_name(self):\n return self._first_name\n\n @first_name.setter\n def first_name(self, value):\n self._first_name = value\n\n @property\n def last_name(self):\n return self._last_name\n\n @last_name.setter\n def last_name(self, value):\n self._last_name = value\n\n @property\n def birth_date(self):\n return self._birth_date\n\n @birth_date.setter\n def birth_date(self, value):\n self._birth_date = value\n\n @property\n def is_active(self):\n return self._is_active\n\n @is_active.setter\n def is_active(self, value):\n self._is_active = value\n\n @property\n def gp_id(self):\n return self._gp_id\n\n @gp_id.setter\n def gp_id(self, value):\n self._gp_id = value\n\n @property\n def zip_code(self):\n return self._zip_code\n\n @zip_code.setter\n def zip_code(self, value):\n self._zip_code = value",
|
| 142 |
+
"unit_test_setup": "import unittest\n\n",
|
| 143 |
+
"unit_test_assertion": "class TestPatientClass(unittest.TestCase):\n def test_properties(self):\n p = Patient(101, \"John\", \"Doe\", \"1980-05-20\", True, 55, \"1000AB\")\n \n self.assertEqual(p.first_name, \"John\")\n self.assertEqual(p.gp_id, 55)\n self.assertTrue(p.is_active)\n \n p.first_name = \"Jane\"\n self.assertEqual(p.first_name, \"Jane\", \"Property setter failed for first_name\")\n \n p.is_active = False\n self.assertFalse(p.is_active, \"Property setter failed for is_active\")\n \n self.assertTrue(isinstance(Patient.first_name, property), \"Field 'first_name' must use @property decorator\")\n self.assertTrue(isinstance(Patient.gp_id, property), \"Field 'gp_id' must use @property decorator\")\n self.assertTrue(isinstance(Patient.zip_code, property), \"Field 'zip_code' must use @property decorator\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 144 |
+
"comment":"solution MUST implement the patient class with AT LEAST the fields with the correct types specified in the prompt, and MUST use the @property decorator for getters and setters."
|
| 145 |
+
}
|
| 146 |
+
{"id":"base_python_04","dataset_type":"base","language":"Python","task_category":"elem_func",
|
| 147 |
+
"prompt_en":"write a class Transaction with fields transaction_id (int), user_id (int), amount (float), currency (str), timestamp (str in ISO 8601 format), status (bool), and pythonic setters, getters and constructor. ",
|
| 148 |
+
"prompt_nl":"Schrijf een klasse Transaction met velden transaction_id (int), user_id (int), amount (float), currency (str), timestamp (str in ISO 8601-formaat), status (bool) en pythonic setters, getters en constructor.",
|
| 149 |
+
"code_snippet_input":"",
|
| 150 |
+
"canonical_solution":"class Transaction:\n def __init__(self, transaction_id: int, user_id: int, amount: float, \n currency: str, timestamp: str, status: bool):\n self.transaction_id = transaction_id\n self.user_id = user_id\n self.amount = amount\n self.currency = currency\n self.timestamp = timestamp\n self.status = status\n @property\n def transaction_id(self) -> int:\n return self._transaction_id\n @transaction_id.setter\n def transaction_id(self, value: int):\n if not isinstance(value, int):\n raise TypeError(\"Transaction ID must be an integer\")\n self._transaction_id = value\n @property\n def user_id(self) -> int:\n return self._user_id\n @user_id.setter\n def user_id(self, value: int):\n if not isinstance(value, int):\n raise TypeError(\"User ID must be an integer\")\n self._user_id = value\n @property\n def amount(self) -> float:\n return self._amount\n @amount.setter\n def amount(self, value: float):\n if not isinstance(value, (int, float)):\n raise TypeError(\"Amount must be a number\")\n if value < 0:\n raise ValueError(\"Amount cannot be negative\")\n self._amount = float(value)\n @property\n def currency(self) -> str:\n return self._currency\n @currency.setter\n def currency(self, value: str):\n if not isinstance(value, str):\n raise TypeError(\"Currency must be a string\")\n if len(value) != 3:\n raise ValueError(\"Currency must be a 3-letter ISO code (e.g., 'USD')\")\n self._currency = value.upper()\n @property\n def timestamp(self) -> str:\n return self._timestamp\n @timestamp.setter\n def timestamp(self, value: str):\n if not isinstance(value, str):\n raise TypeError(\"Timestamp must be a string (ISO 8601)\")\n self._timestamp = value\n @property\n def status(self) -> bool:\n return self._status\n @status.setter\n def status(self, value: bool):\n if not isinstance(value, bool):\n raise TypeError(\"Status must be a boolean\")\n self._status = value\n def __repr__(self):\n return (f\"Transaction(id={self.transaction_id}, user={self.user_id}, \"\n f\"amount={self.amount} {self.currency}, status={self.status})\")",
|
| 151 |
+
"unit_test_setup": "import unittest\n\n",
|
| 152 |
+
"unit_test_assertion": "class TestTransactionClass(unittest.TestCase):\n def test_pythonic_properties(self):\n t = Transaction(1, 101, 50.0, \"EUR\", \"2023-01-01T12:00:00Z\", True)\n self.assertEqual(t.amount, 50.0)\n self.assertEqual(t.currency, \"EUR\")\n \n t.amount = 75.50\n self.assertEqual(t.amount, 75.50)\n t.status = False\n self.assertFalse(t.status)\n \n # 3. Meta-Test: Verify @property usage\n self.assertTrue(isinstance(Transaction.amount, property), \"Field 'amount' is not a @property\")\n self.assertTrue(isinstance(Transaction.transaction_id, property), \"Field 'transaction_id' is not a @property\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 153 |
+
"comment":"solution MUST implement the transaction class with AT LEAST the fields with the correct types specified in the prompt, and MUST use the @property decorator for getters and setters."
|
| 154 |
+
}
|
| 155 |
+
{"id":"base_python_05","dataset_type":"base","language":"Python","task_category":"id_bug",
|
| 156 |
+
"prompt_en":"This function cleans transactions but it doesn't seem to be updating the dataframe correctly when it should. Fix the bugs in the function.",
|
| 157 |
+
"prompt_nl":"Deze functie ruimt transacties op, maar lijkt het gegevensframe niet correct bij te werken wanneer dat nodig is. Los de bugs in de functie op.",
|
| 158 |
+
"code_snippet_input":"import pandas as pd\nimport numpy as np\ndef clean_transactions(df):\n df = df[df['amount'] >= 0]\n df['category'] = df['category'].fillna('Unknown')\n df[df['risk_score'] > 0.9]['amount'] = 1000\n return df",
|
| 159 |
+
"canonical_solution":"import pandas as pd\nimport numpy as np\ndef clean_transactions(df):\n df = df[df['amount'] >= 0]\n df['category'] = df['category'].fillna('Unknown')\n df.loc[df['risk_score'] > 0.9, 'amount'] = 1000\n return df",
|
| 160 |
+
"unit_test_setup": "import pandas as pd\nimport numpy as np\nimport unittest\n\n",
|
| 161 |
+
"unit_test_assertion": "class TestTransactionCleaning(unittest.TestCase):\n def test_logic(self):\n data = {\n 'id': [1, 2, 3, 4],\n 'amount': [100.0, -50.0, 200.0, 5000.0],\n 'category': ['Food', 'Food', np.nan, 'Travel'],\n 'risk_score': [0.1, 0.5, 0.1, 0.95]\n }\n df = pd.DataFrame(data)\n \n result = clean_transactions(df)\n \n self.assertFalse((result['amount'] < 0).any(), \"Negative amounts should be removed.\")\n self.assertEqual(len(result), 3, \"Row count mismatch. Did you filter negative amounts?\")\n \n cat_val = result.loc[result['id'] == 3, 'category'].values[0]\n self.assertEqual(cat_val, 'Unknown', \"NaN category should be replaced with 'Unknown'.\")\n \n risk_amount = result.loc[result['id'] == 4, 'amount'].values[0]\n self.assertEqual(risk_amount, 1000.0, \"High risk transactions (>0.9) must be capped at 1000. Did you use .loc?\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 162 |
+
"comment":"df[df['risk_score'] > 0.9]['amount'] = 1000 creates a copy of the filtered df and modifies that copy, not the original df. The solution MUST use .loc to correctly update the original dataframe."
|
| 163 |
+
}
|
| 164 |
+
{"id":"base_python_06","dataset_type":"base","language":"Python","task_category":"id_bug",
|
| 165 |
+
"prompt_en":"This python recursively searches through a nested dictionary to find all values associated with a given key, but it's returning more values than it should. Fix the bugs in the function.",
|
| 166 |
+
"prompt_nl":"Deze python doorzoekt recursief een geneste woordenlijst om alle waarden te vinden die bij een bepaalde sleutel horen, maar geeft meer waarden terug dan zou moeten. Los de bugs in de functie op.",
|
| 167 |
+
"code_snippet_input":"def extract_all_values(data, target_key, results=[]):\n if isinstance(data, dict):\n for key, value in data.items():\n if key == target_key:\n results.append(value)\n if isinstance(value, (dict, list)):\n extract_all_values(value, target_key, results)\n elif isinstance(data, list):\n for item in data:\n extract_all_values(item, target_key, results)\n return results",
|
| 168 |
+
"canonical_solution":"def extract_all_values(data, target_key, results=None):\n if results is None:\n results = []\n if isinstance(data, dict):\n for key, value in data.items():\n if key == target_key:\n results.append(value)\n if isinstance(value, (dict, list)):\n extract_all_values(value, target_key, results)\n elif isinstance(data, list):\n for item in data:\n extract_all_values(item, target_key, results)\n return results",
|
| 169 |
+
"unit_test_setup": "import unittest\n\n",
|
| 170 |
+
"unit_test_assertion": "class TestRecursiveSearch(unittest.TestCase):\n def test_mutable_default(self):\n data1 = {'id': 101, 'meta': {'id': 102, 'name': 'test'}}\n res1 = extract_all_values(data1, 'id')\n self.assertEqual(sorted(res1), [101, 102], \"First call failed to extract correct IDs\")\n\n data2 = {'id': 999}\n res2 = extract_all_values(data2, 'id')\n \n self.assertEqual(res2, [999], f\"Memory Leak Detected! Expected [999] but got {res2}. Did you remove the mutable default argument?\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 171 |
+
"comment":"python instantiates arguemnts once at function definition, so the results list is shared across calls. The solution MUST set results=None and initialize it inside the function to ensure a fresh list on each call."
|
| 172 |
+
}
|
| 173 |
+
{"id":"base_python_07","dataset_type":"base","language":"Python","task_category":"id_bug",
|
| 174 |
+
"prompt_en":"I want this function to return the leaderboard of all players with their scores, but when players don't finish the game and don't have a score they are missing when they should appear.",
|
| 175 |
+
"prompt_nl":"Ik wil dat deze functie het klassement van alle spelers met hun scores weergeeft, maar soms ontbreken sommige spelers terwijl ze wel zouden moeten verschijnen.",
|
| 176 |
+
"code_snippet_input":"import time\ndef process_match_report(players, match_scores):\n report = []\n for player, score in zip(players, match_scores):\n entry = {\n \"player_id\": player[\"id\"],\n \"username\": player[\"username\"],\n \"score\": score,\n \"status\": \"Ranked\",\n \"processed_at\": time.strftime(\"%H:%M:%S\")\n }\n report.append(entry)\n return report",
|
| 177 |
+
"canonical_solution":"from itertools import zip_longest\nimport time\ndef process_match_report(players, match_scores):\n report = []\n for player, score in zip_longest(players, match_scores, fillvalue=None):\n if score is None:\n final_score = 0\n status = \"Unranked (No Play)\"\n else:\n final_score = score\n status = \"Ranked\"\n entry = {\n \"player_id\": player[\"id\"],\n \"username\": player[\"username\"],\n \"score\": final_score,\n \"status\": status,\n \"processed_at\": time.strftime(\"%H:%M:%S\")\n }\n report.append(entry)\n return report",
|
| 178 |
+
"unit_test_setup": "import unittest\nimport time\n\n",
|
| 179 |
+
"unit_test_assertion": "class TestLeaderboard(unittest.TestCase):\n def test_missing_players(self):\n players = [\n {\"id\": 1, \"username\": \"Alice\"},\n {\"id\": 2, \"username\": \"Bob\"},\n {\"id\": 3, \"username\": \"Charlie\"}\n ]\n scores = [100]\n \n report = process_match_report(players, scores)\n \n self.assertEqual(len(report), 3, f\"Data Loss! Expected 3 players, got {len(report)}. zip() drops items if lists are unequal.\")\n \n bob_entry = next((r for r in report if r['username'] == 'Bob'), None)\n self.assertIsNotNone(bob_entry, \"Bob is missing from the report\")\n self.assertTrue(bob_entry['score'] == 0 or bob_entry['score'] is None, \"Bob should have a default score (0 or None)\")\n\nif __name__ == '__main__':\n unittest.main()",
|
| 180 |
+
"comment":"the zip function drops the extra players when the match_scores list is shorter, solution MUST use zip_longest with fillvalue=None to ensure all players are included."
|
| 181 |
+
}
|
| 182 |
{"id":"base_python_08","dataset_type":"base","language":"Python","task_category":"fix_bug","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 183 |
{"id":"base_python_09","dataset_type":"base","language":"Python","task_category":"fix_bug","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
| 184 |
{"id":"base_python_10","dataset_type":"base","language":"Python","task_category":"fix_bug","prompt_en":"","prompt_nl":"","code_snippet_input":"","canonical_solution":"","unit_test_setup":"","unit_test_assertion":""}
|
|
|
|
| 207 |
"unit_test_setup":"",
|
| 208 |
"unit_test_assertion":""
|
| 209 |
}
|
| 210 |
+
{"id": "base_python_14","dataset_type": "base","language": "Python","task_category": "refactoring",
|
| 211 |
+
"prompt_en":"This is a legacy setup.py file. Refactor it into a modern pyproject.toml format. Return the result as a Python string inside a function named `get_pyproject_toml()`.",
|
| 212 |
+
"prompt_nl":"Dit is een verouderd setup.py bestand. Herstructureer het naar een modern pyproject.toml formaat. Retourneer het resultaat als een Python string binnen een functie genaamd `get_pyproject_toml()`.",
|
| 213 |
+
"code_snippet_input":"from setuptools import setup, find_packages\nsetup(\nname=\"legacy-data-tool\",\nversion=\"1.2.0\",\ndescription=\"A legacy tool for data processing that needs modernization.\",\nlong_description=open(\"README.md\").read(),\nlong_description_content_type=\"text/markdown\",\nurl=\"https://github.com/example/legacy-data-tool\",\nauthor=\"Jane Doe\",\nauthor_email=\"jane.doe@example.com\",\nlicense=\"MIT\",\nclassifiers=[\n\"Development Status :: 4 - Beta\",\n\"Intended Audience :: Developers\",\n\"Topic :: Software Development :: Build Tools\",\n\"License :: OSI Approved :: MIT License\",\n\"Programming Language :: Python :: 3.8\",\n\"Programming Language :: Python :: 3.9\",\n],\nkeywords=\"data processing, legacy, conversion test\",\npackages=find_packages(where=\"src\"),\npackage_dir={\"\": \"src\"},\npython_requires=\">=3.8, <4\",\ninstall_requires=[\n\"pandas>=1.3.0\",\n\"requests==2.26.0\",\n\"numpy\",\n],\nextras_require={\n\"dev\": [\"check-manifest\"],\n\"test\": [\"pytest\", \"coverage\"],\n},\nentry_points={\n\"console_scripts\": [\n\"data-cli=legacy_tool.cli:main\",\n],\n},\nproject_urls={\n\"Bug Reports\": \"https://github.com/example/legacy-data-tool/issues\",\n\"Source\": \"https://github.com/example/legacy-data-tool\",\n},\n)",
|
| 214 |
+
"canonical_solution": "def get_pyproject_toml():\n return \"\"\"\n[build-system]\nrequires = [\"setuptools>=61.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"legacy-data-tool\"\nversion = \"1.2.0\"\ndescription = \"A legacy tool for data processing that needs modernization.\"\nreadme = \"README.md\"\nrequires-python = \">=3.8, <4\"\nlicense = {text = \"MIT\"}\nkeywords = [\"data processing\", \"legacy\", \"conversion test\"]\nauthors = [\n {name = \"Jane Doe\", email = \"jane.doe@example.com\"}\n]\nclassifiers = [\n \"Development Status :: 4 - Beta\",\n \"Intended Audience :: Developers\",\n \"Topic :: Software Development :: Build Tools\",\n \"License :: OSI Approved :: MIT License\",\n \"Programming Language :: Python :: 3.8\",\n \"Programming Language :: Python :: 3.9\",\n]\ndependencies = [\n \"pandas>=1.3.0\",\n \"requests==2.26.0\",\n \"numpy\",\n]\n\n[project.optional-dependencies]\ndev = [\"check-manifest\"]\ntest = [\"pytest\", \"coverage\"]\n\n[project.scripts]\ndata-cli = \"legacy_tool.cli:main\"\n\n[project.urls]\n\"Bug Reports\" = \"https://github.com/example/legacy-data-tool/issues\"\n\"Source\" = \"https://github.com/example/legacy-data-tool\"\n\n[tool.setuptools.packages.find]\nwhere = [\"src\"]\n\"\"\"",
|
| 215 |
+
"unit_test_setup":"import tomli\nimport unittest\n\n",
|
| 216 |
+
"unit_test_assertion":"toml_string = get_pyproject_toml()\ntry:\n data = tomli.loads(toml_string)\nexcept Exception as e:\n raise AssertionError(f\"Invalid TOML syntax: {e}\")\n\nassert \"build-system\" in data\nassert data[\"project\"][\"name\"] == \"legacy-data-tool\"\nassert \"pandas>=1.3.0\" in data[\"project\"][\"dependencies\"]\n",
|
| 217 |
+
"comment":"NEED TOMLI IN MY RUNNER. the solution MUST define a function called get_pyproject_toml() that returns a valid pyproject.toml string representing the same metadata as the legacy setup.py. The unit test checks that the returned string is valid TOML and contains key expected fields."
|
| 218 |
+
}
|
| 219 |
+
{"id":"base_python_15","dataset_type":"base","language":"Python","task_category":"refactoring",
|
| 220 |
+
"prompt_en":"",
|
| 221 |
+
"prompt_nl":"",
|
| 222 |
+
"code_snippet_input":"",
|
| 223 |
+
"canonical_solution":"",
|
| 224 |
+
"unit_test_setup":"",
|
| 225 |
+
"unit_test_assertion":""
|
| 226 |
+
}
|
| 227 |
|
| 228 |
{"id":"base_sql_01","dataset_type":"base","language":"SQL","dialect": "mssql","task_category":"queries",
|
| 229 |
"prompt_en":"I am calculating and retrieving data for a tableau chart using an MSSQL query. Above the chart is AGG (average number of customer hours cost center), which is SUM([Direct Time In Hours])/[numberofclients].[Sum unique clients cost center]. Sum unique clients cost center is in Tableau with the following calculation: SUM({FIXED [Year], [Month], [Cost Center Name]: COUNTD([Client])}) I want the tableau to have a row per cost center per month, and all the data comes from the numberofclients table. Can you convert this to an MSSQL database query?",
|