antonio commited on
Commit
cd65e6f
1 Parent(s): 6c9eb72

(BUG): Fix rename solve_2

Browse files
data/docstring/test_standard_humaneval.jsonl CHANGED
@@ -159,6 +159,6 @@
159
  {"task_id":"HumanEval\/158","prompt":"\ndef find_max(words):\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characters. If multiple strings have maximum number of unique\n characters, return the one which comes first in lexicographical order.\n \"\"\"\n","entry_point":"find_max","canonical_solution":" return sorted(words, key = lambda x: (-len(set(x)), x))[0]\n","test":"def check(candidate):\n assert (candidate([\"name\",\"Test 0\"\n assert (candidate([\"name\",\"Test 1\"\n assert (candidate([\"aaaaaaa\",\"Test 2\"\n assert (candidate([\"abc\",\"Test 3\"\n assert (candidate([\"play\", \"this\", \"game\", \"of\",\"Test 4\"\n assert (candidate([\"play\",\"Test 5\"\n assert (candidate([\"we\",\"Test 6\"\n assert (candidate([\"we\",\"Test 7\"\n assert (candidate([\"this\",\"Test 8\"\n assert (candidate([\"b\"]) == \"b\"), 't9',\"Test 9\"\n assert (candidate([\"play\",\"Test 10\"\n"}
160
  {"task_id":"HumanEval\/159","prompt":"\ndef eat(number, need, remaining):\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to complete the day's meals.\n you should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\n if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n \n Variables:\n @number : integer\n the number of carrots that you have eaten.\n @need : integer\n the number of carrots that you need to eat.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n \n Constrain:\n * 0 <= number <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"\n","entry_point":"eat","canonical_solution":" if(need <= remaining):\n return [ number + need , remaining-need ]\n else:\n return [ number + remaining , 0]\n","test":"def check(candidate):\n assert True,\"Test 0\"\n assert candidate(5, 6, 10) == [11, 4],\"Test 1\"\n assert candidate(4, 8, 9) == [12, 1],\"Test 2\"\n assert candidate(1, 10, 10) == [11, 0],\"Test 3\"\n assert candidate(2, 11, 5) == [7, 0],\"Test 4\"\n assert True,\"Test 5\"\n assert candidate(4, 5, 7) == [9, 2],\"Test 6\"\n assert candidate(4, 5, 1) == [5, 0],\"Test 7\"\n"}
161
  {"task_id":"HumanEval\/160","prompt":"\ndef do_algebra(operator, operand):\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and \n the second list is a list of integers. Use the two given lists to build the algebric \n expression and return the evaluation of this expression.\n\n The basic algebra operations:\n Addition ( + ) \n Subtraction ( - ) \n Multiplication ( * ) \n Floor division ( \/\/ ) \n Exponentiation ( ** ) \n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n\n \"\"\"\n","entry_point":"do_algebra","canonical_solution":" expression = str(operand[0])\n for oprt, oprn in zip(operator, operand[1:]):\n expression+= oprt + str(oprn)\n return eval(expression)\n","test":"def check(candidate):\n assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37,\"Test 0\"\n assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9,\"Test 1\"\n assert candidate(['\/\/', '*'], [7, 3, 4]) == 8,\"Test 2\"\n assert True,\"Test 3\"\n"}
162
- {"task_id":"HumanEval\/161","prompt":"\ndef solve_2(s):\n \"\"\"You are given a string s.\n if s[i] is a letter, reverse its case from lower to upper or vise versa, \n otherwise keep it as it is.\n If the string contains no letters, reverse the string.\n The function should return the resulted string.\n \"\"\"\n","entry_point_2":"solve","canonical_solution":" flg = 0\n idx = 0\n new_str = list(s)\n for i in s:\n if i.isalpha():\n new_str[idx] = i.swapcase()\n flg = 1\n idx += 1\n s = \"\"\n for i in new_str:\n s += i\n if flg == 0:\n return s[len(s)::-1]\n return s\n","test":"def check(candidate):\n assert candidate(\"AsDf\") == \"aSdF\",\"Test 0\"\n assert candidate(\"1234\") == \"4321\",\"Test 1\"\n assert candidate(\"ab\") == \"AB\",\"Test 2\"\n assert candidate(\"#a@C\") == \"#A@c\",\"Test 3\"\n assert candidate(\"#AsdfW^45\") == \"#aSDFw^45\",\"Test 4\"\n assert candidate(\"#6@2\") == \"2@6#\",\"Test 5\"\n assert candidate(\"#$a^D\") == \"#$A^d\",\"Test 6\"\n assert candidate(\"#ccc\") == \"#CCC\",\"Test 7\"\n"}
163
  {"task_id":"HumanEval\/162","prompt":"\ndef string_to_md5(text):\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n \"\"\"\n","entry_point":"string_to_md5","canonical_solution":" import hashlib\n return hashlib.md5(text.encode('ascii')).hexdigest() if text else None\n","test":"def check(candidate):\n assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62',\"Test 0\"\n assert candidate('') == None,\"Test 1\"\n assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888',\"Test 2\"\n assert candidate('password') == '5f4dcc3b5aa765d61d8327deb882cf99',\"Test 3\"\n assert True,\"Test 4\"\n"}
164
  {"task_id":"HumanEval\/163","prompt":"\ndef generate_integers(a, b):\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n \"\"\"\n","entry_point":"generate_integers","canonical_solution":" lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n\n return [i for i in range(lower, upper+1) if i % 2 == 0]\n","test":"def check(candidate):\n assert candidate(2, 10) == [2, 4, 6, 8], \"Test 1\"\n assert candidate(10, 2) == [2, 4, 6, 8], \"Test 2\"\n assert candidate(132, 2) == [2, 4, 6, 8], \"Test 3\"\n assert candidate(17,89) == [], \"Test 4\"\n assert True,\"Test 4\"\n"}
 
159
  {"task_id":"HumanEval\/158","prompt":"\ndef find_max(words):\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characters. If multiple strings have maximum number of unique\n characters, return the one which comes first in lexicographical order.\n \"\"\"\n","entry_point":"find_max","canonical_solution":" return sorted(words, key = lambda x: (-len(set(x)), x))[0]\n","test":"def check(candidate):\n assert (candidate([\"name\",\"Test 0\"\n assert (candidate([\"name\",\"Test 1\"\n assert (candidate([\"aaaaaaa\",\"Test 2\"\n assert (candidate([\"abc\",\"Test 3\"\n assert (candidate([\"play\", \"this\", \"game\", \"of\",\"Test 4\"\n assert (candidate([\"play\",\"Test 5\"\n assert (candidate([\"we\",\"Test 6\"\n assert (candidate([\"we\",\"Test 7\"\n assert (candidate([\"this\",\"Test 8\"\n assert (candidate([\"b\"]) == \"b\"), 't9',\"Test 9\"\n assert (candidate([\"play\",\"Test 10\"\n"}
160
  {"task_id":"HumanEval\/159","prompt":"\ndef eat(number, need, remaining):\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to complete the day's meals.\n you should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\n if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n \n Variables:\n @number : integer\n the number of carrots that you have eaten.\n @need : integer\n the number of carrots that you need to eat.\n @remaining : integer\n the number of remaining carrots thet exist in stock\n \n Constrain:\n * 0 <= number <= 1000\n * 0 <= need <= 1000\n * 0 <= remaining <= 1000\n\n Have fun :)\n \"\"\"\n","entry_point":"eat","canonical_solution":" if(need <= remaining):\n return [ number + need , remaining-need ]\n else:\n return [ number + remaining , 0]\n","test":"def check(candidate):\n assert True,\"Test 0\"\n assert candidate(5, 6, 10) == [11, 4],\"Test 1\"\n assert candidate(4, 8, 9) == [12, 1],\"Test 2\"\n assert candidate(1, 10, 10) == [11, 0],\"Test 3\"\n assert candidate(2, 11, 5) == [7, 0],\"Test 4\"\n assert True,\"Test 5\"\n assert candidate(4, 5, 7) == [9, 2],\"Test 6\"\n assert candidate(4, 5, 1) == [5, 0],\"Test 7\"\n"}
161
  {"task_id":"HumanEval\/160","prompt":"\ndef do_algebra(operator, operand):\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and \n the second list is a list of integers. Use the two given lists to build the algebric \n expression and return the evaluation of this expression.\n\n The basic algebra operations:\n Addition ( + ) \n Subtraction ( - ) \n Multiplication ( * ) \n Floor division ( \/\/ ) \n Exponentiation ( ** ) \n\n Note:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\n\n \"\"\"\n","entry_point":"do_algebra","canonical_solution":" expression = str(operand[0])\n for oprt, oprn in zip(operator, operand[1:]):\n expression+= oprt + str(oprn)\n return eval(expression)\n","test":"def check(candidate):\n assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37,\"Test 0\"\n assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9,\"Test 1\"\n assert candidate(['\/\/', '*'], [7, 3, 4]) == 8,\"Test 2\"\n assert True,\"Test 3\"\n"}
162
+ {"task_id":"HumanEval\/161","prompt":"\ndef solve_2(s):\n \"\"\"You are given a string s.\n if s[i] is a letter, reverse its case from lower to upper or vise versa, \n otherwise keep it as it is.\n If the string contains no letters, reverse the string.\n The function should return the resulted string.\n \"\"\"\n","entry_point":"solve_2","canonical_solution":" flg = 0\n idx = 0\n new_str = list(s)\n for i in s:\n if i.isalpha():\n new_str[idx] = i.swapcase()\n flg = 1\n idx += 1\n s = \"\"\n for i in new_str:\n s += i\n if flg == 0:\n return s[len(s)::-1]\n return s\n","test":"def check(candidate):\n assert candidate(\"AsDf\") == \"aSdF\",\"Test 0\"\n assert candidate(\"1234\") == \"4321\",\"Test 1\"\n assert candidate(\"ab\") == \"AB\",\"Test 2\"\n assert candidate(\"#a@C\") == \"#A@c\",\"Test 3\"\n assert candidate(\"#AsdfW^45\") == \"#aSDFw^45\",\"Test 4\"\n assert candidate(\"#6@2\") == \"2@6#\",\"Test 5\"\n assert candidate(\"#$a^D\") == \"#$A^d\",\"Test 6\"\n assert candidate(\"#ccc\") == \"#CCC\",\"Test 7\"\n"}
163
  {"task_id":"HumanEval\/162","prompt":"\ndef string_to_md5(text):\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n \"\"\"\n","entry_point":"string_to_md5","canonical_solution":" import hashlib\n return hashlib.md5(text.encode('ascii')).hexdigest() if text else None\n","test":"def check(candidate):\n assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62',\"Test 0\"\n assert candidate('') == None,\"Test 1\"\n assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888',\"Test 2\"\n assert candidate('password') == '5f4dcc3b5aa765d61d8327deb882cf99',\"Test 3\"\n assert True,\"Test 4\"\n"}
164
  {"task_id":"HumanEval\/163","prompt":"\ndef generate_integers(a, b):\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n \"\"\"\n","entry_point":"generate_integers","canonical_solution":" lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n\n return [i for i in range(lower, upper+1) if i % 2 == 0]\n","test":"def check(candidate):\n assert candidate(2, 10) == [2, 4, 6, 8], \"Test 1\"\n assert candidate(10, 2) == [2, 4, 6, 8], \"Test 2\"\n assert candidate(132, 2) == [2, 4, 6, 8], \"Test 3\"\n assert candidate(17,89) == [], \"Test 4\"\n assert True,\"Test 4\"\n"}