should be it
This commit is contained in:
27
external/duckdb/data/csv/unquoted_escape/basic.tsv
vendored
Normal file
27
external/duckdb/data/csv/unquoted_escape/basic.tsv
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
0 \\ 0
|
||||
1 \ 1
|
||||
2 \
|
||||
2
|
||||
3 a\\a 3
|
||||
4 b\ b 4
|
||||
5 c\
|
||||
c 5
|
||||
6 \\d 6
|
||||
7 \ e 7
|
||||
8 \
|
||||
f 8
|
||||
9 g\\ 9
|
||||
10 h\ 10
|
||||
11 i\
|
||||
11
|
||||
12 \\j 12
|
||||
13 \ k 13
|
||||
14 \
|
||||
l 14
|
||||
15 \\\\ 15
|
||||
16 \ \ 16
|
||||
17 \
|
||||
\
|
||||
17
|
||||
18 \\\ \
|
||||
18
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
339
external/duckdb/data/csv/unquoted_escape/human_eval.csv
vendored
Normal file
339
external/duckdb/data/csv/unquoted_escape/human_eval.csv
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
HumanEval/0,from typing import List\
|
||||
\
|
||||
\
|
||||
def has_close_elements(numbers: List[float]\, threshold: float) -> bool:\
|
||||
""" Check if in given list of numbers\, are any two numbers closer to each other than\
|
||||
given threshold.\
|
||||
>>> has_close_elements([1.0\, 2.0\, 3.0]\, 0.5)\
|
||||
False\
|
||||
>>> has_close_elements([1.0\, 2.8\, 3.0\, 4.0\, 5.0\, 2.0]\, 0.3)\
|
||||
True\
|
||||
"""\
|
||||
,has_close_elements, for idx\, elem in enumerate(numbers):\
|
||||
for idx2\, elem2 in enumerate(numbers):\
|
||||
if idx != idx2:\
|
||||
distance = abs(elem - elem2)\
|
||||
if distance < threshold:\
|
||||
return True\
|
||||
\
|
||||
return False\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate([1.0\, 2.0\, 3.9\, 4.0\, 5.0\, 2.2]\, 0.3) == True\
|
||||
assert candidate([1.0\, 2.0\, 3.9\, 4.0\, 5.0\, 2.2]\, 0.05) == False\
|
||||
assert candidate([1.0\, 2.0\, 5.9\, 4.0\, 5.0]\, 0.95) == True\
|
||||
assert candidate([1.0\, 2.0\, 5.9\, 4.0\, 5.0]\, 0.8) == False\
|
||||
assert candidate([1.0\, 2.0\, 3.0\, 4.0\, 5.0\, 2.0]\, 0.1) == True\
|
||||
assert candidate([1.1\, 2.2\, 3.1\, 4.1\, 5.1]\, 1.0) == True\
|
||||
assert candidate([1.1\, 2.2\, 3.1\, 4.1\, 5.1]\, 0.5) == False\
|
||||
\
|
||||
|
||||
HumanEval/1,from typing import List\
|
||||
\
|
||||
\
|
||||
def separate_paren_groups(paren_string: str) -> List[str]:\
|
||||
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\
|
||||
separate those group into separate strings and return the list of those.\
|
||||
Separate groups are balanced (each open brace is properly closed) and not nested within each other\
|
||||
Ignore any spaces in the input string.\
|
||||
>>> separate_paren_groups('( ) (( )) (( )( ))')\
|
||||
['()'\, '(())'\, '(()())']\
|
||||
"""\
|
||||
,separate_paren_groups, result = []\
|
||||
current_string = []\
|
||||
current_depth = 0\
|
||||
\
|
||||
for c in paren_string:\
|
||||
if c == '(':\
|
||||
current_depth += 1\
|
||||
current_string.append(c)\
|
||||
elif c == ')':\
|
||||
current_depth -= 1\
|
||||
current_string.append(c)\
|
||||
\
|
||||
if current_depth == 0:\
|
||||
result.append(''.join(current_string))\
|
||||
current_string.clear()\
|
||||
\
|
||||
return result\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate('(()()) ((())) () ((())()())') == [\
|
||||
'(()())'\, '((()))'\, '()'\, '((())()())'\
|
||||
]\
|
||||
assert candidate('() (()) ((())) (((())))') == [\
|
||||
'()'\, '(())'\, '((()))'\, '(((())))'\
|
||||
]\
|
||||
assert candidate('(()(())((())))') == [\
|
||||
'(()(())((())))'\
|
||||
]\
|
||||
assert candidate('( ) (( )) (( )( ))') == ['()'\, '(())'\, '(()())']\
|
||||
|
||||
HumanEval/2,\
|
||||
\
|
||||
def truncate_number(number: float) -> float:\
|
||||
""" Given a positive floating point number\, it can be decomposed into\
|
||||
and integer part (largest integer smaller than given number) and decimals\
|
||||
(leftover part always smaller than 1).\
|
||||
\
|
||||
Return the decimal part of the number.\
|
||||
>>> truncate_number(3.5)\
|
||||
0.5\
|
||||
"""\
|
||||
,truncate_number, return number % 1.0\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate(3.5) == 0.5\
|
||||
assert abs(candidate(1.33) - 0.33) < 1e-6\
|
||||
assert abs(candidate(123.456) - 0.456) < 1e-6\
|
||||
|
||||
HumanEval/3,from typing import List\
|
||||
\
|
||||
\
|
||||
def below_zero(operations: List[int]) -> bool:\
|
||||
""" You're given a list of deposit and withdrawal operations on a bank account that starts with\
|
||||
zero balance. Your task is to detect if at any point the balance of account fallls below zero\, and\
|
||||
at that point function should return True. Otherwise it should return False.\
|
||||
>>> below_zero([1\, 2\, 3])\
|
||||
False\
|
||||
>>> below_zero([1\, 2\, -4\, 5])\
|
||||
True\
|
||||
"""\
|
||||
,below_zero, balance = 0\
|
||||
\
|
||||
for op in operations:\
|
||||
balance += op\
|
||||
if balance < 0:\
|
||||
return True\
|
||||
\
|
||||
return False\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate([]) == False\
|
||||
assert candidate([1\, 2\, -3\, 1\, 2\, -3]) == False\
|
||||
assert candidate([1\, 2\, -4\, 5\, 6]) == True\
|
||||
assert candidate([1\, -1\, 2\, -2\, 5\, -5\, 4\, -4]) == False\
|
||||
assert candidate([1\, -1\, 2\, -2\, 5\, -5\, 4\, -5]) == True\
|
||||
assert candidate([1\, -2\, 2\, -2\, 5\, -5\, 4\, -4]) == True\
|
||||
|
||||
HumanEval/4,from typing import List\
|
||||
\
|
||||
\
|
||||
def mean_absolute_deviation(numbers: List[float]) -> float:\
|
||||
""" For a given list of input numbers\, calculate Mean Absolute Deviation\
|
||||
around the mean of this dataset.\
|
||||
Mean Absolute Deviation is the average absolute difference between each\
|
||||
element and a centerpoint (mean in this case):\
|
||||
MAD = average | x - x_mean |\
|
||||
>>> mean_absolute_deviation([1.0\, 2.0\, 3.0\, 4.0])\
|
||||
1.0\
|
||||
"""\
|
||||
,mean_absolute_deviation, mean = sum(numbers) / len(numbers)\
|
||||
return sum(abs(x - mean) for x in numbers) / len(numbers)\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert abs(candidate([1.0\, 2.0\, 3.0]) - 2.0/3.0) < 1e-6\
|
||||
assert abs(candidate([1.0\, 2.0\, 3.0\, 4.0]) - 1.0) < 1e-6\
|
||||
assert abs(candidate([1.0\, 2.0\, 3.0\, 4.0\, 5.0]) - 6.0/5.0) < 1e-6\
|
||||
\
|
||||
|
||||
HumanEval/5,from typing import List\
|
||||
\
|
||||
\
|
||||
def intersperse(numbers: List[int]\, delimeter: int) -> List[int]:\
|
||||
""" Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\
|
||||
>>> intersperse([]\, 4)\
|
||||
[]\
|
||||
>>> intersperse([1\, 2\, 3]\, 4)\
|
||||
[1\, 4\, 2\, 4\, 3]\
|
||||
"""\
|
||||
,intersperse, if not numbers:\
|
||||
return []\
|
||||
\
|
||||
result = []\
|
||||
\
|
||||
for n in numbers[:-1]:\
|
||||
result.append(n)\
|
||||
result.append(delimeter)\
|
||||
\
|
||||
result.append(numbers[-1])\
|
||||
\
|
||||
return result\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate([]\, 7) == []\
|
||||
assert candidate([5\, 6\, 3\, 2]\, 8) == [5\, 8\, 6\, 8\, 3\, 8\, 2]\
|
||||
assert candidate([2\, 2\, 2]\, 2) == [2\, 2\, 2\, 2\, 2]\
|
||||
|
||||
HumanEval/6,from typing import List\
|
||||
\
|
||||
\
|
||||
def parse_nested_parens(paren_string: str) -> List[int]:\
|
||||
""" Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\
|
||||
For each of the group\, output the deepest level of nesting of parentheses.\
|
||||
E.g. (()()) has maximum two levels of nesting while ((())) has three.\
|
||||
\
|
||||
>>> parse_nested_parens('(()()) ((())) () ((())()())')\
|
||||
[2\, 3\, 1\, 3]\
|
||||
"""\
|
||||
,parse_nested_parens, def parse_paren_group(s):\
|
||||
depth = 0\
|
||||
max_depth = 0\
|
||||
for c in s:\
|
||||
if c == '(':\
|
||||
depth += 1\
|
||||
max_depth = max(depth\, max_depth)\
|
||||
else:\
|
||||
depth -= 1\
|
||||
\
|
||||
return max_depth\
|
||||
\
|
||||
return [parse_paren_group(x) for x in paren_string.split(' ') if x]\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate('(()()) ((())) () ((())()())') == [2\, 3\, 1\, 3]\
|
||||
assert candidate('() (()) ((())) (((())))') == [1\, 2\, 3\, 4]\
|
||||
assert candidate('(()(())((())))') == [4]\
|
||||
|
||||
HumanEval/7,from typing import List\
|
||||
\
|
||||
\
|
||||
def filter_by_substring(strings: List[str]\, substring: str) -> List[str]:\
|
||||
""" Filter an input list of strings only for ones that contain given substring\
|
||||
>>> filter_by_substring([]\, 'a')\
|
||||
[]\
|
||||
>>> filter_by_substring(['abc'\, 'bacd'\, 'cde'\, 'array']\, 'a')\
|
||||
['abc'\, 'bacd'\, 'array']\
|
||||
"""\
|
||||
,filter_by_substring, return [x for x in strings if substring in x]\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate([]\, 'john') == []\
|
||||
assert candidate(['xxx'\, 'asd'\, 'xxy'\, 'john doe'\, 'xxxAAA'\, 'xxx']\, 'xxx') == ['xxx'\, 'xxxAAA'\, 'xxx']\
|
||||
assert candidate(['xxx'\, 'asd'\, 'aaaxxy'\, 'john doe'\, 'xxxAAA'\, 'xxx']\, 'xx') == ['xxx'\, 'aaaxxy'\, 'xxxAAA'\, 'xxx']\
|
||||
assert candidate(['grunt'\, 'trumpet'\, 'prune'\, 'gruesome']\, 'run') == ['grunt'\, 'prune']\
|
||||
|
||||
HumanEval/8,from typing import List\, Tuple\
|
||||
\
|
||||
\
|
||||
def sum_product(numbers: List[int]) -> Tuple[int\, int]:\
|
||||
""" For a given list of integers\, return a tuple consisting of a sum and a product of all the integers in a list.\
|
||||
Empty sum should be equal to 0 and empty product should be equal to 1.\
|
||||
>>> sum_product([])\
|
||||
(0\, 1)\
|
||||
>>> sum_product([1\, 2\, 3\, 4])\
|
||||
(10\, 24)\
|
||||
"""\
|
||||
,sum_product, sum_value = 0\
|
||||
prod_value = 1\
|
||||
\
|
||||
for n in numbers:\
|
||||
sum_value += n\
|
||||
prod_value *= n\
|
||||
return sum_value\, prod_value\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate([]) == (0\, 1)\
|
||||
assert candidate([1\, 1\, 1]) == (3\, 1)\
|
||||
assert candidate([100\, 0]) == (100\, 0)\
|
||||
assert candidate([3\, 5\, 7]) == (3 + 5 + 7\, 3 * 5 * 7)\
|
||||
assert candidate([10]) == (10\, 10)\
|
||||
|
||||
HumanEval/9,from typing import List\, Tuple\
|
||||
\
|
||||
\
|
||||
def rolling_max(numbers: List[int]) -> List[int]:\
|
||||
""" From a given list of integers\, generate a list of rolling maximum element found until given moment\
|
||||
in the sequence.\
|
||||
>>> rolling_max([1\, 2\, 3\, 2\, 3\, 4\, 2])\
|
||||
[1\, 2\, 3\, 3\, 3\, 4\, 4]\
|
||||
"""\
|
||||
,rolling_max, running_max = None\
|
||||
result = []\
|
||||
\
|
||||
for n in numbers:\
|
||||
if running_max is None:\
|
||||
running_max = n\
|
||||
else:\
|
||||
running_max = max(running_max\, n)\
|
||||
\
|
||||
result.append(running_max)\
|
||||
\
|
||||
return result\
|
||||
,\
|
||||
\
|
||||
METADATA = {\
|
||||
'author': 'jt'\,\
|
||||
'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
assert candidate([]) == []\
|
||||
assert candidate([1\, 2\, 3\, 4]) == [1\, 2\, 3\, 4]\
|
||||
assert candidate([4\, 3\, 2\, 1]) == [4\, 4\, 4\, 4]\
|
||||
assert candidate([3\, 2\, 3\, 100\, 3]) == [3\, 3\, 3\, 100\, 100]\
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 4.
|
339
external/duckdb/data/csv/unquoted_escape/human_eval.tsv
vendored
Normal file
339
external/duckdb/data/csv/unquoted_escape/human_eval.tsv
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
HumanEval/0 from typing import List\
|
||||
\
|
||||
\
|
||||
def has_close_elements(numbers: List[float], threshold: float) -> bool:\
|
||||
\ """ Check if in given list of numbers, are any two numbers closer to each other than\
|
||||
\ given threshold.\
|
||||
\ >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\
|
||||
\ False\
|
||||
\ >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\
|
||||
\ True\
|
||||
\ """\
|
||||
has_close_elements \ for idx, elem in enumerate(numbers):\
|
||||
\ \ for idx2, elem2 in enumerate(numbers):\
|
||||
\ \ \ if idx != idx2:\
|
||||
\ \ \ \ distance = abs(elem - elem2)\
|
||||
\ \ \ \ if distance < threshold:\
|
||||
\ \ \ \ \ return True\
|
||||
\
|
||||
\ return False\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True\
|
||||
\ assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False\
|
||||
\ assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True\
|
||||
\ assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) == False\
|
||||
\ assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) == True\
|
||||
\ assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) == True\
|
||||
\ assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) == False\
|
||||
\
|
||||
|
||||
HumanEval/1 from typing import List\
|
||||
\
|
||||
\
|
||||
def separate_paren_groups(paren_string: str) -> List[str]:\
|
||||
\ """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\
|
||||
\ separate those group into separate strings and return the list of those.\
|
||||
\ Separate groups are balanced (each open brace is properly closed) and not nested within each other\
|
||||
\ Ignore any spaces in the input string.\
|
||||
\ >>> separate_paren_groups('( ) (( )) (( )( ))')\
|
||||
\ ['()', '(())', '(()())']\
|
||||
\ """\
|
||||
separate_paren_groups \ result = []\
|
||||
\ current_string = []\
|
||||
\ current_depth = 0\
|
||||
\
|
||||
\ for c in paren_string:\
|
||||
\ \ if c == '(':\
|
||||
\ \ \ current_depth += 1\
|
||||
\ \ \ current_string.append(c)\
|
||||
\ \ elif c == ')':\
|
||||
\ \ \ current_depth -= 1\
|
||||
\ \ \ current_string.append(c)\
|
||||
\
|
||||
\ \ \ if current_depth == 0:\
|
||||
\ \ \ \ result.append(''.join(current_string))\
|
||||
\ \ \ \ current_string.clear()\
|
||||
\
|
||||
\ return result\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate('(()()) ((())) () ((())()())') == [\
|
||||
\ \ '(()())', '((()))', '()', '((())()())'\
|
||||
\ ]\
|
||||
\ assert candidate('() (()) ((())) (((())))') == [\
|
||||
\ \ '()', '(())', '((()))', '(((())))'\
|
||||
\ ]\
|
||||
\ assert candidate('(()(())((())))') == [\
|
||||
\ \ '(()(())((())))'\
|
||||
\ ]\
|
||||
\ assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']\
|
||||
|
||||
HumanEval/2 \
|
||||
\
|
||||
def truncate_number(number: float) -> float:\
|
||||
\ """ Given a positive floating point number, it can be decomposed into\
|
||||
\ and integer part (largest integer smaller than given number) and decimals\
|
||||
\ (leftover part always smaller than 1).\
|
||||
\
|
||||
\ Return the decimal part of the number.\
|
||||
\ >>> truncate_number(3.5)\
|
||||
\ 0.5\
|
||||
\ """\
|
||||
truncate_number \ return number % 1.0\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate(3.5) == 0.5\
|
||||
\ assert abs(candidate(1.33) - 0.33) < 1e-6\
|
||||
\ assert abs(candidate(123.456) - 0.456) < 1e-6\
|
||||
|
||||
HumanEval/3 from typing import List\
|
||||
\
|
||||
\
|
||||
def below_zero(operations: List[int]) -> bool:\
|
||||
\ """ You're given a list of deposit and withdrawal operations on a bank account that starts with\
|
||||
\ zero balance. Your task is to detect if at any point the balance of account fallls below zero, and\
|
||||
\ at that point function should return True. Otherwise it should return False.\
|
||||
\ >>> below_zero([1, 2, 3])\
|
||||
\ False\
|
||||
\ >>> below_zero([1, 2, -4, 5])\
|
||||
\ True\
|
||||
\ """\
|
||||
below_zero \ balance = 0\
|
||||
\
|
||||
\ for op in operations:\
|
||||
\ \ balance += op\
|
||||
\ \ if balance < 0:\
|
||||
\ \ \ return True\
|
||||
\
|
||||
\ return False\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate([]) == False\
|
||||
\ assert candidate([1, 2, -3, 1, 2, -3]) == False\
|
||||
\ assert candidate([1, 2, -4, 5, 6]) == True\
|
||||
\ assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False\
|
||||
\ assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True\
|
||||
\ assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True\
|
||||
|
||||
HumanEval/4 from typing import List\
|
||||
\
|
||||
\
|
||||
def mean_absolute_deviation(numbers: List[float]) -> float:\
|
||||
\ """ For a given list of input numbers, calculate Mean Absolute Deviation\
|
||||
\ around the mean of this dataset.\
|
||||
\ Mean Absolute Deviation is the average absolute difference between each\
|
||||
\ element and a centerpoint (mean in this case):\
|
||||
\ MAD = average | x - x_mean |\
|
||||
\ >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\
|
||||
\ 1.0\
|
||||
\ """\
|
||||
mean_absolute_deviation \ mean = sum(numbers) / len(numbers)\
|
||||
\ return sum(abs(x - mean) for x in numbers) / len(numbers)\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert abs(candidate([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6\
|
||||
\ assert abs(candidate([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6\
|
||||
\ assert abs(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5.0) < 1e-6\
|
||||
\
|
||||
|
||||
HumanEval/5 from typing import List\
|
||||
\
|
||||
\
|
||||
def intersperse(numbers: List[int], delimeter: int) -> List[int]:\
|
||||
\ """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\
|
||||
\ >>> intersperse([], 4)\
|
||||
\ []\
|
||||
\ >>> intersperse([1, 2, 3], 4)\
|
||||
\ [1, 4, 2, 4, 3]\
|
||||
\ """\
|
||||
intersperse \ if not numbers:\
|
||||
\ \ return []\
|
||||
\
|
||||
\ result = []\
|
||||
\
|
||||
\ for n in numbers[:-1]:\
|
||||
\ \ result.append(n)\
|
||||
\ \ result.append(delimeter)\
|
||||
\
|
||||
\ result.append(numbers[-1])\
|
||||
\
|
||||
\ return result\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate([], 7) == []\
|
||||
\ assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2]\
|
||||
\ assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]\
|
||||
|
||||
HumanEval/6 from typing import List\
|
||||
\
|
||||
\
|
||||
def parse_nested_parens(paren_string: str) -> List[int]:\
|
||||
\ """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\
|
||||
\ For each of the group, output the deepest level of nesting of parentheses.\
|
||||
\ E.g. (()()) has maximum two levels of nesting while ((())) has three.\
|
||||
\
|
||||
\ >>> parse_nested_parens('(()()) ((())) () ((())()())')\
|
||||
\ [2, 3, 1, 3]\
|
||||
\ """\
|
||||
parse_nested_parens \ def parse_paren_group(s):\
|
||||
\ \ depth = 0\
|
||||
\ \ max_depth = 0\
|
||||
\ \ for c in s:\
|
||||
\ \ \ if c == '(':\
|
||||
\ \ \ \ depth += 1\
|
||||
\ \ \ \ max_depth = max(depth, max_depth)\
|
||||
\ \ \ else:\
|
||||
\ \ \ \ depth -= 1\
|
||||
\
|
||||
\ \ return max_depth\
|
||||
\
|
||||
\ return [parse_paren_group(x) for x in paren_string.split(' ') if x]\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3]\
|
||||
\ assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4]\
|
||||
\ assert candidate('(()(())((())))') == [4]\
|
||||
|
||||
HumanEval/7 from typing import List\
|
||||
\
|
||||
\
|
||||
def filter_by_substring(strings: List[str], substring: str) -> List[str]:\
|
||||
\ """ Filter an input list of strings only for ones that contain given substring\
|
||||
\ >>> filter_by_substring([], 'a')\
|
||||
\ []\
|
||||
\ >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')\
|
||||
\ ['abc', 'bacd', 'array']\
|
||||
\ """\
|
||||
filter_by_substring \ return [x for x in strings if substring in x]\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate([], 'john') == []\
|
||||
\ assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']\
|
||||
\ assert candidate(['xxx', 'asd', 'aaaxxy', 'john doe', 'xxxAAA', 'xxx'], 'xx') == ['xxx', 'aaaxxy', 'xxxAAA', 'xxx']\
|
||||
\ assert candidate(['grunt', 'trumpet', 'prune', 'gruesome'], 'run') == ['grunt', 'prune']\
|
||||
|
||||
HumanEval/8 from typing import List, Tuple\
|
||||
\
|
||||
\
|
||||
def sum_product(numbers: List[int]) -> Tuple[int, int]:\
|
||||
\ """ For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.\
|
||||
\ Empty sum should be equal to 0 and empty product should be equal to 1.\
|
||||
\ >>> sum_product([])\
|
||||
\ (0, 1)\
|
||||
\ >>> sum_product([1, 2, 3, 4])\
|
||||
\ (10, 24)\
|
||||
\ """\
|
||||
sum_product \ sum_value = 0\
|
||||
\ prod_value = 1\
|
||||
\
|
||||
\ for n in numbers:\
|
||||
\ \ sum_value += n\
|
||||
\ \ prod_value *= n\
|
||||
\ return sum_value, prod_value\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate([]) == (0, 1)\
|
||||
\ assert candidate([1, 1, 1]) == (3, 1)\
|
||||
\ assert candidate([100, 0]) == (100, 0)\
|
||||
\ assert candidate([3, 5, 7]) == (3 + 5 + 7, 3 * 5 * 7)\
|
||||
\ assert candidate([10]) == (10, 10)\
|
||||
|
||||
HumanEval/9 from typing import List, Tuple\
|
||||
\
|
||||
\
|
||||
def rolling_max(numbers: List[int]) -> List[int]:\
|
||||
\ """ From a given list of integers, generate a list of rolling maximum element found until given moment\
|
||||
\ in the sequence.\
|
||||
\ >>> rolling_max([1, 2, 3, 2, 3, 4, 2])\
|
||||
\ [1, 2, 3, 3, 3, 4, 4]\
|
||||
\ """\
|
||||
rolling_max \ running_max = None\
|
||||
\ result = []\
|
||||
\
|
||||
\ for n in numbers:\
|
||||
\ \ if running_max is None:\
|
||||
\ \ \ running_max = n\
|
||||
\ \ else:\
|
||||
\ \ \ running_max = max(running_max, n)\
|
||||
\
|
||||
\ \ result.append(running_max)\
|
||||
\
|
||||
\ return result\
|
||||
\
|
||||
\
|
||||
METADATA = {\
|
||||
\ 'author': 'jt',\
|
||||
\ 'dataset': 'test'\
|
||||
}\
|
||||
\
|
||||
\
|
||||
def check(candidate):\
|
||||
\ assert candidate([]) == []\
|
||||
\ assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4]\
|
||||
\ assert candidate([4, 3, 2, 1]) == [4, 4, 4, 4]\
|
||||
\ assert candidate([3, 2, 3, 100, 3]) == [3, 3, 3, 100, 100]\
|
||||
|
||||
|
Can't render this file because it has a wrong number of fields in line 2.
|
6
external/duckdb/data/csv/unquoted_escape/identical.csv
vendored
Normal file
6
external/duckdb/data/csv/unquoted_escape/identical.csv
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
x,y
|
||||
"",a""b
|
||||
c""d,""
|
||||
"ef,""gh""",
|
||||
,"""ij"",kl"
|
||||
mn",op""
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 5.
|
8
external/duckdb/data/csv/unquoted_escape/mixed.csv
vendored
Normal file
8
external/duckdb/data/csv/unquoted_escape/mixed.csv
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
w,x,y,z
|
||||
\\,"\\\"\\",0,\"
|
||||
\,,"\,\"\,",1,\"a\"
|
||||
\","\"\"\"",2,\"b
|
||||
\
|
||||
,"
|
||||
\"\
|
||||
",3,c\"
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 8.
|
10
external/duckdb/data/csv/unquoted_escape/plain.csv
vendored
Normal file
10
external/duckdb/data/csv/unquoted_escape/plain.csv
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
0,\\
|
||||
1,\,
|
||||
2,\"
|
||||
3,\\\,
|
||||
4,\\\"
|
||||
5,\,\"
|
||||
6,\\\,\"
|
||||
7,\N
|
||||
8,\\\N
|
||||
9,\Na
|
||||
|
Can't render this file because it contains an unexpected character in line 3 and column 4.
|
Reference in New Issue
Block a user