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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ClickHouseNode.query | (self, sql, message=None, exitcode=None, steps=True, no_checks=False,
raise_on_exception=False, step=By, settings=None, *args, **kwargs) | Execute and check query.
:param sql: sql query
:param message: expected message that should be in the output, default: None
:param exitcode: expected exitcode, default: None
| Execute and check query.
:param sql: sql query
:param message: expected message that should be in the output, default: None
:param exitcode: expected exitcode, default: None
| def query(self, sql, message=None, exitcode=None, steps=True, no_checks=False,
raise_on_exception=False, step=By, settings=None, *args, **kwargs):
"""Execute and check query.
:param sql: sql query
:param message: expected message that should be in the output, default: None
... | [
"def",
"query",
"(",
"self",
",",
"sql",
",",
"message",
"=",
"None",
",",
"exitcode",
"=",
"None",
",",
"steps",
"=",
"True",
",",
"no_checks",
"=",
"False",
",",
"raise_on_exception",
"=",
"False",
",",
"step",
"=",
"By",
",",
"settings",
"=",
"Non... | [
193,
4
] | [
252,
16
] | python | en | ['en', 'en', 'en'] | True |
Cluster.control_shell | (self, timeout=300) | Must be called with self.lock.acquired.
| Must be called with self.lock.acquired.
| def control_shell(self, timeout=300):
"""Must be called with self.lock.acquired.
"""
if self._control_shell is not None:
return self._control_shell
time_start = time.time()
while True:
try:
shell = Shell()
shell.timeout = 3... | [
"def",
"control_shell",
"(",
"self",
",",
"timeout",
"=",
"300",
")",
":",
"if",
"self",
".",
"_control_shell",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_control_shell",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"while",
"True",
":",
"... | [
299,
4
] | [
317,
34
] | python | en | ['en', 'en', 'en'] | True |
Cluster.node_container_id | (self, node, timeout=300) | Must be called with self.lock acquired.
| Must be called with self.lock acquired.
| def node_container_id(self, node, timeout=300):
"""Must be called with self.lock acquired.
"""
container_id = None
time_start = time.time()
while True:
c = self.control_shell(f"{self.docker_compose} ps -q {node}")
container_id = c.output.strip()
... | [
"def",
"node_container_id",
"(",
"self",
",",
"node",
",",
"timeout",
"=",
"300",
")",
":",
"container_id",
"=",
"None",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"while",
"True",
":",
"c",
"=",
"self",
".",
"control_shell",
"(",
"f\"{self.docker... | [
319,
4
] | [
331,
27
] | python | en | ['en', 'en', 'en'] | True |
Cluster.shell | (self, node, timeout=300) | Returns unique shell terminal to be used.
| Returns unique shell terminal to be used.
| def shell(self, node, timeout=300):
"""Returns unique shell terminal to be used.
"""
container_id = None
if node is not None:
with self.lock:
container_id = self.node_container_id(node=node, timeout=timeout)
time_start = time.time()
w... | [
"def",
"shell",
"(",
"self",
",",
"node",
",",
"timeout",
"=",
"300",
")",
":",
"container_id",
"=",
"None",
"if",
"node",
"is",
"not",
"None",
":",
"with",
"self",
".",
"lock",
":",
"container_id",
"=",
"self",
".",
"node_container_id",
"(",
"node",
... | [
333,
4
] | [
360,
20
] | python | en | ['en', 'en', 'en'] | True |
Cluster.bash | (self, node, timeout=300, command="bash --noediting") | Returns thread-local bash terminal
to a specific node.
:param node: name of the service
| Returns thread-local bash terminal
to a specific node.
:param node: name of the service
| def bash(self, node, timeout=300, command="bash --noediting"):
"""Returns thread-local bash terminal
to a specific node.
:param node: name of the service
"""
test = current()
if top().terminating:
if test and (test.cflags & MANDATORY and test.subtype is not T... | [
"def",
"bash",
"(",
"self",
",",
"node",
",",
"timeout",
"=",
"300",
",",
"command",
"=",
"\"bash --noediting\"",
")",
":",
"test",
"=",
"current",
"(",
")",
"if",
"top",
"(",
")",
".",
"terminating",
":",
"if",
"test",
"and",
"(",
"test",
".",
"cf... | [
362,
4
] | [
415,
33
] | python | en | ['en', 'gd', 'en'] | True |
Cluster.node | (self, name) | Get object with node bound methods.
:param name: name of service name
| Get object with node bound methods.
:param name: name of service name
| def node(self, name):
"""Get object with node bound methods.
:param name: name of service name
"""
if name.startswith("clickhouse"):
return ClickHouseNode(self, name)
return Node(self, name) | [
"def",
"node",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
".",
"startswith",
"(",
"\"clickhouse\"",
")",
":",
"return",
"ClickHouseNode",
"(",
"self",
",",
"name",
")",
"return",
"Node",
"(",
"self",
",",
"name",
")"
] | [
441,
4
] | [
447,
31
] | python | en | ['en', 'en', 'en'] | True |
Cluster.down | (self, timeout=300) | Bring cluster down by executing docker-compose down. | Bring cluster down by executing docker-compose down. | def down(self, timeout=300):
"""Bring cluster down by executing docker-compose down."""
# add message to each clickhouse-server.log
if settings.debug:
for node in self.nodes["clickhouse"]:
self.command(node=node, command=f"echo -e \"\n-- sending stop to: {node} --\n\... | [
"def",
"down",
"(",
"self",
",",
"timeout",
"=",
"300",
")",
":",
"# add message to each clickhouse-server.log",
"if",
"settings",
".",
"debug",
":",
"for",
"node",
"in",
"self",
".",
"nodes",
"[",
"\"clickhouse\"",
"]",
":",
"self",
".",
"command",
"(",
"... | [
449,
4
] | [
472,
22
] | python | en | ['en', 'en', 'en'] | True |
Cluster.command | (self, node, command, message=None, exitcode=None, steps=True, bash=None, *args, **kwargs) | Execute and check command.
:param node: name of the service
:param command: command
:param message: expected message that should be in the output, default: None
:param exitcode: expected exitcode, default: None
:param steps: don't break command into steps, default: True
| Execute and check command.
:param node: name of the service
:param command: command
:param message: expected message that should be in the output, default: None
:param exitcode: expected exitcode, default: None
:param steps: don't break command into steps, default: True
| def command(self, node, command, message=None, exitcode=None, steps=True, bash=None, *args, **kwargs):
"""Execute and check command.
:param node: name of the service
:param command: command
:param message: expected message that should be in the output, default: None
:param exitco... | [
"def",
"command",
"(",
"self",
",",
"node",
",",
"command",
",",
"message",
"=",
"None",
",",
"exitcode",
"=",
"None",
",",
"steps",
"=",
"True",
",",
"bash",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"By",
"(",
... | [
537,
4
] | [
559,
16
] | python | en | ['en', 'en', 'en'] | True |
color_format | (use_color, fmt_str, *args, **kwargs) |
Return the result of 'fmt_str.format(*args, **kwargs)' after transforming
'args' and 'kwargs' according to the value of 'use_color'. If 'use_color'
is False then all color codes in 'args' and 'kwargs' are replaced with
the empty string.
|
Return the result of 'fmt_str.format(*args, **kwargs)' after transforming
'args' and 'kwargs' according to the value of 'use_color'. If 'use_color'
is False then all color codes in 'args' and 'kwargs' are replaced with
the empty string.
| def color_format(use_color, fmt_str, *args, **kwargs):
"""
Return the result of 'fmt_str.format(*args, **kwargs)' after transforming
'args' and 'kwargs' according to the value of 'use_color'. If 'use_color'
is False then all color codes in 'args' and 'kwargs' are replaced with
the empty string.
... | [
"def",
"color_format",
"(",
"use_color",
",",
"fmt_str",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"use_color",
"is",
"True",
"or",
"use_color",
"is",
"False",
"if",
"not",
"use_color",
":",
"args",
"=",
"[",
"arg",
"if",
"not",
... | [
31,
0
] | [
44,
42
] | python | en | ['en', 'error', 'th'] | False |
find_longest_name | (benchmark_list) |
Return the length of the longest benchmark name in a given list of
benchmark JSON objects
|
Return the length of the longest benchmark name in a given list of
benchmark JSON objects
| def find_longest_name(benchmark_list):
"""
Return the length of the longest benchmark name in a given list of
benchmark JSON objects
"""
longest_name = 1
for bc in benchmark_list:
if len(bc['name']) > longest_name:
longest_name = len(bc['name'])
return longest_name | [
"def",
"find_longest_name",
"(",
"benchmark_list",
")",
":",
"longest_name",
"=",
"1",
"for",
"bc",
"in",
"benchmark_list",
":",
"if",
"len",
"(",
"bc",
"[",
"'name'",
"]",
")",
">",
"longest_name",
":",
"longest_name",
"=",
"len",
"(",
"bc",
"[",
"'name... | [
47,
0
] | [
56,
23
] | python | en | ['en', 'error', 'th'] | False |
calculate_change | (old_val, new_val) |
Return a float representing the decimal change between old_val and new_val.
|
Return a float representing the decimal change between old_val and new_val.
| def calculate_change(old_val, new_val):
"""
Return a float representing the decimal change between old_val and new_val.
"""
if old_val == 0 and new_val == 0:
return 0.0
if old_val == 0:
return float(new_val - old_val) / (float(old_val + new_val) / 2)
return float(new_val - old_va... | [
"def",
"calculate_change",
"(",
"old_val",
",",
"new_val",
")",
":",
"if",
"old_val",
"==",
"0",
"and",
"new_val",
"==",
"0",
":",
"return",
"0.0",
"if",
"old_val",
"==",
"0",
":",
"return",
"float",
"(",
"new_val",
"-",
"old_val",
")",
"/",
"(",
"fl... | [
59,
0
] | [
67,
50
] | python | en | ['en', 'error', 'th'] | False |
filter_benchmark | (json_orig, family, replacement="") |
Apply a filter to the json, and only leave the 'family' of benchmarks.
|
Apply a filter to the json, and only leave the 'family' of benchmarks.
| def filter_benchmark(json_orig, family, replacement=""):
"""
Apply a filter to the json, and only leave the 'family' of benchmarks.
"""
regex = re.compile(family)
filtered = {}
filtered['benchmarks'] = []
for be in json_orig['benchmarks']:
if not regex.search(be['name']):
... | [
"def",
"filter_benchmark",
"(",
"json_orig",
",",
"family",
",",
"replacement",
"=",
"\"\"",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"family",
")",
"filtered",
"=",
"{",
"}",
"filtered",
"[",
"'benchmarks'",
"]",
"=",
"[",
"]",
"for",
"be",
... | [
70,
0
] | [
83,
19
] | python | en | ['en', 'error', 'th'] | False |
generate_difference_report | (json1, json2, use_color=True) |
Calculate and report the difference between each test of two benchmarks
runs specified as 'json1' and 'json2'.
|
Calculate and report the difference between each test of two benchmarks
runs specified as 'json1' and 'json2'.
| def generate_difference_report(json1, json2, use_color=True):
"""
Calculate and report the difference between each test of two benchmarks
runs specified as 'json1' and 'json2'.
"""
first_col_width = find_longest_name(json1['benchmarks'])
def find_test(name):
for b in json2['benchmarks']:... | [
"def",
"generate_difference_report",
"(",
"json1",
",",
"json2",
",",
"use_color",
"=",
"True",
")",
":",
"first_col_width",
"=",
"find_longest_name",
"(",
"json1",
"[",
"'benchmarks'",
"]",
")",
"def",
"find_test",
"(",
"name",
")",
":",
"for",
"b",
"in",
... | [
86,
0
] | [
127,
22
] | python | en | ['en', 'error', 'th'] | False |
positive_overflow_with_Int16 | (self) | Check positive overflow with Int16.
| Check positive overflow with Int16.
| def positive_overflow_with_Int16(self):
"""Check positive overflow with Int16.
"""
expected = convert_output("""
x | last_value
-------+------------
32764 | 0
32765 | 0
32766 | 0
""")
execute_query(
"""
select number as x, last... | [
"def",
"positive_overflow_with_Int16",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | last_value \n -------+------------\n 32764 | 0\n 32765 | 0\n 32766 | 0\n \"\"\"",
")",
"execute_query",
"(",
"\"\"\"\n ... | [
6,
0
] | [
23,
5
] | python | en | ['en', 'en', 'en'] | True |
negative_overflow_with_Int16 | (self) | Check negative overflow with Int16.
| Check negative overflow with Int16.
| def negative_overflow_with_Int16(self):
"""Check negative overflow with Int16.
"""
expected = convert_output("""
x | last_value
--------+------------
-32764 | 0
-32765 | 0
-32766 | 0
""")
execute_query(
"""
select number as x,... | [
"def",
"negative_overflow_with_Int16",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | last_value \n --------+------------\n -32764 | 0\n -32765 | 0\n -32766 | 0\n \"\"\"",
")",
"execute_query",
"(",
"\"\"... | [
26,
0
] | [
43,
5
] | python | en | ['en', 'en', 'en'] | True |
positive_overflow_for_Int32 | (self) | Check positive overflow for Int32.
| Check positive overflow for Int32.
| def positive_overflow_for_Int32(self):
"""Check positive overflow for Int32.
"""
expected = convert_output("""
x | last_value
------------+------------
2147483644 | 2147483646
2147483645 | 2147483646
2147483646 | 2147483646
""")
execute_query(
"""
s... | [
"def",
"positive_overflow_for_Int32",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | last_value \n ------------+------------\n 2147483644 | 2147483646\n 2147483645 | 2147483646\n 2147483646 | 2147483646\n \"\"\"",
")",
"execute_que... | [
46,
0
] | [
63,
5
] | python | en | ['en', 'en', 'en'] | True |
negative_overflow_for_Int32 | (self) | Check negative overflow for Int32.
| Check negative overflow for Int32.
| def negative_overflow_for_Int32(self):
"""Check negative overflow for Int32.
"""
expected = convert_output("""
x | last_value
-------------+-------------
-2147483644 | -2147483646
-2147483645 | -2147483646
-2147483646 | -2147483646
""")
execute_query(
"""... | [
"def",
"negative_overflow_for_Int32",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | last_value \n -------------+-------------\n -2147483644 | -2147483646\n -2147483645 | -2147483646\n -2147483646 | -2147483646\n \"\"\"",
")",
"e... | [
66,
0
] | [
83,
5
] | python | en | ['en', 'en', 'en'] | True |
positive_overflow_for_Int64 | (self) | Check positive overflow for Int64.
| Check positive overflow for Int64.
| def positive_overflow_for_Int64(self):
"""Check positive overflow for Int64.
"""
expected = convert_output("""
x | last_value
---------------------+---------------------
9223372036854775804 | 9223372036854775806
9223372036854775805 | 9223372036854775806
92... | [
"def",
"positive_overflow_for_Int64",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | last_value \n ---------------------+---------------------\n 9223372036854775804 | 9223372036854775806\n 9223372036854775805 | 9223372036854... | [
86,
0
] | [
103,
5
] | python | en | ['en', 'en', 'en'] | True |
negative_overflow_for_Int64 | (self) | Check negative overflow for Int64.
| Check negative overflow for Int64.
| def negative_overflow_for_Int64(self):
"""Check negative overflow for Int64.
"""
expected = convert_output("""
x | last_value
----------------------+----------------------
-9223372036854775804 | -9223372036854775806
-9223372036854775805 | -9223372036854775806... | [
"def",
"negative_overflow_for_Int64",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n x | last_value \n ----------------------+----------------------\n -9223372036854775804 | -9223372036854775806\n -9223372036854775805 | -92233... | [
106,
0
] | [
123,
5
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check using range frame with overflows.
| Check using range frame with overflows.
| def feature(self):
"""Check using range frame with overflows.
"""
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",
")"
] | [
130,
0
] | [
134,
40
] | python | en | ['en', 'en', 'en'] | True |
BaseAlgorithm.__init__ | (self, env, params) |
Base class for optimization algorithms.
Parameters
----------
env: BaseEnv
Learning environment.
params: dict
Dictionary of parameters.
|
Base class for optimization algorithms. | def __init__(self, env, params):
"""
Base class for optimization algorithms.
Parameters
----------
env: BaseEnv
Learning environment.
params: dict
Dictionary of parameters.
"""
self.env = env
self.global_params = params
... | [
"def",
"__init__",
"(",
"self",
",",
"env",
",",
"params",
")",
":",
"self",
".",
"env",
"=",
"env",
"self",
".",
"global_params",
"=",
"params",
"self",
".",
"algo_params",
"=",
"params",
"[",
"'algo_params'",
"]"
] | [
3,
4
] | [
16,
48
] | python | en | ['en', 'error', 'th'] | False |
BaseAlgorithm.learn | (self, num_env_steps) |
Main learning loop
Parameters
----------
num_env_steps: int
Budget of environment steps.
|
Main learning loop | def learn(self, num_env_steps):
"""
Main learning loop
Parameters
----------
num_env_steps: int
Budget of environment steps.
"""
pass | [
"def",
"learn",
"(",
"self",
",",
"num_env_steps",
")",
":",
"pass"
] | [
19,
4
] | [
29,
12
] | python | en | ['en', 'error', 'th'] | False |
BaseAlgorithm.evaluate | (self, n, goal=None) |
Evaluation of the current policy on a set of evaluation goals.
Parameters
----------
n: int
Number of evaluation episodes.
goal: nd.array, optional
Goal to be targeted during evaluation. If not provided, evaluation goals are used.
|
Evaluation of the current policy on a set of evaluation goals. | def evaluate(self, n, goal=None):
"""
Evaluation of the current policy on a set of evaluation goals.
Parameters
----------
n: int
Number of evaluation episodes.
goal: nd.array, optional
Goal to be targeted during evaluation. If not provided, evalu... | [
"def",
"evaluate",
"(",
"self",
",",
"n",
",",
"goal",
"=",
"None",
")",
":"
] | [
32,
4
] | [
43,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseAlgorithm.log | (self, **kwargs) |
Logging function
|
Logging function | def log(self, **kwargs):
"""
Logging function
"""
pass | [
"def",
"log",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
45,
4
] | [
50,
12
] | python | en | ['en', 'error', 'th'] | False |
BaseAlgorithm.act | (self, state, deterministic) |
Policy that uses the learned critics.
Parameters
----------
state: 1D nd.array
Current state.
deterministic: bool
Whether the policy should be deterministic (e.g. in evaluation mode).
Returns
-------
action: nd.array
... |
Policy that uses the learned critics. | def act(self, state, deterministic):
"""
Policy that uses the learned critics.
Parameters
----------
state: 1D nd.array
Current state.
deterministic: bool
Whether the policy should be deterministic (e.g. in evaluation mode).
Returns
... | [
"def",
"act",
"(",
"self",
",",
"state",
",",
"deterministic",
")",
":"
] | [
53,
4
] | [
69,
11
] | python | en | ['en', 'error', 'th'] | False |
rate_limited_imap | (f, l) | a thread pre-processes the next element | a thread pre-processes the next element | def rate_limited_imap(f, l):
'a thread pre-processes the next element'
pool = ThreadPool(1)
res = None
for i in l:
res_next = pool.apply_async(f, (i, ))
if res:
yield res.get()
res = res_next
yield res.get() | [
"def",
"rate_limited_imap",
"(",
"f",
",",
"l",
")",
":",
"pool",
"=",
"ThreadPool",
"(",
"1",
")",
"res",
"=",
"None",
"for",
"i",
"in",
"l",
":",
"res_next",
"=",
"pool",
".",
"apply_async",
"(",
"f",
",",
"(",
"i",
",",
")",
")",
"if",
"res"... | [
143,
0
] | [
152,
19
] | python | en | ['en', 'en', 'en'] | True |
matrix_slice_iterator | (x, bs) | iterate over the lines of x in blocks of size bs | iterate over the lines of x in blocks of size bs | def matrix_slice_iterator(x, bs):
" iterate over the lines of x in blocks of size bs"
nb = x.shape[0]
block_ranges = [(i0, min(nb, i0 + bs))
for i0 in range(0, nb, bs)]
return rate_limited_imap(
lambda i01: x[i01[0]:i01[1]].astype('float32').copy(),
block_ranges) | [
"def",
"matrix_slice_iterator",
"(",
"x",
",",
"bs",
")",
":",
"nb",
"=",
"x",
".",
"shape",
"[",
"0",
"]",
"block_ranges",
"=",
"[",
"(",
"i0",
",",
"min",
"(",
"nb",
",",
"i0",
"+",
"bs",
")",
")",
"for",
"i0",
"in",
"range",
"(",
"0",
",",... | [
155,
0
] | [
163,
21
] | python | en | ['en', 'en', 'en'] | True |
TestPackageConan._build_autotools | (self) | Test autotools integration | Test autotools integration | def _build_autotools(self):
""" Test autotools integration """
# Copy autotools directory to build folder
shutil.copytree(os.path.join(self.source_folder, "autotools"), os.path.join(self.build_folder, "autotools"))
with tools.chdir("autotools"):
self.run("{} --install --verbo... | [
"def",
"_build_autotools",
"(",
"self",
")",
":",
"# Copy autotools directory to build folder",
"shutil",
".",
"copytree",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"source_folder",
",",
"\"autotools\"",
")",
",",
"os",
".",
"path",
".",
"join",
... | [
38,
4
] | [
58,
35
] | python | en | ['en', 'et', 'en'] | True |
TestPackageConan._build_ltdl | (self) | Build library using ltdl library | Build library using ltdl library | def _build_ltdl(self):
""" Build library using ltdl library """
cmake = CMake(self)
cmake.configure(source_folder="ltdl")
cmake.build() | [
"def",
"_build_ltdl",
"(",
"self",
")",
":",
"cmake",
"=",
"CMake",
"(",
"self",
")",
"cmake",
".",
"configure",
"(",
"source_folder",
"=",
"\"ltdl\"",
")",
"cmake",
".",
"build",
"(",
")"
] | [
68,
4
] | [
72,
21
] | python | en | ['en', 'en', 'en'] | True |
TestPackageConan._test_ltdl | (self) | Test library using ltdl library | Test library using ltdl library | def _test_ltdl(self):
""" Test library using ltdl library"""
lib_suffix = {
"Linux": "so",
"Macos": "dylib",
"Windows": "dll",
}[str(self.settings.os)]
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
... | [
"def",
"_test_ltdl",
"(",
"self",
")",
":",
"lib_suffix",
"=",
"{",
"\"Linux\"",
":",
"\"so\"",
",",
"\"Macos\"",
":",
"\"dylib\"",
",",
"\"Windows\"",
":",
"\"dll\"",
",",
"}",
"[",
"str",
"(",
"self",
".",
"settings",
".",
"os",
")",
"]",
"if",
"no... | [
74,
4
] | [
86,
78
] | python | en | ['en', 'en', 'en'] | True |
TestPackageConan._build_static_lib_in_shared | (self) | Build shared library using libtool (while linking to a static library) | Build shared library using libtool (while linking to a static library) | def _build_static_lib_in_shared(self):
""" Build shared library using libtool (while linking to a static library) """
# Copy static-in-shared directory to build folder
autotools_folder = os.path.join(self.build_folder, "static-in-shared")
shutil.copytree(os.path.join(self.source_folder,... | [
"def",
"_build_static_lib_in_shared",
"(",
"self",
")",
":",
"# Copy static-in-shared directory to build folder",
"autotools_folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"build_folder",
",",
"\"static-in-shared\"",
")",
"shutil",
".",
"copytree",
"(... | [
88,
4
] | [
120,
35
] | python | en | ['en', 'en', 'en'] | True |
TestPackageConan._test_static_lib_in_shared | (self) | Test existence of shared library | Test existence of shared library | def _test_static_lib_in_shared(self):
""" Test existence of shared library """
install_prefix = os.path.join(self.build_folder, "static-in-shared", "prefix")
with tools.chdir(install_prefix):
if self.settings.os == "Windows":
assert len(list(glob.glob(os.path.join("b... | [
"def",
"_test_static_lib_in_shared",
"(",
"self",
")",
":",
"install_prefix",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"build_folder",
",",
"\"static-in-shared\"",
",",
"\"prefix\"",
")",
"with",
"tools",
".",
"chdir",
"(",
"install_prefix",
")",... | [
122,
4
] | [
132,
76
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check show row polices query syntax.
```sql
SHOW [ROW] POLICIES [ON [database.]table]
```
| Check show row polices query syntax. | def feature(self, node="clickhouse1"):
"""Check show row polices query syntax.
```sql
SHOW [ROW] POLICIES [ON [database.]table]
```
"""
node = self.context.cluster.node(node)
@contextmanager
def cleanup(policy, on="default.foo"):
try:
with Given("I have a row policy... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"cleanup",
"(",
"policy",
",",
"on",
"=",
"\"default.foo\"",
... | [
8,
0
] | [
57,
59
] | python | en | ['en', 'en', 'en'] | True |
MockServer.__init__ | (self, port=0) | If no port provided, automatically chooses one.
Chosen port will be set at self.port,
after self.port_event is signalled. | If no port provided, automatically chooses one.
Chosen port will be set at self.port,
after self.port_event is signalled. | def __init__(self, port=0):
"""If no port provided, automatically chooses one.
Chosen port will be set at self.port,
after self.port_event is signalled."""
super().__init__()
self.daemon = True
self.port = port
self.port_event = threading.Event()
self.sto... | [
"def",
"__init__",
"(",
"self",
",",
"port",
"=",
"0",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"daemon",
"=",
"True",
"self",
".",
"port",
"=",
"port",
"self",
".",
"port_event",
"=",
"threading",
".",
"Event",
"(",
"... | [
14,
4
] | [
23,
46
] | python | en | ['en', 'en', 'en'] | True |
TkoServer.__init__ | (self, period, phase=0, tmo=0.5, hitcmd='hit') | Simple server stub that alternatively responds to requests
with or withoud a delay.
On startup, 'period' - 'phase' requests will be fast initially,
then next 'period' requests will be slow; and so on.
Always responds to 'version' requests without changing state.
| Simple server stub that alternatively responds to requests
with or withoud a delay. | def __init__(self, period, phase=0, tmo=0.5, hitcmd='hit'):
"""Simple server stub that alternatively responds to requests
with or withoud a delay.
On startup, 'period' - 'phase' requests will be fast initially,
then next 'period' requests will be slow; and so on.
Always responds... | [
"def",
"__init__",
"(",
"self",
",",
"period",
",",
"phase",
"=",
"0",
",",
"tmo",
"=",
"0.5",
",",
"hitcmd",
"=",
"'hit'",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"period",
"=",
"period",
"self",
".",
"step",
"=",
... | [
137,
4
] | [
149,
28
] | python | en | ['en', 'en', 'en'] | True |
translate | () |
:return:
| def translate():
"""
:return:
"""
from ibis.mapd.compiler import MapDDialect
dialect = MapDDialect()
context = dialect.make_context()
return lambda expr: dialect.translator(expr, context).get_result() | [
"def",
"translate",
"(",
")",
":",
"from",
"ibis",
".",
"mapd",
".",
"compiler",
"import",
"MapDDialect",
"dialect",
"=",
"MapDDialect",
"(",
")",
"context",
"=",
"dialect",
".",
"make_context",
"(",
")",
"return",
"lambda",
"expr",
":",
"dialect",
".",
... | [
43,
0
] | [
51,
70
] | python | en | ['en', 'error', 'th'] | False | |
_extract_comment | (_comment) |
remove '#' at start of comment
|
remove '#' at start of comment
| def _extract_comment(_comment):
"""
remove '#' at start of comment
"""
# if _comment is empty, do nothing
if not _comment:
return _comment
# str_ = _comment.lstrip(" ")
str_ = _comment.strip()
str_ = str_.lstrip("#")
return str_ | [
"def",
"_extract_comment",
"(",
"_comment",
")",
":",
"# if _comment is empty, do nothing",
"if",
"not",
"_comment",
":",
"return",
"_comment",
"# str_ = _comment.lstrip(\" \")",
"str_",
"=",
"_comment",
".",
"strip",
"(",
")",
"str_",
"=",
"str_",
".",
"lstrip",
... | [
21,
0
] | [
33,
15
] | python | en | ['en', 'error', 'th'] | False |
_add_eol_comment | (element, *args, **kwargs) |
add_eol_comment
args --> (comment, key)
|
add_eol_comment
args --> (comment, key)
| def _add_eol_comment(element, *args, **kwargs):
"""
add_eol_comment
args --> (comment, key)
"""
if element is None or \
(not isinstance(element, CommentedMap) and
not isinstance(element, CommentedSeq)) or \
args[0] is None or \
len(args[0]) == 0:
... | [
"def",
"_add_eol_comment",
"(",
"element",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"element",
"is",
"None",
"or",
"(",
"not",
"isinstance",
"(",
"element",
",",
"CommentedMap",
")",
"and",
"not",
"isinstance",
"(",
"element",
",",
"C... | [
36,
0
] | [
58,
53
] | python | en | ['en', 'error', 'th'] | False |
_comment_counter | (_comment) |
counter comment tips and split into list
| def _comment_counter(_comment):
"""
counter comment tips and split into list
"""
x = lambda l: l.strip().strip("#").strip()
_counter = []
if _comment.startswith("\n"):
_counter.append("")
_counter.append(x(_comment[1:]))
return _counter
elif _comment.startswith("#... | [
"def",
"_comment_counter",
"(",
"_comment",
")",
":",
"x",
"=",
"lambda",
"l",
":",
"l",
".",
"strip",
"(",
")",
".",
"strip",
"(",
"\"#\"",
")",
".",
"strip",
"(",
")",
"_counter",
"=",
"[",
"]",
"if",
"_comment",
".",
"startswith",
"(",
"\"\\n\""... | [
102,
0
] | [
124,
19
] | python | en | ['en', 'error', 'th'] | False | |
update_map_element | (element, key, value, comment, _type) |
element:
key:
value:
comment:
_type: value type.
|
element:
key:
value:
comment:
_type: value type.
| def update_map_element(element, key, value, comment, _type):
"""
element:
key:
value:
comment:
_type: value type.
"""
if element is None or not isinstance(element, CommentedMap):
print("Only key-value update support")
sys.exit(1)
origin_comment = _map_comment(e... | [
"def",
"update_map_element",
"(",
"element",
",",
"key",
",",
"value",
",",
"comment",
",",
"_type",
")",
":",
"if",
"element",
"is",
"None",
"or",
"not",
"isinstance",
"(",
"element",
",",
"CommentedMap",
")",
":",
"print",
"(",
"\"Only key-value update sup... | [
184,
0
] | [
205,
61
] | python | en | ['en', 'error', 'th'] | False |
_set_merge_parser | (_parsers) |
config merge parser
|
config merge parser
| def _set_merge_parser(_parsers):
"""
config merge parser
"""
merge_parser = _parsers.add_parser("merge", help="merge with another yaml file")
_set_merge_parser_arg(merge_parser)
_set_update_parser_arg(merge_parser)
merge_parser.set_defaults(
function=merge_yaml,
tips=merge... | [
"def",
"_set_merge_parser",
"(",
"_parsers",
")",
":",
"merge_parser",
"=",
"_parsers",
".",
"add_parser",
"(",
"\"merge\"",
",",
"help",
"=",
"\"merge with another yaml file\"",
")",
"_set_merge_parser_arg",
"(",
"merge_parser",
")",
"_set_update_parser_arg",
"(",
"m... | [
448,
0
] | [
461,
5
] | python | en | ['en', 'error', 'th'] | False |
_set_merge_parser_arg | (_parser) |
config parser argument for merging
|
config parser argument for merging
| def _set_merge_parser_arg(_parser):
"""
config parser argument for merging
"""
_parser.add_argument("-m", "--merge-file", help="indicate merge yaml file") | [
"def",
"_set_merge_parser_arg",
"(",
"_parser",
")",
":",
"_parser",
".",
"add_argument",
"(",
"\"-m\"",
",",
"\"--merge-file\"",
",",
"help",
"=",
"\"indicate merge yaml file\"",
")"
] | [
464,
0
] | [
469,
79
] | python | en | ['en', 'error', 'th'] | False |
_set_update_parser | (_parsers) |
config merge parser
|
config merge parser
| def _set_update_parser(_parsers):
"""
config merge parser
"""
update_parser = _parsers.add_parser("update", help="update with another yaml file")
_set_update_parser_arg(update_parser)
update_parser.set_defaults(
function=update_yaml,
tips=update_parser.format_help()
) | [
"def",
"_set_update_parser",
"(",
"_parsers",
")",
":",
"update_parser",
"=",
"_parsers",
".",
"add_parser",
"(",
"\"update\"",
",",
"help",
"=",
"\"update with another yaml file\"",
")",
"_set_update_parser_arg",
"(",
"update_parser",
")",
"update_parser",
".",
"set_... | [
472,
0
] | [
483,
5
] | python | en | ['en', 'error', 'th'] | False |
_set_update_parser_arg | (_parser) |
config parser argument for updating
|
config parser argument for updating
| def _set_update_parser_arg(_parser):
"""
config parser argument for updating
"""
_parser.add_argument("-f", "--file", help="source yaml file")
_parser.add_argument('-u', '--update', help="update with args, instance as \"a.b.c=d# d comment\"")
_parser.add_argument('-a', '--append', action="store... | [
"def",
"_set_update_parser_arg",
"(",
"_parser",
")",
":",
"_parser",
".",
"add_argument",
"(",
"\"-f\"",
",",
"\"--file\"",
",",
"help",
"=",
"\"source yaml file\"",
")",
"_parser",
".",
"add_argument",
"(",
"'-u'",
",",
"'--update'",
",",
"help",
"=",
"\"upd... | [
486,
0
] | [
497,
115
] | python | en | ['en', 'error', 'th'] | False |
_set_reset_parser | (_parsers) |
config merge parser
|
config merge parser
| def _set_reset_parser(_parsers):
"""
config merge parser
"""
reset_parser = _parsers.add_parser("reset", help="reset yaml file")
# indicate yaml file
reset_parser.add_argument('-f', '--file', help="indicate input yaml file")
reset_parser.set_defaults(
function=reset,
tips=... | [
"def",
"_set_reset_parser",
"(",
"_parsers",
")",
":",
"reset_parser",
"=",
"_parsers",
".",
"add_parser",
"(",
"\"reset\"",
",",
"help",
"=",
"\"reset yaml file\"",
")",
"# indicate yaml file",
"reset_parser",
".",
"add_argument",
"(",
"'-f'",
",",
"'--file'",
",... | [
500,
0
] | [
513,
5
] | python | en | ['en', 'error', 'th'] | False |
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",
... | [
43,
0
] | [
50,
47
] | python | en | ['en', 'error', 'th'] | False |
Arm.__init__ | (self, linear_servo, rotational_servo,
linear_low, linear_high, rotation_low, rotation_high,
current_linear, current_rotational,
rotation_speed, command_delay) |
Create an object to represent an arm of the rubik's solver cube.
:param linear_servo: Index of the linear servo.
:param rotational_servo: Index of the rotational servo.
:param linear_low: The low position of the linear servo.
:param linear_high: The high position of the l... |
Create an object to represent an arm of the rubik's solver cube.
:param linear_servo: Index of the linear servo.
:param rotational_servo: Index of the rotational servo.
:param linear_low: The low position of the linear servo.
:param linear_high: The high position of the l... | def __init__(self, linear_servo, rotational_servo,
linear_low, linear_high, rotation_low, rotation_high,
current_linear, current_rotational,
rotation_speed, command_delay):
"""
Create an object to represent an arm of the rubik's solver cube.
... | [
"def",
"__init__",
"(",
"self",
",",
"linear_servo",
",",
"rotational_servo",
",",
"linear_low",
",",
"linear_high",
",",
"rotation_low",
",",
"rotation_high",
",",
"current_linear",
",",
"current_rotational",
",",
"rotation_speed",
",",
"command_delay",
")",
":",
... | [
24,
4
] | [
58,
107
] | python | en | ['en', 'ja', 'th'] | False |
Arm.check_position | (self, axis) |
Gets the current position of the arm depending on which axis is referred to.
This method must be used in conjunction with rotate/move methods to verify if a certain movement can be done.
:param axis: Can be LINEAR or ROTATIONAL.
:return: The arms position for the given servo of ... |
Gets the current position of the arm depending on which axis is referred to.
This method must be used in conjunction with rotate/move methods to verify if a certain movement can be done.
:param axis: Can be LINEAR or ROTATIONAL.
:return: The arms position for the given servo of ... | def check_position(self, axis):
"""
Gets the current position of the arm depending on which axis is referred to.
This method must be used in conjunction with rotate/move methods to verify if a certain movement can be done.
:param axis: Can be LINEAR or ROTATIONAL.
:retur... | [
"def",
"check_position",
"(",
"self",
",",
"axis",
")",
":",
"position",
"=",
"State",
".",
"ERROR",
"if",
"axis",
"==",
"State",
".",
"LINEAR",
":",
"if",
"self",
".",
"current_linear",
"==",
"self",
".",
"linear_low",
":",
"position",
"=",
"State",
"... | [
60,
4
] | [
82,
23
] | python | en | ['en', 'ja', 'th'] | False |
Arm.check_dof | (self, axis, way) |
Checks if a turn can be done depending on which axis is referred to.
It's also dependent on the way it's being looked at.
This method must be used in conjunction with rotate/move methods to verify if a certain movement can be done.
:param axis: Can be LINEAR or ROTATIONAL.
... |
Checks if a turn can be done depending on which axis is referred to.
It's also dependent on the way it's being looked at.
This method must be used in conjunction with rotate/move methods to verify if a certain movement can be done.
:param axis: Can be LINEAR or ROTATIONAL.
... | def check_dof(self, axis, way):
"""
Checks if a turn can be done depending on which axis is referred to.
It's also dependent on the way it's being looked at.
This method must be used in conjunction with rotate/move methods to verify if a certain movement can be done.
:pa... | [
"def",
"check_dof",
"(",
"self",
",",
"axis",
",",
"way",
")",
":",
"dof",
"=",
"State",
".",
"ERROR",
"if",
"axis",
"==",
"State",
".",
"LINEAR",
":",
"if",
"way",
"==",
"State",
".",
"BACK",
":",
"if",
"self",
".",
"current_linear",
"==",
"self",... | [
85,
4
] | [
126,
18
] | python | en | ['en', 'ja', 'th'] | False |
Arm.rotate | (self, way, add_servo_delay=True, add_command_delay=True) |
Rotate the arm's servo that's designated for rotating the cube.
:param way: CLOCKWISE or ANTICLOCKWISE.
:param add_servo_delay: True if it must be waited for the servo's command to finish. False otherwise.
:param add_command_delay: True if a delay is to be put between commands. F... |
Rotate the arm's servo that's designated for rotating the cube.
:param way: CLOCKWISE or ANTICLOCKWISE.
:param add_servo_delay: True if it must be waited for the servo's command to finish. False otherwise.
:param add_command_delay: True if a delay is to be put between commands. F... | def rotate(self, way, add_servo_delay=True, add_command_delay=True):
"""
Rotate the arm's servo that's designated for rotating the cube.
:param way: CLOCKWISE or ANTICLOCKWISE.
:param add_servo_delay: True if it must be waited for the servo's command to finish. False otherwise.
... | [
"def",
"rotate",
"(",
"self",
",",
"way",
",",
"add_servo_delay",
"=",
"True",
",",
"add_command_delay",
"=",
"True",
")",
":",
"turns",
"=",
"self",
".",
"check_dof",
"(",
"State",
".",
"ROTATIONAL",
",",
"way",
")",
"done",
"=",
"False",
"time",
"=",... | [
128,
4
] | [
169,
23
] | python | en | ['en', 'ja', 'th'] | False |
Arm.move | (self, position, add_servo_delay=True, add_command_delay=True) |
Move the arm's servo that's designated for sliding the arm.
:param position: Position of the arm to move to. Can be BACK or FORWARD. Use check_dof method to see if that's possible.
:param add_servo_delay: True if a delay is to be put between commands. False otherwise.
:param add_c... |
Move the arm's servo that's designated for sliding the arm.
:param position: Position of the arm to move to. Can be BACK or FORWARD. Use check_dof method to see if that's possible.
:param add_servo_delay: True if a delay is to be put between commands. False otherwise.
:param add_c... | def move(self, position, add_servo_delay=True, add_command_delay=True):
"""
Move the arm's servo that's designated for sliding the arm.
:param position: Position of the arm to move to. Can be BACK or FORWARD. Use check_dof method to see if that's possible.
:param add_servo_delay: T... | [
"def",
"move",
"(",
"self",
",",
"position",
",",
"add_servo_delay",
"=",
"True",
",",
"add_command_delay",
"=",
"True",
")",
":",
"turns",
"=",
"self",
".",
"check_dof",
"(",
"State",
".",
"LINEAR",
",",
"position",
")",
"done",
"=",
"False",
"time",
... | [
173,
4
] | [
214,
23
] | python | en | ['en', 'ja', 'th'] | False |
Arm.reposition_linear | (self, delay=0.0) |
Forces to record the repositioning of the linear servo even though it
may be in that position already.
:param delay: Time in seconds to wait for this command to execute.
:return: A dictionary with the 'servo', 'linear', 'rotational', 'position', 'time' keys that
specify... |
Forces to record the repositioning of the linear servo even though it
may be in that position already.
:param delay: Time in seconds to wait for this command to execute.
:return: A dictionary with the 'servo', 'linear', 'rotational', 'position', 'time' keys that
specify... | def reposition_linear(self, delay=0.0):
"""
Forces to record the repositioning of the linear servo even though it
may be in that position already.
:param delay: Time in seconds to wait for this command to execute.
:return: A dictionary with the 'servo', 'linear', 'rotational... | [
"def",
"reposition_linear",
"(",
"self",
",",
"delay",
"=",
"0.0",
")",
":",
"step",
"=",
"{",
"'servo'",
":",
"self",
".",
"linear_servo",
",",
"'linear'",
":",
"True",
",",
"'rotational'",
":",
"False",
",",
"'position'",
":",
"self",
".",
"current_lin... | [
216,
4
] | [
232,
19
] | python | en | ['en', 'ja', 'th'] | False |
Arm.reposition_rotational | (self, delay=0.0) |
Forces to record the repositioning of the rotational servo even though it
may be in that position already.
:param delay: Time in seconds to wait for this command to execute.
:return: A dictionary with the 'servo', 'linear', 'rotational', 'position', 'time' keys that
spe... |
Forces to record the repositioning of the rotational servo even though it
may be in that position already.
:param delay: Time in seconds to wait for this command to execute.
:return: A dictionary with the 'servo', 'linear', 'rotational', 'position', 'time' keys that
spe... | def reposition_rotational(self, delay=0.0):
"""
Forces to record the repositioning of the rotational servo even though it
may be in that position already.
:param delay: Time in seconds to wait for this command to execute.
:return: A dictionary with the 'servo', 'linear', 'ro... | [
"def",
"reposition_rotational",
"(",
"self",
",",
"delay",
"=",
"0.0",
")",
":",
"step",
"=",
"{",
"'servo'",
":",
"self",
".",
"rotational_servo",
",",
"'linear'",
":",
"False",
",",
"'rotational'",
":",
"True",
",",
"'position'",
":",
"self",
".",
"cur... | [
234,
4
] | [
250,
19
] | python | en | ['en', 'ja', 'th'] | False |
invalid_date | (self) | Check how non-existent date is treated.
For example, check 31st day in month that only has 30 days.
| Check how non-existent date is treated.
For example, check 31st day in month that only has 30 days.
| def invalid_date(self):
"""Check how non-existent date is treated.
For example, check 31st day in month that only has 30 days.
"""
date_range = [1930, 1980, 2230]
if self.context.stress:
date_range = range(1925, 2238)
with When("I check 31st day of a 30-day month"):
for year in... | [
"def",
"invalid_date",
"(",
"self",
")",
":",
"date_range",
"=",
"[",
"1930",
",",
"1980",
",",
"2230",
"]",
"if",
"self",
".",
"context",
".",
"stress",
":",
"date_range",
"=",
"range",
"(",
"1925",
",",
"2238",
")",
"with",
"When",
"(",
"\"I check ... | [
11,
0
] | [
27,
79
] | python | en | ['en', 'en', 'en'] | True |
invalid_time | (self, datetime, expected, timezone='UTC') | proper handling of invalid time for a timezone
when using DateTime64 extended range data type, for example,
2:30am on 7th April 2002 never happened at all in the US/Eastern timezone,
| proper handling of invalid time for a timezone
when using DateTime64 extended range data type, for example,
2:30am on 7th April 2002 never happened at all in the US/Eastern timezone,
| def invalid_time(self, datetime, expected, timezone='UTC'):
"""proper handling of invalid time for a timezone
when using DateTime64 extended range data type, for example,
2:30am on 7th April 2002 never happened at all in the US/Eastern timezone,
"""
with When(f"I check non-existent datetime {datetim... | [
"def",
"invalid_time",
"(",
"self",
",",
"datetime",
",",
"expected",
",",
"timezone",
"=",
"'UTC'",
")",
":",
"with",
"When",
"(",
"f\"I check non-existent datetime {datetime}\"",
")",
":",
"select_check_datetime",
"(",
"datetime",
"=",
"datetime",
",",
"expected... | [
40,
0
] | [
46,
86
] | python | en | ['en', 'en', 'en'] | True |
dst_disappeared | (self, tz, time_dates) | Proper handling of switching DST, when an hour is being skipped.
Testing in 2 steps: first, try to make a DateTime64 with skipped time value.
Second, adding interval so that result is in the skipped time.
| Proper handling of switching DST, when an hour is being skipped.
Testing in 2 steps: first, try to make a DateTime64 with skipped time value.
Second, adding interval so that result is in the skipped time.
| def dst_disappeared(self, tz, time_dates):
"""Proper handling of switching DST, when an hour is being skipped.
Testing in 2 steps: first, try to make a DateTime64 with skipped time value.
Second, adding interval so that result is in the skipped time.
"""
for time, dates in time_dates.items():
... | [
"def",
"dst_disappeared",
"(",
"self",
",",
"tz",
",",
"time_dates",
")",
":",
"for",
"time",
",",
"dates",
"in",
"time_dates",
".",
"items",
"(",
")",
":",
"for",
"date",
"in",
"dates",
":",
"with",
"Given",
"(",
"f\"forming a datetime\"",
")",
":",
"... | [
59,
0
] | [
81,
69
] | python | en | ['en', 'en', 'en'] | True |
leap_seconds | (self, datet, years) | Test proper handling of leap seconds. Read more: https://de.wikipedia.org/wiki/Schaltsekunde
Being checked by selecting a timestamp prior to leap second and adding seconds so that the result is after it.
| Test proper handling of leap seconds. Read more: https://de.wikipedia.org/wiki/Schaltsekunde
Being checked by selecting a timestamp prior to leap second and adding seconds so that the result is after it.
| def leap_seconds(self, datet, years):
"""Test proper handling of leap seconds. Read more: https://de.wikipedia.org/wiki/Schaltsekunde
Being checked by selecting a timestamp prior to leap second and adding seconds so that the result is after it.
"""
for year in years:
with When(f"{datet}, {year}"... | [
"def",
"leap_seconds",
"(",
"self",
",",
"datet",
",",
"years",
")",
":",
"for",
"year",
"in",
"years",
":",
"with",
"When",
"(",
"f\"{datet}, {year}\"",
")",
":",
"with",
"By",
"(",
"\"forming an expected result using python\"",
")",
":",
"dt_str",
"=",
"f\... | [
93,
0
] | [
107,
65
] | python | en | ['en', 'fy', 'en'] | True |
dst_time_zone_switch | (self) | Check how ClickHouse supports handling of invalid time when using DateTime64 extended range data type
when the invalid time is caused when countries switch timezone definitions with no daylight savings time switch.
| Check how ClickHouse supports handling of invalid time when using DateTime64 extended range data type
when the invalid time is caused when countries switch timezone definitions with no daylight savings time switch.
| def dst_time_zone_switch(self):
"""Check how ClickHouse supports handling of invalid time when using DateTime64 extended range data type
when the invalid time is caused when countries switch timezone definitions with no daylight savings time switch.
"""
stress = self.context.stress
timezones = timez... | [
"def",
"dst_time_zone_switch",
"(",
"self",
")",
":",
"stress",
"=",
"self",
".",
"context",
".",
"stress",
"timezones",
"=",
"timezones_range",
"(",
"stress",
")",
"utc",
"=",
"pytz",
".",
"timezone",
"(",
"\"UTC\"",
")",
"for",
"timezone",
"in",
"timezon... | [
115,
0
] | [
147,
72
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check how ClickHouse treats non-existent time in DateTime64 data type.
| Check how ClickHouse treats non-existent time in DateTime64 data type.
| def feature(self, node="clickhouse1"):
"""Check how ClickHouse treats non-existent time in DateTime64 data type.
"""
self.context.node = self.context.cluster.node(node)
for scenario in loads(current_module(), Scenario, Suite):
Scenario(run=scenario) | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",... | [
155,
0
] | [
161,
30
] | python | en | ['en', 'en', 'en'] | True |
describe_with_privilege_granted_directly | (self, node=None) | Check that user is able to execute DESCRIBE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
| Check that user is able to execute DESCRIBE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
| def describe_with_privilege_granted_directly(self, node=None):
"""Check that user is able to execute DESCRIBE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
"""
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
with us... | [
"def",
"describe_with_privilege_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",... | [
8,
0
] | [
20,
101
] | python | en | ['en', 'en', 'en'] | True |
describe_with_privilege_granted_via_role | (self, node=None) | Check that user is able to execute DESCRIBE on a table if and only if
they have SHOW COLUMNS privilege for that table granted through a role.
| Check that user is able to execute DESCRIBE on a table if and only if
they have SHOW COLUMNS privilege for that table granted through a role.
| def describe_with_privilege_granted_via_role(self, node=None):
"""Check that user is able to execute DESCRIBE on a table if and only if
they have SHOW COLUMNS privilege for that table granted through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
... | [
"def",
"describe_with_privilege_granted_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"no... | [
23,
0
] | [
39,
101
] | python | en | ['en', 'en', 'en'] | True |
describe | (self, grant_target_name, user_name, table_name, node=None) | Check that user is able to execute DESCRIBE only when they have SHOW COLUMNS privilege.
| Check that user is able to execute DESCRIBE only when they have SHOW COLUMNS privilege.
| def describe(self, grant_target_name, user_name, table_name, node=None):
"""Check that user is able to execute DESCRIBE only when they have SHOW COLUMNS privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
with table(node... | [
"def",
"describe",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"i... | [
45,
0
] | [
105,
89
] | python | en | ['en', 'en', 'en'] | True |
show_create_with_privilege_granted_directly | (self, node=None) | Check that user is able to execute SHOW CREATE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
| Check that user is able to execute SHOW CREATE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
| def show_create_with_privilege_granted_directly(self, node=None):
"""Check that user is able to execute SHOW CREATE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
"""
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
w... | [
"def",
"show_create_with_privilege_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
"... | [
108,
0
] | [
120,
104
] | python | en | ['en', 'en', 'en'] | True |
show_create_with_privilege_granted_via_role | (self, node=None) | Check that user is able to execute SHOW CREATE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
| Check that user is able to execute SHOW CREATE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
| def show_create_with_privilege_granted_via_role(self, node=None):
"""Check that user is able to execute SHOW CREATE on a table if and only if
they have SHOW COLUMNS privilege for that table granted directly.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
... | [
"def",
"show_create_with_privilege_granted_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
... | [
123,
0
] | [
139,
104
] | python | en | ['en', 'en', 'en'] | True |
show_create | (self, grant_target_name, user_name, table_name, node=None) | Check that user is able to execute SHOW CREATE on a table only when they have SHOW COLUMNS privilege.
| Check that user is able to execute SHOW CREATE on a table only when they have SHOW COLUMNS privilege.
| def show_create(self, grant_target_name, user_name, table_name, node=None):
"""Check that user is able to execute SHOW CREATE on a table only when they have SHOW COLUMNS privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"show_create",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
... | [
145,
0
] | [
193,
92
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SHOW COLUMNS.
| Check the RBAC functionality of SHOW COLUMNS.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SHOW COLUMNS.
"""
self.context.node = self.context.cluster.node(node)
Suite(run=describe_with_privilege_granted_directly, setup=instrument_clickhouse_server_log)
Suite(run=describe_with_privilege_granted_via_role, setup=instr... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"describe_with_privilege_granted_direct... | [
202,
0
] | [
210,
98
] | python | en | ['en', 'en', 'en'] | True |
train_script | (input_data, output_dir, image_dir, batch_size=4, num_iter=10, **kwargs) |
This script provides FastAI-compatible training for the input labeled images
:param image_dir: directory with images
:param filenames: image filenames
:param labels: image labels
:param output_dir: output directory where results will be exported
:return: fastai.basic_train.Learner object
|
This script provides FastAI-compatible training for the input labeled images
:param image_dir: directory with images
:param filenames: image filenames
:param labels: image labels
:param output_dir: output directory where results will be exported
:return: fastai.basic_train.Learner object
| def train_script(input_data, output_dir, image_dir, batch_size=4, num_iter=10, **kwargs):
"""
This script provides FastAI-compatible training for the input labeled images
:param image_dir: directory with images
:param filenames: image filenames
:param labels: image labels
:param output_dir: outp... | [
"def",
"train_script",
"(",
"input_data",
",",
"output_dir",
",",
"image_dir",
",",
"batch_size",
"=",
"4",
",",
"num_iter",
"=",
"10",
",",
"*",
"*",
"kwargs",
")",
":",
"filenames",
",",
"labels",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"item",
"in",
... | [
39,
0
] | [
70,
61
] | python | en | ['en', 'error', 'th'] | False |
eval_error | (cfg: EvalErrorConfig) | Evalutate Fourier heat map. The result is saved under outpus/eval_error.
Note:
Currently, we only supports the input of even-sized images.
Args:
cfg (EvalErrorConfig): The config of error evaluation.
| Evalutate Fourier heat map. The result is saved under outpus/eval_error. | def eval_error(cfg: EvalErrorConfig) -> None:
"""Evalutate Fourier heat map. The result is saved under outpus/eval_error.
Note:
Currently, we only supports the input of even-sized images.
Args:
cfg (EvalErrorConfig): The config of error evaluation.
"""
# Make config read only.
... | [
"def",
"eval_error",
"(",
"cfg",
":",
"EvalErrorConfig",
")",
"->",
"None",
":",
"# Make config read only.",
"# without this, config values might be changed accidentally.",
"OmegaConf",
".",
"set_readonly",
"(",
"cfg",
",",
"True",
")",
"# type: ignore",
"logger",
".",
... | [
62,
0
] | [
114,
25
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, distributed, node="clickhouse1") | Check window functions behavior using non-distributed or
distributed tables.
| Check window functions behavior using non-distributed or
distributed tables.
| def feature(self, distributed, node="clickhouse1"):
"""Check window functions behavior using non-distributed or
distributed tables.
"""
self.context.distributed = distributed
self.context.node = self.context.cluster.node(node)
with Given("I allow experimental window functions"):
allow_e... | [
"def",
"feature",
"(",
"self",
",",
"distributed",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"distributed",
"=",
"distributed",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node... | [
12,
0
] | [
46,
73
] | python | en | ['en', 'en', 'en'] | True |
TestCollectionInfoBase.test_get_collection_info_name_None | (self, connect, collection) |
target: get collection info where collection name is None
method: call collection_info with the collection_name: None
expected: status not ok
|
target: get collection info where collection name is None
method: call collection_info with the collection_name: None
expected: status not ok
| def test_get_collection_info_name_None(self, connect, collection):
'''
target: get collection info where collection name is None
method: call collection_info with the collection_name: None
expected: status not ok
'''
collection_name = None
with pytest.raises(Excep... | [
"def",
"test_get_collection_info_name_None",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"collection_name",
"=",
"None",
"with",
"pytest",
".",
"raises",
"(",
"Exception",
")",
"as",
"e",
":",
"status",
",",
"info",
"=",
"connect",
".",
"get_co... | [
36,
4
] | [
44,
72
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_name_not_existed | (self, connect, collection) |
target: get collection info where collection name does not exist
method: call collection_info with a random collection_name, which is not in db
expected: status not ok
|
target: get collection info where collection name does not exist
method: call collection_info with a random collection_name, which is not in db
expected: status not ok
| def test_get_collection_info_name_not_existed(self, connect, collection):
'''
target: get collection info where collection name does not exist
method: call collection_info with a random collection_name, which is not in db
expected: status not ok
'''
collection_name = gen_... | [
"def",
"test_get_collection_info_name_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"\"not_existed_collection\"",
")",
"status",
",",
"info",
"=",
"connect",
".",
"get_collection_stats",
"(",
"co... | [
47,
4
] | [
55,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_name_invalid | (self, connect, get_collection_name) |
target: get collection info where collection name is invalid
method: call collection_info with invalid collection_name
expected: status not ok
|
target: get collection info where collection name is invalid
method: call collection_info with invalid collection_name
expected: status not ok
| def test_get_collection_info_name_invalid(self, connect, get_collection_name):
'''
target: get collection info where collection name is invalid
method: call collection_info with invalid collection_name
expected: status not ok
'''
collection_name = get_collection_name
... | [
"def",
"test_get_collection_info_name_invalid",
"(",
"self",
",",
"connect",
",",
"get_collection_name",
")",
":",
"collection_name",
"=",
"get_collection_name",
"status",
",",
"info",
"=",
"connect",
".",
"get_collection_stats",
"(",
"collection_name",
")",
"assert",
... | [
65,
4
] | [
73,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_collection_row_count | (self, connect, collection) |
target: get row count with collection_info
method: add and delete vectors, check count in collection info
expected: status ok, count as expected
|
target: get row count with collection_info
method: add and delete vectors, check count in collection info
expected: status ok, count as expected
| def test_get_collection_info_collection_row_count(self, connect, collection):
'''
target: get row count with collection_info
method: add and delete vectors, check count in collection info
expected: status ok, count as expected
'''
vectors = gen_vector(nb, dim)
sta... | [
"def",
"test_get_collection_info_collection_row_count",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vector",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
... | [
76,
4
] | [
98,
42
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_partition_stats_A | (self, connect, collection) |
target: get partition info in a collection
method: no partition, call collection_info and check partition_stats
expected: status ok, "_default" partition is listed
|
target: get partition info in a collection
method: no partition, call collection_info and check partition_stats
expected: status ok, "_default" partition is listed
| def test_get_collection_info_partition_stats_A(self, connect, collection):
'''
target: get partition info in a collection
method: no partition, call collection_info and check partition_stats
expected: status ok, "_default" partition is listed
'''
vectors = gen_vector(nb, ... | [
"def",
"test_get_collection_info_partition_stats_A",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vector",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
"... | [
101,
4
] | [
117,
55
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_partition_stats_B | (self, connect, collection) |
target: get partition info in a collection
method: call collection_info after partition created and check partition_stats
expected: status ok, vectors added to partition
|
target: get partition info in a collection
method: call collection_info after partition created and check partition_stats
expected: status ok, vectors added to partition
| def test_get_collection_info_partition_stats_B(self, connect, collection):
'''
target: get partition info in a collection
method: call collection_info after partition created and check partition_stats
expected: status ok, vectors added to partition
'''
vectors = gen_vecto... | [
"def",
"test_get_collection_info_partition_stats_B",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"st... | [
121,
4
] | [
138,
55
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_partition_stats_C | (self, connect, collection) |
target: get partition info in a collection
method: create two partitions, add vectors in one of the partitions, call collection_info and check
expected: status ok, vectors added to one partition but not the other
|
target: get partition info in a collection
method: create two partitions, add vectors in one of the partitions, call collection_info and check
expected: status ok, vectors added to one partition but not the other
| def test_get_collection_info_partition_stats_C(self, connect, collection):
'''
target: get partition info in a collection
method: create two partitions, add vectors in one of the partitions, call collection_info and check
expected: status ok, vectors added to one partition but not the o... | [
"def",
"test_get_collection_info_partition_stats_C",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"new_tag",
"=",
"\"new_tag\"",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"coll... | [
141,
4
] | [
164,
50
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_partition_stats_D | (self, connect, collection) |
target: get partition info in a collection
method: create two partitions, add vectors in both partitions, call collection_info and check
expected: status ok, vectors added to both partitions
|
target: get partition info in a collection
method: create two partitions, add vectors in both partitions, call collection_info and check
expected: status ok, vectors added to both partitions
| def test_get_collection_info_partition_stats_D(self, connect, collection):
'''
target: get partition info in a collection
method: create two partitions, add vectors in both partitions, call collection_info and check
expected: status ok, vectors added to both partitions
'''
... | [
"def",
"test_get_collection_info_partition_stats_D",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"new_tag",
"=",
"\"new_tag\"",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"coll... | [
167,
4
] | [
192,
51
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_after_index_created | (self, connect, collection, get_simple_index) |
target: test collection info after index created
method: create collection, add vectors, create index and call collection_info
expected: status ok, index created and shown in segments
|
target: test collection info after index created
method: create collection, add vectors, create index and call collection_info
expected: status ok, index created and shown in segments
| def test_get_collection_info_after_index_created(self, connect, collection, get_simple_index):
'''
target: test collection info after index created
method: create collection, add vectors, create index and call collection_info
expected: status ok, index created and shown in segments
... | [
"def",
"test_get_collection_info_after_index_created",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"... | [
207,
4
] | [
230,
70
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_after_create_same_index_repeatedly | (self, connect, collection, get_simple_index) |
target: test collection info after index created repeatedly
method: create collection, add vectors, create index and call collection_info multiple times
expected: status ok, index info shown in segments
|
target: test collection info after index created repeatedly
method: create collection, add vectors, create index and call collection_info multiple times
expected: status ok, index info shown in segments
| def test_get_collection_info_after_create_same_index_repeatedly(self, connect, collection, get_simple_index):
'''
target: test collection info after index created repeatedly
method: create collection, add vectors, create index and call collection_info multiple times
expected: status ok,... | [
"def",
"test_get_collection_info_after_create_same_index_repeatedly",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"ind... | [
233,
4
] | [
256,
70
] | python | en | ['en', 'error', 'th'] | False |
TestCollectionInfoBase.test_get_collection_info_after_create_different_index_repeatedly | (self, connect, collection, get_simple_index) |
target: test collection info after index created repeatedly
method: create collection, add vectors, create index and call collection_info multiple times
expected: status ok, index info shown in segments
|
target: test collection info after index created repeatedly
method: create collection, add vectors, create index and call collection_info multiple times
expected: status ok, index info shown in segments
| def test_get_collection_info_after_create_different_index_repeatedly(self, connect, collection, get_simple_index):
'''
target: test collection info after index created repeatedly
method: create collection, add vectors, create index and call collection_info multiple times
expected: statu... | [
"def",
"test_get_collection_info_after_create_different_index_repeatedly",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"vectors",
"=",
"gen_vector",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"inse... | [
259,
4
] | [
280,
74
] | python | en | ['en', 'error', 'th'] | False |
privilege_granted_directly_or_via_role | (self, node=None) | Check that user is only able to execute DETACH DATABASE when they have required privilege, either directly or via role.
| Check that user is only able to execute DETACH DATABASE when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is only able to execute DETACH DATABASE when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
5,
0
] | [
27,
92
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege", setup=instrument_clickhouse_server_log):
db_name... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"with",
"Scenario",
"(",
"\"user without... | [
29,
0
] | [
138,
64
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of DETACH DATABASE.
| Check the RBAC functionality of DETACH DATABASE.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of DETACH DATABASE.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = stres... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
147,
0
] | [
158,
48
] | python | en | ['en', 'en', 'en'] | True |
login_and_execute_query | (self, username, password, exitcode=None, message=None, steps=True) | Execute query as some user.
| Execute query as some user.
| def login_and_execute_query(self, username, password, exitcode=None, message=None, steps=True):
"""Execute query as some user.
"""
self.context.node.query("SELECT 1",
settings=[("user", username), ("password", password)],
exitcode=exitcode or 0,
message=message, steps=steps) | [
"def",
"login_and_execute_query",
"(",
"self",
",",
"username",
",",
"password",
",",
"exitcode",
"=",
"None",
",",
"message",
"=",
"None",
",",
"steps",
"=",
"True",
")",
":",
"self",
".",
"context",
".",
"node",
".",
"query",
"(",
"\"SELECT 1\"",
",",
... | [
31,
0
] | [
37,
37
] | python | en | ['en', 'gl', 'en'] | True |
add_user_to_ldap_and_login | (self, server, user=None, ch_user=None, login=None, exitcode=None, message=None, rbac=False) | Add user to LDAP and ClickHouse and then try to login.
| Add user to LDAP and ClickHouse and then try to login.
| def add_user_to_ldap_and_login(self, server, user=None, ch_user=None, login=None, exitcode=None, message=None, rbac=False):
"""Add user to LDAP and ClickHouse and then try to login.
"""
self.context.ldap_node = self.context.cluster.node(server)
if ch_user is None:
ch_user = {}
if login is N... | [
"def",
"add_user_to_ldap_and_login",
"(",
"self",
",",
"server",
",",
"user",
"=",
"None",
",",
"ch_user",
"=",
"None",
",",
"login",
"=",
"None",
",",
"exitcode",
"=",
"None",
",",
"message",
"=",
"None",
",",
"rbac",
"=",
"False",
")",
":",
"self",
... | [
40,
0
] | [
59,
109
] | python | en | ['en', 'en', 'en'] | True |
parallel_login | (self, server, user_count=10, timeout=300, rbac=False) | Check that login of valid and invalid LDAP authenticated users works in parallel.
| Check that login of valid and invalid LDAP authenticated users works in parallel.
| def parallel_login(self, server, user_count=10, timeout=300, rbac=False):
"""Check that login of valid and invalid LDAP authenticated users works in parallel.
"""
self.context.ldap_node = self.context.cluster.node(server)
user = None
users = [{"cn": f"parallel_user{i}", "userpassword": randomword(2... | [
"def",
"parallel_login",
"(",
"self",
",",
"server",
",",
"user_count",
"=",
"10",
",",
"timeout",
"=",
"300",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(... | [
66,
0
] | [
114,
56
] | python | en | ['en', 'en', 'en'] | True |
login_after_user_is_deleted_from_ldap | (self, server, rbac=False) | Check that login fails after user is deleted from LDAP.
| Check that login fails after user is deleted from LDAP.
| def login_after_user_is_deleted_from_ldap(self, server, rbac=False):
"""Check that login fails after user is deleted from LDAP.
"""
self.context.ldap_node = self.context.cluster.node(server)
user = None
try:
with Given(f"I add user to LDAP"):
user = {"cn": "myuser", "userpasswor... | [
"def",
"login_after_user_is_deleted_from_ldap",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"server",
")",
"user",
"=",
"None",
... | [
121,
0
] | [
147,
58
] | python | en | ['en', 'en', 'en'] | True |
login_after_user_password_changed_in_ldap | (self, server, rbac=False) | Check that login fails after user password is changed in LDAP.
| Check that login fails after user password is changed in LDAP.
| def login_after_user_password_changed_in_ldap(self, server, rbac=False):
"""Check that login fails after user password is changed in LDAP.
"""
self.context.ldap_node = self.context.cluster.node(server)
user = None
try:
with Given(f"I add user to LDAP"):
user = {"cn": "myuser", "... | [
"def",
"login_after_user_password_changed_in_ldap",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"server",
")",
"user",
"=",
"None"... | [
154,
0
] | [
184,
58
] | python | en | ['en', 'en', 'en'] | True |
login_after_user_cn_changed_in_ldap | (self, server, rbac=False) | Check that login fails after user cn is changed in LDAP.
| Check that login fails after user cn is changed in LDAP.
| def login_after_user_cn_changed_in_ldap(self, server, rbac=False):
"""Check that login fails after user cn is changed in LDAP.
"""
self.context.ldap_node = self.context.cluster.node(server)
user = None
new_user = None
try:
with Given(f"I add user to LDAP"):
user = {"cn": "my... | [
"def",
"login_after_user_cn_changed_in_ldap",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"server",
")",
"user",
"=",
"None",
"n... | [
191,
0
] | [
218,
62
] | python | en | ['en', 'en', 'en'] | True |
login_after_ldap_server_is_restarted | (self, server, timeout=300, rbac=False) | Check that login succeeds after LDAP server is restarted.
| Check that login succeeds after LDAP server is restarted.
| def login_after_ldap_server_is_restarted(self, server, timeout=300, rbac=False):
"""Check that login succeeds after LDAP server is restarted.
"""
self.context.ldap_node = self.context.cluster.node(server)
user = None
try:
with Given(f"I add user to LDAP"):
user = {"cn": "myuser"... | [
"def",
"login_after_ldap_server_is_restarted",
"(",
"self",
",",
"server",
",",
"timeout",
"=",
"300",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"server",
... | [
225,
0
] | [
254,
58
] | python | en | ['en', 'da', 'en'] | True |
login_after_clickhouse_server_is_restarted | (self, server, timeout=300, rbac=False) | Check that login succeeds after ClickHouse server is restarted.
| Check that login succeeds after ClickHouse server is restarted.
| def login_after_clickhouse_server_is_restarted(self, server, timeout=300, rbac=False):
"""Check that login succeeds after ClickHouse server is restarted.
"""
self.context.ldap_node = self.context.cluster.node(server)
user = None
try:
with Given(f"I add user to LDAP"):
user = {"c... | [
"def",
"login_after_clickhouse_server_is_restarted",
"(",
"self",
",",
"server",
",",
"timeout",
"=",
"300",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"serv... | [
261,
0
] | [
290,
58
] | python | en | ['en', 'da', 'en'] | True |
valid_username_with_valid_empty_password | (self, server, rbac=False) | Check that we can't login using valid username that has empty password.
| Check that we can't login using valid username that has empty password.
| def valid_username_with_valid_empty_password(self, server, rbac=False):
"""Check that we can't login using valid username that has empty password.
"""
user = {"cn": "empty_password", "userpassword": ""}
exitcode = 4
message = f"DB::Exception: {user['cn']}: Authentication failed: password is incorrec... | [
"def",
"valid_username_with_valid_empty_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"user",
"=",
"{",
"\"cn\"",
":",
"\"empty_password\"",
",",
"\"userpassword\"",
":",
"\"\"",
"}",
"exitcode",
"=",
"4",
"message",
"=",
"f\"DB::... | [
297,
0
] | [
304,
103
] | python | en | ['en', 'en', 'en'] | True |
valid_username_and_invalid_empty_password | (self, server, rbac=False) | Check that we can't login using valid username but invalid empty password.
| Check that we can't login using valid username but invalid empty password.
| def valid_username_and_invalid_empty_password(self, server, rbac=False):
"""Check that we can't login using valid username but invalid empty password.
"""
username = "user_non_empty_password"
user = {"cn": username, "userpassword": username}
login = {"password": ""}
exitcode = 4
message = f... | [
"def",
"valid_username_and_invalid_empty_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"user_non_empty_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"username",
"}",
"login"... | [
311,
0
] | [
321,
116
] | python | en | ['en', 'en', 'en'] | True |
valid_username_and_password | (self, server, rbac=False) | Check that we can login using valid username and password.
| Check that we can login using valid username and password.
| def valid_username_and_password(self, server, rbac=False):
"""Check that we can login using valid username and password.
"""
username = "valid_username_and_password"
user = {"cn": username, "userpassword": username}
with When(f"I add user {username} to LDAP and try to login"):
add_user_to_l... | [
"def",
"valid_username_and_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"valid_username_and_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"username",
"}",
"with",
"When",... | [
327,
0
] | [
334,
71
] | python | en | ['en', 'en', 'en'] | True |
valid_username_and_password_invalid_server | (self, server=None, rbac=False) | Check that we can't login using valid username and valid
password but for a different server.
| Check that we can't login using valid username and valid
password but for a different server.
| def valid_username_and_password_invalid_server(self, server=None, rbac=False):
"""Check that we can't login using valid username and valid
password but for a different server.
"""
self.context.ldap_node = self.context.cluster.node("openldap1")
user = {"username": "user2", "userpassword": "user2", "... | [
"def",
"valid_username_and_password_invalid_server",
"(",
"self",
",",
"server",
"=",
"None",
",",
"rbac",
"=",
"False",
")",
":",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"\"openldap1\"",
")",
... | [
340,
0
] | [
352,
102
] | python | en | ['en', 'en', 'en'] | True |
valid_long_username_and_short_password | (self, server, rbac=False) | Check that we can login using valid very long username and short password.
| Check that we can login using valid very long username and short password.
| def valid_long_username_and_short_password(self, server, rbac=False):
"""Check that we can login using valid very long username and short password.
"""
username = "long_username_12345678901234567890123456789012345678901234567890123456789012345678901234567890"
user = {"cn": username, "userpassword": "lon... | [
"def",
"valid_long_username_and_short_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"long_username_12345678901234567890123456789012345678901234567890123456789012345678901234567890\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username"... | [
360,
0
] | [
366,
67
] | python | en | ['en', 'en', 'en'] | True |
invalid_long_username_and_valid_short_password | (self, server, rbac=False) | Check that we can't login using slightly invalid long username but valid password.
| Check that we can't login using slightly invalid long username but valid password.
| def invalid_long_username_and_valid_short_password(self, server, rbac=False):
"""Check that we can't login using slightly invalid long username but valid password.
"""
username = "long_username_12345678901234567890123456789012345678901234567890123456789012345678901234567890"
user = {"cn": username, "use... | [
"def",
"invalid_long_username_and_valid_short_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"long_username_12345678901234567890123456789012345678901234567890123456789012345678901234567890\"",
"user",
"=",
"{",
"\"cn\"",
":",
"u... | [
372,
0
] | [
382,
116
] | python | en | ['en', 'en', 'en'] | True |
valid_short_username_and_long_password | (self, server, rbac=False) | Check that we can login using valid short username with very long password.
| Check that we can login using valid short username with very long password.
| def valid_short_username_and_long_password(self, server, rbac=False):
"""Check that we can login using valid short username with very long password.
"""
username = "long_password"
user = {"cn": username, "userpassword": "long_password_123456789012345678901234567890123456789012345678901234567890123456789... | [
"def",
"valid_short_username_and_long_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"long_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"\"long_password_123456789012345678901234... | [
389,
0
] | [
394,
67
] | python | en | ['en', 'en', 'en'] | True |
valid_short_username_and_invalid_long_password | (self, server, rbac=False) | Check that we can't login using valid short username and invalid long password.
| Check that we can't login using valid short username and invalid long password.
| def valid_short_username_and_invalid_long_password(self, server, rbac=False):
"""Check that we can't login using valid short username and invalid long password.
"""
username = "long_password"
user = {"cn": username, "userpassword": "long_password_123456789012345678901234567890123456789012345678901234567... | [
"def",
"valid_short_username_and_invalid_long_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"long_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"\"long_password_1234567890123456... | [
400,
0
] | [
410,
116
] | python | en | ['en', 'en', 'en'] | True |
valid_username_and_invalid_password | (self, server, rbac=False) | Check that we can't login using valid username and invalid password.
| Check that we can't login using valid username and invalid password.
| def valid_username_and_invalid_password(self, server, rbac=False):
"""Check that we can't login using valid username and invalid password.
"""
username = "valid_username_and_invalid_password"
user = {"cn": username, "userpassword": username}
login = {"password": user["userpassword"] + "1"}
exit... | [
"def",
"valid_username_and_invalid_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"valid_username_and_invalid_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"username",
"}",
"... | [
416,
0
] | [
426,
116
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.