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": "Implement a function `add_celestial_body(celestial_bodies: List[Dict[str, Union[str, float, int]]], body: Dict[str, Union[str, float, int]]) -> List[Dict[str, Union[str, float, int]]]:` that takes in a list of celestial bodies and a new celestial body represented as a dictionar...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_celestial_body([], {'name': 'Earth', 'type': 'Planet', 'distance_from_sun': 1.0, 'num_of_moons': 1}) == [{'name': 'Earth', 'type': 'Planet', 'distance_from_sun': 1.0, 'num_of_moons': 1}]\", \"assert add_celestial_body([{'name': 'Earth', 'type': 'Planet',...
{ "split": "train", "index": 65300, "acecode_id": "evol_30588", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes a dictionary representing HTTP request headers to extract a token and populate a context dictionary. Your function should accept the request headers as an input and return a context dictionary that includes the extracte...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_request_headers({'Auth-Token': 'abc123'}) == {'token_id': 'abc123', 'subject_token': None}\", \"assert process_request_headers({'Auth-Token': 'xyz789', 'Subject-Token': 'subj456'}) == {'token_id': 'xyz789', 'subject_token': 'subj456'}\", \"assert pro...
{ "split": "train", "index": 65301, "acecode_id": "oss_35140", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of edit steps, each defined by a rectangular area with coordinates (x1, y1, x2, y2) and a color represented as a tuple (R, G, B). Your task is to apply these edit steps to an image represented as a 2D list of pixels, where each pixel is a tuple (R, G, B). I...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert apply_edit_steps([[ (255, 255, 255), (255, 255, 255)], [(255, 255, 255), (255, 255, 255)]], [((0, 0, 1, 1), (0, 0, 255)), ((0, 1, 1, 2), (255, 0, 0))]) == [[(0, 0, 255), (255, 0, 0)], [(255, 255, 255), (255, 255, 255)]]\", \"assert apply_edit_steps([[ (255, ...
{ "split": "train", "index": 65302, "acecode_id": "bigcode_python_fns_3258", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function that checks if a list of strings, which includes both numbers and alphabets, can be arranged in a valid order such that all sequences of numbers are in decreasing order and all sequences of alphabets are in decreasing order. The function should return 'Yes'...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert valid_inverted_sequence(['987', 'cba', '123']) == 'Yes'\", \"assert valid_inverted_sequence(['c', '7', '9', 'abc']) == 'No'\", \"assert valid_inverted_sequence(['abc', 'def', '123']) == 'No'\", \"assert valid_inverted_sequence(['edcba', '54321']) == 'Yes'\",...
{ "split": "train", "index": 65303, "acecode_id": "evol_23018", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a string `hex_str`, write a function `is_hex(hex_str: str) -> bool` that determines if the string is a valid hexadecimal number. A valid hexadecimal number contains only the characters 0-9 and a-f (case insensitive). If the string is a valid hexadecimal number, the functi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_hex('1a3f') == True\", \"assert is_hex('abcdef') == True\", \"assert is_hex('ABCDEF') == True\", \"assert is_hex('1234567890') == True\", \"assert is_hex('0x1a3f') == False\", \"assert is_hex('GHIJKL') == False\", \"assert is_hex('') == False\", \"assert ...
{ "split": "train", "index": 65304, "acecode_id": "bigcode_python_fns_34728", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a worktime statistics system for a project management tool. The system should calculate and display the average worktime statistics for tasks and inputs for a specific user. The worktime statistics are represented as a list of `WorktimeStatistic...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_average_worktime_statistics('user1', [], []) == {'tasks_average': 0, 'inputs_average': 0}\", \"assert calculate_average_worktime_statistics('user2', [WorktimeStatisticsItem('task1', 30)], [WorktimeStatisticsItem('input1', 60)]) == {'tasks_average':...
{ "split": "train", "index": 65305, "acecode_id": "oss_28743", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that accepts an array of integers and returns a new array where each element is the sum of all other elements except the element at the current index. For example, for the array [1, 2, 3, 4], the function should return [9, 8, 7, 6] since 9=2+3+4, 8=1+3+4, 7...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_sums([1, 2, 3, 4]) == [9, 8, 7, 6]\", \"assert get_sums([5, 10, 15]) == [25, 20, 15]\", \"assert get_sums([0, 0, 0]) == [0, 0, 0]\", \"assert get_sums([-1, -2, -3]) == [-5, -4, -3]\", \"assert get_sums([1]) == [0]\", \"assert get_sums([1, 2]) == [2, 1]\"...
{ "split": "train", "index": 65306, "acecode_id": "evol_33732", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a string representing a device name and a dictionary containing device attributes (status, primary_ip, device_role, device_type, platform, site, and services), create a function `map_device_to_target(device_name: str, attributes: dict) -> dict` that returns a dictionary r...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert map_device_to_target('DeviceA', {'status': 'active', 'primary_ip': '192.168.1.1', 'device_role': {'name': 'Router', 'slug': 'router'}, 'device_type': {'model': 'Cisco', 'slug': 'cisco'}, 'platform': {'name': 'IOS', 'slug': 'ios'}, 'site': {'name': 'SiteA', '...
{ "split": "train", "index": 65307, "acecode_id": "bigcode_python_fns_31594", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with designing a function that simulates the alteration of a project management application's `supervisors` field in a `Project` model. The `supervisors` field is a list of user IDs representing the users who supervise a project. Your function should take a list ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert alter_supervisors([None, 1, 2, 2, 1]) == [None, 1, 2]\", \"assert alter_supervisors([None]) == [None]\", \"assert alter_supervisors([1, 1, 1]) == [1]\", \"assert alter_supervisors([None, None, 1, 1]) == [None, 1]\", \"assert alter_supervisors([]) == []\", \"...
{ "split": "train", "index": 65308, "acecode_id": "oss_20855", "num_tests": 6 }
acecode
[ { "role": "user", "content": "You are tasked with simulating the process of starting a database server and running a JDBC test. Write a function `run_jdbc_test` that takes the following parameters: `db_host` (a string representing the database host), `db_port` (an integer representing the database port), `j...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert run_jdbc_test('localhost', 5432, 'jdbc_test.sh', 'test_target') == (['/path/to/peloton/bin', '-port 5432'], ['/bin/bash', 'jdbc_test.sh', 'test_target', 'localhost', '5432'])\", \"assert run_jdbc_test('127.0.0.1', 3306, 'jdbc_test.sh', 'test_target') == (['/...
{ "split": "train", "index": 65309, "acecode_id": "oss_16937", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `is_dormant(function_name: str, last_modified: str) -> bool` that determines whether a given AWS Lambda function is considered dormant. A function is considered dormant if it has not been updated in the last 60 days. The `last_modified` parameter is a strin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_dormant('my_function', '2023-01-01T12:00:00+0000') == True\", \"assert is_dormant('my_function', '2022-10-01T12:00:00+0000') == True\", \"assert is_dormant('my_function', '2023-06-30T12:00:00+0000') == True\", \"assert is_dormant('my_function', '2023-05-0...
{ "split": "train", "index": 65310, "acecode_id": "evol_1790", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Write a function `fibonacci_sequence(n: int) -> List[int]` that returns the first `n` components of the Fibonacci sequence. The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two. For example, if `n` is 8, the function should retur...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert fibonacci_sequence(1) == [0]\", \"assert fibonacci_sequence(2) == [0, 1]\", \"assert fibonacci_sequence(3) == [0, 1, 1]\", \"assert fibonacci_sequence(4) == [0, 1, 1, 2]\", \"assert fibonacci_sequence(5) == [0, 1, 1, 2, 3]\", \"assert fibonacci_sequence(6) =...
{ "split": "train", "index": 65311, "acecode_id": "evol_2881", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with managing a list of devices in a lost mode system. Implement a function `set_lost_mode` that takes the following parameters: a boolean `disable`, a string or None `search`, an integer or None `id`, and a string `message`. The function should simulate enabling...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_lost_mode(True, 'iPhone', None, '') == 'Lost mode has been disabled for devices matching: iPhone'\", \"assert set_lost_mode(False, None, 1, 'Please return my device.') == 'Lost mode has been enabled for device with ID 1: Please return my device.'\", \"as...
{ "split": "train", "index": 65312, "acecode_id": "bigcode_python_fns_40122", "num_tests": 5 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that takes a list of integers as input and returns a new list containing only the unique elements from the input list, while maintaining the original order of their first occurrence. The output list should not contain any duplicates. Write...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unique_elements([1, 2, 2, 3, 1, 4]) == [1, 2, 3, 4]\", \"assert unique_elements([1, 1, 1, 1]) == [1]\", \"assert unique_elements([]) == []\", \"assert unique_elements([5, 5, 5, 5, 5]) == [5]\", \"assert unique_elements([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]\", ...
{ "split": "train", "index": 65313, "acecode_id": "oss_34622", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of categorical variables represented as strings, implement a function `categorical_to_numerical(categorical_list: List[str]) -> List[int]` that transforms each unique categorical value into a unique integer code starting from 0. The order of the output integers sho...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorical_to_numerical(['apple', 'banana', 'apple', 'orange']) == [0, 1, 0, 2]\", \"assert categorical_to_numerical(['red', 'blue', 'green', 'red']) == [0, 1, 2, 0]\", \"assert categorical_to_numerical(['cat', 'dog', 'cat', 'fish', 'dog']) == [0, 1, 0, 2, ...
{ "split": "train", "index": 65314, "acecode_id": "bigcode_python_fns_20491", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of edges representing a graph. Your task is to identify and return the edges that do not exist in the graph along with a score calculated by a function that takes the graph and each non-existing edge as input. The function should return a list of tuples, wh...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert apply_prediction([(1, 2), (2, 3)], lambda g, u, v: 1.0) == [(1, 3, 1.0)]\", \"assert apply_prediction([(1, 2), (2, 3)], lambda g, u, v: 0.1) == [(1, 3, 0.1)]\", \"assert apply_prediction([(1, 2), (1, 3)], lambda g, u, v: 0.2) == [(2, 3, 0.2)]\", \"assert app...
{ "split": "train", "index": 65315, "acecode_id": "bigcode_python_fns_12164", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given a list of numbers and a format string, implement a function that returns a list of strings where each number from the input list is formatted according to the provided format string. The function should handle both integer and floating-point numbers correctly. The format ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_numbers([], '%.2f') == []\", \"assert format_numbers([1, 2, 3], '%.2f') == ['1.00', '2.00', '3.00']\", \"assert format_numbers([1.2345, 2.3456, 3.4567], '%.1f') == ['1.2', '2.3', '3.5']\", \"assert format_numbers([-1, -2, -3], '%.2e') == ['-1.00e+00',...
{ "split": "train", "index": 65316, "acecode_id": "bigcode_python_fns_143", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates retrying a given function multiple times when a specific exception occurs. The function should take the following parameters: `func`, `exception`, `retries`, and `wait_time`. If the specified `exception` is raised when ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert retry_function(lambda: 1, ValueError, 3, 1) == 1\", \"assert retry_function(lambda: 5, Exception, 2, 0.1) == 5\", \"assert retry_function(lambda: 'Hello', TypeError, 1, 0) == 'Hello'\", \"assert retry_function(lambda: (x for x in range(5)), StopIteration, 2,...
{ "split": "train", "index": 65317, "acecode_id": "bigcode_python_fns_48616", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function that retrieves the last n elements from a given list. If n exceeds the length of the list, return the entire list instead. For example, given the list [1, 2, 3, 4, 5] and n = 3, the function should return [3, 4, 5].\nPlease reason step by step, then write a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_last_n_elements([1, 2, 3, 4, 5], 3) == [3, 4, 5]\", \"assert print_last_n_elements([1, 2, 3, 4, 5], 5) == [1, 2, 3, 4, 5]\", \"assert print_last_n_elements([1, 2, 3, 4, 5], 6) == [1, 2, 3, 4, 5]\", \"assert print_last_n_elements([], 0) == []\", \"asser...
{ "split": "train", "index": 65318, "acecode_id": "evol_34828", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a balanced binary tree, write a function to find the diameter of the tree. The diameter of a binary tree is defined as the length of the longest path between any two nodes in the tree. Additionally, your function should return the elements that constitute this longest pat...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert diameter_and_path(None) == (0, [])\", \"assert diameter_and_path(Node(1)) == (0, [1])\", \"assert diameter_and_path(Node(1, Node(2))) == (1, [2, 1])\", \"assert diameter_and_path(Node(1, Node(2), Node(3))) == (2, [2, 1, 3])\", \"assert diameter_and_path(Node...
{ "split": "train", "index": 65319, "acecode_id": "evol_31325", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Given an odd-valued integer `npix` and a multiplicative factor `factor`, write a function `computeIntCorrections` that computes the nearest odd-valued integer to the product of `npix` and `factor`. Additionally, the function should return the corrected `factor` such that the pr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert computeIntCorrections(3, 2.0) == (7, 2.3333333333333335)\", \"assert computeIntCorrections(3, 5.0) == (15, 5.0)\", \"assert computeIntCorrections(15, 0.6) == (9, 0.6)\", \"assert computeIntCorrections(15, 0.5) == (7, 0.4666666666666667)\", \"assert computeIn...
{ "split": "train", "index": 65320, "acecode_id": "bigcode_python_fns_42446", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that merges two lists of integers based on specific criteria. The function `merge_lists` takes in four parameters: `list1`, `criteria1`, `list2`, and `criteria2`. The expected output of the function is a list containing elements from ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert merge_lists([], [], [], []) == []\", \"assert merge_lists([0], [0], [0], [0]) == []\", \"assert merge_lists([10, 20], [30, 40], [50, 60], [20, 30]) == [10, 20, 50, 60]\", \"assert merge_lists([1], [2], [3], [0]) == [1, 3]\", \"assert merge_lists([1, 5, 10], ...
{ "split": "train", "index": 65321, "acecode_id": "oss_1454", "num_tests": 7 }
acecode
[ { "role": "user", "content": "Given a string consisting of alphanumeric characters, implement a function `replace_char_at_indexes(input_str: str, indexes: List[int]) -> str` that replaces the characters at the specified indexes with new randomly generated alphanumeric characters. The new characters must not...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replace_char_at_indexes('abcdef123', [2, 5, 7, 2, 8]) != 'abcdef123'\", \"assert replace_char_at_indexes('1a2b3c', [0, 1]) != '1a2b3c'\", \"assert replace_char_at_indexes('hello', [1, 3, 4]) != 'hello'\", \"assert replace_char_at_indexes('xyz', [0, 1]) != 'x...
{ "split": "train", "index": 65322, "acecode_id": "evol_8675", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that validates if two dictionaries have the same set of keys. Write a function `validate_explanations(defaults, explanations)` where: \n- `defaults` is a dictionary containing default values with keys as strings and values as float...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_explanations({'gamma': 0.7, 'zeta': 0.7, 'iota': 0.7}, {'gamma': 'Explanation 1', 'zeta': 'Explanation 2', 'iota': 'Explanation 3'}) == True\", \"assert validate_explanations({'alpha': 1.0, 'beta': 2.0}, {'alpha': 'A', 'beta': 'B'}) == True\", \"ass...
{ "split": "train", "index": 65323, "acecode_id": "oss_27345", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that determines whether a given role is valid based on a list of allowed roles. The function should take two parameters: a string `role` representing the role to be checked, and a list of strings `allowed_roles` representing the valid rol...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_valid_role('admin', ['admin', 'editor', 'viewer']) == True\", \"assert is_valid_role('user', ['admin', 'editor', 'viewer']) == False\", \"assert is_valid_role('editor', ['admin', 'editor', 'viewer']) == True\", \"assert is_valid_role('viewer', ['admin', '...
{ "split": "train", "index": 65324, "acecode_id": "oss_16226", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a date in the format 'YYYY-MM-DD', implement a function that determines if that date falls on a weekend (Saturday or Sunday). The function should return 'Weekend' if it is a weekend, and 'Weekday' if it falls on a weekday (Monday to Friday). You may assume the date provid...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_weekend('2023-10-21') == 'Weekend'\", \"assert is_weekend('2023-10-22') == 'Weekend'\", \"assert is_weekend('2023-10-23') == 'Weekday'\", \"assert is_weekend('2023-10-24') == 'Weekday'\", \"assert is_weekend('2023-10-25') == 'Weekday'\", \"assert is_weeke...
{ "split": "train", "index": 65325, "acecode_id": "bigcode_python_fns_31290", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a list of dictionaries representing deployments and returns a new list where each deployment's 'end_date' field is set to read-only if it already has a value. The function should ensure that 'end_date' can only be modified if i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert set_end_date_readonly([{'end_date': None}]) == [{'end_date': None, 'read_only': False}]\", \"assert set_end_date_readonly([{'end_date': '2021-01-01'}]) == [{'end_date': '2021-01-01', 'read_only': True}]\", \"assert set_end_date_readonly([{'end_date': '2022-0...
{ "split": "train", "index": 65326, "acecode_id": "evol_651", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `random_letter(string: str) -> str` that takes a string as input and returns a random letter from the string, excluding any whitespace characters. Each letter should have an equal probability of being selected. You can assume that the input string will alwa...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert random_letter('a b c d') in ['a', 'b', 'c', 'd']\", \"assert random_letter('Hello World') in ['H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd']\", \"assert random_letter('Python Programming') in ['P', 'y', 't', 'h', 'o', 'n', 'P', 'r', 'o', 'g', 'r', 'a', 'm...
{ "split": "train", "index": 65327, "acecode_id": "evol_25179", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of strings representing the names of pods in a Kubernetes cluster. Write a function `find_pod_status(pod_name: str, pods: List[str]) -> str` that returns the status of the given pod name if it exists in the list of pods. If the pod name is not found, return...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_pod_status('pod1', ['pod1 is running', 'pod2 is running']) == 'pod1 is running'\", \"assert find_pod_status('pod2', ['pod1 is running', 'pod2 is running']) == 'pod2 is running'\", \"assert find_pod_status('pod3', ['pod1 is running', 'pod2 is running']) ...
{ "split": "train", "index": 65328, "acecode_id": "bigcode_python_fns_45536", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers, return a list of its unique elements in descending order and the sum of the last three elements in this sorted list. If the list has fewer than three unique elements, return the sum of those available unique elements. Implement a function `process_list...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_list([5, 3, 2, 5, 1]) == ([5, 3, 2, 1], 6)\", \"assert process_list([3, 3, 3]) == ([3], 3)\", \"assert process_list([10, 20, 10, 30]) == ([30, 20, 10], 60)\", \"assert process_list([5, 5, 5, 5]) == ([5], 5)\", \"assert process_list([1, 2, 2, 3, 3, 4]...
{ "split": "train", "index": 65329, "acecode_id": "evol_9803", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a string, implement a function `find_first_unique(string: str) -> Tuple[Optional[str], int]` that returns the first unique alphanumeric character in the string along with its index. If there are no unique characters, return None and -1.\nPlease reason step by step, then w...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_first_unique('aabbccddeeff') == (None, -1)\", \"assert find_first_unique('abcdefg') == ('a', 0)\", \"assert find_first_unique('aabb') == (None, -1)\", \"assert find_first_unique('swiss') == ('w', 1)\", \"assert find_first_unique('hello') == ('h', 0)\", ...
{ "split": "train", "index": 65330, "acecode_id": "evol_4559", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of table entries from a switch, where each entry is represented by a dictionary containing the table name, match fields, action name, and action parameters. Implement a function `extract_action_names(entries: List[Dict[str, Any]]) -> List[str]` that extract...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert extract_action_names([{'table': 'table1', 'match': {}, 'action_name': 'action1', 'action_params': {}}, {'table': 'table1', 'match': {}, 'action_name': 'action1', 'action_params': {}}]) == ['action1']\", \"assert extract_action_names([]) == []\", \"assert ext...
{ "split": "train", "index": 65331, "acecode_id": "bigcode_python_fns_6202", "num_tests": 7 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that adjusts the learning rates for the convolutional layers of a neural network model. The function should take the following inputs: \n- `params`: A list of strings representing the names of the parameters in the model. \n- `base_lr...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert adjust_conv_lr(['conv1_weight', 'conv2_weight', 'fc_weight'], 0.01, 0.1) == {'conv1_weight': 0.001, 'conv2_weight': 0.001, 'fc_weight': 0.01}\", \"assert adjust_conv_lr(['conv1_bias', 'conv2_bias', 'fc_bias'], 0.02, 0.5) == {'conv1_bias': 0.01, 'conv2_bias':...
{ "split": "train", "index": 65332, "acecode_id": "oss_9305", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with creating a Python function that processes a simplified representation of a Django model and returns a list of field names that have the `auto_now_add` attribute set to `True`. The Django model is represented as a list of tuples, where each tuple contains the...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_auto_now_add_fields([('id', {'field': 'models.AutoField(primary_key=True)'}), ('name', {'field': 'models.CharField(max_length=100)'}), ('dateTimeCreated', {'field': 'models.DateTimeField(auto_now_add=True, null=True)'}), ('dateTimeUpdated', {'field': 'm...
{ "split": "train", "index": 65333, "acecode_id": "oss_6061", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with optimizing the energy consumption of a neural network based on the energy output of each layer and their corresponding weights. You need to implement a function `process_energy_consumption(network_output_energy, weights)` that performs the following operatio...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_energy_consumption([10, 20, 30], [0.5, 0.3, 0.2]) == [5.0, 6.0, 6.0]\", \"assert process_energy_consumption([10], [0.1]) == [1.0]\", \"assert process_energy_consumption([], [1, 2, 3]) == [0, 0, 0]\", \"assert process_energy_consumption([5, 5], [0.5, ...
{ "split": "train", "index": 65334, "acecode_id": "oss_2411", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function `compare_series(series1: List[float], series2: Union[List[float], float]) -> List[bool]` that compares each element of the list `series1` with the corresponding element in `series2` if `series2` is a list, or with the scalar value if `series2` is a float. T...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert compare_series([1.0, 2.0, 3.0], [2.0, 2.0, 4.0]) == [True, True, True]\", \"assert compare_series([5.0, 6.0, 7.0], [4.0, 5.0, 8.0]) == [False, False, True]\", \"assert compare_series([1.0, 2.0, 3.0], 3.0) == [True, True, True]\", \"assert compare_series([4.0...
{ "split": "train", "index": 65335, "acecode_id": "bigcode_python_fns_5414", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the process of unsetting a session cookie in a web application. The function will take a session key as input and return a response message indicating whether the session was successfully unset. The return value should ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert unset_session_cookie('user_session') == {'status': 'ok', 'msg': 'Session user_session has been expired.'}\", \"assert unset_session_cookie('admin_session') == {'status': 'ok', 'msg': 'Session admin_session has been expired.'}\", \"assert unset_session_cookie...
{ "split": "train", "index": 65336, "acecode_id": "bigcode_python_fns_7147", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a dictionary representing HTML attributes, implement a function `add_class(attrs_dict: Dict[str, str], classes_str: str) -> None` that adds the given `classes_str` to the 'class' key in the dictionary `attrs_dict`. If the 'class' key does not exist, create it and set its ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert add_class({'class': 'btn'}, 'btn-primary') == None; assert {'class': 'btn btn-primary'}\", \"assert add_class({'class': 'active'}, 'highlight') == None; assert {'class': 'active highlight'}\", \"assert add_class({'class': 'btn'}, 'btn-large') == None; assert...
{ "split": "train", "index": 65337, "acecode_id": "bigcode_python_fns_22863", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Implement a function that takes two 3-dimensional vectors represented as tuples (x1, y1, z1) and (x2, y2, z2), and returns the result of vector addition and subtraction. The function should return a tuple containing two tuples: the first tuple is the result of the addition and ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert vector_operations((1, 2, 3), (4, 5, 6)) == ((5, 7, 9), (-3, -3, -3))\", \"assert vector_operations((0, 0, 0), (1, 1, 1)) == ((1, 1, 1), (-1, -1, -1))\", \"assert vector_operations((10, -5, 3), (2, 2, 2)) == ((12, -3, 5), (8, -7, 1))\", \"assert vector_operat...
{ "split": "train", "index": 65338, "acecode_id": "evol_20516", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that generates a unique list of workflow metadata names. Each name should follow the format 'datagroup_n', where 'n' is a sequential number starting from 0. The function should take an integer input 'count', which represents the number of ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_workflow_metadata_names(0) == []\", \"assert generate_workflow_metadata_names(1) == ['datagroup_0']\", \"assert generate_workflow_metadata_names(2) == ['datagroup_0', 'datagroup_1']\", \"assert generate_workflow_metadata_names(3) == ['datagroup_0', ...
{ "split": "train", "index": 65339, "acecode_id": "oss_18431", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries `raw_data`, where each dictionary represents a JSON instance with an 'id' and optionally a 'label'. You also have a `label_mapping` dictionary that maps labels to corresponding values. Your task is to create a new list `target_data` based on...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_data([{'id': '109'}, {'id': '110', 'label': 'A'}, {'id': '112', 'label': 'B'}], {'A': 1, 'B': 2}, True) == [['109', None], ['110', 1], ['112', 2]]\", \"assert process_data([{'id': '109'}, {'id': '110', 'label': 'A'}], {'A': 1}, False) == [['109', Non...
{ "split": "train", "index": 65340, "acecode_id": "oss_33040", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with analyzing the sentiment of a given text. The sentiment analysis will involve counting the occurrences of positive and negative words in the text and determining the overall sentiment based on these counts. Implement a function `sentiment_analysis(text: str, ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sentiment_analysis('the movie was great and fantastic', ['great', 'fantastic'], ['terrible']) == 'Positive'\", \"assert sentiment_analysis('the movie was terrible and bad', ['great', 'fantastic'], ['terrible', 'bad']) == 'Negative'\", \"assert sentiment_anal...
{ "split": "train", "index": 65341, "acecode_id": "oss_14460", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a string 's' consisting of lowercase English letters. Your task is to return a string representing the digits (0-9) that can be formed from the letters in 's'. Each digit is represented by its corresponding letters and can be formed uniquely from the letters provi...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert original_digits('owoztneoer') == '012'\", \"assert original_digits('fviefuro') == '45'\", \"assert original_digits('nnei') == '9'\", \"assert original_digits('zero') == '0'\", \"assert original_digits('six') == '6'\", \"assert original_digits('eight') == '8'...
{ "split": "train", "index": 65342, "acecode_id": "evol_25026", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with calculating the total utility bill for a household based on the consumption of gas, water, and electricity. You are given the rates for each utility and the corresponding consumption amounts. Implement a function `calculate_utilities(gas_in: float, water_in:...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_utilities(100.0, 50.0, 30.0, 0.5, 1.0, 0.2) == (50.0, 50.0, 6.0)\", \"assert calculate_utilities(0.0, 0.0, 0.0, 1.0, 1.0, 1.0) == (0.0, 0.0, 0.0)\", \"assert calculate_utilities(150.0, 75.0, 60.0, 0.4, 0.8, 0.15) == (60.0, 60.0, 9.0)\", \"assert ca...
{ "split": "train", "index": 65343, "acecode_id": "bigcode_python_fns_12742", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `get_activation_function(activation_name: str) -> Callable`: Given a string `activation_name` that represents the name of an activation function (e.g., 'ReLU', 'Sigmoid', 'Tanh'), return the corresponding activation function. The function should handle the ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_activation_function('ReLU')(5) == 5\", \"assert get_activation_function('ReLU')(-5) == 0\", \"assert get_activation_function('Sigmoid')(0) == 0.5\", \"assert get_activation_function('Sigmoid')(10) == 0.9999546021312976\", \"assert get_activation_function...
{ "split": "train", "index": 65344, "acecode_id": "bigcode_python_fns_40226", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are given a list of dictionaries, where each dictionary contains various key-value pairs. Your task is to implement a function `match_dicts(dicts: List[Dict[str, Any]], matchers: Dict[str, Any]) -> List[bool]` that checks for each dictionary in the list whether it matches t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert match_dicts([{'a': 1, 'b': 2}, {'a': 1, 'b': 3}], {'a': 1}) == [True, True]\", \"assert match_dicts([{'a': 1, 'b': 2}, {'a': 2, 'b': 2}], {'a': 1}) == [True, False]\", \"assert match_dicts([{'x': 5}], {'x': 5}) == [True]\", \"assert match_dicts([], {'key': '...
{ "split": "train", "index": 65345, "acecode_id": "bigcode_python_fns_43134", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a button-clicking game. The game consists of a series of buttons, each with a specific point value. When a button is clicked, the player earns the designated points for that button. Your goal is to calculate the maximum possible score that can be ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert maxScore([10, 5, 8], 1) == 23\", \"assert maxScore([1, 2, 3, 4, 5], 1) == 15\", \"assert maxScore([0, 0, 0, 0], 1) == 0\", \"assert maxScore([5, 10, 15], 1) == 30\", \"assert maxScore([5, 10, 15, 20], 3) == 25\", \"assert maxScore([2, 2, 2, 2], 2) == 4\", \"...
{ "split": "train", "index": 65346, "acecode_id": "oss_11063", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a list of monitor hostnames and determines if they are valid. A valid hostname must follow the rules of being a non-empty string consisting of alphanumeric characters, periods, and hyphens, and it cannot start or end with a...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_hostnames(['server-01', 'example.com', 'test-host-123']) == [True, True, True]\", \"assert validate_hostnames(['-invalidhost', 'another_invalid-', 'valid.host']) == [False, False, True]\", \"assert validate_hostnames(['valid-host', 'another.valid-ho...
{ "split": "train", "index": 65347, "acecode_id": "bigcode_python_fns_38645", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a floating-point number x, write a function `format_percentage(x: float) -> str` that formats the number as a percentage string. The output should multiply the input number by 100 and return it in a specific format: if the absolute difference between the number and its ne...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert format_percentage(0.05) == '5%'\", \"assert format_percentage(0.1) == '10%'\", \"assert format_percentage(0.123) == '12.3%'\", \"assert format_percentage(0.15) == '15%'\", \"assert format_percentage(0.25) == '25%'\", \"assert format_percentage(0.3) == '30%'\...
{ "split": "train", "index": 65348, "acecode_id": "bigcode_python_fns_13755", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a configuration object that holds settings for a web application. Your task is to implement a function `get_host(config: dict) -> str` that returns the host address specified in the configuration. If the host is not specified, the function should return the defaul...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_host({}) == '0.0.0.0'\", \"assert get_host({'host': '127.0.0.1'}) == '127.0.0.1'\", \"assert get_host({'host': '192.168.1.1'}) == '192.168.1.1'\", \"assert get_host({'host': 'localhost'}) == 'localhost'\", \"assert get_host({'host': 'example.com'}) == 'e...
{ "split": "train", "index": 65349, "acecode_id": "bigcode_python_fns_48983", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that retrieves a list of modules associated with a given application ID from a hypothetical database. The function should accept an integer `app_id` and return a list of strings, where each string represents the name of a module. If the `...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_modules_by_appid(1) == ['ModuleA', 'ModuleB', 'ModuleC']\", \"assert get_modules_by_appid(2) == ['ModuleD']\", \"assert get_modules_by_appid(3) == []\", \"assert get_modules_by_appid(0) == []\", \"assert get_modules_by_appid(-1) == []\", \"assert get_mod...
{ "split": "train", "index": 65350, "acecode_id": "bigcode_python_fns_25901", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Implement a function `generate_unique_code()` that generates a unique 9-character alphanumerical code using hexadecimal system characters (0-9 and A-F). The function should ensure that the generated code is not a palindrome and does not contain any repeating sequence of more th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_unique_code() != generate_unique_code()\", \"assert len(generate_unique_code()) == 9\", \"assert all(c in '0123456789ABCDEF' for c in generate_unique_code())\", \"assert generate_unique_code() != generate_unique_code()[::-1]\", \"assert generate_uni...
{ "split": "train", "index": 65351, "acecode_id": "evol_20020", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that accepts a list of words and their corresponding synonyms and antonyms, and organizes this data into a dictionary structure that allows for efficient look-up of synonyms and antonyms for any given word. The function should take a ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert build_thesaurus([('happy', ['joyful', 'cheerful'], ['sad']), ('sad', ['unhappy', 'sorrowful'], ['happy']), ('fast', ['quick', 'rapid'], ['slow'])]) == {'happy': {'synonyms': ['joyful', 'cheerful'], 'antonyms': ['sad']}, 'sad': {'synonyms': ['unhappy', 'sorro...
{ "split": "train", "index": 65352, "acecode_id": "evol_18907", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that determines whether a local file should be uploaded to a remote location based on the content of the files. Your function should take in the local file's content and a hash representing the remote file's content. If the remote file do...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert should_upload('Hello, World!', None) == True\", \"assert should_upload('Hello, World!', 'f8a8f8e4e8d4f4b8a9a0f236c3e2e2e5c4c4f4c5e4e5c5e4a4c4d4f4e5e5a5') == True\", \"assert should_upload('Hello, Python!', None) == True\", \"assert should_upload('Hello, Pyth...
{ "split": "train", "index": 65353, "acecode_id": "bigcode_python_fns_48715", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Write a function `print_pyramid(n: int) -> str` that generates a pyramid pattern using asterisks ('*'). The function should return a string representation of the pyramid, where `n` is the number of rows in the pyramid. Each row should have the correct number of leading spaces f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert print_pyramid(1) == '*\\\\n'\", \"assert print_pyramid(2) == ' *\\\\n***\\\\n'\", \"assert print_pyramid(3) == ' *\\\\n ***\\\\n*****\\\\n'\", \"assert print_pyramid(4) == ' *\\\\n ***\\\\n *****\\\\n*******\\\\n'\", \"assert print_pyramid(5) == ' *\\...
{ "split": "train", "index": 65354, "acecode_id": "evol_35811", "num_tests": 13 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates a simple test manager for software development kits (SDKs). The function should take a string representing the type of test (e.g., 'unit', 'integration', 'SDK') and an optional string representing the type of SDK (only ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert test_manager('unit') == None\", \"assert test_manager('integration') == None\", \"assert test_manager('SDK', 'TypeA') == None\", \"assert test_manager('SDK', 'TypeB') == None\", \"assert test_manager('SDK') == None\", \"assert test_manager('unit') == None\",...
{ "split": "train", "index": 65355, "acecode_id": "oss_86", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that takes a text string and counts the frequency of each word in the text. The function should return a dictionary where the keys are the words and the values are the number of times each word appears in the text. The words are case-inse...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert count_word_frequencies('Hello, world! Hello!!') == {'hello': 2, 'world': 1}\", \"assert count_word_frequencies('Python is great. Python is fun!') == {'python': 2, 'is': 2, 'great': 1, 'fun': 1}\", \"assert count_word_frequencies('A quick brown fox jumps over...
{ "split": "train", "index": 65356, "acecode_id": "bigcode_python_fns_34595", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that filters points from a 2D polygon based on a confidence threshold. The function `filter_polygon_points` takes in a list of points, where each point is represented as a dictionary with a 'confidence' key. The function should also t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_polygon_points([{'x': 1, 'y': 2, 'confidence': 0.9}, {'x': 2, 'y': 3, 'confidence': 0.4}, {'x': 3, 'y': 1, 'confidence': 0.7}], 0.5) == [{'x': 1, 'y': 2, 'confidence': 0.9}, {'x': 3, 'y': 1, 'confidence': 0.7}]\", \"assert filter_polygon_points([{'x':...
{ "split": "train", "index": 65357, "acecode_id": "oss_19373", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function to detect peaks in a one-dimensional signal using a simple threshold-based algorithm. The function should identify indices of all elements in the input signal that are greater than a specified threshold value. You need to implement th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert detect_peaks([1.0, 3.5, 2.0, 5.1, 0.5], 2.0) == [1, 3]\", \"assert detect_peaks([1.0, 1.5, 1.9, 2.0], 2.0) == []\", \"assert detect_peaks([0.5, 0.6, 1.0, 2.1, 3.0], 1.5) == [3, 4]\", \"assert detect_peaks([-1.0, -0.5, 0.0, 1.0, 1.5], 0.5) == [3, 4]\", \"asse...
{ "split": "train", "index": 65358, "acecode_id": "oss_9653", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are tasked with writing a function that calculates the final total amount in a shopping cart after adding various items. The function should take an initial total amount and a list of tuples, where each tuple contains an item name and its corresponding price. Your goal is t...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_final_total(100.0, [('Shoes', 50.0), ('T-shirt', 25.0)]) == 175.0\", \"assert calculate_final_total(50.0, [('Hat', 15.0), ('Socks', 5.0)]) == 70.0\", \"assert calculate_final_total(0.0, [('Laptop', 1000.0)]) == 1000.0\", \"assert calculate_final_to...
{ "split": "train", "index": 65359, "acecode_id": "oss_34701", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `factorial(n: int) -> int` that calculates the factorial of a non-negative integer n using recursion. The factorial of a number is the product of all positive integers less than or equal to that number. For example, factorial(5) should return 120 because 5!...
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": 65360, "acecode_id": "evol_7448", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `gradient_descent(func, derivative, initial_point, learning_rate=0.1, max_iters=10000, precision=0.0001)` that performs gradient descent to find the local minimum of a given cost function. The function takes the following parameters: `func`, which is a call...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert gradient_descent(lambda x: (x-3)**2, lambda x: 2*(x-3), 0) == pytest.approx(3.0, rel=1e-2)\", \"assert gradient_descent(lambda x: (x-5)**2 + 10, lambda x: 2*(x-5), 0) == pytest.approx(5.0, rel=1e-2)\", \"assert gradient_descent(lambda x: x**2 + 2*x + 1, lamb...
{ "split": "train", "index": 65361, "acecode_id": "evol_6367", "num_tests": 9 }
acecode
[ { "role": "user", "content": "Implement a function that searches for a specified element in a singly linked list and returns a list of indices where the element is found. If the element is not present in the linked list, return an empty list. The linked list may contain duplicate elements. The function shou...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert search(head, 2) == [1, 3]\", \"assert search(head, 1) == [0, 4]\", \"assert search(head, 3) == [2]\", \"assert search(head, 4) == []\", \"assert search(None, 1) == []\", \"assert search(head, 2) == [1, 3]\", \"assert search(head, 0) == []\", \"assert search(...
{ "split": "train", "index": 65362, "acecode_id": "evol_4570", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of image file names generated by a script. Each file name follows a specific pattern indicating the variable name, vertical level (if applicable), and lead time. Your task is to extract and categorize the unique variable names, lead times, and vertical leve...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert categorize_images(['temperature_T+00.png', 'temperature_T+01.png', 'humidity_T+00.png']) == {'temperature': {'lead_times': [0, 1], 'levels': []}, 'humidity': {'lead_times': [0], 'levels': []}}\", \"assert categorize_images(['pressure_T+00.png', 'altitude_T+0...
{ "split": "train", "index": 65363, "acecode_id": "bigcode_python_fns_12358", "num_tests": 6 }
acecode
[ { "role": "user", "content": "Write a function `validate_message(message: str) -> bool` that checks if the given string matches the following criteria: it must be a two-word message that starts with 'Hey', the second word must start with a capital letter, and the message must end with a punctuation mark (ei...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_message('Hey John!') == True\", \"assert validate_message('Hey Alice?') == True\", \"assert validate_message('Hey Bob.') == True\", \"assert validate_message('Hey Sarah!') == True\", \"assert validate_message('Hey Tom?') == True\", \"assert validate...
{ "split": "train", "index": 65364, "acecode_id": "evol_10856", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a custom error handling mechanism in a cloud infrastructure management system. Your goal is to create a custom exception class named `NoProcessError` that inherits from the base `Exception` class. This exception class should accept a message as ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert handle_process(['process1', 'process2'], 'process1') == 'Process found'\", \"assert handle_process(['test_process'], 'test_process') == 'Process found'\", \"assert handle_process(['proc1'], 'proc1') == 'Process found'\", \"assert handle_process(['service1', ...
{ "split": "train", "index": 65365, "acecode_id": "oss_15617", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a Python function that processes a list of historical terminology and returns a dictionary where each historical period is associated with its corresponding index (starting from 1). The function should take a list of historical terminology as in...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_historical_dictionary([]) == {}\", \"assert create_historical_dictionary([\\\"Ancient\\\"]) == {1: \\\"Ancient\\\"}\", \"assert create_historical_dictionary([\\\"Medieval\\\", \\\"Renaissance\\\"]) == {1: \\\"Medieval\\\", 2: \\\"Renaissance\\\"}\", \...
{ "split": "train", "index": 65366, "acecode_id": "oss_30049", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are working with a project management tool, and you want to implement a function that filters a list of issues based on specific criteria. Each issue is represented as a dictionary with the keys 'issue_type', 'status', 'priority', 'assign', and 'attention'. Your task is to ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert filter_issues([{'issue_type': 'bug', 'status': 'open', 'priority': 'high', 'assign': 'user1', 'attention': 'user2'}, {'issue_type': 'feature', 'status': 'closed', 'priority': 'low', 'assign': 'user3', 'attention': 'user4'}], {'status': ['open']}) == [{'issue...
{ "split": "train", "index": 65367, "acecode_id": "bigcode_python_fns_9402", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Write a function that takes a string as an argument and recursively removes all vowels (a, e, i, o, u) from it. Additionally, the function should count and return the number of vowels removed. Consider case sensitivity. The function signature should be: `def remove_vowels(strin...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert remove_vowels('Hello World') == ('Hll Wrld', 3)\", \"assert remove_vowels('Recursion') == ('Rcrsn', 4)\", \"assert remove_vowels('Python') == ('Pythn', 1)\", \"assert remove_vowels('AEIOU') == ('', 5)\", \"assert remove_vowels('') == ('', 0)\", \"assert remo...
{ "split": "train", "index": 65368, "acecode_id": "evol_2457", "num_tests": 14 }
acecode
[ { "role": "user", "content": "You are given a list of strings called 'tokens' and two integers 'start' and 'end'. Your task is to replace a subrange of the 'tokens' list, starting at index 'start' and ending just before index 'end', with another list of strings called 'replacement'. Write a function 'replac...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert replace_token_range(['a', 'b', 'c', 'd'], 1, 3, ['x', 'y']) == ['a', 'x', 'y', 'd']\", \"assert replace_token_range(['hello', 'world'], 0, 1, ['hi']) == ['hi', 'world']\", \"assert replace_token_range(['apple', 'banana', 'cherry'], 0, 2, ['orange']) == ['ora...
{ "split": "train", "index": 65369, "acecode_id": "bigcode_python_fns_28184", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of record identifiers and a table name, write a function that generates an SQL delete statement to remove the specified records from the specified table. The SQL delete statement should follow the structure: 'DELETE FROM method_usage.pandas_{table_name} WHERE {tabl...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_sql_delete_stmt(['1', '2', '3'], 'users') == 'DELETE FROM method_usage.pandas_users WHERE users_id IN (1, 2, 3)'\", \"assert create_sql_delete_stmt(['10', '20', '30'], 'products') == 'DELETE FROM method_usage.pandas_products WHERE products_id IN (10, ...
{ "split": "train", "index": 65370, "acecode_id": "bigcode_python_fns_36757", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with creating a function that processes a given string, referred to as 'tweet'. The function should perform the following modifications to the tweet: 1. Replace any URLs in the tweet with the string 'URL'. 2. Remove any leading or trailing whitespace from the twe...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert preprocess_tweet('Visit us at http://mywebsite.com') == 'Visit us at URL'\", \"assert preprocess_tweet(' URL test ') == 'URL test'\", \"assert preprocess_tweet('This is a test tweet with no URLs') == 'This is a test tweet with no URLs'\", \"assert prepro...
{ "split": "train", "index": 65371, "acecode_id": "bigcode_python_fns_21828", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Implement a function that takes a list of complex numbers and sorts them in ascending order based on their magnitude. For complex numbers with the same magnitude, sort them first by their real part, and if they also tie on the real part, sort them by their imaginary part. The f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert sort_complex_numbers([1+1j, 1+1j, 1+1j]) == [1+1j, 1+1j, 1+1j]\", \"assert sort_complex_numbers([1+1j, 2+2j, 3+3j]) == [1+1j, 2+2j, 3+3j]\", \"assert sort_complex_numbers([-1-1j, 1+1j, 0+0j]) == [0+0j, -1-1j, 1+1j]\", \"assert sort_complex_numbers([3+4j, 3+3...
{ "split": "train", "index": 65372, "acecode_id": "evol_15111", "num_tests": 11 }
acecode
[ { "role": "user", "content": "Design a function that takes two integer arrays and returns true if the first array contains at least one element from the second array. The function should handle 2D arrays and maintain time complexity under O(n log n).\nPlease reason step by step, then write a self-contained ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert contains_element([1, 2, 3], [2]) == True\", \"assert contains_element([5, 6, 7], [8, 9]) == False\", \"assert contains_element([10, 20, 30], [15, 20]) == True\", \"assert contains_element([], [1, 2]) == False\", \"assert contains_element([1, 2, 3], []) == Fa...
{ "split": "train", "index": 65373, "acecode_id": "evol_7882", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that simulates the retrieval of information about a protection container in a cloud infrastructure management system. The function `get_protection_container` should take the following optional parameters: `name`, `recovery_fabric_name...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_protection_container() == {'id': 'sample_id', 'name': 'sample_name', 'recovery_fabric_name': 'sample_recovery_fabric', 'recovery_vault_name': 'sample_recovery_vault', 'resource_group_name': 'sample_resource_group'}\", \"assert get_protection_container(na...
{ "split": "train", "index": 65374, "acecode_id": "oss_23161", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a function that processes motion data for a given motion ID. The function `process_motion_data` takes the following parameters: a database URL (DB_URL), a motion ID (motion_id), a BVH name (bvh_name), motion data (motion_data), a collection name...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert process_motion_data('http://example.com/db', 'motion_1', 'walk.bvh', 'data_1', 'collection_1', 'skeleton_1', 'meta_1', True) == 'Motion data processed successfully.'\", \"assert process_motion_data('http://example.com/db', 'motion_2', 'run.bvh', 'data_2', 'c...
{ "split": "train", "index": 65375, "acecode_id": "oss_21221", "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 unique integers from the input list, preserving the order of their first appearance. Implement the function `get_unique_integers(arr: List[int]) -> List[int]`. The f...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert get_unique_integers([]) == []\", \"assert get_unique_integers([1, 2, 3]) == [1, 2, 3]\", \"assert get_unique_integers([1, 2, 2, 3]) == [1, 2, 3]\", \"assert get_unique_integers([1, 2, 3, 1, 2, 3]) == [1, 2, 3]\", \"assert get_unique_integers([1, 1, 1, 1]) ==...
{ "split": "train", "index": 65376, "acecode_id": "oss_23275", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that calculates the value of the expression defined by the linear equation 2x - 3y + 6 for given integer values of x and y. The function should take two parameters, x and y, and return the result of the equation.\nPlease reason step by step, then write a se...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert linear_equation(0, 0) == 6\", \"assert linear_equation(1, 1) == 5\", \"assert linear_equation(2, 2) == 4\", \"assert linear_equation(3, 0) == 12\", \"assert linear_equation(0, 3) == -3\", \"assert linear_equation(10, 0) == 26\", \"assert linear_equation(0, -...
{ "split": "train", "index": 65377, "acecode_id": "evol_2101", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a string representation of an XML document that categorizes individuals by their attributes such as name, age, hobbies, and city, write a function `parse_people(xml_string: str) -> List[Person]` that parses this XML string and returns a list of Person objects. The Person ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert parse_people('<people><person><name>John Doe</name><age>56</age><hobbies><hobby>Gardening</hobby><hobby>Cooking</hobby></hobbies><city>New York</city></person></people>') == [Person(name='John Doe', age=56, hobbies=['Gardening', 'Cooking'], city='New York')]...
{ "split": "train", "index": 65378, "acecode_id": "evol_27509", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function `classify_and_divide(n: int, d: int) -> Tuple[str, str, Optional[int]]` that takes a given integer `n` and a chosen integer `d` as input. The function should classify `n` as 'Even' or 'Odd', determine if `n` is divisible by `d` (output 'Yes' or 'No'), and i...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert classify_and_divide(10, 5) == ('Even', 'Yes', 2)\", \"assert classify_and_divide(11, 3) == ('Odd', 'No', None)\", \"assert classify_and_divide(0, 1) == ('Even', 'Yes', 0)\", \"assert classify_and_divide(-10, 5) == ('Even', 'Yes', -2)\", \"assert classify_and...
{ "split": "train", "index": 65379, "acecode_id": "evol_4058", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers representing the number of participants in different events, write a function `average_participants(events: List[int]) -> float` that calculates the average number of participants across all events. The function should return the average as a float roun...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert average_participants([10, 20, 30]) == 20.0\", \"assert average_participants([5, 15, 25, 35]) == 20.0\", \"assert average_participants([1, 2, 3, 4, 5]) == 3.0\", \"assert average_participants([100, 200]) == 150.0\", \"assert average_participants([]) == 0.0\",...
{ "split": "train", "index": 65380, "acecode_id": "bigcode_python_fns_43792", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of dictionaries representing literary works, each containing the keys 'manuscript_title', 'publication_date', and 'co_authors', write a function `create_binary_relations(database_data)` that returns a list of these dictionaries, where each dictionary represents a b...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert create_binary_relations([{'manuscript_title': 'Title A', 'publication_date': '2021-01-01', 'co_authors': 'Author X'}, {'manuscript_title': 'Title B', 'publication_date': '2021-02-01', 'co_authors': 'Author Y'}]) == [{'manuscript_title': 'Title A', 'publicati...
{ "split": "train", "index": 65381, "acecode_id": "evol_8477", "num_tests": 13 }
acecode
[ { "role": "user", "content": "Write a python function that concatenates a given list of strings provided in sequence and ends the resultant string with an exclamation point. Ensure that each separate string is separated by a space in the resultant string, while maintaining the original order from the list. ...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert concat_strings(['Hello', 'World']) == 'Hello World!'\", \"assert concat_strings(['Hello']) == 'Hello!'\", \"assert concat_strings(['Python', 'is', 'fun']) == 'Python is fun!'\", \"assert concat_strings(['Leet', 'Code']) == 'Leet Code!'\", \"assert concat_str...
{ "split": "train", "index": 65382, "acecode_id": "evol_17716", "num_tests": 15 }
acecode
[ { "role": "user", "content": "You are given a string containing various characters, including parentheses. Your task is to implement a function `is_balanced_parentheses(input_string)` that checks whether the parentheses in the string are balanced. A string is considered balanced if every opening parenthesis...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_balanced_parentheses('((()))') == True\", \"assert is_balanced_parentheses('()()()') == True\", \"assert is_balanced_parentheses('(()') == False\", \"assert is_balanced_parentheses('())') == False\", \"assert is_balanced_parentheses('abc(d)e(f)') == True\...
{ "split": "train", "index": 65383, "acecode_id": "oss_9403", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a 2D array representing an image, where each element is a tuple containing the RGB values of a pixel (e.g., (r, g, b)). Your task is to implement a function `calculate_contrast_pixels(img, threshold)` that takes this image and a positive integer threshold as input...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert calculate_contrast_pixels([[(100, 100, 100), (150, 150, 150), (200, 200, 200)]], 30) == 1\", \"assert calculate_contrast_pixels([[(0, 0, 0), (0, 0, 0), (0, 0, 0)]], 10) == 0\", \"assert calculate_contrast_pixels([[(255, 0, 0), (255, 0, 0), (255, 0, 0)]], 100...
{ "split": "train", "index": 65384, "acecode_id": "oss_21895", "num_tests": 10 }
acecode
[ { "role": "user", "content": "You are given a string representing a policy type, which can be either \"infer\" or \"infer_float32_vars\", along with a string representing a data type (dtype). Your task is to write a function that returns a new policy type based on the following rules: If the input policy is...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert generate_policy('infer', 'float64') == 'float64'\", \"assert generate_policy('infer_float32_vars', 'int32') == 'int32_with_float32_vars'\", \"assert generate_policy('infer', 'float32') == 'float32'\", \"assert generate_policy('infer_float32_vars', 'float64')...
{ "split": "train", "index": 65385, "acecode_id": "bigcode_python_fns_4797", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Write a Python function to determine whether a given integer n is a Mersenne prime or not. A Mersenne prime is defined as a prime number that is one less than a power of two. Implement the function `is_mersenne_prime(n)`, which returns True if n is a Mersenne prime, and False o...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert is_mersenne_prime(3) == True\", \"assert is_mersenne_prime(7) == True\", \"assert is_mersenne_prime(15) == False\", \"assert is_mersenne_prime(31) == True\", \"assert is_mersenne_prime(127) == True\", \"assert is_mersenne_prime(2) == False\", \"assert is_mer...
{ "split": "train", "index": 65386, "acecode_id": "evol_25461", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given an array of numbers, both integers and floating point values, implement a function that returns a new array containing only the distinct non-zero values from the input array. The order of elements in the output array should match the order of their first appearances in th...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert prod_signs([1, 2, 3, 1, 2, 0]) == [1, 2, 3]\", \"assert prod_signs([0, 0, 0]) == []\", \"assert prod_signs([3.5, 2.2, 3.5, 0, 1.2]) == [3.5, 2.2, 1.2]\", \"assert prod_signs([-1, -2, -1, 0]) == [-1, -2]\", \"assert prod_signs([]) == []\", \"assert prod_signs...
{ "split": "train", "index": 65387, "acecode_id": "evol_7460", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Implement a function that checks the validity of a list of email addresses and classifies them based on their domains. The function should return a dictionary where each key is a domain and the value is a list of valid email addresses associated with that domain. An email is co...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert validate_emails(['user@example.com', 'admin@domain.com', 'invalid-email@domain', 'name@sub.domain.com']) == {'example.com': ['user@example.com'], 'domain.com': ['admin@domain.com'], 'sub.domain.com': ['name@sub.domain.com']}\", \"assert validate_emails(['tes...
{ "split": "train", "index": 65388, "acecode_id": "evol_24911", "num_tests": 15 }
acecode
[ { "role": "user", "content": "Given a list of lists, write a function `to_ndarray(arr)` that converts the input into a multidimensional list (similar to a numpy array) where each inner list represents a row. The function should return the resulting multidimensional list. For example, if the input is [[1, 2,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert to_ndarray([[1, 2], [3, 4]]) == [[1, 2], [3, 4]]\", \"assert to_ndarray([[5, 6, 7], [8, 9, 10]]) == [[5, 6, 7], [8, 9, 10]]\", \"assert to_ndarray([[0], [1], [2]]) == [[0], [1], [2]]\", \"assert to_ndarray([[1]]) == [[1]]\", \"assert to_ndarray([[], []]) == ...
{ "split": "train", "index": 65389, "acecode_id": "bigcode_python_fns_25898", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with simulating a simple banking transaction system. Your task is to implement a function `bank_account_operations(operations: List[Tuple[str, int]]) -> Tuple[int, int]` that processes a list of operations on a bank account. Each operation is represented as a tup...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert bank_account_operations([('deposit', 100), ('withdraw', 50)]) == (50, 2)\", \"assert bank_account_operations([('deposit', 200), ('withdraw', 300)]) == (200, 1)\", \"assert bank_account_operations([('deposit', 50), ('deposit', 150), ('withdraw', 100)]) == (10...
{ "split": "train", "index": 65390, "acecode_id": "oss_37061", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Implement a function `convert_pressure(from_unit: str, to_unit: str, value: float) -> float` that converts a pressure value from one unit to another. The supported units are 'pa' (Pascal), 'bar', 'psi' (Pounds per Square Inch), and 'torr'. The function should raise an exception...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_pressure('pa', 'bar', 100000) == 1.0\", \"assert convert_pressure('bar', 'pa', 1) == 100000.0\", \"assert convert_pressure('psi', 'pa', 1) == 6894.76\", \"assert convert_pressure('pa', 'psi', 6894.76) == 1.0\", \"assert convert_pressure('torr', 'pa',...
{ "split": "train", "index": 65391, "acecode_id": "evol_25098", "num_tests": 11 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the hue adjustments for a collection of images, where each adjustment is represented as a float in the range [-0.5, 0.5]. Your task is to implement a function that checks whether all the hue adjustments in the list are valid. A vali...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert are_hue_adjustments_valid([-0.5, 0.0, 0.5]) == True\", \"assert are_hue_adjustments_valid([-0.3, 0.1, 0.2]) == True\", \"assert are_hue_adjustments_valid([-0.6, 0.0, 0.5]) == False\", \"assert are_hue_adjustments_valid([0.5, 0.5, 0.5]) == True\", \"assert ar...
{ "split": "train", "index": 65392, "acecode_id": "bigcode_python_fns_20208", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Given a list of integers 'lst' and an integer 'size', write a function that partitions the list into 'size' number of sublists. Each sublist should contain elements from the original list, selected in a round-robin manner. The function should return a list of these sublists. If...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert partition([1, 2, 3, 4, 5], 2) == [[1, 3, 5], [2, 4]]\", \"assert partition([1, 2, 3, 4], 2) == [[1, 3], [2, 4]]\", \"assert partition([], 3) == [[], [], []]\", \"assert partition([1], 1) == [[1]]\", \"assert partition([1, 2, 3, 4, 5, 6], 3) == [[1, 4], [2, 5...
{ "split": "train", "index": 65393, "acecode_id": "bigcode_python_fns_35481", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are given a list of integers representing the responses to a survey. Implement a function `increment_responses(responses: List[int]) -> List[int]` that takes this list and increments each response by 1. Your function should return the updated list containing the incremented...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert increment_responses([1, 2, 3]) == [2, 3, 4]\", \"assert increment_responses([0, 0, 0]) == [1, 1, 1]\", \"assert increment_responses([-1, -2, -3]) == [0, -1, -2]\", \"assert increment_responses([5]) == [6]\", \"assert increment_responses([-5]) == [-4]\", \"as...
{ "split": "train", "index": 65394, "acecode_id": "bigcode_python_fns_34488", "num_tests": 16 }
acecode
[ { "role": "user", "content": "Craft a Python function called \"assemble\". This function requires two arguments - a string titled `letters` composed of individual characters, as well as an additional string designated as `string_connector` that will serve as the binding string between the letters. This func...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert assemble('abc', 'z') == 'azbzc'\", \"assert assemble('hello', '-') == 'h-e-l-l-o'\", \"assert assemble('', 'z') == ''\", \"assert assemble('a', 'z') == 'a'\", \"assert assemble('abcde', 'x') == 'axbxcxdxe'\", \"assert assemble('openai', ' ') == 'o p e n a i'...
{ "split": "train", "index": 65395, "acecode_id": "evol_11020", "num_tests": 10 }
acecode
[ { "role": "user", "content": "Given a list of points represented as tuples of coordinates (x, y), write a function that returns a list of the nearest points from a predefined set of cell test points. The cell test points are defined as [(1, 2), (3, 4), (5, 6), (7, 8)]. For each point in the input list, find...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert find_nearest_cell_points([(0, 0)]) == [((0, 0), (1, 2))]\", \"assert find_nearest_cell_points([(3, 3), (6, 7)]) == [((3, 3), (3, 4)), ((6, 7), (5, 6))]\", \"assert find_nearest_cell_points([(8, 9)]) == [((8, 9), (7, 8))]\", \"assert find_nearest_cell_points(...
{ "split": "train", "index": 65396, "acecode_id": "bigcode_python_fns_17696", "num_tests": 12 }
acecode
[ { "role": "user", "content": "You are given a list of task dependency pairs, where each task is represented by a unique integer. Each pair (a, b) indicates that task a must be completed before task b can start. Your task is to implement a function `determine_execution_order(dependency_pairs: List[Tuple[int,...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert determine_execution_order([]) == []\", \"assert determine_execution_order([(1, 2)]) == [1, 2]\", \"assert determine_execution_order([(1, 2), (2, 3)]) == [1, 2, 3]\", \"assert determine_execution_order([(1, 2), (1, 3)]) == [1, 2, 3]\", \"assert determine_exec...
{ "split": "train", "index": 65397, "acecode_id": "oss_21767", "num_tests": 12 }
acecode
[ { "role": "user", "content": "Given a year represented as either a two-digit or a four-digit number, write a function `convert_year(year)` that converts the two-digit year into a four-digit year, assuming the two-digit year is in the 21st century (i.e., 00-99 translates to 2000-2099). If the year is already...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert convert_year(19) == 2019\", \"assert convert_year(99) == 2099\", \"assert convert_year(0) == 2000\", \"assert convert_year(20) == 2020\", \"assert convert_year(2021) == 2021\", \"assert convert_year(1985) == 1985\", \"assert convert_year(50) == 2050\", \"ass...
{ "split": "train", "index": 65398, "acecode_id": "evol_2175", "num_tests": 16 }
acecode
[ { "role": "user", "content": "You are tasked with implementing a custom error handling mechanism for a networking library in Python. The library is designed to facilitate peer-to-peer communication and needs to handle specific error scenarios gracefully. Your task is to create a custom exception class named...
code
{ "style": "rule", "ground_truth": "{\"tests\": [\"assert issubclass(HandshakeFailure, BaseLibp2pError)\", \"assert isinstance(HandshakeFailure(), BaseLibp2pError)\", \"assert HandshakeFailure.__name__ == 'HandshakeFailure'\", \"assert HandshakeFailure.__bases__ == (BaseLibp2pError,)\", \"assert len(HandshakeFailur...
{ "split": "train", "index": 65399, "acecode_id": "oss_11994", "num_tests": 16 }