data_source large_stringclasses 1
value | prompt listlengths 1 1 | ability large_stringclasses 1
value | reward_model dict | extra_info dict |
|---|---|---|---|---|
acecode | [
{
"role": "user",
"content": "Given an object that supports the __index__ method, implement a function called convert_to_integer that takes an object as an argument and returns its integer representation. The function should call the __index__ method on the object to retrieve its integer value. If the objec... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_to_integer(0) == 0\", \"assert convert_to_integer(1) == 1\", \"assert convert_to_integer(-1) == -1\", \"assert convert_to_integer(True) == 1\", \"assert convert_to_integer(False) == 0\", \"assert convert_to_integer(object()) == None\", \"assert conve... | {
"split": "train",
"index": 67700,
"acecode_id": "bigcode_python_fns_7383",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that calculates the factorial of a given non-negative integer n. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 is 5! = 5 × 4 × 3 × 2 × 1 = 120. Y... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(... | {
"split": "train",
"index": 67701,
"acecode_id": "bigcode_python_fns_31548",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that takes a list of integers and returns a new list containing only the even numbers from the original list. Your function should maintain the order of the even numbers as they appeared in the original list. Implement the function `filte... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_even_numbers([1, 2, 3, 4, 5]) == [2, 4]\", \"assert filter_even_numbers([10, 15, 20, 25, 30]) == [10, 20, 30]\", \"assert filter_even_numbers([0, 1, 2, 3, 4]) == [0, 2, 4]\", \"assert filter_even_numbers([-1, -2, -3, -4]) == [-2, -4]\", \"assert filte... | {
"split": "train",
"index": 67702,
"acecode_id": "evol_28664",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with calculating the contribution ratio of a user on a version control platform like GitHub. The contribution ratio is defined as the ratio of contributions to the number of public repositories. Write a function `contribution_ratio(contributions: int, public_repo... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert contribution_ratio(500, 20) == 25.0\", \"assert contribution_ratio(100, 10) == 10.0\", \"assert contribution_ratio(0, 5) == 0.0\", \"assert contribution_ratio(300, 0) == 0.0\", \"assert contribution_ratio(150, 15) == 10.0\", \"assert contribution_ratio(200, ... | {
"split": "train",
"index": 67703,
"acecode_id": "oss_15501",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to control a set of light posts in a smart city. The function `light_post` is responsible for handling two types of requests based on the input parameter `val`, which represents the request data. Your task is to implement the function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert light_post('POST: light_value ') == 'light_value'\", \"assert light_post('POST: another_light ') == 'another_light'\", \"assert light_post('POST: test_light ') == 'test_light'\", \"assert light_post('POST: space_before_and_after ') == 'space_before... | {
"split": "train",
"index": 67704,
"acecode_id": "oss_35839",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function `fibonacci(n)` that computes the Fibonacci series up to the nth term. The Fibonacci series starts with 0 and 1, and each subsequent term is the sum of the two preceding terms. Your function should return a list containing the Fibonacci series up to the nth ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert fibonacci(0) == []\", \"assert fibonacci(1) == [0]\", \"assert fibonacci(2) == [0, 1]\", \"assert fibonacci(3) == [0, 1, 1]\", \"assert fibonacci(4) == [0, 1, 1, 2]\", \"assert fibonacci(5) == [0, 1, 1, 2, 3]\", \"assert fibonacci(6) == [0, 1, 1, 2, 3, 5]\",... | {
"split": "train",
"index": 67705,
"acecode_id": "evol_22124",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `decimal_to_ternary(n: float) -> Tuple[str, int]` that converts a decimal number to its ternary (base 3) representation. The function should take a single parameter `n`, which can be either an integer or a float. If the input is not of type integer or float... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert decimal_to_ternary(0) == ('0', 0)\", \"assert decimal_to_ternary(1) == ('1', 0)\", \"assert decimal_to_ternary(2) == ('2', 1)\", \"assert decimal_to_ternary(3) == ('10', 0)\", \"assert decimal_to_ternary(5) == ('12', 1)\", \"assert decimal_to_ternary(-1) == ... | {
"split": "train",
"index": 67706,
"acecode_id": "evol_34249",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "Given a string, write a function that determines the minimum number of characters that need to be inserted to make the string a palindrome. Implement a function `min_insertions(s: str) -> int` that returns this minimum number of insertions required.\nPlease reason step by step,... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert min_insertions('race') == 3\", \"assert min_insertions('a') == 0\", \"assert min_insertions('ab') == 1\", \"assert min_insertions('abc') == 2\", \"assert min_insertions('abba') == 0\", \"assert min_insertions('abcba') == 0\", \"assert min_insertions('abcd') ... | {
"split": "train",
"index": 67707,
"acecode_id": "evol_9555",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function `count_vowels(input_string: str) -> int` that takes a string as input and returns the total number of vowel letters (a, e, i, o, u, A, E, I, O, U) present in that string. Vowels are defined as the characters a, e, i, o, u (both uppercase and lowercase).\nPlease... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_vowels('Hello AI.') == 4\", \"assert count_vowels('Python programming.') == 4\", \"assert count_vowels('This is a test.') == 4\", \"assert count_vowels('') == 0\", \"assert count_vowels('a e i o u A E I O U') == 10\", \"assert count_vowels('The quick b... | {
"split": "train",
"index": 67708,
"acecode_id": "evol_15392",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary where the keys are strings representing names of fields and the values are their corresponding values. Write a function `validate_fields(data: Dict[str, Any], schema: Dict[str, Type]) -> bool` that checks if the types of the values in the dictionary m... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_fields({'name': 'Alice', 'age': 30}, {'name': str, 'age': int}) == True\", \"assert validate_fields({'name': 'Bob', 'age': 'twenty'}, {'name': str, 'age': int}) == False\", \"assert validate_fields({'price': 19.99, 'item': 'Book'}, {'price': float, ... | {
"split": "train",
"index": 67709,
"acecode_id": "bigcode_python_fns_19307",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that takes two arrays of integers as parameters and returns an array containing the elements that are present in both input arrays. The output array should maintain the order of elements as they appear in the first array. If there are no common elements, return... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert find_common_elements([2, 3, 4, 5], [1, 4, 6]) == [4]\", \"assert find_common_elements([1, 2, 3], [4, 5, 6]) == []\", \"assert find_common_elements([1, 2, 2, 3], [2, 2, 4]) == [2, 2]\", \"assert find_common_elements([], [1, 2, 3]) == []\", \"assert find_commo... | {
"split": "train",
"index": 67710,
"acecode_id": "evol_2759",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the creation of tables in a MySQL database. The function should take no arguments and always return True if the tables are created successfully, and False if there was an error during the creation process. Your implementati... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert mysql_create_tables() == True\", \"assert mysql_create_tables() == True\", \"assert mysql_create_tables() == True\", \"assert mysql_create_tables() == True\", \"assert mysql_create_tables() == True\", \"assert mysql_create_tables() == True\", \"assert mysql_... | {
"split": "train",
"index": 67711,
"acecode_id": "bigcode_python_fns_41890",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function `select_random_service(services: List[str]) -> str` that takes a list of GCP service names as input and randomly selects one of the services from the list. If the list is empty, the function should return an empty string. Ensure that the functio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert select_random_service(['Compute Engine', 'Cloud Storage', 'BigQuery']) in ['Compute Engine', 'Cloud Storage', 'BigQuery']\", \"assert select_random_service(['Cloud Functions', 'Pub/Sub', 'Cloud Functions']) in ['Cloud Functions', 'Pub/Sub']\", \"assert selec... | {
"split": "train",
"index": 67712,
"acecode_id": "evol_13525",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a logging utility that simulates logging messages of various severity levels. Your function should take a list of messages and their corresponding severity levels (as integers) and return a formatted string that represents the log output. The severi... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert log_messages([(0, 'This is a debug message'), (1, 'This is an info message'), (2, 'This is a warning message'), (3, 'This is an error message'), (4, 'This is a critical message')]) == 'INFO: This is an info message\\\\nWARNING: This is a warning message\\\\n... | {
"split": "train",
"index": 67713,
"acecode_id": "oss_34021",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "Given a list of floating point numbers and a probability value between 0 and 1, implement a function that simulates a dropout operation. With the specified probability, each element in the list should either be kept or replaced with 0. If the probability is set to 0, return the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert dropout_operation([1.0, 2.0, 3.0], 0.0) == [1.0, 2.0, 3.0]\", \"assert dropout_operation([1.0, 2.0, 3.0], 1.0) == [0.0, 0.0, 0.0]\", \"assert len(dropout_operation([1.0, 2.0, 3.0], 0.5)) == 3\", \"assert len(dropout_operation([0.5, 0.5, 0.5], 0.1)) == 3\", \... | {
"split": "train",
"index": 67714,
"acecode_id": "bigcode_python_fns_41974",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a simple animation simulation using a given array of frame numbers. Write a Python function called `animate_frames` that takes two parameters: a list of integers called `frames`, which represents the frame numbers, and an integer called `iterations`... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert animate_frames([1, 2, 3], 2) == ['Frame: 1', 'Frame: 2', 'Frame: 3', 'Frame: 1', 'Frame: 2', 'Frame: 3']\", \"assert animate_frames([10, 20, 30], 1) == ['Frame: 10', 'Frame: 20', 'Frame: 30']\", \"assert animate_frames([5, 15], 3) == ['Frame: 5', 'Frame: 15'... | {
"split": "train",
"index": 67715,
"acecode_id": "oss_28912",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a positive integer n, define a function `S_k(n)` that computes the sum of the k-th powers of the first n positive integers for k = 2. Specifically, `S_k(n) = 1^2 + 2^2 + ... + n^2`. Implement the function `S_k(n)` to return the computed value for any given n.\nPlease reas... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert S_k(1) == 1\", \"assert S_k(2) == 5\", \"assert S_k(3) == 14\", \"assert S_k(4) == 30\", \"assert S_k(5) == 55\", \"assert S_k(10) == 385\", \"assert S_k(15) == 1240\", \"assert S_k(20) == 2870\", \"assert S_k(25) == 5525\", \"assert S_k(30) == 9455\", \"ass... | {
"split": "train",
"index": 67716,
"acecode_id": "evol_24602",
"num_tests": 11
} |
acecode | [
{
"role": "user",
"content": "You need to implement a function `basketball_team_stats(players: List[str], stats: List[Dict[str, int]]) -> Tuple[Dict[str, int], Dict[str, float], Dict[str, str]]` that takes in a list of player names and a corresponding list of dictionaries containing their statistics (points... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert basketball_team_stats(['Alice', 'Bob'], [{'points': 10, 'assists': 5, 'rebounds': 3, 'steals': 2, 'blocks': 1}, {'points': 20, 'assists': 7, 'rebounds': 5, 'steals': 3, 'blocks': 2}]) == ({'points': 30, 'assists': 12, 'rebounds': 8, 'steals': 5, 'blocks': 3}... | {
"split": "train",
"index": 67717,
"acecode_id": "evol_16585",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that validates user update requests based on their IDs. The function should take in two parameters: an integer `resource_id` representing the ID of the user resource being updated, and a dictionary `request_data` that may contain an optio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_user_update(1, {'id': 1, 'username': 'user1', 'email': 'user1@example.com', 'password': 'password1'}) == (True, None)\", \"assert validate_user_update(2, {'username': 'user2', 'email': 'user2@example.com', 'password': 'password2'}) == (True, None)\"... | {
"split": "train",
"index": 67718,
"acecode_id": "bigcode_python_fns_12045",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Create an abstract base class in Python named 'Vehicle'. This class should contain an abstract method called 'honk'. Now, create two different classes 'Car' and 'Bike' derived from the 'Vehicle' class that implement the 'honk' method in different ways. The output should reflect... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert Car().honk() == 'Beep!'\", \"assert Bike().honk() == 'Ring!'\", \"assert isinstance(Car(), Vehicle) == True\", \"assert isinstance(Bike(), Vehicle) == True\", \"assert Car().honk() != Bike().honk()\", \"assert Car().honk() == 'Beep!'\", \"assert Bike().honk(... | {
"split": "train",
"index": 67719,
"acecode_id": "evol_34585",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a positive integer n, implement a function `factorial(n)` that computes the factorial of n without using recursion. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, factorial(5) should return 120, sinc... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert factorial(0) == 1\", \"assert factorial(1) == 1\", \"assert factorial(2) == 2\", \"assert factorial(3) == 6\", \"assert factorial(4) == 24\", \"assert factorial(5) == 120\", \"assert factorial(6) == 720\", \"assert factorial(7) == 5040\", \"assert factorial(... | {
"split": "train",
"index": 67720,
"acecode_id": "evol_29131",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates retrieving the status of running containers in a virtual environment. Your function should take a list of strings, where each string represents the name of a container. The function should return a formatted string that lis... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_container_status(['container1', 'container2', 'container3']) == 'container1: running\\\\ncontainer2: stopped\\\\ncontainer3: running'\", \"assert get_container_status(['a', 'b']) == 'a: running\\\\nb: stopped'\", \"assert get_container_status(['test1', '... | {
"split": "train",
"index": 67721,
"acecode_id": "bigcode_python_fns_24321",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Design a function `build_url` that constructs a comprehensive URL from independent segments. The function should take in the following parameters: `protocol` (a string that can be either 'http' or 'https'), `subdomain` (a string that can contain any allowed string or be empty),... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert build_url('https', 'www', 'example.com', ['path', 'to', 'resource'], {'key1': 'value1', 'key2': 'value2'}) == 'https://www.example.com/path/to/resource?key1=value1&key2=value2'\", \"assert build_url('http', '', 'example.com', [], {}) == 'http://example.com'\... | {
"split": "train",
"index": 67722,
"acecode_id": "evol_13342",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers. Your task is to implement a function that takes this list and returns a new list where each element is scaled to a range of 0 to 255 based on the minimum and maximum values of the original list. The scaling should be done using the formula: sca... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert scale_to_uint8([0, 1, 2, 3]) == [0, 85, 170, 255]\", \"assert scale_to_uint8([10, 20, 30]) == [0, 127, 255]\", \"assert scale_to_uint8([5, 5, 5]) == [0, 0, 0]\", \"assert scale_to_uint8([100, 200, 300]) == [0, 127, 255]\", \"assert scale_to_uint8([-1, 0, 1])... | {
"split": "train",
"index": 67723,
"acecode_id": "bigcode_python_fns_2636",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of integers representing the power generation forecasts for a solar panel in megawatts. Your task is to implement a function that takes this list as input and returns the maximum forecasted power generation and the number of forecasts that are less than or ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert analyze_forecasts([0, 0, 0, 0, 0]) == (0, 5)\", \"assert analyze_forecasts([1, 2, 3, 4, 5]) == (5, 1)\", \"assert analyze_forecasts([1, 1, 1, 1, 2]) == (2, 4)\", \"assert analyze_forecasts([3, 4, 5, 2, 1]) == (5, 1)\", \"assert analyze_forecasts([2, 3, 4, 5,... | {
"split": "train",
"index": 67724,
"acecode_id": "bigcode_python_fns_25460",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string of space-separated, floating point numbers (e.g., '12.1 10.2 6.3 5.4') and a string of fractional numbers represented as division operations (e.g., '1/2 2/3 3/4'), implement a function that alternately merges these two lists into one list of floating-point number... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_and_convert('12.1 10.2 6.3 5.4', '1/2 2/3') == [12.1, 0.5, 10.2, 0.67, 6.3, 5.4]\", \"assert merge_and_convert('5.5 2.2', '1/4 1/2 3/4') == [5.5, 0.25, 2.2, 0.5, 0.75]\", \"assert merge_and_convert('1.1', '1/3 1/6') == [1.1, 0.33, 0.17]\", \"assert mer... | {
"split": "train",
"index": 67725,
"acecode_id": "evol_7471",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a nested list of integers, implement a function that extracts and returns a flat list containing all the prime numbers found within the nested list. The input is guaranteed to be a list of lists with integers. Write a function `extract_primes(nested_list)` that takes the ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_primes([[10, 12], [14, 15], [16]]) == []\", \"assert extract_primes([[11, 13, 17], [19, 23], [29]]) == [11, 13, 17, 19, 23, 29]\", \"assert extract_primes([[0, 1, 4], [6, 8, 10]]) == []\", \"assert extract_primes([[2, 3], [5, 7]]) == [2, 3, 5, 7]\", ... | {
"split": "train",
"index": 67726,
"acecode_id": "evol_29173",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string consisting of letters, implement a function that removes all consecutive repeating characters from the string. The function should return a new string that contains only the first occurrence of each sequence of consecutive repeating characters. For example, if th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_repetitions('AAABBBCCC') == 'ABC'\", \"assert remove_repetitions('XXXXXYZZZZ') == 'XYZ'\", \"assert remove_repetitions('') == ''\", \"assert remove_repetitions('HELLOOO') == 'HELO'\", \"assert remove_repetitions('A') == 'A'\", \"assert remove_repetiti... | {
"split": "train",
"index": 67727,
"acecode_id": "evol_9145",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that identifies the operating system type from a provided boolean input. If the input is True, the function should return the string 'Linux'. If the input is False, the function should return the string 'Windows'. Implement the function `... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert detect_os_flavour(True) == 'Linux'\", \"assert detect_os_flavour(False) == 'Windows'\", \"assert detect_os_flavour(True) == 'Linux'\", \"assert detect_os_flavour(False) == 'Windows'\", \"assert detect_os_flavour(True) == 'Linux'\", \"assert detect_os_flavour... | {
"split": "train",
"index": 67728,
"acecode_id": "bigcode_python_fns_8173",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `get_normalization_layer` that takes a string as input representing the device type, either 'cpu' or 'gpu'. Your function should return a string indicating which normalization layer to use. If the device is 'cpu', return 'BatchNorm2D'. If... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_normalization_layer('cpu') == 'BatchNorm2D'\", \"assert get_normalization_layer('gpu') == 'SyncBatchNorm'\", \"assert get_normalization_layer('cpu') == 'BatchNorm2D'\", \"assert get_normalization_layer('gpu') == 'SyncBatchNorm'\", \"assert get_normalizat... | {
"split": "train",
"index": 67729,
"acecode_id": "bigcode_python_fns_12989",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a primary color, a fill color, and an optional list of additional colors, write a function `make_colors` that returns a tuple of colors. If the additional colors list is not provided, the function should return a tuple containing the primary color, fill color, and a prede... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert make_colors('red', 'blue', None) == ('red', 'blue', 'green', 'yellow', 'black')\", \"assert make_colors('red', 'blue', ['purple', 'orange', 'pink']) == ('red', 'blue', 'purple', 'orange', 'pink')\", \"assert make_colors('green', 'yellow', ['cyan', 'magenta',... | {
"split": "train",
"index": 67730,
"acecode_id": "bigcode_python_fns_3908",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a selection slider for a given set of parameter options. The function should take in a dictionary of parameter options where each key is a parameter name and the corresponding value is a list of possible values for that par... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_sliders({'brightness': [0, 1, 2], 'contrast': [1, 2, 3]}, {'brightness': 1, 'contrast': 2}) == {'brightness': 1, 'contrast': 2}\", \"assert generate_sliders({'brightness': [0, 1, 2], 'contrast': [1, 2, 3]}, {'brightness': 5, 'contrast': 2}) == {'bri... | {
"split": "train",
"index": 67731,
"acecode_id": "bigcode_python_fns_8203",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that simulates a simplified version of command execution. The function should take a list of commands and execute them sequentially. Each command should return a predefined output based on its value. Your function should return a l... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert execute_commands(['ls']) == ['file1.txt file2.txt']\", \"assert execute_commands(['pwd']) == ['/home/user/project']\", \"assert execute_commands(['echo Hello']) == ['Hello, World!']\", \"assert execute_commands(['ls', 'pwd']) == ['file1.txt file2.txt', '/hom... | {
"split": "train",
"index": 67732,
"acecode_id": "oss_29801",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string containing a list of users and their roles formatted as follows: each line contains a username followed by its roles, separated by a tab. Each role can be separated by spaces. Your task is to write a function that takes this string as input and returns a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_user_roles('guest\\\\t[administrator user]\\\\r\\\\nother\\\\t[a b]\\\\r\\\\n') == {'guest': ['administrator', 'user'], 'other': ['a', 'b']}\", \"assert parse_user_roles('admin\\\\t[editor]\\\\r\\\\njohn\\\\t[viewer contributor]\\\\r\\\\n') == {'admin'... | {
"split": "train",
"index": 67733,
"acecode_id": "bigcode_python_fns_14971",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of four integers, design a function that returns the maximum value from the array. The function should handle cases where all numbers could potentially be negative. The function should only accept lists of exactly four integers.\nPlease reason step by step, then ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_value([1, 2, 3, 4]) == 4\", \"assert max_value([-1, -2, -3, -4]) == -1\", \"assert max_value([0, 0, 0, 0]) == 0\", \"assert max_value([-5, -2, -45, -9]) == -2\", \"assert max_value([100, 200, 300, 400]) == 400\", \"assert max_value([-10, -20, -30, -5]) =... | {
"split": "train",
"index": 67734,
"acecode_id": "evol_17252",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to remove duplicates from a given list while preserving the order of unique elements. Write a function `remove_duplicates` that takes in a list of elements and returns a list containing only the unique elements from the input list in ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert remove_duplicates([1, 2, 3, 2, 4, 1, 5]) == [1, 2, 3, 4, 5]\", \"assert remove_duplicates(['a', 'b', 'a', 'c']) == ['a', 'b', 'c']\", \"assert remove_duplicates([True, False, True, False, True]) == [True, False]\", \"assert remove_duplicates([]) == []\", \"a... | {
"split": "train",
"index": 67735,
"acecode_id": "oss_36994",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a recursive function that takes a list of words and prints each letter in ASCII representation of every word on a separate line. After printing the ASCII representations, the function should return the count of unique alphabets across all words. The words are case-sen... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert word_processing(['Python', 'Coding']) == 12\", \"assert word_processing(['Artificial', 'Intelligence']) == 16\", \"assert word_processing(['Unique', 'Characters']) == 14\", \"assert word_processing(['Example', 'Words']) == 12\", \"assert word_processing(['Li... | {
"split": "train",
"index": 67736,
"acecode_id": "evol_1143",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "You are tasked with managing a flight schedule represented as a list of dictionaries. Each dictionary contains the flight details, including 'FlightNumber', 'StartDate', and 'EndDate'. Your goal is to implement a function `add_new_schedule(existing_schedule, new_schedule)` that... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert add_new_schedule([], [{'FlightNumber': 'AA101', 'StartDate': '2023-10-01', 'EndDate': '2023-10-01'}]) == [{'FlightNumber': 'AA101', 'StartDate': '2023-10-01', 'EndDate': '2023-10-01'}]\", \"assert add_new_schedule([{'FlightNumber': 'AA101', 'StartDate': '202... | {
"split": "train",
"index": 67737,
"acecode_id": "oss_23473",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a Python function that processes a string containing doctest-like test cases and evaluates them. Each test case consists of a Python expression followed by its expected output, separated by '=='. The expressions are preceded by a '>>> ' prompt a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_tests('>>> x = 4\\\\nx == 4') == {'x = 4': (4, True)}\", \"assert process_tests('>>> y = 10\\\\ny == 10') == {'y = 10': (10, True)}\", \"assert process_tests('>>> z = [1, 2, 3]\\\\nz == [1, 2, 3]') == {'z = [1, 2, 3]': ([1, 2, 3], True)}\", \"assert ... | {
"split": "train",
"index": 67738,
"acecode_id": "oss_14261",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a credit card number. Your task is to determine the supplier of the card based on predefined regular expressions that match certain card number patterns. Implement a function `get_supplier(card_number: str) -> str` that takes a credit card nu... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_supplier('4111111111111111') == 'Visa'\", \"assert get_supplier('5500000000000004') == 'MasterCard'\", \"assert get_supplier('340000000000009') == 'American Express'\", \"assert get_supplier('6011000000000004') == 'Discover'\", \"assert get_supplier('412... | {
"split": "train",
"index": 67739,
"acecode_id": "bigcode_python_fns_12010",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of variant calling data represented as a list of strings, write a function that processes each entry in the list and returns a list of formatted sequences based on specific conditions. Each entry in the list is formatted as 'V\\tchrom\\tstart\\tend\\t\\t\\tref\\tal... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert convert_variants(['V\\\\tchr1\\\\t100\\\\t150\\\\t\\\\t\\\\tAAAAA\\\\tA\\\\tname1\\\\t10\\\\t20\\\\t+']) == []\", \"assert convert_variants(['V\\\\tchr1\\\\t100\\\\t150\\\\t\\\\t\\\\tAAAAA\\\\tTTT\\\\tname1\\\\t10\\\\t20\\\\t+']) == []\", \"assert convert_va... | {
"split": "train",
"index": 67740,
"acecode_id": "bigcode_python_fns_4726",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the behavior of a circular queue with a fixed size using a list. The function should take two arguments: an integer `size` representing the size of the circular queue, and a list `operations` which contains a series of ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert circular_queue_operations(2, [('enqueue', 1), ('enqueue', 2), ('dequeue', None), ('enqueue', 3)]) == [2, 3]\", \"assert circular_queue_operations(5, [('enqueue', 10), ('enqueue', 20), ('dequeue', None), ('enqueue', 30), ('enqueue', 40), ('enqueue', 50), ('en... | {
"split": "train",
"index": 67741,
"acecode_id": "oss_27576",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function to determine the number of distinct clusters of connected land in a given binary matrix. A land cluster is represented by the number 1 in the matrix, and adjacent 1s (horizontally or vertically) form a single cluster. The function sho... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_land_clusters([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\", \"assert count_land_clusters([[1, 1, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1], [0, 0, 0, 0]]) == 1\", \"assert count_land_clusters([[1, 0], [0, 1]]) == 2\", \"assert count_land_cl... | {
"split": "train",
"index": 67742,
"acecode_id": "oss_24184",
"num_tests": 14
} |
acecode | [
{
"role": "user",
"content": "You are tasked with helping an elderly person prepare a shopping list while staying within their budget. Write a function `calculate_total(prices, quantities)` that takes two dictionaries as input: `prices`, which contains product names as keys and their respective prices as va... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_total({'chocolate': 3.00, 'cookies': 2.50}, {'chocolate': 1, 'cookies': 2}) == 8.0\", \"assert calculate_total({'pasta': 1.20, 'sauce': 1.50}, {'pasta': 3, 'sauce': 2}) == 6.6\", \"assert calculate_total({'cereal': 2.00, 'milk': 1.00}, {'cereal': 5... | {
"split": "train",
"index": 67743,
"acecode_id": "bigcode_python_fns_24053",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that processes a sequence of traffic data requests. The function should take two parameters: a list of integers representing the number of requests received at different time intervals and a boolean flag indicating whether the service... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_traffic_data([3, 5, 2], True) == 11\", \"assert process_traffic_data([1, 1, 1, 1], False) == 4\", \"assert process_traffic_data([], True) == 1\", \"assert process_traffic_data([], False) == 0\", \"assert process_traffic_data([10], True) == 11\", \"as... | {
"split": "train",
"index": 67744,
"acecode_id": "oss_11960",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the shutdown process of an application. The function `shutdown_application(app_name: str) -> str` takes a string `app_name` as input, which represents the name of the application. The function should return a message indica... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert shutdown_application('Zeus') == 'Zeus is shutting down gracefully.'\", \"assert shutdown_application('Apollo') == 'Application is shutting down.'\", \"assert shutdown_application('Athena') == 'Application is shutting down.'\", \"assert shutdown_application('... | {
"split": "train",
"index": 67745,
"acecode_id": "bigcode_python_fns_43814",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function `process_request` that simulates handling HTTP requests. The function should accept a string `request_method` which can be 'GET', 'POST', or any other value. If the `request_method` is 'GET', return the string 'Hello World!'. If the `request_method` is 'POS... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_request('GET') == 'Hello World!'\", \"assert process_request('POST') == 'POST request received.'\", \"assert process_request('PUT') == 'Method Not Allowed'\", \"assert process_request('DELETE') == 'Method Not Allowed'\", \"assert process_request('HEA... | {
"split": "train",
"index": 67746,
"acecode_id": "evol_1115",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers containing both positive and negative numbers, write a function `max_min_product(lst)` that returns the maximum product of any two numbers in the list and the minimum product of any three numbers in the list. The list will contain at least six elements.... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert max_min_product([1, 2, 3, 4, 5, 6]) == (30, 6)\", \"assert max_min_product([0, 1, 2, 3, 4, 5]) == (20, 0)\", \"assert max_min_product([0, 0, 0, 0, 0, 0]) == (0, 0)\", \"assert max_min_product([-1, 0, 0, 0, 0, 0]) == (0, 0)\", \"assert max_min_product([1, 1, ... | {
"split": "train",
"index": 67747,
"acecode_id": "evol_8677",
"num_tests": 6
} |
acecode | [
{
"role": "user",
"content": "Given two integers m and t, implement a function `calculate_output(m, t)` that returns the value of 9 times the sum of 9 times m and 3 times t. The equation can be expressed as 9 * (9*m + 3*t).\nPlease reason step by step, then write a self-contained Python solution. Give your ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_output(1, 1) == 108\", \"assert calculate_output(0, 0) == 0\", \"assert calculate_output(10, 0) == 810\", \"assert calculate_output(-1, -1) == -108\", \"assert calculate_output(0, 10) == 270\", \"assert calculate_output(9, 9) == 972\", \"assert cal... | {
"split": "train",
"index": 67748,
"acecode_id": "evol_18161",
"num_tests": 8
} |
acecode | [
{
"role": "user",
"content": "You are developing a music library management system, and you need to implement a function to process song metadata based on certain configuration settings and user interactions. Your task is to implement the function `process_song_metadata(comments, config, email, RATINGS)` th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert process_song_metadata({'coverartmime': 'image/jpeg', '~#rating': 'good', '~#playcount': 5}, {'editing': {'save_to_songs': True}}, 'user@example.com', RATINGS) == {'~#rating': 'good', 'rating:user@example.com': 'good', '~#playcount': '6'}\", \"assert process_... | {
"split": "train",
"index": 67749,
"acecode_id": "oss_13293",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a string, write a function `is_text_none(s: str) -> bool` that checks if the string is equal to 'None'. The function should return True if the string is 'None', and False otherwise. The input string may contain leading or trailing whitespace, which should be ignored when ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_text_none('None') == True\", \"assert is_text_none(' None') == True\", \"assert is_text_none('None ') == True\", \"assert is_text_none(' None ') == True\", \"assert is_text_none('none') == False\", \"assert is_text_none('NULL') == False\", \"assert is_t... | {
"split": "train",
"index": 67750,
"acecode_id": "bigcode_python_fns_49704",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a function that generates an array of 5 unique random integers between 1 and 100 (inclusive). The function should return two lists: one sorted in ascending order and the other in descending order. Ensure that the integers are unique and handle any potential errors appropr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert len(generate_sort_display_numbers()[0]) == 5\", \"assert len(generate_sort_display_numbers()[1]) == 5\", \"assert all(1 <= num <= 100 for num in generate_sort_display_numbers()[0])\", \"assert all(1 <= num <= 100 for num in generate_sort_display_numbers()[1]... | {
"split": "train",
"index": 67751,
"acecode_id": "evol_2869",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that checks whether a user belongs to a specific group based on their group membership. The function should take the following parameters: 1. `user` (a dictionary representing the user with a key 'groups' that contains a list of group nam... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert user_in_group({'groups': ['admin', 'editor']}, 'admin', '/login') == (True, None)\", \"assert user_in_group({'groups': ['user']}, 'admin', '/login') == (False, '/login')\", \"assert user_in_group({'groups': []}, 'admin', '/login') == (False, '/login')\", \"a... | {
"split": "train",
"index": 67752,
"acecode_id": "oss_33058",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that generates a unique channel box name based on a given prefix and a list of existing channel box names. The function should take in a prefix (a string) and a list of existing channel box names (list of strings). The function should ret... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_channel_box_name('Channel', ['Channel1', 'Channel2']) == 'Channel3'\", \"assert generate_channel_box_name('Box', ['Box1', 'Box2', 'Box3']) == 'Box4'\", \"assert generate_channel_box_name('', ['Channel1']) == 'Invalid Input'\", \"assert generate_chan... | {
"split": "train",
"index": 67753,
"acecode_id": "bigcode_python_fns_30489",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a variable number of integer arguments, return True if all integers are either positive or negative (i.e., they do not mix signs). Return False if there is at least one positive and one negative integer. If no integers are provided, return False.\nPlease reason step by st... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert is_invsign1(1, 2, 3) == True\", \"assert is_invsign1(-1, -2, -3) == True\", \"assert is_invsign1(1, -1) == False\", \"assert is_invsign1(-1, 1) == False\", \"assert is_invsign1() == False\", \"assert is_invsign1(5, 10, 15) == True\", \"assert is_invsign1(-5,... | {
"split": "train",
"index": 67754,
"acecode_id": "bigcode_python_fns_7457",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a mapping of node IDs to their corresponding (git revision, protocol version) pairs, write a function `get_protocol_version(branch_map: Dict[int, Tuple[str, str]], node_id: int) -> str` that takes a dictionary `branch_map` and an integer `node_id`, and returns the protoco... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_protocol_version({0: ('zeronet', 'alpha'), 1: ('mainnet', '004-Pt24m4xi'), 2: ('alphanet', '003-PsddFKi3')}, 0) == 'alpha'\", \"assert get_protocol_version({0: ('zeronet', 'alpha'), 1: ('mainnet', '004-Pt24m4xi'), 2: ('alphanet', '003-PsddFKi3')}, 1) == ... | {
"split": "train",
"index": 67755,
"acecode_id": "bigcode_python_fns_6372",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string `s` and a pattern `p`. The pattern can include the following special characters: `.` which matches any single character, and `*` which matches zero or more of the preceding element. Write a function `isMatch(s: str, p: str) -> bool` to determine if the st... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert isMatch('aa', 'a') == False\", \"assert isMatch('aa', 'a*') == True\", \"assert isMatch('ab', '.*') == True\", \"assert isMatch('aab', 'c*a*b') == True\", \"assert isMatch('mississippi', 'mis*is*p*.') == False\", \"assert isMatch('', '') == True\", \"assert ... | {
"split": "train",
"index": 67756,
"acecode_id": "oss_31993",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of positive integers. Write a function that sorts this list in ascending order using the counting sort algorithm. The function should modify the input list in place and return nothing. You may assume that all integers in the list are non-negative and the li... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_sort([3, 6, 4, 1, 2]) == None\", \"assert count_sort([0, 1, 2, 3, 4]) == None\", \"assert count_sort([5, 3, 8, 6, 2]) == None\", \"assert count_sort([10, 9, 8, 7, 6]) == None\", \"assert count_sort([1, 4, 3, 2, 5]) == None\", \"assert count_sort([2, 2,... | {
"split": "train",
"index": 67757,
"acecode_id": "bigcode_python_fns_7964",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that manages a list of installed packages and their versions for a software project. Implement a function `manage_packages` that takes a list of package names and their respective versions, and returns a string describing the installed pa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_packages([('api', '1.1.0'), ('requests', '2.0.0')]) == 'Packages installed: api, requests'\", \"assert manage_packages([('numpy', '1.21.0'), ('pandas', '1.3.0')]) == 'Packages installed: numpy, pandas'\", \"assert manage_packages([('flask', '2.0.1')])... | {
"split": "train",
"index": 67758,
"acecode_id": "oss_19103",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates an interactive application. Implement a function `run_interactive(package: str, action: str, app_args: dict, interaction: str) -> Any` that takes a package name, an action name, application arguments in the form of a dictio... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert run_interactive('package1', 'action1', {'arg1': 'value1'}, 'Hello') == 'Hello with value1'\", \"assert run_interactive('package1', 'action2', {'arg2': 'value2'}, 'World') == 'World with value2'\", \"assert run_interactive('package1', 'non_existent_action', {... | {
"split": "train",
"index": 67759,
"acecode_id": "bigcode_python_fns_17300",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary where the keys represent attributes of a person and the values represent the corresponding information. Your task is to implement a function called `filter_dict` that takes this dictionary as input and returns a new dictionary containing the same key-... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert filter_dict({'__name__': 'John', 'age': 25, 'city': 'New York', 'gender': 'Male', 'email': 'john@example.com', 'phone__': '123456789'}) == {'age': 25, 'city': 'New York', 'gender': 'Male', 'email': 'john@example.com'}\", \"assert filter_dict({'__init__': 'va... | {
"split": "train",
"index": 67760,
"acecode_id": "oss_27583",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that checks if a list of alphanumeric strings is sorted in descending lexicographical order. The function should return True if the list is sorted in descending order and False otherwise. The comparison should be case-sensitive, meaning 'Z' is considered gr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert check_descending_lexicographical(['z', 'y', 'x', 'w']) == True\", \"assert check_descending_lexicographical(['apple', 'banana', 'cherry']) == False\", \"assert check_descending_lexicographical(['cat', 'bat', 'ant']) == True\", \"assert check_descending_lexic... | {
"split": "train",
"index": 67761,
"acecode_id": "evol_12335",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given two lists of dictionaries, each representing a set of parameter definitions. Each dictionary contains two keys: 'field_alias' (a string) and 'is_required' (a boolean). Your task is to implement a function that merges these two lists into a single list based on the... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert merge_parameter_definitions([{'field_alias': 'paramA', 'is_required': True}], [{'field_alias': 'paramB', 'is_required': False}]) == [{'field_alias': 'paramA', 'is_required': True}, {'field_alias': 'paramB', 'is_required': False}]\", \"assert merge_parameter_... | {
"split": "train",
"index": 67762,
"acecode_id": "bigcode_python_fns_43575",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that validates the names of robot and module containers in a system configuration. The function should raise a ValidationError if the names of the robot and module containers are the same. The system configuration is represented as... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_container_names({'robot': 'robot1', 'module': 'module1'}) is None\", \"assert validate_container_names({'robot': 'robotA', 'module': 'moduleB'}) is None\", \"assert validate_container_names({'robot': 'R2D2', 'module': 'C3PO'}) is None\", \"assert va... | {
"split": "train",
"index": 67763,
"acecode_id": "oss_23437",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that logs the execution of another function. This function should take a logging level and a function as arguments. When the function is called, it should log the function name, its arguments, and the return value at the specified logging... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert log_function_execution(20, lambda x, y: x + y)(3, 4) == 7\", \"assert log_function_execution(10, lambda: 'Hello, World!')() == 'Hello, World!'\", \"assert log_function_execution(30, lambda x: x * 2)(5) == 10\", \"assert log_function_execution(50, lambda: Non... | {
"split": "train",
"index": 67764,
"acecode_id": "oss_26885",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given an array of integers, implement a function that returns the five smallest unique numbers from the array. If there are fewer than five unique numbers, return all of them. The function should ignore duplicate numbers and handle possible negative numbers.\nPlease reason step... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert smallest_nums([11, 40, 5, 33, 44, 5, 28, 11, 30, 30, 2, 17]) == [2, 5, 11, 17, 28]\", \"assert smallest_nums([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", \"assert smallest_nums([-1, -2, -3, -4, -5]) == [-5, -4, -3, -2, -1]\", \"assert smallest_nums([5, 5, 5, 5]) =... | {
"split": "train",
"index": 67765,
"acecode_id": "evol_6214",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a function that interprets a string of colors in a specialized hex format and converts each color representation into a tuple of RGB values. The input will be a string of color codes, each prefixed with a '#' symbol. The function should return a list of tuples where e... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert decode_complex_colors('#FFF') == [(255, 255, 255)]\", \"assert decode_complex_colors('#000') == [(0, 0, 0)]\", \"assert decode_complex_colors('#F00') == [(255, 0, 0)]\", \"assert decode_complex_colors('#f00') == [(255, 0, 0)]\", \"assert decode_complex_color... | {
"split": "train",
"index": 67766,
"acecode_id": "evol_25783",
"num_tests": 15
} |
acecode | [
{
"role": "user",
"content": "Given a dictionary containing various key-value pairs, implement a function `serialize_dictionary` that takes this dictionary as input and returns its JSON serialized string representation. The function should convert the dictionary into a JSON formatted string and encode it in... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert serialize_dictionary({'name': 'Alice', 'age': '30', 'city': 'Wonderland'}) == b'{\\\"name\\\": \\\"Alice\\\", \\\"age\\\": \\\"30\\\", \\\"city\\\": \\\"Wonderland\\\"}'\", \"assert serialize_dictionary({'fruit': 'apple', 'color': 'red'}) == b'{\\\"fruit\\\"... | {
"split": "train",
"index": 67767,
"acecode_id": "bigcode_python_fns_34421",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that interacts with an event handling system. The function will retrieve an event by a given user ID. Implement the function `get_event_by_user_id(user_id: int) -> dict` that takes a user ID as input and returns the event associated with ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_event_by_user_id(1) == {'event_id': 1, 'user_id': 1, 'title': 'Event 1'}\", \"assert get_event_by_user_id(2) == {'event_id': 2, 'user_id': 2, 'title': 'Event 2'}\", \"assert get_event_by_user_id(3) == {}\", \"assert get_event_by_user_id(0) == {}\", \"ass... | {
"split": "train",
"index": 67768,
"acecode_id": "oss_8537",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Implement a function `insert_composition(db_name: str, title: str, composer: str, period: str) -> None` that inserts a new musical composition into a SQLite database. The function should connect to the database specified by `db_name`, add a new composition with the given `title... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert insert_composition('test.db', 'Symphony No. 5', 'Beethoven', 'Classical') is None\", \"assert insert_composition('test.db', 'Clair de Lune', 'Debussy', 'Impressionism') is None\", \"assert insert_composition('test.db', 'The Four Seasons', 'Vivaldi', 'Baroque... | {
"split": "train",
"index": 67769,
"acecode_id": "evol_5343",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a list of integers, write a function that computes the summation of squared deviations of each integer from the numerical average of the entire list. The function should take a list of integers as input and return a single integer representing the sum of squared deviation... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert solve_problem([1, 2, 3, 4]) == 5.0\", \"assert solve_problem([1, 1, 1, 1]) == 0.0\", \"assert solve_problem([5]) == 0.0\", \"assert solve_problem([1, 2, 3]) == 2.0\", \"assert solve_problem([1, 3, 5, 7, 9]) == 40.0\", \"assert solve_problem([0, 0, 0]) == 0.0... | {
"split": "train",
"index": 67770,
"acecode_id": "evol_5394",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "Implement a function `pluck(arr, cond_fn_list)` that takes a non-negative integer array `arr` and a list of condition functions `cond_fn_list`. The function should return the smallest value node satisfying all the conditions from `cond_fn_list`, in the form of a list containing... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert pluck([4, 2, 3], [lambda x: x % 2 == 0, lambda x: x > 1]) == [2, 1]\", \"assert pluck([1, 2, 3, 4], [lambda x: x % 2 == 1, lambda x: x < 4]) == [1, 0]\", \"assert pluck([], [lambda x: x % 3 == 0, lambda x: x > 0]) == []\", \"assert pluck([5, 0, 3, 0, 4, 2], ... | {
"split": "train",
"index": 67771,
"acecode_id": "evol_16966",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the total disk usage of a storage device. The function should take in three parameters: `storage_type`, `storage_desc`, and `unit_size_in_bytes`. The `storage_type` is a string indicating the type of storage (e.g., 'hr... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert calculate_disk_usage('hrStorageFixedDisk', 'Main Disk', 1024) == ('hrStorageFixedDisk', 'Main Disk', 1024, 819)\", \"assert calculate_disk_usage('hrStorageFixedDisk', 'Backup Disk', 2048) == ('hrStorageFixedDisk', 'Backup Disk', 2048, 1638)\", \"assert calcu... | {
"split": "train",
"index": 67772,
"acecode_id": "evol_5029",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a list of user timing values, where each value is associated with a specific timing variable name. Your task is to implement a function that takes this list and returns a dictionary that maps each unique timing variable to the sum of its corresponding user timing ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert sum_user_timing_values([('load', 100), ('load', 200), ('render', 150)]) == {'load': 300, 'render': 150}\", \"assert sum_user_timing_values([('load', 50), ('load', 50), ('load', 50)]) == {'load': 150}\", \"assert sum_user_timing_values([('paint', 300)]) == {'... | {
"split": "train",
"index": 67773,
"acecode_id": "bigcode_python_fns_13618",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given a string consisting of alphanumeric characters, punctuation, and spaces, write a Python function called `string_to_list` that takes a single parameter `input_string` (1 <= len(input_string) <= 1000) and returns a list where each element is a character from the input strin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert string_to_list('hello') == ['h', 'e', 'l', 'l', 'o']\", \"assert string_to_list('Python') == ['P', 'y', 't', 'h', 'o', 'n']\", \"assert string_to_list('12345') == ['1', '2', '3', '4', '5']\", \"assert string_to_list('') == []\", \"assert string_to_list(' ') ... | {
"split": "train",
"index": 67774,
"acecode_id": "oss_11982",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are working on a financial management system that requires you to identify discrepancies in financial transactions. Your task is to implement a function `number_of_errors` that checks for discrepancies based on specific criteria. The function takes three arguments: `_FILE` ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert number_of_errors('file1', {'record1': {'amount': 100, 'budget_authority': 100, 'fiscal_year': 2023, 'period': 1}, 'record2': {'amount': 150, 'budget_authority': 100, 'fiscal_year': 2023, 'period': 1}}, None) == 1\", \"assert number_of_errors('file1', {'recor... | {
"split": "train",
"index": 67775,
"acecode_id": "oss_33777",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates a simplified package installation process. The function `install_package(actions_dict)` should take a dictionary `actions_dict` that describes a series of actions to perform. The possible actions are: 'download_by_url', 'cl... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert install_package({'actions': [['download_by_url', {'url': 'http://example.com/package.zip'}]]}) == ['Success: download_by_url']\", \"assert install_package({'actions': [['clone', {'repository': 'git://github.com/user/repo.git'}]]}) == ['Success: clone']\", \"... | {
"split": "train",
"index": 67776,
"acecode_id": "bigcode_python_fns_9772",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `get_hub_manager()` that initializes and returns a global variable `_HUB_MANAGER` if it has not been initialized yet. The `_HUB_MANAGER` should be an instance of the `_HubManager` class, which takes a list of plugins as an argument. If `_... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_hub_manager() is get_hub_manager()\", \"assert get_hub_manager() == get_hub_manager()\", \"assert isinstance(get_hub_manager(), _HubManager)\", \"assert get_hub_manager() is not None\", \"assert type(get_hub_manager()) is _HubManager\", \"assert get_hub_... | {
"split": "train",
"index": 67777,
"acecode_id": "bigcode_python_fns_22394",
"num_tests": 7
} |
acecode | [
{
"role": "user",
"content": "You are tasked with monitoring a list of actions. Each action can be categorized into three types based on specific keywords. Your function should take a list of strings as input and return a dictionary with the counts of each category. The categories are defined as follows: if... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert simulate_watchlist_monitoring(['Resolve urgent issue', 'Error in database', 'Perform routine maintenance']) == {'high_priority': 1, 'error': 1, 'regular': 1}\", \"assert simulate_watchlist_monitoring(['urgent task', 'normal task', 'error occurred']) == {'hig... | {
"split": "train",
"index": 67778,
"acecode_id": "oss_21613",
"num_tests": 13
} |
acecode | [
{
"role": "user",
"content": "You are given a dictionary containing metadata of an image processing system. The dictionary has the following keys: 'NumVectors', 'PixPerVector', 'ZeroOffset', 'Angle', 'PixelsPerMm', 'FramesPerSec', and 'TimeInSecsOfFirstFrame'. Write a function `extract_metadata(metadata: Di... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert extract_metadata({'NumVectors': 10, 'PixPerVector': 256, 'ZeroOffset': 0, 'Angle': 45.0, 'PixelsPerMm': 0.1, 'FramesPerSec': 30, 'TimeInSecsOfFirstFrame': 0.0}) == (10, 256, 0, 45.0, 0.1, 30, 0.0)\", \"assert extract_metadata({'NumVectors': 5, 'PixPerVector'... | {
"split": "train",
"index": 67779,
"acecode_id": "bigcode_python_fns_18152",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given a string representing a line of data that contains information about a particle phase-space coordinate. The string is formatted as follows: '<number1> <number2> <number3> <number4> <number5>'. Your task is to parse this string and return a dictionary containing th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert parse_particle_data('1 10 30 0.5 5') == {'filename': 'fort.30', 'sample_frequency': 10, 's': 0.5}\", \"assert parse_particle_data('2 20 40 1.5 10') == {}\", \"assert parse_particle_data('3 30 50 2.5 15') == {}\", \"assert parse_particle_data('4 40 25 3.5 20'... | {
"split": "train",
"index": 67780,
"acecode_id": "bigcode_python_fns_5932",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Given the parameters for a cylinder defined in a 3D space, write a function `create_cylinder` that takes the following parameters: a float `radius`, a float `height`, a tuple `position` representing the coordinates of the cylinder's base center (x, y, z), and a tuple `direction... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_cylinder(5.0, 10.0, (0, 0, 0), (0, 0, 1)) == {'radius': 5.0, 'height': 10.0, 'position': '(0, 0, 0)', 'direction': '(0, 0, 1)'}\", \"assert create_cylinder(2.5, 7.0, (1, 2, 3), (1, 0, 0)) == {'radius': 2.5, 'height': 7.0, 'position': '(1, 2, 3)', 'dir... | {
"split": "train",
"index": 67781,
"acecode_id": "bigcode_python_fns_17437",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that transforms RGB values in the range of 0 to 255 into a format suitable for matplotlib, which requires the RGB values to be in the range of 0 to 1. Implement a function called `to_mpl_format(r: int, g: int, b: int) -> Tuple[float, floa... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert to_mpl_format(0, 0, 0) == (0.0, 0.0, 0.0)\", \"assert to_mpl_format(255, 255, 255) == (0.99609375, 0.99609375, 0.99609375)\", \"assert to_mpl_format(128, 128, 128) == (0.5, 0.5, 0.5)\", \"assert to_mpl_format(255, 0, 0) == (0.99609375, 0.0, 0.0)\", \"assert ... | {
"split": "train",
"index": 67782,
"acecode_id": "bigcode_python_fns_16239",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function that simulates the deployment, scaling, and restarting of applications in a cloud environment. Write a function `manage_applications` that takes three parameters: `app_name` (a string representing the name of the application), `action` (a... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert manage_applications('myapp', 'deploy', None) == 'Deployed application myapp'\", \"assert manage_applications('myapp', 'scale', 3) == 'Scaled application myapp to 3 dynos'\", \"assert manage_applications('myapp', 'restart', None) == 'Restarted application mya... | {
"split": "train",
"index": 67783,
"acecode_id": "oss_11645",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a function `get_uname_arch()`. This function should simulate the behavior of detecting the architecture of a host system. The architecture can be either 'x86', 'x64', or 'ARM'. Your function should return the architecture as a string. To simulate th... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert get_uname_arch() in ['x86', 'x64', 'ARM']\", \"assert get_uname_arch() in ['x86', 'x64', 'ARM']\", \"assert get_uname_arch() in ['x86', 'x64', 'ARM']\", \"assert get_uname_arch() in ['x86', 'x64', 'ARM']\", \"assert get_uname_arch() in ['x86', 'x64', 'ARM']\... | {
"split": "train",
"index": 67784,
"acecode_id": "bigcode_python_fns_7343",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a help documentation system for a bioprocess management application. The system should generate a formatted help message based on a list of available modules and their descriptions. Each module will have a name and a description. Your function shoul... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert generate_help_message([('module_one', 'description for module one'), ('module_two', 'description for module two')]) == 'Module One: description for module one\\\\nModule Two: description for module two'\", \"assert generate_help_message([('test_module', 'thi... | {
"split": "train",
"index": 67785,
"acecode_id": "bigcode_python_fns_45214",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that calculates the reciprocal of geometric quantities. Specifically, your function should accept two parameters: a string representing the geometric quantity ('abc' for the product of three sides of a triangle or 'volume' for the vol... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reciprocal_calculation('abc', 3, 4, 5) == 1 / (3 * 4 * 5)\", \"assert reciprocal_calculation('abc', 1, 2, 3) == 1 / (1 * 2 * 3)\", \"assert reciprocal_calculation('abc', 5, 5, 5) == 1 / (5 * 5 * 5)\", \"assert reciprocal_calculation('abc', 2.5, 3.5, 4.5) == ... | {
"split": "train",
"index": 67786,
"acecode_id": "oss_26775",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are given the northern and southern latitude along with the eastern and western longitude which define a bounding box. Your task is to implement a function that creates a polygon representation of this bounding box. The function should take four float parameters representin... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert create_polygon(10.0, 5.0, 15.0, 5.0) == [(5.0, 5.0), (15.0, 5.0), (15.0, 10.0), (5.0, 10.0)]\", \"assert create_polygon(20.0, 15.0, 25.0, 15.0) == [(15.0, 15.0), (25.0, 15.0), (25.0, 20.0), (15.0, 20.0)]\", \"assert create_polygon(30.5, 28.0, 35.0, 28.0) == ... | {
"split": "train",
"index": 67787,
"acecode_id": "bigcode_python_fns_18058",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Write a python function to reverse the elements in a list. The function should be able to handle lists of any length and data type. The original list should not be modified, and a new list with the reversed elements should be returned.\nPlease reason step by step, then write a ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert reverse_list([1, 2, 3, 4, 5]) == [5, 4, 3, 2, 1]\", \"assert reverse_list(['a', 'b', 'c']) == ['c', 'b', 'a']\", \"assert reverse_list([]) == []\", \"assert reverse_list([True, False]) == [False, True]\", \"assert reverse_list([1.1, 2.2, 3.3]) == [3.3, 2.2, ... | {
"split": "train",
"index": 67788,
"acecode_id": "evol_28402",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with creating a Python function that validates the configuration settings of a MinIO server. Your function will need to verify specific settings for the MinIO server using the provided configuration dictionary called `AnsibleDefaults`. The function should impleme... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_minio_server_config({'minio_user': 'minio_user', 'minio_group': 'minio_user', 'minio_mode': 493}) == True\", \"assert validate_minio_server_config({'minio_user': 'minio_user', 'minio_group': 'minio_user', 'minio_mode': 500}) == False\", \"assert val... | {
"split": "train",
"index": 67789,
"acecode_id": "oss_35707",
"num_tests": 12
} |
acecode | [
{
"role": "user",
"content": "Given a Python dictionary and a key, implement a function called `validate_key` that checks whether the specified key exists in the dictionary. The function should return 'Key is in the dictionary' if the key is found and 'Key is not in the dictionary' if the key is not found. ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert validate_key({1: 'apple', 2: 'banana', 3: 'cherry'}, 1) == 'Key is in the dictionary'\", \"assert validate_key({1: 'apple', 2: 'banana', 3: 'cherry'}, 2) == 'Key is in the dictionary'\", \"assert validate_key({1: 'apple', 2: 'banana', 3: 'cherry'}, 3) == 'Ke... | {
"split": "train",
"index": 67790,
"acecode_id": "evol_28599",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Construct a function that blends two designated strings by creating a sequence that alternates their characters, and then reverses the accumulated output. If one string is longer, append the remaining characters at the end before reversing the final result. Implement a function... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert custom_mix_strings('', '') == ''\", \"assert custom_mix_strings('a', 'b') == 'ba'\", \"assert custom_mix_strings('abc', '') == 'cba'\", \"assert custom_mix_strings('', 'xyz') == 'zyx'\", \"assert custom_mix_strings('a', 'a') == 'aa'\"]}"
} | {
"split": "train",
"index": 67791,
"acecode_id": "evol_2479",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of file names as strings. Your task is to rename these files such that they follow a specific naming convention. The convention is to prepend the string 'file_' to each original file name, and you also need to reverse the names if a boolean flag is set to T... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert rename_files(['document.txt', 'image.png'], False) == ['file_document.txt', 'file_image.png']\", \"assert rename_files(['notes.doc', 'summary.pdf'], False) == ['file_notes.doc', 'file_summary.pdf']\", \"assert rename_files(['a.txt', 'b.txt', 'c.txt'], False)... | {
"split": "train",
"index": 67792,
"acecode_id": "bigcode_python_fns_21154",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function that takes a single phrase as input and returns the number of distinct characters in that phrase. The function should disregard spaces and punctuation but should consider uppercase and lowercase letters as distinct characters. For example, the phrase 'Hello... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert count_distinct_characters('') == 0\", \"assert count_distinct_characters('SingleWord') == 10\", \"assert count_distinct_characters('The quick brown fox jumps over a lazy dog.') == 26\", \"assert count_distinct_characters('ABCDEFGHIJKLMNOPQRSTUVWXYZ') == 26\"... | {
"split": "train",
"index": 67793,
"acecode_id": "evol_3457",
"num_tests": 5
} |
acecode | [
{
"role": "user",
"content": "You are given a list of strings, where each string contains words separated by spaces. Your task is to write a function that returns the probabilities of each unique word in the list. The probability of a word is defined as the number of times the word appears divided by the to... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert word_probabilities(['test', 'test', 'test']) == {'test': 1.0}\", \"assert word_probabilities(['one two three', 'one two', 'one']) == {'one': 0.5, 'two': 0.3333333333333333, 'three': 0.16666666666666666}\", \"assert word_probabilities(['hello']) == {'hello': ... | {
"split": "train",
"index": 67794,
"acecode_id": "bigcode_python_fns_33181",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Implement a function `do_algebra(operator: List[str], operand: List[int], round_off: bool) -> Union[int, float]` that evaluates an algebraic expression constructed from two lists: `operator` and `operand`. The `operator` list contains basic arithmetic operations represented as ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert do_algebra(['-','+'], [10, 5, 1], False) == 6\", \"assert do_algebra(['-','+'], [10, 5, 1], True) == 6\", \"assert do_algebra(['**', '//'], [5, 2, 1], False) == 25\", \"assert do_algebra(['**', '//'], [5, 2, 1], True) == 25\", \"assert do_algebra(['//', '+']... | {
"split": "train",
"index": 67795,
"acecode_id": "evol_3868",
"num_tests": 10
} |
acecode | [
{
"role": "user",
"content": "Given a variable that may be a string or a list, implement a function `ensure_list(variable)` that converts the variable into a list. If the variable is already a list, return it as is. If it is a string, wrap it in a list. If the variable is neither a string nor a list, return... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert ensure_list('hello') == ['hello']\", \"assert ensure_list(['hello', 'world']) == ['hello', 'world']\", \"assert ensure_list(42) == []\", \"assert ensure_list(3.14) == []\", \"assert ensure_list(None) == []\", \"assert ensure_list(['a', 'b', 'c']) == ['a', 'b... | {
"split": "train",
"index": 67796,
"acecode_id": "bigcode_python_fns_22102",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "Implement a generator function called `countdown_generator` that takes an integer `n` as input and yields numbers in a countdown from `n` to `0`. The generator should yield `n`, `n-1`, ..., `1`, `0` in that order. It should stop yielding values once it reaches `0`. If the input... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert list(countdown_generator(5)) == [5, 4, 3, 2, 1, 0]\", \"assert list(countdown_generator(0)) == [0]\", \"assert list(countdown_generator(-1)) == []\", \"assert list(countdown_generator(10)) == [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\", \"assert list(countdown_gene... | {
"split": "train",
"index": 67797,
"acecode_id": "evol_9197",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You need to implement a logging function that logs messages based on a given TRACE flag. Write a function named `log_message(trace_flag: bool, message: str) -> None:` that takes two parameters: a boolean `trace_flag` and a string `message`. The function should print the message... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert log_message(True, 'Test message 1') is None\", \"assert log_message(False, 'Test message 2') is None\", \"assert log_message(True, 'Another message') is None\", \"assert log_message(False, 'No log for this message') is None\", \"assert log_message(True, 'Log... | {
"split": "train",
"index": 67798,
"acecode_id": "oss_29095",
"num_tests": 16
} |
acecode | [
{
"role": "user",
"content": "You are tasked with implementing a function that simulates the flipping of a fair coin. The function should randomly return either 'heads' or 'tails'. Implement the function `flip_coin()` which takes no parameters and returns a string that is either 'heads' or 'tails'.\nPlease ... | code | {
"style": "rule",
"ground_truth": "{\"tests\": [\"assert flip_coin() in ['heads', 'tails']\", \"assert flip_coin() in ['heads', 'tails']\", \"assert flip_coin() in ['heads', 'tails']\", \"assert flip_coin() in ['heads', 'tails']\", \"assert flip_coin() in ['heads', 'tails']\", \"assert flip_coin() in ['heads', 'ta... | {
"split": "train",
"index": 67799,
"acecode_id": "bigcode_python_fns_39275",
"num_tests": 16
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.