Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
between_current_row_and_expr_following | (self) | Check rows between current row and expr following.
| Check rows between current row and expr following.
| def between_current_row_and_expr_following(self):
"""Check rows between current row and expr following.
"""
expected = convert_output("""
i | b | bool_and | bool_or
---+---+----------+---------
1 | 1 | 1 | 1
2 | 1 | 0 | 1
3 | 0 | 0 | 0
4 | 0 | 0 | 1
... | [
"def",
"between_current_row_and_expr_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n i | b | bool_and | bool_or\n ---+---+----------+---------\n 1 | 1 | 1 | 1\n 2 | 1 | 0 | 1\n 3 | 0 | 0 | 0\n 4 | 0 | 0 | 1\n... | [
220,
0
] | [
239,
5
] | python | en | ['en', 'en', 'en'] | True |
between_unbounded_preceding_and_current_row | (self) | Check rows between unbounded preceding and current row.
| Check rows between unbounded preceding and current row.
| def between_unbounded_preceding_and_current_row(self):
"""Check rows between unbounded preceding and current row.
"""
expected = convert_output("""
four | two | sum | last_value
------+-----+-----+------------
0 | 0 | 0 | 0
0 | 0 | 0 | 0
... | [
"def",
"between_unbounded_preceding_and_current_row",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n four | two | sum | last_value\n ------+-----+-----+------------\n 0 | 0 | 0 | 0\n 0 | 0 | 0 | 0\n ... | [
245,
0
] | [
279,
5
] | python | en | ['en', 'en', 'en'] | True |
between_unbounded_preceding_and_unbounded_preceding_error | (self) | Check rows between unbounded preceding and unbounded preceding returns an error.
| Check rows between unbounded preceding and unbounded preceding returns an error.
| def between_unbounded_preceding_and_unbounded_preceding_error(self):
"""Check rows between unbounded preceding and unbounded preceding returns an error.
"""
exitcode, message = frame_end_unbounded_preceding_error()
self.context.node.query("SELECT number,sum(number) OVER (ROWS BETWEEN UNBOUNDED PRECEDIN... | [
"def",
"between_unbounded_preceding_and_unbounded_preceding_error",
"(",
"self",
")",
":",
"exitcode",
",",
"message",
"=",
"frame_end_unbounded_preceding_error",
"(",
")",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER (ROWS BETWE... | [
285,
0
] | [
291,
43
] | python | en | ['en', 'en', 'en'] | True |
between_unbounded_preceding_and_expr_preceding | (self) | Check rows between unbounded preceding and expr preceding frame.
| Check rows between unbounded preceding and expr preceding frame.
| def between_unbounded_preceding_and_expr_preceding(self):
"""Check rows between unbounded preceding and expr preceding frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
1 | 5000 | 0
2 | 3900 | 5000
3 | 4800 | 8900
4 ... | [
"def",
"between_unbounded_preceding_and_expr_preceding",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 1 | 5000 | 0\n 2 | 3900 | 5000\n 3 | 4800 | 8900\n 4 | 4800 | ... | [
297,
0
] | [
318,
5
] | python | en | ['en', 'en', 'en'] | True |
between_unbounded_preceding_and_unbounded_following | (self) | Check rows between unbounded preceding and unbounded following frame.
| Check rows between unbounded preceding and unbounded following frame.
| def between_unbounded_preceding_and_unbounded_following(self):
"""Check rows between unbounded preceding and unbounded following frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
1 | 5000 | 47100
2 | 3900 | 47100
3 | 4800 |... | [
"def",
"between_unbounded_preceding_and_unbounded_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 1 | 5000 | 47100\n 2 | 3900 | 47100\n 3 | 4800 | 47100\n 4 ... | [
324,
0
] | [
345,
5
] | python | en | ['en', 'en', 'en'] | True |
between_unbounded_preceding_and_expr_following | (self) | Check rows between unbounded preceding and expr following.
| Check rows between unbounded preceding and expr following.
| def between_unbounded_preceding_and_expr_following(self):
"""Check rows between unbounded preceding and expr following.
"""
expected = convert_output("""
sum | unique1 | four
-----+---------+------
1 | 0 | 0
3 | 1 | 1
6 | 2 | 2
... | [
"def",
"between_unbounded_preceding_and_expr_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | unique1 | four\n -----+---------+------\n 1 | 0 | 0\n 3 | 1 | 1\n 6 | 2 | 2\n 10 | ... | [
351,
0
] | [
374,
5
] | python | en | ['en', 'en', 'en'] | True |
between_unbounded_following_error | (self, range) | Check rows between unbounded following and any end frame returns an error.
| Check rows between unbounded following and any end frame returns an error.
| def between_unbounded_following_error(self, range):
"""Check rows between unbounded following and any end frame returns an error.
"""
exitcode, message = frame_start_error()
self.context.node.query(f"SELECT number,sum(number) OVER (ROWS BETWEEN {range}) FROM numbers(1,3)",
exitcode=exitcode, me... | [
"def",
"between_unbounded_following_error",
"(",
"self",
",",
"range",
")",
":",
"exitcode",
",",
"message",
"=",
"frame_start_error",
"(",
")",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"f\"SELECT number,sum(number) OVER (ROWS BETWEEN {range}) FROM number... | [
387,
0
] | [
393,
43
] | python | en | ['en', 'en', 'en'] | True |
between_expr_following_error | (self, range, exitcode, message) | Check cases when rows between expr following returns an error.
| Check cases when rows between expr following returns an error.
| def between_expr_following_error(self, range, exitcode, message):
"""Check cases when rows between expr following returns an error.
"""
self.context.node.query(f"SELECT number,sum(number) OVER (ROWS BETWEEN {range}) FROM numbers(1,3)",
exitcode=exitcode, message=message) | [
"def",
"between_expr_following_error",
"(",
"self",
",",
"range",
",",
"exitcode",
",",
"message",
")",
":",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"f\"SELECT number,sum(number) OVER (ROWS BETWEEN {range}) FROM numbers(1,3)\"",
",",
"exitcode",
"=",
"... | [
404,
0
] | [
408,
43
] | python | en | ['en', 'en', 'en'] | True |
between_expr_following_and_expr_following_error | (self) | Check rows between expr following and expr following returns an error when frame end index is less
than frame start.
| Check rows between expr following and expr following returns an error when frame end index is less
than frame start.
| def between_expr_following_and_expr_following_error(self):
"""Check rows between expr following and expr following returns an error when frame end index is less
than frame start.
"""
exitcode, message = frame_start_error()
self.context.node.query("SELECT number,sum(number) OVER (ROWS BETWEEN 1 FOLL... | [
"def",
"between_expr_following_and_expr_following_error",
"(",
"self",
")",
":",
"exitcode",
",",
"message",
"=",
"frame_start_error",
"(",
")",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER (ROWS BETWEEN 1 FOLLOWING AND 0 FOLLOWI... | [
414,
0
] | [
421,
43
] | python | en | ['en', 'en', 'en'] | True |
between_expr_following_and_unbounded_following | (self) | Check rows between exp following and unbounded following frame.
| Check rows between exp following and unbounded following frame.
| def between_expr_following_and_unbounded_following(self):
"""Check rows between exp following and unbounded following frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
1 | 5000 | 28600
2 | 3900 | 25100
3 | 4800 | 20900
... | [
"def",
"between_expr_following_and_unbounded_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 1 | 5000 | 28600\n 2 | 3900 | 25100\n 3 | 4800 | 20900\n 4 | 48... | [
427,
0
] | [
448,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_following_and_expr_following | (self) | Check rows between exp following and expr following frame when end of the frame is greater than
the start of the frame.
| Check rows between exp following and expr following frame when end of the frame is greater than
the start of the frame.
| def between_expr_following_and_expr_following(self):
"""Check rows between exp following and expr following frame when end of the frame is greater than
the start of the frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
1 | 5000 | 17000
... | [
"def",
"between_expr_following_and_expr_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 1 | 5000 | 17000\n 2 | 3900 | 17300\n 3 | 4800 | 18500\n 4 | 4800 |... | [
454,
0
] | [
476,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_current_row | (self) | Check rows between exp preceding and current row frame.
| Check rows between exp preceding and current row frame.
| def between_expr_preceding_and_current_row(self):
"""Check rows between exp preceding and current row frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
8 | 6000 | 6000
10 | 5200 | 11200
11 | 5200 | 10400
""")
execut... | [
"def",
"between_expr_preceding_and_current_row",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 8 | 6000 | 6000\n 10 | 5200 | 11200\n 11 | 5200 | 10400\n \"\"\"",
")",
"ex... | [
482,
0
] | [
496,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_unbounded_preceding_error | (self) | Check rows between expr preceding and unbounded preceding returns an error.
| Check rows between expr preceding and unbounded preceding returns an error.
| def between_expr_preceding_and_unbounded_preceding_error(self):
"""Check rows between expr preceding and unbounded preceding returns an error.
"""
exitcode, message = frame_end_error()
self.context.node.query("SELECT number,sum(number) OVER (ROWS BETWEEN 1 PRECEDING AND UNBOUNDED PRECEDING) FROM number... | [
"def",
"between_expr_preceding_and_unbounded_preceding_error",
"(",
"self",
")",
":",
"exitcode",
",",
"message",
"=",
"frame_end_error",
"(",
")",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER (ROWS BETWEEN 1 PRECEDING AND UNBOUN... | [
502,
0
] | [
508,
43
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_unbounded_following | (self) | Check rows between exp preceding and unbounded following frame.
| Check rows between exp preceding and unbounded following frame.
| def between_expr_preceding_and_unbounded_following(self):
"""Check rows between exp preceding and unbounded following frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
8 | 6000 | 16400
10 | 5200 | 16400
11 | 5200 | 10400
... | [
"def",
"between_expr_preceding_and_unbounded_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 8 | 6000 | 16400\n 10 | 5200 | 16400\n 11 | 5200 | 10400\n \"\"\"",
")... | [
514,
0
] | [
528,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_expr_preceding_error | (self) | Check rows between expr preceding and expr preceding returns an error when frame end is
before frame start.
| Check rows between expr preceding and expr preceding returns an error when frame end is
before frame start.
| def between_expr_preceding_and_expr_preceding_error(self):
"""Check rows between expr preceding and expr preceding returns an error when frame end is
before frame start.
"""
exitcode, message = frame_start_error()
self.context.node.query("SELECT number,sum(number) OVER (ROWS BETWEEN 1 PRECEDING AND... | [
"def",
"between_expr_preceding_and_expr_preceding_error",
"(",
"self",
")",
":",
"exitcode",
",",
"message",
"=",
"frame_start_error",
"(",
")",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT number,sum(number) OVER (ROWS BETWEEN 1 PRECEDING AND 2 PRECEDI... | [
534,
0
] | [
541,
43
] | python | en | ['en', 'gl', 'en'] | True |
between_expr_preceding_and_expr_preceding | (self) | Check rows between expr preceding and expr preceding frame when frame end is after or at frame start.
| Check rows between expr preceding and expr preceding frame when frame end is after or at frame start.
| def between_expr_preceding_and_expr_preceding(self):
"""Check rows between expr preceding and expr preceding frame when frame end is after or at frame start.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
1 | 5000 | 5000
2 | 3900 | 8900
... | [
"def",
"between_expr_preceding_and_expr_preceding",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 1 | 5000 | 5000\n 2 | 3900 | 8900\n 3 | 4800 | 8700\n 4 | 4800 | 96... | [
547,
0
] | [
568,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_expr_following | (self) | Check rows between expr preceding and expr following frame.
| Check rows between expr preceding and expr following frame.
| def between_expr_preceding_and_expr_following(self):
"""Check rows between expr preceding and expr following frame.
"""
expected = convert_output("""
empno | salary | sum
--------+--------+--------
8 | 6000 | 11200
10 | 5200 | 16400
11 | 5200 | 10400
""")
... | [
"def",
"between_expr_preceding_and_expr_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | sum\n --------+--------+--------\n 8 | 6000 | 11200\n 10 | 5200 | 16400\n 11 | 5200 | 10400\n \"\"\"",
")",
... | [
574,
0
] | [
588,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_following_and_expr_following_ref | (self) | Check reference result for rows between expr following and expr following range.
| Check reference result for rows between expr following and expr following range.
| def between_expr_following_and_expr_following_ref(self):
"""Check reference result for rows between expr following and expr following range.
"""
expected = convert_output("""
sum | unique1 | four
-----+---------+------
6 | 0 | 0
9 | 1 | 1
12 | 2 | 2
15... | [
"def",
"between_expr_following_and_expr_following_ref",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | unique1 | four\n -----+---------+------\n 6 | 0 | 0\n 9 | 1 | 1\n 12 | 2 | 2\n 15 | 3 | 3\n 18 | ... | [
595,
0
] | [
618,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_expr_preceding_ref | (self) | Check reference result for rows between expr preceding and expr preceding frame.
| Check reference result for rows between expr preceding and expr preceding frame.
| def between_expr_preceding_and_expr_preceding_ref(self):
"""Check reference result for rows between expr preceding and expr preceding frame.
"""
expected = convert_output("""
sum | unique1 | four
-----+---------+------
0 | 0 | 0
0 | 1 | 1
1 | 2 | 2
3 ... | [
"def",
"between_expr_preceding_and_expr_preceding_ref",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | unique1 | four\n -----+---------+------\n 0 | 0 | 0\n 0 | 1 | 1\n 1 | 2 | 2\n 3 | 3 | 3\n 5 | ... | [
624,
0
] | [
647,
5
] | python | en | ['en', 'en', 'en'] | True |
between_expr_preceding_and_expr_following_ref | (self) | Check reference result for rows between expr preceding and expr following frame.
| Check reference result for rows between expr preceding and expr following frame.
| def between_expr_preceding_and_expr_following_ref(self):
"""Check reference result for rows between expr preceding and expr following frame.
"""
expected = convert_output("""
sum | unique1 | four
-----+---------+------
3 | 0 | 0
6 | 1 | 1
10 | 2 | 2
15... | [
"def",
"between_expr_preceding_and_expr_following_ref",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | unique1 | four\n -----+---------+------\n 3 | 0 | 0\n 6 | 1 | 1\n 10 | 2 | 2\n 15 | 3 | 3\n 20 | ... | [
653,
0
] | [
676,
5
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check defining rows frame.
| Check defining rows frame.
| def feature(self):
"""Check defining rows frame.
"""
for scenario in loads(current_module(), Scenario):
Scenario(run=scenario, flags=TE) | [
"def",
"feature",
"(",
"self",
")",
":",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",
")",
",",
"Scenario",
")",
":",
"Scenario",
"(",
"run",
"=",
"scenario",
",",
"flags",
"=",
"TE",
")"
] | [
683,
0
] | [
687,
40
] | python | en | ['es', 'en', 'en'] | True |
test_valid_input | () | Return 200 Success for valid 2 character US state postal code. | Return 200 Success for valid 2 character US state postal code. | def test_valid_input():
"""Return 200 Success for valid 2 character US state postal code."""
response = client.get('/viz/IL')
assert response.status_code == 200
assert 'Illinois Unemployment Rate' in response.text | [
"def",
"test_valid_input",
"(",
")",
":",
"response",
"=",
"client",
".",
"get",
"(",
"'/viz/IL'",
")",
"assert",
"response",
".",
"status_code",
"==",
"200",
"assert",
"'Illinois Unemployment Rate'",
"in",
"response",
".",
"text"
] | [
7,
0
] | [
11,
56
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_input | () | Return 404 if the endpoint isn't valid US state postal code. | Return 404 if the endpoint isn't valid US state postal code. | def test_invalid_input():
"""Return 404 if the endpoint isn't valid US state postal code."""
response = client.get('/viz/ZZ')
body = response.json()
assert response.status_code == 404
assert body['detail'] == 'State code ZZ not found' | [
"def",
"test_invalid_input",
"(",
")",
":",
"response",
"=",
"client",
".",
"get",
"(",
"'/viz/ZZ'",
")",
"body",
"=",
"response",
".",
"json",
"(",
")",
"assert",
"response",
".",
"status_code",
"==",
"404",
"assert",
"body",
"[",
"'detail'",
"]",
"==",... | [
14,
0
] | [
19,
54
] | python | en | ['en', 'en', 'en'] | True |
is_executable_file | (filename) |
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
|
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
| def is_executable_file(filename):
"""
Return 'True' if 'filename' names a valid file which is likely
an executable. A file is considered an executable if it starts with the
magic bytes for a EXE, Mach O, or ELF file.
"""
if not os.path.isfile(filename):
return False
with open(filenam... | [
"def",
"is_executable_file",
"(",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
"return",
"False",
"with",
"open",
"(",
"filename",
",",
"mode",
"=",
"'rb'",
")",
"as",
"f",
":",
"magic_bytes",
"=",
"... | [
14,
0
] | [
36,
40
] | python | en | ['en', 'error', 'th'] | False |
is_json_file | (filename) |
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.
|
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.
| def is_json_file(filename):
"""
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.
"""
try:
with open(filename, 'r') as f:
json.load(f)
return True
except:
pass
return False | [
"def",
"is_json_file",
"(",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"json",
".",
"load",
"(",
"f",
")",
"return",
"True",
"except",
":",
"pass",
"return",
"False"
] | [
39,
0
] | [
50,
16
] | python | en | ['en', 'error', 'th'] | False |
classify_input_file | (filename) |
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
|
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
| def classify_input_file(filename):
"""
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
"""
ftype = IT_Invalid
err_msg = None
if not os.path.exists(filename):
... | [
"def",
"classify_input_file",
"(",
"filename",
")",
":",
"ftype",
"=",
"IT_Invalid",
"err_msg",
"=",
"None",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"err_msg",
"=",
"\"'%s' does not exist\"",
"%",
"filename",
"elif",
"not",
... | [
53,
0
] | [
71,
25
] | python | en | ['en', 'error', 'th'] | False |
check_input_file | (filename) |
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
|
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
| def check_input_file(filename):
"""
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
"""
ftype, msg = classify_input_file(filename)
if ftype == IT_Invalid:
print("Invalid input ... | [
"def",
"check_input_file",
"(",
"filename",
")",
":",
"ftype",
",",
"msg",
"=",
"classify_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_Invalid",
":",
"print",
"(",
"\"Invalid input file: %s\"",
"%",
"msg",
")",
"sys",
".",
"exit",
"(",
"1",
... | [
74,
0
] | [
84,
16
] | python | en | ['en', 'error', 'th'] | False |
find_benchmark_flag | (prefix, benchmark_flags) |
Search the specified list of flags for a flag matching `<prefix><arg>` and
if it is found return the arg it specifies. If specified more than once the
last value is returned. If the flag is not found None is returned.
|
Search the specified list of flags for a flag matching `<prefix><arg>` and
if it is found return the arg it specifies. If specified more than once the
last value is returned. If the flag is not found None is returned.
| def find_benchmark_flag(prefix, benchmark_flags):
"""
Search the specified list of flags for a flag matching `<prefix><arg>` and
if it is found return the arg it specifies. If specified more than once the
last value is returned. If the flag is not found None is returned.
"""
assert prefix.starts... | [
"def",
"find_benchmark_flag",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"result",
"=",
"None",
"for",
"f",
"in",
"benchmark_flags",
":",
"if"... | [
86,
0
] | [
97,
17
] | python | en | ['en', 'error', 'th'] | False |
remove_benchmark_flags | (prefix, benchmark_flags) |
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
|
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
| def remove_benchmark_flags(prefix, benchmark_flags):
"""
Return a new list containing the specified benchmark_flags except those
with the specified prefix.
"""
assert prefix.startswith('--') and prefix.endswith('=')
return [f for f in benchmark_flags if not f.startswith(prefix)] | [
"def",
"remove_benchmark_flags",
"(",
"prefix",
",",
"benchmark_flags",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'--'",
")",
"and",
"prefix",
".",
"endswith",
"(",
"'='",
")",
"return",
"[",
"f",
"for",
"f",
"in",
"benchmark_flags",
"if",
"no... | [
99,
0
] | [
105,
67
] | python | en | ['en', 'error', 'th'] | False |
load_benchmark_results | (fname) |
Read benchmark output from a file and return the JSON object.
REQUIRES: 'fname' names a file containing JSON benchmark output.
|
Read benchmark output from a file and return the JSON object.
REQUIRES: 'fname' names a file containing JSON benchmark output.
| def load_benchmark_results(fname):
"""
Read benchmark output from a file and return the JSON object.
REQUIRES: 'fname' names a file containing JSON benchmark output.
"""
with open(fname, 'r') as f:
return json.load(f) | [
"def",
"load_benchmark_results",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'r'",
")",
"as",
"f",
":",
"return",
"json",
".",
"load",
"(",
"f",
")"
] | [
107,
0
] | [
113,
27
] | python | en | ['en', 'error', 'th'] | False |
run_benchmark | (exe_name, benchmark_flags) |
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
|
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
| def run_benchmark(exe_name, benchmark_flags):
"""
Run a benchmark specified by 'exe_name' with the specified
'benchmark_flags'. The benchmark is run directly as a subprocess to preserve
real time console output.
RETURNS: A JSON object representing the benchmark output
"""
output_name = find_... | [
"def",
"run_benchmark",
"(",
"exe_name",
",",
"benchmark_flags",
")",
":",
"output_name",
"=",
"find_benchmark_flag",
"(",
"'--benchmark_out='",
",",
"benchmark_flags",
")",
"is_temp_output",
"=",
"False",
"if",
"output_name",
"is",
"None",
":",
"is_temp_output",
"=... | [
116,
0
] | [
142,
19
] | python | en | ['en', 'error', 'th'] | False |
run_or_load_benchmark | (filename, benchmark_flags) |
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned.
|
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned.
| def run_or_load_benchmark(filename, benchmark_flags):
"""
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result return... | [
"def",
"run_or_load_benchmark",
"(",
"filename",
",",
"benchmark_flags",
")",
":",
"ftype",
"=",
"check_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_JSON",
":",
"return",
"load_benchmark_results",
"(",
"filename",
")",
"elif",
"ftype",
"==",
"IT_E... | [
145,
0
] | [
158,
20
] | python | en | ['en', 'error', 'th'] | False |
without_privilege | (self, table_type, node=None) | Check that user without insert privilege on a table is not able to insert on that table.
| Check that user without insert privilege on a table is not able to insert on that table.
| def without_privilege(self, table_type, node=None):
"""Check that user without insert privilege on a table is not able to insert on that table.
"""
user_name = f"user_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name, tab... | [
"def",
"without_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"... | [
21,
0
] | [
43,
55
] | python | en | ['en', 'en', 'en'] | True |
user_with_privilege | (self, table_type, node=None) | Check that user can insert into a table on which they have insert privilege.
| Check that user can insert into a table on which they have insert privilege.
| def user_with_privilege(self, table_type, node=None):
"""Check that user can insert into a table on which they have insert privilege.
"""
user_name = f"user_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name, table_type):
... | [
"def",
"user_with_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
... | [
49,
0
] | [
69,
62
] | python | en | ['en', 'en', 'en'] | True |
all_privilege | (self, table_type, node=None) | Check that user can insert into a table on which they have insert privilege.
| Check that user can insert into a table on which they have insert privilege.
| def all_privilege(self, table_type, node=None):
"""Check that user can insert into a table on which they have insert privilege.
"""
user_name = f"user_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name, table_type):
... | [
"def",
"all_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
76,
0
] | [
97,
62
] | python | en | ['en', 'en', 'en'] | True |
user_with_revoked_privilege | (self, table_type, node=None) | Check that user is unable to insert into a table after insert privilege on that table has been revoked from user.
| Check that user is unable to insert into a table after insert privilege on that table has been revoked from user.
| def user_with_revoked_privilege(self, table_type, node=None):
"""Check that user is unable to insert into a table after insert privilege on that table has been revoked from user.
"""
user_name = f"user_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node = self.context.node
... | [
"def",
"user_with_revoked_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
... | [
103,
0
] | [
124,
86
] | python | en | ['en', 'en', 'en'] | True |
user_with_all_revoked_privilege | (self, table_type, node=None) | Check that user is unable to insert into a table after ALL privilege has been revoked from user.
| Check that user is unable to insert into a table after ALL privilege has been revoked from user.
| def user_with_all_revoked_privilege(self, table_type, node=None):
"""Check that user is unable to insert into a table after ALL privilege has been revoked from user.
"""
user_name = f"user_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node = self.context.node
with table... | [
"def",
"user_with_all_revoked_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"contex... | [
127,
0
] | [
148,
86
] | python | en | ['en', 'en', 'en'] | True |
user_column_privileges | (self, grant_columns, insert_columns_pass, data_fail, data_pass, table_type,
revoke_columns=None, insert_columns_fail=None, node=None) | Check that user is able to insert on columns where insert privilege is granted
and unable to insert on columns where insert privilege has not been granted or has been revoked.
| Check that user is able to insert on columns where insert privilege is granted
and unable to insert on columns where insert privilege has not been granted or has been revoked.
| def user_column_privileges(self, grant_columns, insert_columns_pass, data_fail, data_pass, table_type,
revoke_columns=None, insert_columns_fail=None, node=None):
"""Check that user is able to insert on columns where insert privilege is granted
and unable to insert on columns where insert privilege has not b... | [
"def",
"user_column_privileges",
"(",
"self",
",",
"grant_columns",
",",
"insert_columns_pass",
",",
"data_fail",
",",
"data_pass",
",",
"table_type",
",",
"revoke_columns",
"=",
"None",
",",
"insert_columns_fail",
"=",
"None",
",",
"node",
"=",
"None",
")",
":"... | [
167,
0
] | [
207,
90
] | python | en | ['en', 'en', 'en'] | True |
role_with_privilege | (self, table_type, node=None) | Check that user can insert into a table after being granted a role that
has the insert privilege for that table.
| Check that user can insert into a table after being granted a role that
has the insert privilege for that table.
| def role_with_privilege(self, table_type, node=None):
"""Check that user can insert into a table after being granted a role that
has the insert privilege for that table.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
... | [
"def",
"role_with_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node... | [
213,
0
] | [
239,
62
] | python | en | ['en', 'en', 'en'] | True |
role_with_revoked_privilege | (self, table_type, node=None) | Check that user with a role that has insert privilege on a table
is unable to insert into that table after insert privilege
has been revoked from the role.
| Check that user with a role that has insert privilege on a table
is unable to insert into that table after insert privilege
has been revoked from the role.
| def role_with_revoked_privilege(self, table_type, node=None):
"""Check that user with a role that has insert privilege on a table
is unable to insert into that table after insert privilege
has been revoked from the role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
table... | [
"def",
"role_with_revoked_privilege",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",... | [
245,
0
] | [
273,
86
] | python | en | ['en', 'en', 'en'] | True |
user_with_revoked_role | (self, table_type, node=None) | Check that user with a role that has insert privilege on a table
is unable to insert into that table after the role has been revoked from the user.
| Check that user with a role that has insert privilege on a table
is unable to insert into that table after the role has been revoked from the user.
| def user_with_revoked_role(self, table_type, node=None):
"""Check that user with a role that has insert privilege on a table
is unable to insert into that table after the role has been revoked from the user.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
table_name = f"table_{... | [
"def",
"user_with_revoked_role",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"n... | [
276,
0
] | [
303,
86
] | python | en | ['en', 'en', 'en'] | True |
role_column_privileges | (self, grant_columns, insert_columns_pass, data_fail, data_pass,
table_type, revoke_columns=None, insert_columns_fail=None, node=None) | Check that user with a role is able to insert on columns where insert privilege is granted to the role
and unable to insert on columns where insert privilege has not been granted or has been revoked from the role.
| Check that user with a role is able to insert on columns where insert privilege is granted to the role
and unable to insert on columns where insert privilege has not been granted or has been revoked from the role.
| def role_column_privileges(self, grant_columns, insert_columns_pass, data_fail, data_pass,
table_type, revoke_columns=None, insert_columns_fail=None, node=None):
"""Check that user with a role is able to insert on columns where insert privilege is granted to the role
and unable to insert on columns where in... | [
"def",
"role_column_privileges",
"(",
"self",
",",
"grant_columns",
",",
"insert_columns_pass",
",",
"data_fail",
",",
"data_pass",
",",
"table_type",
",",
"revoke_columns",
"=",
"None",
",",
"insert_columns_fail",
"=",
"None",
",",
"node",
"=",
"None",
")",
":"... | [
321,
0
] | [
365,
90
] | python | en | ['en', 'en', 'en'] | True |
user_with_privilege_on_cluster | (self, table_type, node=None) | Check that user is able or unable to insert into a table
depending whether insert privilege is granted or revoked on a cluster.
| Check that user is able or unable to insert into a table
depending whether insert privilege is granted or revoked on a cluster.
| def user_with_privilege_on_cluster(self, table_type, node=None):
"""Check that user is able or unable to insert into a table
depending whether insert privilege is granted or revoked on a cluster.
"""
user_name = f"user_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node =... | [
"def",
"user_with_privilege_on_cluster",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context... | [
371,
0
] | [
417,
79
] | python | en | ['en', 'en', 'en'] | True |
role_with_privilege_on_cluster | (self, table_type, node=None) | Check that user with role is able to insert into a table
depending whether insert privilege granted or revoked from the role on the cluster.
| Check that user with role is able to insert into a table
depending whether insert privilege granted or revoked from the role on the cluster.
| def role_with_privilege_on_cluster(self, table_type, node=None):
"""Check that user with role is able to insert into a table
depending whether insert privilege granted or revoked from the role on the cluster.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
table_name = f"table_... | [
"def",
"role_with_privilege_on_cluster",
"(",
"self",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
"... | [
423,
0
] | [
476,
79
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, table_type, parallel=None, stress=None, node="clickhouse1") | Check the RBAC functionality of INSERT.
| Check the RBAC functionality of INSERT.
| def feature(self, table_type, parallel=None, stress=None, node="clickhouse1"):
"""Check the RBAC functionality of INSERT.
"""
self.context.node = self.context.cluster.node(node)
self.context.node1 = self.context.cluster.node("clickhouse1")
self.context.node2 = self.context.cluster.node("clickhouse2... | [
"def",
"feature",
"(",
"self",
",",
"table_type",
",",
"parallel",
"=",
"None",
",",
"stress",
"=",
"None",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
... | [
487,
0
] | [
507,
23
] | python | en | ['en', 'en', 'en'] | True |
is_good_response | (resp) |
Returns True if the response seems to be HTML, False otherwise.
|
Returns True if the response seems to be HTML, False otherwise.
| def is_good_response(resp):
"""
Returns True if the response seems to be HTML, False otherwise.
"""
content_type = resp.headers['Content-Type'].lower()
return (resp.status_code == 200
and content_type is not None
and content_type.find('html') > -1) | [
"def",
"is_good_response",
"(",
"resp",
")",
":",
"content_type",
"=",
"resp",
".",
"headers",
"[",
"'Content-Type'",
"]",
".",
"lower",
"(",
")",
"return",
"(",
"resp",
".",
"status_code",
"==",
"200",
"and",
"content_type",
"is",
"not",
"None",
"and",
... | [
41,
0
] | [
48,
47
] | python | en | ['en', 'error', 'th'] | False |
error_using_non_window_function | (self) | Check that trying to use non window or aggregate function over a window
returns an error.
| Check that trying to use non window or aggregate function over a window
returns an error.
| def error_using_non_window_function(self):
"""Check that trying to use non window or aggregate function over a window
returns an error.
"""
exitcode = 63
message = "DB::Exception: Unknown aggregate function numbers"
sql = ("SELECT numbers(1, 100) OVER () FROM empsalary")
with When("I execu... | [
"def",
"error_using_non_window_function",
"(",
"self",
")",
":",
"exitcode",
"=",
"63",
"message",
"=",
"\"DB::Exception: Unknown aggregate function numbers\"",
"sql",
"=",
"(",
"\"SELECT numbers(1, 100) OVER () FROM empsalary\"",
")",
"with",
"When",
"(",
"\"I execute query\... | [
6,
0
] | [
16,
81
] | python | en | ['en', 'en', 'en'] | True |
error_order_by_another_window_function | (self) | Check that trying to order by another window function returns an error.
| Check that trying to order by another window function returns an error.
| def error_order_by_another_window_function(self):
"""Check that trying to order by another window function returns an error.
"""
exitcode = 184
message = "DB::Exception: Window function rank() OVER (ORDER BY random() ASC) is found inside window definition in query"
sql = ("SELECT rank() OVER (ORDER... | [
"def",
"error_order_by_another_window_function",
"(",
"self",
")",
":",
"exitcode",
"=",
"184",
"message",
"=",
"\"DB::Exception: Window function rank() OVER (ORDER BY random() ASC) is found inside window definition in query\"",
"sql",
"=",
"(",
"\"SELECT rank() OVER (ORDER BY rank() O... | [
19,
0
] | [
28,
81
] | python | en | ['en', 'en', 'en'] | True |
error_window_function_in_where | (self) | Check that trying to use window function in `WHERE` returns an error.
| Check that trying to use window function in `WHERE` returns an error.
| def error_window_function_in_where(self):
"""Check that trying to use window function in `WHERE` returns an error.
"""
exitcode = 184
message = "DB::Exception: Window function row_number() OVER (ORDER BY salary ASC) is found in WHERE in query"
sql = ("SELECT * FROM empsalary WHERE row_number() OVER... | [
"def",
"error_window_function_in_where",
"(",
"self",
")",
":",
"exitcode",
"=",
"184",
"message",
"=",
"\"DB::Exception: Window function row_number() OVER (ORDER BY salary ASC) is found in WHERE in query\"",
"sql",
"=",
"(",
"\"SELECT * FROM empsalary WHERE row_number() OVER (ORDER BY... | [
31,
0
] | [
40,
81
] | python | en | ['en', 'en', 'en'] | True |
error_window_function_in_join | (self) | Check that trying to use window function in `JOIN` returns an error.
| Check that trying to use window function in `JOIN` returns an error.
| def error_window_function_in_join(self):
"""Check that trying to use window function in `JOIN` returns an error.
"""
exitcode = 48
message = "DB::Exception: JOIN ON inequalities are not supported. Unexpected 'row_number() OVER (ORDER BY salary ASC) < 10"
sql = ("SELECT * FROM empsalary INNER JOIN t... | [
"def",
"error_window_function_in_join",
"(",
"self",
")",
":",
"exitcode",
"=",
"48",
"message",
"=",
"\"DB::Exception: JOIN ON inequalities are not supported. Unexpected 'row_number() OVER (ORDER BY salary ASC) < 10\"",
"sql",
"=",
"(",
"\"SELECT * FROM empsalary INNER JOIN tenk1 ON r... | [
43,
0
] | [
52,
81
] | python | en | ['en', 'en', 'en'] | True |
error_window_function_in_group_by | (self) | Check that trying to use window function in `GROUP BY` returns an error.
| Check that trying to use window function in `GROUP BY` returns an error.
| def error_window_function_in_group_by(self):
"""Check that trying to use window function in `GROUP BY` returns an error.
"""
exitcode = 47
message = "DB::Exception: Unknown identifier: row_number() OVER (ORDER BY salary ASC); there are columns"
sql = ("SELECT rank() OVER (ORDER BY 1), count(*) FROM... | [
"def",
"error_window_function_in_group_by",
"(",
"self",
")",
":",
"exitcode",
"=",
"47",
"message",
"=",
"\"DB::Exception: Unknown identifier: row_number() OVER (ORDER BY salary ASC); there are columns\"",
"sql",
"=",
"(",
"\"SELECT rank() OVER (ORDER BY 1), count(*) FROM empsalary GR... | [
55,
0
] | [
64,
81
] | python | en | ['en', 'en', 'en'] | True |
error_window_function_in_having | (self) | Check that trying to use window function in `HAVING` returns an error.
| Check that trying to use window function in `HAVING` returns an error.
| def error_window_function_in_having(self):
"""Check that trying to use window function in `HAVING` returns an error.
"""
exitcode = 184
message = "DB::Exception: Window function row_number() OVER (ORDER BY salary ASC) is found in HAVING in query"
sql = ("SELECT rank() OVER (ORDER BY 1), count(*) FR... | [
"def",
"error_window_function_in_having",
"(",
"self",
")",
":",
"exitcode",
"=",
"184",
"message",
"=",
"\"DB::Exception: Window function row_number() OVER (ORDER BY salary ASC) is found in HAVING in query\"",
"sql",
"=",
"(",
"\"SELECT rank() OVER (ORDER BY 1), count(*) FROM empsalar... | [
67,
0
] | [
76,
81
] | python | en | ['en', 'en', 'en'] | True |
error_select_from_window | (self) | Check that trying to use window function in `FROM` returns an error.
| Check that trying to use window function in `FROM` returns an error.
| def error_select_from_window(self):
"""Check that trying to use window function in `FROM` returns an error.
"""
exitcode = 46
message = "DB::Exception: Unknown table function rank"
sql = ("SELECT * FROM rank() OVER (ORDER BY random())")
with When("I execute query", description=sql):
r ... | [
"def",
"error_select_from_window",
"(",
"self",
")",
":",
"exitcode",
"=",
"46",
"message",
"=",
"\"DB::Exception: Unknown table function rank\"",
"sql",
"=",
"(",
"\"SELECT * FROM rank() OVER (ORDER BY random())\"",
")",
"with",
"When",
"(",
"\"I execute query\"",
",",
"... | [
79,
0
] | [
88,
81
] | python | en | ['en', 'en', 'en'] | True |
error_window_function_in_alter_delete_where | (self) | Check that trying to use window function in `ALTER DELETE`'s `WHERE` clause returns an error.
| Check that trying to use window function in `ALTER DELETE`'s `WHERE` clause returns an error.
| def error_window_function_in_alter_delete_where(self):
"""Check that trying to use window function in `ALTER DELETE`'s `WHERE` clause returns an error.
"""
if self.context.distributed:
exitcode = 48
message = "Exception: Table engine Distributed doesn't support mutations"
else:
e... | [
"def",
"error_window_function_in_alter_delete_where",
"(",
"self",
")",
":",
"if",
"self",
".",
"context",
".",
"distributed",
":",
"exitcode",
"=",
"48",
"message",
"=",
"\"Exception: Table engine Distributed doesn't support mutations\"",
"else",
":",
"exitcode",
"=",
... | [
91,
0
] | [
104,
81
] | python | en | ['en', 'en', 'en'] | True |
error_named_window_defined_twice | (self) | Check that trying to define named window twice.
| Check that trying to define named window twice.
| def error_named_window_defined_twice(self):
"""Check that trying to define named window twice.
"""
exitcode = 36
message = "DB::Exception: Window 'w' is defined twice in the WINDOW clause"
sql = ("SELECT count(*) OVER w FROM tenk1 WINDOW w AS (ORDER BY unique1), w AS (ORDER BY unique1)")
with ... | [
"def",
"error_named_window_defined_twice",
"(",
"self",
")",
":",
"exitcode",
"=",
"36",
"message",
"=",
"\"DB::Exception: Window 'w' is defined twice in the WINDOW clause\"",
"sql",
"=",
"(",
"\"SELECT count(*) OVER w FROM tenk1 WINDOW w AS (ORDER BY unique1), w AS (ORDER BY unique1)\... | [
107,
0
] | [
116,
81
] | python | en | ['en', 'en', 'en'] | True |
error_coma_between_partition_by_and_order_by_clause | (self) | Check that trying to use a coma between partition by and order by clause.
| Check that trying to use a coma between partition by and order by clause.
| def error_coma_between_partition_by_and_order_by_clause(self):
"""Check that trying to use a coma between partition by and order by clause.
"""
exitcode = 62
message = "DB::Exception: Syntax error"
sql = ("SELECT rank() OVER (PARTITION BY four, ORDER BY ten) FROM tenk1")
with When("I execute q... | [
"def",
"error_coma_between_partition_by_and_order_by_clause",
"(",
"self",
")",
":",
"exitcode",
"=",
"62",
"message",
"=",
"\"DB::Exception: Syntax error\"",
"sql",
"=",
"(",
"\"SELECT rank() OVER (PARTITION BY four, ORDER BY ten) FROM tenk1\"",
")",
"with",
"When",
"(",
"\"... | [
119,
0
] | [
128,
81
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check different error conditions.
| Check different error conditions.
| def feature(self):
"""Check different error conditions.
"""
for scenario in loads(current_module(), Scenario):
Scenario(run=scenario, flags=TE) | [
"def",
"feature",
"(",
"self",
")",
":",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",
")",
",",
"Scenario",
")",
":",
"Scenario",
"(",
"run",
"=",
"scenario",
",",
"flags",
"=",
"TE",
")"
] | [
132,
0
] | [
136,
40
] | python | da | ['da', 'it', 'en'] | False |
reverseByteOrder | (data) | Reverses the byte order of an int (16-bit) or long (32-bit) value. | Reverses the byte order of an int (16-bit) or long (32-bit) value. | def reverseByteOrder(data):
"""Reverses the byte order of an int (16-bit) or long (32-bit) value."""
# Courtesy Vishal Sapre
byteCount = len(hex(data)[2:].replace('L','')[::2])
val = 0
for i in range(byteCount):
val = (val << 8) | (data & 0xff)
data >>= 8
return val | [
"def",
"reverseByteOrder",
"(",
"data",
")",
":",
"# Courtesy Vishal Sapre",
"byteCount",
"=",
"len",
"(",
"hex",
"(",
"data",
")",
"[",
"2",
":",
"]",
".",
"replace",
"(",
"'L'",
",",
"''",
")",
"[",
":",
":",
"2",
"]",
")",
"val",
"=",
"0",
"fo... | [
29,
0
] | [
37,
14
] | python | en | ['en', 'en', 'en'] | True |
get_default_bus | () | Return the default bus number based on the device platform. For a
Raspberry Pi either bus 0 or 1 (based on the Pi revision) will be returned.
For a Beaglebone Black the first user accessible bus, 1, will be returned.
| Return the default bus number based on the device platform. For a
Raspberry Pi either bus 0 or 1 (based on the Pi revision) will be returned.
For a Beaglebone Black the first user accessible bus, 1, will be returned.
| def get_default_bus():
"""Return the default bus number based on the device platform. For a
Raspberry Pi either bus 0 or 1 (based on the Pi revision) will be returned.
For a Beaglebone Black the first user accessible bus, 1, will be returned.
"""
plat = Platform.platform_detect()
if plat == Pla... | [
"def",
"get_default_bus",
"(",
")",
":",
"plat",
"=",
"Platform",
".",
"platform_detect",
"(",
")",
"if",
"plat",
"==",
"Platform",
".",
"RASPBERRY_PI",
":",
"if",
"Platform",
".",
"pi_revision",
"(",
")",
"==",
"1",
":",
"# Revision 1 Pi uses I2C bus 0.",
"... | [
39,
0
] | [
56,
79
] | python | en | ['en', 'da', 'en'] | True |
get_i2c_device | (address, busnum=None, **kwargs) | Return an I2C device for the specified address and on the specified bus.
If busnum isn't specified, the default I2C bus for the platform will attempt
to be detected.
| Return an I2C device for the specified address and on the specified bus.
If busnum isn't specified, the default I2C bus for the platform will attempt
to be detected.
| def get_i2c_device(address, busnum=None, **kwargs):
"""Return an I2C device for the specified address and on the specified bus.
If busnum isn't specified, the default I2C bus for the platform will attempt
to be detected.
"""
if busnum is None:
busnum = get_default_bus()
return Device(add... | [
"def",
"get_i2c_device",
"(",
"address",
",",
"busnum",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"busnum",
"is",
"None",
":",
"busnum",
"=",
"get_default_bus",
"(",
")",
"return",
"Device",
"(",
"address",
",",
"busnum",
",",
"*",
"*",
"... | [
58,
0
] | [
65,
44
] | python | en | ['en', 'en', 'en'] | True |
require_repeated_start | () | Enable repeated start conditions for I2C register reads. This is the
normal behavior for I2C, however on some platforms like the Raspberry Pi
there are bugs which disable repeated starts unless explicitly enabled with
this function. See this thread for more details:
http://www.raspberrypi.org/forums... | Enable repeated start conditions for I2C register reads. This is the
normal behavior for I2C, however on some platforms like the Raspberry Pi
there are bugs which disable repeated starts unless explicitly enabled with
this function. See this thread for more details:
http://www.raspberrypi.org/forums... | def require_repeated_start():
"""Enable repeated start conditions for I2C register reads. This is the
normal behavior for I2C, however on some platforms like the Raspberry Pi
there are bugs which disable repeated starts unless explicitly enabled with
this function. See this thread for more details:
... | [
"def",
"require_repeated_start",
"(",
")",
":",
"plat",
"=",
"Platform",
".",
"platform_detect",
"(",
")",
"if",
"plat",
"==",
"Platform",
".",
"RASPBERRY_PI",
":",
"# On the Raspberry Pi there is a bug where register reads don't send a",
"# repeated start condition like the ... | [
67,
0
] | [
81,
100
] | python | en | ['en', 'en', 'en'] | True |
Device.__init__ | (self, address, busnum) | Create an instance of the I2C device at the specified address on the
specified I2C bus number. | Create an instance of the I2C device at the specified address on the
specified I2C bus number. | def __init__(self, address, busnum):
"""Create an instance of the I2C device at the specified address on the
specified I2C bus number."""
self._address = address
self._bus = smbus.SMBus(busnum)
self._logger = logging.getLogger('Adafruit_I2C.Device.Bus.{0}.Address.{1:#0X}' \
... | [
"def",
"__init__",
"(",
"self",
",",
"address",
",",
"busnum",
")",
":",
"self",
".",
"_address",
"=",
"address",
"self",
".",
"_bus",
"=",
"smbus",
".",
"SMBus",
"(",
"busnum",
")",
"self",
".",
"_logger",
"=",
"logging",
".",
"getLogger",
"(",
"'Ad... | [
90,
4
] | [
96,
57
] | python | en | ['en', 'en', 'en'] | True |
Device.writeRaw8 | (self, value) | Write an 8-bit value on the bus (without register). | Write an 8-bit value on the bus (without register). | def writeRaw8(self, value):
"""Write an 8-bit value on the bus (without register)."""
value = value & 0xFF
self._bus.write_byte(self._address, value)
self._logger.debug("Wrote 0x%02X",
value) | [
"def",
"writeRaw8",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"value",
"&",
"0xFF",
"self",
".",
"_bus",
".",
"write_byte",
"(",
"self",
".",
"_address",
",",
"value",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Wrote 0x%02X\"",
",",
... | [
98,
4
] | [
103,
27
] | python | en | ['en', 'en', 'en'] | True |
Device.write8 | (self, register, value) | Write an 8-bit value to the specified register. | Write an 8-bit value to the specified register. | def write8(self, register, value):
"""Write an 8-bit value to the specified register."""
value = value & 0xFF
self._bus.write_byte_data(self._address, register, value)
self._logger.debug("Wrote 0x%02X to register 0x%02X",
value, register) | [
"def",
"write8",
"(",
"self",
",",
"register",
",",
"value",
")",
":",
"value",
"=",
"value",
"&",
"0xFF",
"self",
".",
"_bus",
".",
"write_byte_data",
"(",
"self",
".",
"_address",
",",
"register",
",",
"value",
")",
"self",
".",
"_logger",
".",
"de... | [
105,
4
] | [
110,
37
] | python | en | ['en', 'en', 'en'] | True |
Device.write16 | (self, register, value) | Write a 16-bit value to the specified register. | Write a 16-bit value to the specified register. | def write16(self, register, value):
"""Write a 16-bit value to the specified register."""
value = value & 0xFFFF
self._bus.write_word_data(self._address, register, value)
self._logger.debug("Wrote 0x%04X to register pair 0x%02X, 0x%02X",
value, register, register+1) | [
"def",
"write16",
"(",
"self",
",",
"register",
",",
"value",
")",
":",
"value",
"=",
"value",
"&",
"0xFFFF",
"self",
".",
"_bus",
".",
"write_word_data",
"(",
"self",
".",
"_address",
",",
"register",
",",
"value",
")",
"self",
".",
"_logger",
".",
... | [
112,
4
] | [
117,
49
] | python | en | ['en', 'en', 'en'] | True |
Device.writeList | (self, register, data) | Write bytes to the specified register. | Write bytes to the specified register. | def writeList(self, register, data):
"""Write bytes to the specified register."""
self._bus.write_i2c_block_data(self._address, register, data)
self._logger.debug("Wrote to register 0x%02X: %s",
register, data) | [
"def",
"writeList",
"(",
"self",
",",
"register",
",",
"data",
")",
":",
"self",
".",
"_bus",
".",
"write_i2c_block_data",
"(",
"self",
".",
"_address",
",",
"register",
",",
"data",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Wrote to register 0x%0... | [
119,
4
] | [
123,
36
] | python | en | ['en', 'en', 'en'] | True |
Device.readList | (self, register, length) | Read a length number of bytes from the specified register. Results
will be returned as a bytearray. | Read a length number of bytes from the specified register. Results
will be returned as a bytearray. | def readList(self, register, length):
"""Read a length number of bytes from the specified register. Results
will be returned as a bytearray."""
results = self._bus.read_i2c_block_data(self._address, register, length)
self._logger.debug("Read the following from register 0x%02X: %s",
... | [
"def",
"readList",
"(",
"self",
",",
"register",
",",
"length",
")",
":",
"results",
"=",
"self",
".",
"_bus",
".",
"read_i2c_block_data",
"(",
"self",
".",
"_address",
",",
"register",
",",
"length",
")",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"... | [
125,
4
] | [
131,
22
] | python | en | ['en', 'en', 'en'] | True |
Device.readRaw8 | (self) | Read an 8-bit value on the bus (without register). | Read an 8-bit value on the bus (without register). | def readRaw8(self):
"""Read an 8-bit value on the bus (without register)."""
result = self._bus.read_byte(self._address) & 0xFF
self._logger.debug("Read 0x%02X",
result)
return result | [
"def",
"readRaw8",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"_bus",
".",
"read_byte",
"(",
"self",
".",
"_address",
")",
"&",
"0xFF",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Read 0x%02X\"",
",",
"result",
")",
"return",
"result"
] | [
133,
4
] | [
138,
21
] | python | en | ['en', 'en', 'en'] | True |
Device.readU8 | (self, register) | Read an unsigned byte from the specified register. | Read an unsigned byte from the specified register. | def readU8(self, register):
"""Read an unsigned byte from the specified register."""
result = self._bus.read_byte_data(self._address, register) & 0xFF
self._logger.debug("Read 0x%02X from register 0x%02X",
result, register)
return result | [
"def",
"readU8",
"(",
"self",
",",
"register",
")",
":",
"result",
"=",
"self",
".",
"_bus",
".",
"read_byte_data",
"(",
"self",
".",
"_address",
",",
"register",
")",
"&",
"0xFF",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Read 0x%02X from register 0x%... | [
140,
4
] | [
145,
21
] | python | en | ['en', 'en', 'en'] | True |
Device.readS8 | (self, register) | Read a signed byte from the specified register. | Read a signed byte from the specified register. | def readS8(self, register):
"""Read a signed byte from the specified register."""
result = self.readU8(register)
if result > 127:
result -= 256
return result | [
"def",
"readS8",
"(",
"self",
",",
"register",
")",
":",
"result",
"=",
"self",
".",
"readU8",
"(",
"register",
")",
"if",
"result",
">",
"127",
":",
"result",
"-=",
"256",
"return",
"result"
] | [
147,
4
] | [
152,
21
] | python | en | ['en', 'en', 'en'] | True |
Device.readU16 | (self, register, little_endian=True) | Read an unsigned 16-bit value from the specified register, with the
specified endianness (default little endian, or least significant byte
first). | Read an unsigned 16-bit value from the specified register, with the
specified endianness (default little endian, or least significant byte
first). | def readU16(self, register, little_endian=True):
"""Read an unsigned 16-bit value from the specified register, with the
specified endianness (default little endian, or least significant byte
first)."""
result = self._bus.read_word_data(self._address,register) & 0xFFFF
self._logge... | [
"def",
"readU16",
"(",
"self",
",",
"register",
",",
"little_endian",
"=",
"True",
")",
":",
"result",
"=",
"self",
".",
"_bus",
".",
"read_word_data",
"(",
"self",
".",
"_address",
",",
"register",
")",
"&",
"0xFFFF",
"self",
".",
"_logger",
".",
"deb... | [
154,
4
] | [
165,
21
] | python | en | ['en', 'en', 'en'] | True |
Device.readS16 | (self, register, little_endian=True) | Read a signed 16-bit value from the specified register, with the
specified endianness (default little endian, or least significant byte
first). | Read a signed 16-bit value from the specified register, with the
specified endianness (default little endian, or least significant byte
first). | def readS16(self, register, little_endian=True):
"""Read a signed 16-bit value from the specified register, with the
specified endianness (default little endian, or least significant byte
first)."""
result = self.readU16(register, little_endian)
if result > 32767:
res... | [
"def",
"readS16",
"(",
"self",
",",
"register",
",",
"little_endian",
"=",
"True",
")",
":",
"result",
"=",
"self",
".",
"readU16",
"(",
"register",
",",
"little_endian",
")",
"if",
"result",
">",
"32767",
":",
"result",
"-=",
"65536",
"return",
"result"... | [
167,
4
] | [
174,
21
] | python | en | ['en', 'en', 'en'] | True |
Device.readU16LE | (self, register) | Read an unsigned 16-bit value from the specified register, in little
endian byte order. | Read an unsigned 16-bit value from the specified register, in little
endian byte order. | def readU16LE(self, register):
"""Read an unsigned 16-bit value from the specified register, in little
endian byte order."""
return self.readU16(register, little_endian=True) | [
"def",
"readU16LE",
"(",
"self",
",",
"register",
")",
":",
"return",
"self",
".",
"readU16",
"(",
"register",
",",
"little_endian",
"=",
"True",
")"
] | [
176,
4
] | [
179,
57
] | python | en | ['en', 'en', 'en'] | True |
Device.readU16BE | (self, register) | Read an unsigned 16-bit value from the specified register, in big
endian byte order. | Read an unsigned 16-bit value from the specified register, in big
endian byte order. | def readU16BE(self, register):
"""Read an unsigned 16-bit value from the specified register, in big
endian byte order."""
return self.readU16(register, little_endian=False) | [
"def",
"readU16BE",
"(",
"self",
",",
"register",
")",
":",
"return",
"self",
".",
"readU16",
"(",
"register",
",",
"little_endian",
"=",
"False",
")"
] | [
181,
4
] | [
184,
58
] | python | en | ['en', 'en', 'en'] | True |
Device.readS16LE | (self, register) | Read a signed 16-bit value from the specified register, in little
endian byte order. | Read a signed 16-bit value from the specified register, in little
endian byte order. | def readS16LE(self, register):
"""Read a signed 16-bit value from the specified register, in little
endian byte order."""
return self.readS16(register, little_endian=True) | [
"def",
"readS16LE",
"(",
"self",
",",
"register",
")",
":",
"return",
"self",
".",
"readS16",
"(",
"register",
",",
"little_endian",
"=",
"True",
")"
] | [
186,
4
] | [
189,
57
] | python | en | ['en', 'en', 'en'] | True |
Device.readS16BE | (self, register) | Read a signed 16-bit value from the specified register, in big
endian byte order. | Read a signed 16-bit value from the specified register, in big
endian byte order. | def readS16BE(self, register):
"""Read a signed 16-bit value from the specified register, in big
endian byte order."""
return self.readS16(register, little_endian=False) | [
"def",
"readS16BE",
"(",
"self",
",",
"register",
")",
":",
"return",
"self",
".",
"readS16",
"(",
"register",
",",
"little_endian",
"=",
"False",
")"
] | [
191,
4
] | [
194,
58
] | python | en | ['en', 'en', 'en'] | True |
TestDumpConfig.test_dump_config | (self) |
Ensures that config files are successfully dumped to disk.
|
Ensures that config files are successfully dumped to disk.
| def test_dump_config(self):
"""
Ensures that config files are successfully dumped to disk.
"""
mcrouter = self.get_mcrouter(self.valid_config)
self.assertTrue(self._is_mcrouter_running(mcrouter))
dumped_config_root = self._get_dumped_config_root()
# check if dir... | [
"def",
"test_dump_config",
"(",
"self",
")",
":",
"mcrouter",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"valid_config",
")",
"self",
".",
"assertTrue",
"(",
"self",
".",
"_is_mcrouter_running",
"(",
"mcrouter",
")",
")",
"dumped_config_root",
"=",
... | [
42,
4
] | [
63,
74
] | python | en | ['en', 'error', 'th'] | False |
TestDumpConfig.test_dont_dump_bad_config | (self) |
Ensures that mcrouter do not dump invalid configs.
|
Ensures that mcrouter do not dump invalid configs.
| def test_dont_dump_bad_config(self):
"""
Ensures that mcrouter do not dump invalid configs.
"""
# first, copy valid config to a temp file, as we need to modify it later
base_dir = BaseDirectory('McConfigs')
config_path = self._get_valid_config(base_dir)
# create ... | [
"def",
"test_dont_dump_bad_config",
"(",
"self",
")",
":",
"# first, copy valid config to a temp file, as we need to modify it later",
"base_dir",
"=",
"BaseDirectory",
"(",
"'McConfigs'",
")",
"config_path",
"=",
"self",
".",
"_get_valid_config",
"(",
"base_dir",
")",
"# c... | [
65,
4
] | [
93,
74
] | python | en | ['en', 'error', 'th'] | False |
TestDumpConfig.test_use_dumped_config | (self) |
Test if mcrouter can successfully reconfigure from dumped configs
when a bad config file if pushed.
|
Test if mcrouter can successfully reconfigure from dumped configs
when a bad config file if pushed.
| def test_use_dumped_config(self):
"""
Test if mcrouter can successfully reconfigure from dumped configs
when a bad config file if pushed.
"""
# first, copy valid config to a temp file, as we need to modify it later
base_dir = BaseDirectory('McConfigs')
config_path... | [
"def",
"test_use_dumped_config",
"(",
"self",
")",
":",
"# first, copy valid config to a temp file, as we need to modify it later",
"base_dir",
"=",
"BaseDirectory",
"(",
"'McConfigs'",
")",
"config_path",
"=",
"self",
".",
"_get_valid_config",
"(",
"base_dir",
")",
"# crea... | [
95,
4
] | [
117,
60
] | python | en | ['en', 'error', 'th'] | False |
TestDumpConfig.test_dumped_config_too_old | (self) |
Test if mcrouter fails to configure if dumped config is too old
to be trusted.
|
Test if mcrouter fails to configure if dumped config is too old
to be trusted.
| def test_dumped_config_too_old(self):
"""
Test if mcrouter fails to configure if dumped config is too old
to be trusted.
"""
# first, copy valid config to a temp file, as we need to modify it later
base_dir = BaseDirectory('McConfigs')
config_path = self._get_vali... | [
"def",
"test_dumped_config_too_old",
"(",
"self",
")",
":",
"# first, copy valid config to a temp file, as we need to modify it later",
"base_dir",
"=",
"BaseDirectory",
"(",
"'McConfigs'",
")",
"config_path",
"=",
"self",
".",
"_get_valid_config",
"(",
"base_dir",
")",
"# ... | [
119,
4
] | [
146,
61
] | python | en | ['en', 'error', 'th'] | False |
main | (global_config, **settings) | This function returns a Pyramid WSGI application.
| This function returns a Pyramid WSGI application.
| def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
session_factory = session_factory_from_settings(settings)
config = Configurator(settings=settings)
config.set_session_factory(session_factory)
config.include('pyramid_mako')
config.add_static_view('static', 'static'... | [
"def",
"main",
"(",
"global_config",
",",
"*",
"*",
"settings",
")",
":",
"session_factory",
"=",
"session_factory_from_settings",
"(",
"settings",
")",
"config",
"=",
"Configurator",
"(",
"settings",
"=",
"settings",
")",
"config",
".",
"set_session_factory",
"... | [
3,
0
] | [
29,
30
] | python | en | ['en', 'hmn', 'en'] | True |
get_neighbors | (hnsw, i, level) | list the neighbors for node i at level | list the neighbors for node i at level | def get_neighbors(hnsw, i, level):
" list the neighbors for node i at level "
assert i < hnsw.levels.size()
assert level < hnsw.levels.at(i)
be = np.empty(2, 'uint64')
hnsw.neighbor_range(i, level, faiss.swig_ptr(be), faiss.swig_ptr(be[1:]))
return [hnsw.neighbors.at(j) for j in range(be[0], be[... | [
"def",
"get_neighbors",
"(",
"hnsw",
",",
"i",
",",
"level",
")",
":",
"assert",
"i",
"<",
"hnsw",
".",
"levels",
".",
"size",
"(",
")",
"assert",
"level",
"<",
"hnsw",
".",
"levels",
".",
"at",
"(",
"i",
")",
"be",
"=",
"np",
".",
"empty",
"("... | [
262,
0
] | [
268,
62
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check show create role query syntax.
```sql
SHOW CREATE ROLE name
```
| Check show create role query syntax. | def feature(self, node="clickhouse1"):
"""Check show create role query syntax.
```sql
SHOW CREATE ROLE name
```
"""
node = self.context.cluster.node(node)
@contextmanager
def setup(role):
try:
with Given("I have a role"):
node.query(f"CREATE ROLE OR ... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"setup",
"(",
"role",
")",
":",
"try",
":",
"with",
"Given... | [
9,
0
] | [
38,
84
] | python | en | ['pt', 'en', 'en'] | True |
order_by_asc_range_between_days_preceding_and_days_following | (self) | Check range between days preceding and days following
with ascending order by.
| Check range between days preceding and days following
with ascending order by.
| def order_by_asc_range_between_days_preceding_and_days_following(self):
"""Check range between days preceding and days following
with ascending order by.
"""
expected = convert_output("""
sum | salary | enroll_date
-------+--------+-------------
34900 | 5000 | 2006-10-01
38400 | ... | [
"def",
"order_by_asc_range_between_days_preceding_and_days_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | salary | enroll_date\n -------+--------+-------------\n 34900 | 5000 | 2006-10-01\n 38400 | 3900 | 2006-12-23\n 47100 | ... | [
6,
0
] | [
29,
5
] | python | en | ['en', 'en', 'en'] | True |
order_by_desc_range_between_days_preceding_and_days_following | (self) | Check range between days preceding and days following
with descending order by. | Check range between days preceding and days following
with descending order by. | def order_by_desc_range_between_days_preceding_and_days_following(self):
"""Check range between days preceding and days following
with descending order by."""
expected = convert_output("""
sum | salary | enroll_date
-------+--------+-------------
34900 | 5000 | 2006-10-01
38400 | 390... | [
"def",
"order_by_desc_range_between_days_preceding_and_days_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | salary | enroll_date\n -------+--------+-------------\n 34900 | 5000 | 2006-10-01\n 38400 | 3900 | 2006-12-23\n 47100 | ... | [
32,
0
] | [
54,
5
] | python | en | ['en', 'en', 'en'] | True |
order_by_desc_range_between_days_following_and_days_following | (self) | Check range between days following and days following with
descending order by.
| Check range between days following and days following with
descending order by.
| def order_by_desc_range_between_days_following_and_days_following(self):
"""Check range between days following and days following with
descending order by.
"""
expected = convert_output("""
sum | salary | enroll_date
-------+--------+-------------
0 | 5000 | 2006-10-01
0 |... | [
"def",
"order_by_desc_range_between_days_following_and_days_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | salary | enroll_date\n -------+--------+-------------\n 0 | 5000 | 2006-10-01\n 0 | 3900 | 2006-12-23\n 0 | ... | [
57,
0
] | [
80,
5
] | python | en | ['en', 'en', 'en'] | True |
order_by_desc_range_between_days_preceding_and_days_preceding | (self) | Check range between days preceding and days preceding with
descending order by.
| Check range between days preceding and days preceding with
descending order by.
| def order_by_desc_range_between_days_preceding_and_days_preceding(self):
"""Check range between days preceding and days preceding with
descending order by.
"""
expected = convert_output("""
sum | salary | enroll_date
-------+--------+-------------
0 | 5000 | 2006-10-01
0 |... | [
"def",
"order_by_desc_range_between_days_preceding_and_days_preceding",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n sum | salary | enroll_date\n -------+--------+-------------\n 0 | 5000 | 2006-10-01\n 0 | 3900 | 2006-12-23\n 0 | ... | [
83,
0
] | [
106,
5
] | python | en | ['en', 'en', 'en'] | True |
datetime_with_timezone_order_by_asc_range_between_n_preceding_and_n_following | (self) | Check range between preceding and following with
DateTime column that has timezone using ascending order by.
| Check range between preceding and following with
DateTime column that has timezone using ascending order by.
| def datetime_with_timezone_order_by_asc_range_between_n_preceding_and_n_following(self):
"""Check range between preceding and following with
DateTime column that has timezone using ascending order by.
"""
expected = convert_output("""
id | f_timestamptz | first_value | last_value
... | [
"def",
"datetime_with_timezone_order_by_asc_range_between_n_preceding_and_n_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n id | f_timestamptz | first_value | last_value\n ----+------------------------------+-------------+------------\n ... | [
109,
0
] | [
136,
5
] | python | en | ['en', 'en', 'en'] | True |
datetime_with_timezone_order_by_desc_range_between_n_preceding_and_n_following | (self) | Check range between preceding and following with
DateTime column that has timezone using descending order by.
| Check range between preceding and following with
DateTime column that has timezone using descending order by.
| def datetime_with_timezone_order_by_desc_range_between_n_preceding_and_n_following(self):
"""Check range between preceding and following with
DateTime column that has timezone using descending order by.
"""
expected = convert_output("""
id | f_timestamptz | first_value | last_value
... | [
"def",
"datetime_with_timezone_order_by_desc_range_between_n_preceding_and_n_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n id | f_timestamptz | first_value | last_value\n ----+------------------------------+-------------+------------\n... | [
139,
0
] | [
166,
5
] | python | en | ['en', 'en', 'en'] | True |
datetime_order_by_asc_range_between_n_preceding_and_n_following | (self) | Check range between preceding and following with
DateTime column and ascending order by.
| Check range between preceding and following with
DateTime column and ascending order by.
| def datetime_order_by_asc_range_between_n_preceding_and_n_following(self):
"""Check range between preceding and following with
DateTime column and ascending order by.
"""
expected = convert_output("""
id | f_timestamp | first_value | last_value
----+------------------------------... | [
"def",
"datetime_order_by_asc_range_between_n_preceding_and_n_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n id | f_timestamp | first_value | last_value\n ----+------------------------------+-------------+------------\n 1 | 2000-10... | [
169,
0
] | [
196,
5
] | python | en | ['en', 'en', 'en'] | True |
datetime_order_by_desc_range_between_n_preceding_and_n_following | (self) | Check range between preceding and following with
DateTime column and descending order by.
| Check range between preceding and following with
DateTime column and descending order by.
| def datetime_order_by_desc_range_between_n_preceding_and_n_following(self):
"""Check range between preceding and following with
DateTime column and descending order by.
"""
expected = convert_output("""
id | f_timestamp | first_value | last_value
----+--------------------------... | [
"def",
"datetime_order_by_desc_range_between_n_preceding_and_n_following",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n id | f_timestamp | first_value | last_value\n ----+------------------------------+-------------+------------\n 10 | 2008... | [
199,
0
] | [
226,
5
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check `Date` and `DateTime` data time with range frames.
| Check `Date` and `DateTime` data time with range frames.
| def feature(self):
"""Check `Date` and `DateTime` data time with range frames.
"""
for scenario in loads(current_module(), Scenario):
Scenario(run=scenario, flags=TE) | [
"def",
"feature",
"(",
"self",
")",
":",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",
")",
",",
"Scenario",
")",
":",
"Scenario",
"(",
"run",
"=",
"scenario",
",",
"flags",
"=",
"TE",
")"
] | [
233,
0
] | [
237,
40
] | python | en | ['en', 'en', 'en'] | True |
Node.close_bashes | (self) | Close all active bashes to the node.
| Close all active bashes to the node.
| def close_bashes(self):
"""Close all active bashes to the node.
"""
with self.cluster.lock:
for key in list(self.cluster._bash.keys()):
if key.endswith(f"-{self.name}"):
shell = self.cluster._bash.pop(key)
shell.__exit__(None, N... | [
"def",
"close_bashes",
"(",
"self",
")",
":",
"with",
"self",
".",
"cluster",
".",
"lock",
":",
"for",
"key",
"in",
"list",
"(",
"self",
".",
"cluster",
".",
"_bash",
".",
"keys",
"(",
")",
")",
":",
"if",
"key",
".",
"endswith",
"(",
"f\"-{self.na... | [
49,
4
] | [
56,
52
] | python | en | ['en', 'en', 'en'] | True |
Node.restart | (self, timeout=300, retries=5, safe=True) | Restart node.
| Restart node.
| def restart(self, timeout=300, retries=5, safe=True):
"""Restart node.
"""
self.close_bashes()
for retry in range(retries):
r = self.cluster.command(None, f'{self.cluster.docker_compose} restart {self.name}', timeout=timeout)
if r.exitcode == 0:
b... | [
"def",
"restart",
"(",
"self",
",",
"timeout",
"=",
"300",
",",
"retries",
"=",
"5",
",",
"safe",
"=",
"True",
")",
":",
"self",
".",
"close_bashes",
"(",
")",
"for",
"retry",
"in",
"range",
"(",
"retries",
")",
":",
"r",
"=",
"self",
".",
"clust... | [
58,
4
] | [
66,
21
] | python | en | ['en', 'lb', 'en'] | False |
Node.start | (self, timeout=300, retries=5) | Start node.
| Start node.
| def start(self, timeout=300, retries=5):
"""Start node.
"""
for retry in range(retries):
r = self.cluster.command(None, f'{self.cluster.docker_compose} start {self.name}', timeout=timeout)
if r.exitcode == 0:
break | [
"def",
"start",
"(",
"self",
",",
"timeout",
"=",
"300",
",",
"retries",
"=",
"5",
")",
":",
"for",
"retry",
"in",
"range",
"(",
"retries",
")",
":",
"r",
"=",
"self",
".",
"cluster",
".",
"command",
"(",
"None",
",",
"f'{self.cluster.docker_compose} s... | [
68,
4
] | [
74,
21
] | python | en | ['en', 'lb', 'en'] | False |
Node.stop | (self, timeout=300, retries=5, safe=True) | Stop node.
| Stop node.
| def stop(self, timeout=300, retries=5, safe=True):
"""Stop node.
"""
self.close_bashes()
for retry in range(retries):
r = self.cluster.command(None, f'{self.cluster.docker_compose} stop {self.name}', timeout=timeout)
if r.exitcode == 0:
break | [
"def",
"stop",
"(",
"self",
",",
"timeout",
"=",
"300",
",",
"retries",
"=",
"5",
",",
"safe",
"=",
"True",
")",
":",
"self",
".",
"close_bashes",
"(",
")",
"for",
"retry",
"in",
"range",
"(",
"retries",
")",
":",
"r",
"=",
"self",
".",
"cluster"... | [
76,
4
] | [
84,
21
] | python | en | ['en', 'nl', 'en'] | False |
Node.cmd | (self, cmd, message=None, exitcode=None, steps=True, shell_command="bash --noediting", no_checks=False,
raise_on_exception=False, step=By, *args, **kwargs) | Execute and check command.
:param cmd: command
:param message: expected message that should be in the output, default: None
:param exitcode: expected exitcode, default: None
| Execute and check command.
:param cmd: command
:param message: expected message that should be in the output, default: None
:param exitcode: expected exitcode, default: None
| def cmd(self, cmd, message=None, exitcode=None, steps=True, shell_command="bash --noediting", no_checks=False,
raise_on_exception=False, step=By, *args, **kwargs):
"""Execute and check command.
:param cmd: command
:param message: expected message that should be in the output, default... | [
"def",
"cmd",
"(",
"self",
",",
"cmd",
",",
"message",
"=",
"None",
",",
"exitcode",
"=",
"None",
",",
"steps",
"=",
"True",
",",
"shell_command",
"=",
"\"bash --noediting\"",
",",
"no_checks",
"=",
"False",
",",
"raise_on_exception",
"=",
"False",
",",
... | [
89,
4
] | [
123,
16
] | python | en | ['en', 'en', 'en'] | True |
ClickHouseNode.stop | (self, timeout=300, safe=True, retries=5) | Stop node.
| Stop node.
| def stop(self, timeout=300, safe=True, retries=5):
"""Stop node.
"""
if safe:
self.query("SYSTEM STOP MOVES")
self.query("SYSTEM STOP MERGES")
self.query("SYSTEM FLUSH LOGS")
with By("waiting for 5 sec for moves and merges to stop"):
... | [
"def",
"stop",
"(",
"self",
",",
"timeout",
"=",
"300",
",",
"safe",
"=",
"True",
",",
"retries",
"=",
"5",
")",
":",
"if",
"safe",
":",
"self",
".",
"query",
"(",
"\"SYSTEM STOP MOVES\"",
")",
"self",
".",
"query",
"(",
"\"SYSTEM STOP MERGES\"",
")",
... | [
141,
4
] | [
158,
21
] | python | en | ['en', 'nl', 'en'] | False |
ClickHouseNode.start | (self, timeout=300, wait_healthy=True, retries=5) | Start node.
| Start node.
| def start(self, timeout=300, wait_healthy=True, retries=5):
"""Start node.
"""
for retry in range(retries):
r = self.cluster.command(None, f'{self.cluster.docker_compose} start {self.name}', timeout=timeout)
if r.exitcode == 0:
break
if wait_healt... | [
"def",
"start",
"(",
"self",
",",
"timeout",
"=",
"300",
",",
"wait_healthy",
"=",
"True",
",",
"retries",
"=",
"5",
")",
":",
"for",
"retry",
"in",
"range",
"(",
"retries",
")",
":",
"r",
"=",
"self",
".",
"cluster",
".",
"command",
"(",
"None",
... | [
160,
4
] | [
169,
38
] | python | en | ['en', 'lb', 'en'] | False |
ClickHouseNode.restart | (self, timeout=300, safe=True, wait_healthy=True, retries=5) | Restart node.
| Restart node.
| def restart(self, timeout=300, safe=True, wait_healthy=True, retries=5):
"""Restart node.
"""
if safe:
self.query("SYSTEM STOP MOVES")
self.query("SYSTEM STOP MERGES")
self.query("SYSTEM FLUSH LOGS")
with By("waiting for 5 sec for moves and merges ... | [
"def",
"restart",
"(",
"self",
",",
"timeout",
"=",
"300",
",",
"safe",
"=",
"True",
",",
"wait_healthy",
"=",
"True",
",",
"retries",
"=",
"5",
")",
":",
"if",
"safe",
":",
"self",
".",
"query",
"(",
"\"SYSTEM STOP MOVES\"",
")",
"self",
".",
"query... | [
171,
4
] | [
191,
38
] | python | en | ['en', 'lb', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.