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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fit_psychophysical_curve | (x, y, hue=None, style=None, pal={}, dashes_dict={},
data=None, to_chance=False, **kwargs) | Fit psychophysical curve to mean data, intended for visualization only.
For use with seaborn's FacetGrid.map_dataframe
Parameters
----------
x, y, hue, style : str
columns from data to map along the x, y, hue, style dimensions
pal : dict, optional
dictionary mapping between hue lev... | Fit psychophysical curve to mean data, intended for visualization only. | def fit_psychophysical_curve(x, y, hue=None, style=None, pal={}, dashes_dict={},
data=None, to_chance=False, **kwargs):
"""Fit psychophysical curve to mean data, intended for visualization only.
For use with seaborn's FacetGrid.map_dataframe
Parameters
----------
x, y,... | [
"def",
"fit_psychophysical_curve",
"(",
"x",
",",
"y",
",",
"hue",
"=",
"None",
",",
"style",
"=",
"None",
",",
"pal",
"=",
"{",
"}",
",",
"dashes_dict",
"=",
"{",
"}",
",",
"data",
"=",
"None",
",",
"to_chance",
"=",
"False",
",",
"*",
"*",
"kwa... | [
1197,
0
] | [
1268,
71
] | python | en | ['en', 'en', 'en'] | True |
lineplot_like_pointplot | (data, x, y, col=None, row=None, hue=None, ci=95,
col_wrap=None, ax=None, **kwargs) | Make a lineplot that looks like pointplot
Pointplot looks nicer than lineplot for data with few points, but it
assumes the data is categorical. This makes a lineplot that looks like
pointplot, but can handle numeric data.
Two modes here:
- relplot: if ax is None, we call relplot, which allows for... | Make a lineplot that looks like pointplot | def lineplot_like_pointplot(data, x, y, col=None, row=None, hue=None, ci=95,
col_wrap=None, ax=None, **kwargs):
"""Make a lineplot that looks like pointplot
Pointplot looks nicer than lineplot for data with few points, but it
assumes the data is categorical. This makes a lineplo... | [
"def",
"lineplot_like_pointplot",
"(",
"data",
",",
"x",
",",
"y",
",",
"col",
"=",
"None",
",",
"row",
"=",
"None",
",",
"hue",
"=",
"None",
",",
"ci",
"=",
"95",
",",
"col_wrap",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
"... | [
1271,
0
] | [
1339,
12
] | python | en | ['en', 'en', 'en'] | True |
_setup_facet_figure | (df, col=None, row=None, col_order=None, row_order=None,
aspect=1, height=2.5, gridspec_kw={},
rotate_xticklabels=False, **kwargs) | Setup figure for custom facetting.
Goal is to have a figure we can plot different facets on, similar to how
sns.FacetGrid works but with slightly more control.
Parameters
----------
df : pd.DataFrame
Dataframe containing the data we'll plot.
col, row : str or None, optional
var... | Setup figure for custom facetting. | def _setup_facet_figure(df, col=None, row=None, col_order=None, row_order=None,
aspect=1, height=2.5, gridspec_kw={},
rotate_xticklabels=False, **kwargs):
"""Setup figure for custom facetting.
Goal is to have a figure we can plot different facets on, similar to h... | [
"def",
"_setup_facet_figure",
"(",
"df",
",",
"col",
"=",
"None",
",",
"row",
"=",
"None",
",",
"col_order",
"=",
"None",
",",
"row_order",
"=",
"None",
",",
"aspect",
"=",
"1",
",",
"height",
"=",
"2.5",
",",
"gridspec_kw",
"=",
"{",
"}",
",",
"ro... | [
1342,
0
] | [
1403,
32
] | python | en | ['en', 'no', 'en'] | True |
_prep_labels | (df, hue=None, style=None, col=None, row=None) | Prepare labels for custom legend.
In order to create our custom legend for our custom facetting, need some
extra info.
Parameters
----------
df : pd.DataFrame
Dataframe containing the data we'll plot.
hue, style, col, row : str or None, optional
variables to plot on axes or fac... | Prepare labels for custom legend. | def _prep_labels(df, hue=None, style=None, col=None, row=None):
"""Prepare labels for custom legend.
In order to create our custom legend for our custom facetting, need some
extra info.
Parameters
----------
df : pd.DataFrame
Dataframe containing the data we'll plot.
hue, style, co... | [
"def",
"_prep_labels",
"(",
"df",
",",
"hue",
"=",
"None",
",",
"style",
"=",
"None",
",",
"col",
"=",
"None",
",",
"row",
"=",
"None",
")",
":",
"if",
"hue",
"is",
"not",
"None",
"and",
"(",
"style",
"is",
"None",
"or",
"style",
"==",
"col",
"... | [
1406,
0
] | [
1447,
28
] | python | en | ['en', 'la', 'en'] | True |
_facetted_scatter_ci_dist | (data, x, y, hue=None, style=None, x_order=None,
label=None, all_labels=[None], x_dodge=None,
marker_adjust={}, palette={},
rotate_xticklabels=False, xlabel="", ylabel="",
title_str="", color='k', ax=... | Use scatter_ci_dist, with style and hue, on a specific axis.
Meant for use with our "custom facetting", this handles much of the
boilerplate stuff (properly arranging style and hue, assembling
final_markers dict, titling / labeling).
NOTE: this is intended for use with a *single* axis, but allows mult... | Use scatter_ci_dist, with style and hue, on a specific axis. | def _facetted_scatter_ci_dist(data, x, y, hue=None, style=None, x_order=None,
label=None, all_labels=[None], x_dodge=None,
marker_adjust={}, palette={},
rotate_xticklabels=False, xlabel="", ylabel="",
... | [
"def",
"_facetted_scatter_ci_dist",
"(",
"data",
",",
"x",
",",
"y",
",",
"hue",
"=",
"None",
",",
"style",
"=",
"None",
",",
"x_order",
"=",
"None",
",",
"label",
"=",
"None",
",",
"all_labels",
"=",
"[",
"None",
"]",
",",
"x_dodge",
"=",
"None",
... | [
1450,
0
] | [
1577,
24
] | python | en | ['en', 'en', 'en'] | True |
_draw_triangle | (ax, top_pt, side_length=.1, rotation_angle=0, **kwargs) | Draw equilateral triangle on axis to point something out.
Will not change axes limits.
Parameters
----------
ax : axis
The axis to add the triangle to.
top_pt : tuple
The (x, y) tuple (in data coordinates) of the "top point" of the
triangle. This is the value the triangle w... | Draw equilateral triangle on axis to point something out. | def _draw_triangle(ax, top_pt, side_length=.1, rotation_angle=0, **kwargs):
"""Draw equilateral triangle on axis to point something out.
Will not change axes limits.
Parameters
----------
ax : axis
The axis to add the triangle to.
top_pt : tuple
The (x, y) tuple (in data coordi... | [
"def",
"_draw_triangle",
"(",
"ax",
",",
"top_pt",
",",
"side_length",
"=",
".1",
",",
"rotation_angle",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"xlim",
"=",
"ax",
".",
"get_xlim",
"(",
")",
"ylim",
"=",
"ax",
".",
"get_ylim",
"(",
")",
"# thi... | [
1580,
0
] | [
1630,
13
] | python | en | ['en', 'en', 'en'] | True |
_draw_rectangle | (ax, top_pts, height=.1, **kwargs) | Draw rectangle on axis to show range.
Will not change axes limits.
Parameters
----------
ax : axis
The axis to add the triangle to.
top_pts : List
List of (x, y) tuples (in data coordinates) of the "top points" of the
rectangle.
height : float, optional
The heig... | Draw rectangle on axis to show range. | def _draw_rectangle(ax, top_pts, height=.1, **kwargs):
"""Draw rectangle on axis to show range.
Will not change axes limits.
Parameters
----------
ax : axis
The axis to add the triangle to.
top_pts : List
List of (x, y) tuples (in data coordinates) of the "top points" of the
... | [
"def",
"_draw_rectangle",
"(",
"ax",
",",
"top_pts",
",",
"height",
"=",
".1",
",",
"*",
"*",
"kwargs",
")",
":",
"xlim",
"=",
"ax",
".",
"get_xlim",
"(",
")",
"ylim",
"=",
"ax",
".",
"get_ylim",
"(",
")",
"# this converts the top pt from data coordinates ... | [
1633,
0
] | [
1674,
13
] | python | en | ['en', 'en', 'en'] | True |
add_physiological_scaling_arrows | (ax, side_length=.05, midget_rgc=True,
parasol_rgc=True, v1=True, **kwargs) | Draw arrows pointing out physiological scaling values.
These are point estimates, just taken from looking at figures, the more
accurate version is `add_physiological_scaling_bars`.
Parameters
----------
ax : axis
The axis to add the triangle to.
side_length : float, optional
Th... | Draw arrows pointing out physiological scaling values. | def add_physiological_scaling_arrows(ax, side_length=.05, midget_rgc=True,
parasol_rgc=True, v1=True, **kwargs):
"""Draw arrows pointing out physiological scaling values.
These are point estimates, just taken from looking at figures, the more
accurate version is `add_ph... | [
"def",
"add_physiological_scaling_arrows",
"(",
"ax",
",",
"side_length",
"=",
".05",
",",
"midget_rgc",
"=",
"True",
",",
"parasol_rgc",
"=",
"True",
",",
"v1",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"pal",
"=",
"get_palette",
"(",
"'model'",
"... | [
1677,
0
] | [
1717,
79
] | python | en | ['en', 'en', 'en'] | True |
add_physiological_scaling_bars | (ax, inf_data, bar_height=.04,
midget_rgc=True, parasol_rgc=True, v1=True,
**kwargs) | Draw bars showing range of physiological scaling values.
We get the range of V1 values from using WebPlotDigitzer on Figure 1G of
[1]_ (same values as in [2]_, Figure 5). For RGC, we fit our own line to
data from [3]_.
Parameters
----------
ax : axis
The axis to add the triangle to.
... | Draw bars showing range of physiological scaling values. | def add_physiological_scaling_bars(ax, inf_data, bar_height=.04,
midget_rgc=True, parasol_rgc=True, v1=True,
**kwargs):
"""Draw bars showing range of physiological scaling values.
We get the range of V1 values from using WebPlotDigitzer on F... | [
"def",
"add_physiological_scaling_bars",
"(",
"ax",
",",
"inf_data",
",",
"bar_height",
"=",
".04",
",",
"midget_rgc",
"=",
"True",
",",
"parasol_rgc",
"=",
"True",
",",
"v1",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"pal",
"=",
"get_palette",
"("... | [
1720,
0
] | [
1785,
79
] | python | en | ['en', 'en', 'en'] | True |
_spectra_dataset_to_dataframe | (spectra, data='sf') | Convert spectra xarray dataset to pandas dataframe.
Parameters
----------
spectra : xarray.Dataset
Dataset containing the spectra for synthesized metamers and our natural
reference images.
data : {'sf', 'orientation'}, optional
Whether to grab the spatial frequency or orientatio... | Convert spectra xarray dataset to pandas dataframe. | def _spectra_dataset_to_dataframe(spectra, data='sf'):
"""Convert spectra xarray dataset to pandas dataframe.
Parameters
----------
spectra : xarray.Dataset
Dataset containing the spectra for synthesized metamers and our natural
reference images.
data : {'sf', 'orientation'}, option... | [
"def",
"_spectra_dataset_to_dataframe",
"(",
"spectra",
",",
"data",
"=",
"'sf'",
")",
":",
"if",
"data",
"==",
"'sf'",
":",
"cols",
"=",
"[",
"'freq_n'",
"]",
"elif",
"data",
"==",
"'orientation'",
":",
"cols",
"=",
"[",
"'orientation_slice'",
",",
"'samp... | [
1788,
0
] | [
1824,
13
] | python | en | ['lv', 'su', 'en'] | False |
tabular_legend | (fig, legend, labels, title='trial_type',
place_under_fig=False) | Add a tabular legend for trial_type to figure.
This is a fancier version of the legend explaining trial type, grouping
them visually by "big category" (synthesized vs synthesized or original vs
synthesized), as well as trying to make it more explicit what the two
images being compared are.
It shou... | Add a tabular legend for trial_type to figure. | def tabular_legend(fig, legend, labels, title='trial_type',
place_under_fig=False):
"""Add a tabular legend for trial_type to figure.
This is a fancier version of the legend explaining trial type, grouping
them visually by "big category" (synthesized vs synthesized or original vs
syn... | [
"def",
"tabular_legend",
"(",
"fig",
",",
"legend",
",",
"labels",
",",
"title",
"=",
"'trial_type'",
",",
"place_under_fig",
"=",
"False",
")",
":",
"def",
"_fix_row_labels",
"(",
"all_rows",
",",
"target_row",
",",
"table",
")",
":",
"\"\"\"Merge cells and c... | [
1827,
0
] | [
2050,
16
] | python | en | ['en', 'en', 'en'] | True |
_replace_interval_with_scalar | (expr) |
Good old Depth-First Search to identify the Interval and IntervalValue
components of the expression and return a comparable scalar expression.
Parameters
----------
expr : float or expression of intervals, i.e.
1 * ibis.day() + 5 * ibis.hour()
Returns
-------
preceding : float o... |
Good old Depth-First Search to identify the Interval and IntervalValue
components of the expression and return a comparable scalar expression. | def _replace_interval_with_scalar(expr):
"""
Good old Depth-First Search to identify the Interval and IntervalValue
components of the expression and return a comparable scalar expression.
Parameters
----------
expr : float or expression of intervals, i.e.
1 * ibis.day() + 5 * ibis.hour()
... | [
"def",
"_replace_interval_with_scalar",
"(",
"expr",
")",
":",
"try",
":",
"expr_op",
"=",
"expr",
".",
"op",
"(",
")",
"except",
"AttributeError",
":",
"expr_op",
"=",
"None",
"if",
"not",
"isinstance",
"(",
"expr",
",",
"(",
"dt",
".",
"Interval",
",",... | [
215,
0
] | [
258,
42
] | python | en | ['en', 'error', 'th'] | False |
LightningQubit.apply_lightning | (self, state, operations) | Apply a list of operations to the state tensor.
Args:
state (array[complex]): the input state tensor
operations (list[~pennylane.operation.Operation]): operations to apply
Returns:
array[complex]: the output state tensor
| Apply a list of operations to the state tensor. | def apply_lightning(self, state, operations):
"""Apply a list of operations to the state tensor.
Args:
state (array[complex]): the input state tensor
operations (list[~pennylane.operation.Operation]): operations to apply
Returns:
array[complex]: the output s... | [
"def",
"apply_lightning",
"(",
"self",
",",
"state",
",",
"operations",
")",
":",
"op_names",
"=",
"[",
"self",
".",
"_remove_inverse_string",
"(",
"o",
".",
"name",
")",
"for",
"o",
"in",
"operations",
"]",
"op_wires",
"=",
"[",
"self",
".",
"wires",
... | [
122,
4
] | [
139,
52
] | python | en | ['en', 'en', 'en'] | True |
LightningQubit._remove_inverse_string | (string) | Removes the ``.inv`` appended to the end of inverse gates.
Args:
string (str): name of operation
Returns:
str: name of operation with ``.inv`` removed (if present)
| Removes the ``.inv`` appended to the end of inverse gates. | def _remove_inverse_string(string):
"""Removes the ``.inv`` appended to the end of inverse gates.
Args:
string (str): name of operation
Returns:
str: name of operation with ``.inv`` removed (if present)
"""
return string.replace(".inv", "") | [
"def",
"_remove_inverse_string",
"(",
"string",
")",
":",
"return",
"string",
".",
"replace",
"(",
"\".inv\"",
",",
"\"\"",
")"
] | [
142,
4
] | [
151,
41
] | python | en | ['en', 'en', 'en'] | True |
test_select_query | (node, krb_auth=True, req="SELECT currentUser()") | Helper forming a HTTP query to ClickHouse server
| Helper forming a HTTP query to ClickHouse server
| def test_select_query(node, krb_auth=True, req="SELECT currentUser()"):
""" Helper forming a HTTP query to ClickHouse server
"""
if krb_auth:
return f"echo '{req}' | curl --negotiate -u : 'http://{node.name}:8123/' --data-binary @-"
else:
return f"echo '{req}' | curl 'http://{node.name}:... | [
"def",
"test_select_query",
"(",
"node",
",",
"krb_auth",
"=",
"True",
",",
"req",
"=",
"\"SELECT currentUser()\"",
")",
":",
"if",
"krb_auth",
":",
"return",
"f\"echo '{req}' | curl --negotiate -u : 'http://{node.name}:8123/' --data-binary @-\"",
"else",
":",
"return",
"... | [
42,
0
] | [
48,
81
] | python | en | ['en', 'pt', 'en'] | True |
kinit_no_keytab | (self, node, principal="kerberos_user", lifetime_option="-l 10:00") | Helper for obtaining Kerberos ticket for client
| Helper for obtaining Kerberos ticket for client
| def kinit_no_keytab(self, node, principal="kerberos_user", lifetime_option="-l 10:00"):
""" Helper for obtaining Kerberos ticket for client
"""
try:
node.cmd("echo pwd | kinit admin/admin")
node.cmd(f"kadmin -w pwd -q \"add_principal -pw pwd {principal}\"")
node.cmd(f"echo pwd | kini... | [
"def",
"kinit_no_keytab",
"(",
"self",
",",
"node",
",",
"principal",
"=",
"\"kerberos_user\"",
",",
"lifetime_option",
"=",
"\"-l 10:00\"",
")",
":",
"try",
":",
"node",
".",
"cmd",
"(",
"\"echo pwd | kinit admin/admin\"",
")",
"node",
".",
"cmd",
"(",
"f\"ka... | [
52,
0
] | [
61,
28
] | python | en | ['en', 'en', 'en'] | True |
create_server_principal | (self, node) | Helper for obtaining Kerberos ticket for server
| Helper for obtaining Kerberos ticket for server
| def create_server_principal(self, node):
""" Helper for obtaining Kerberos ticket for server
"""
try:
node.cmd("echo pwd | kinit admin/admin")
node.cmd(f"kadmin -w pwd -q \"add_principal -randkey HTTP/docker-compose_{node.name}_1.docker-compose_default\"")
node.cmd(f"kadmin -w pwd -q... | [
"def",
"create_server_principal",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"node",
".",
"cmd",
"(",
"\"echo pwd | kinit admin/admin\"",
")",
"node",
".",
"cmd",
"(",
"f\"kadmin -w pwd -q \\\"add_principal -randkey HTTP/docker-compose_{node.name}_1.docker-compose_defaul... | [
65,
0
] | [
75,
39
] | python | en | ['en', 'pt', 'en'] | True |
save_file_state | (self, node, filename) | Save current file and then restore it, restarting the node
| Save current file and then restore it, restarting the node
| def save_file_state(self, node, filename):
""" Save current file and then restore it, restarting the node
"""
try:
with When("I save file state"):
with open(filename, 'r') as f:
a = f.read()
yield
finally:
with Finally("I restore initial state"):
... | [
"def",
"save_file_state",
"(",
"self",
",",
"node",
",",
"filename",
")",
":",
"try",
":",
"with",
"When",
"(",
"\"I save file state\"",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"a",
"=",
"f",
".",
"read",
"(",
")... | [
79,
0
] | [
91,
26
] | python | en | ['en', 'en', 'en'] | True |
temp_erase | (self, node, filename=None) | Temporary erasing config file and restarting the node
| Temporary erasing config file and restarting the node
| def temp_erase(self, node, filename=None):
""" Temporary erasing config file and restarting the node
"""
if filename is None:
filename = f"kerberos/configs/{node.name}/config.d/kerberos.xml"
with When("I save file state"):
with open(filename, 'r') as f:
a = f.read()
try:
... | [
"def",
"temp_erase",
"(",
"self",
",",
"node",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"f\"kerberos/configs/{node.name}/config.d/kerberos.xml\"",
"with",
"When",
"(",
"\"I save file state\"",
")",
":",
"with",
... | [
95,
0
] | [
113,
26
] | python | en | ['en', 'en', 'en'] | True |
restart | (node, config_path, safe=False, timeout=60) | Restart ClickHouse server and wait for config to be reloaded.
| Restart ClickHouse server and wait for config to be reloaded.
| def restart(node, config_path, safe=False, timeout=60):
"""Restart ClickHouse server and wait for config to be reloaded.
"""
filename = '/etc/clickhouse-server/config.xml' if 'config.d' in config_path else '/etc/clickhouse-server/users.xml'
with When("I restart ClickHouse server node"):
with no... | [
"def",
"restart",
"(",
"node",
",",
"config_path",
",",
"safe",
"=",
"False",
",",
"timeout",
"=",
"60",
")",
":",
"filename",
"=",
"'/etc/clickhouse-server/config.xml'",
"if",
"'config.d'",
"in",
"config_path",
"else",
"'/etc/clickhouse-server/users.xml'",
"with",
... | [
116,
0
] | [
143,
36
] | python | en | ['en', 'en', 'en'] | True |
check_wrong_config | (self, node, client, config_path, modify_file, log_error="", output="",
tail=120, timeout=60, healthy_on_restart=True) | Check that ClickHouse errors when trying to load invalid configuration file.
| Check that ClickHouse errors when trying to load invalid configuration file.
| def check_wrong_config(self, node, client, config_path, modify_file, log_error="", output="",
tail=120, timeout=60, healthy_on_restart=True):
"""Check that ClickHouse errors when trying to load invalid configuration file.
"""
preprocessed_name = "config.xml" if "config.d" in config_pa... | [
"def",
"check_wrong_config",
"(",
"self",
",",
"node",
",",
"client",
",",
"config_path",
",",
"modify_file",
",",
"log_error",
"=",
"\"\"",
",",
"output",
"=",
"\"\"",
",",
"tail",
"=",
"120",
",",
"timeout",
"=",
"60",
",",
"healthy_on_restart",
"=",
"... | [
147,
0
] | [
222,
41
] | python | en | ['en', 'en', 'en'] | True |
getArticlesOn_n_pages | (num_pages_to_check, driver) |
clanki se pojavijo na strani sele, ko se zloada javascript,
zato se uporabi selenium knjiznjica
|
clanki se pojavijo na strani sele, ko se zloada javascript,
zato se uporabi selenium knjiznjica
| def getArticlesOn_n_pages(num_pages_to_check, driver):
'''
clanki se pojavijo na strani sele, ko se zloada javascript,
zato se uporabi selenium knjiznjica
'''
articles = []
print('\tgathering articles ...')
for n in tqdm(range(num_pages_to_check)):
driver.get(full_url + str(n... | [
"def",
"getArticlesOn_n_pages",
"(",
"num_pages_to_check",
",",
"driver",
")",
":",
"articles",
"=",
"[",
"]",
"print",
"(",
"'\\tgathering articles ...'",
")",
"for",
"n",
"in",
"tqdm",
"(",
"range",
"(",
"num_pages_to_check",
")",
")",
":",
"driver",
".",
... | [
34,
0
] | [
53,
19
] | python | en | ['en', 'error', 'th'] | False |
cleanup | () | Cleanup all libxslt and libxml2 memory allocated | Cleanup all libxslt and libxml2 memory allocated | def cleanup():
"""Cleanup all libxslt and libxml2 memory allocated"""
libxsltmod.xsltPythonCleanup()
libxml2.cleanupParser() | [
"def",
"cleanup",
"(",
")",
":",
"libxsltmod",
".",
"xsltPythonCleanup",
"(",
")",
"libxml2",
".",
"cleanupParser",
"(",
")"
] | [
120,
0
] | [
123,
27
] | python | en | ['en', 'en', 'en'] | True |
extensionModule.styleInit | (self, style, URI) | Callback function when used in a newly compiled stylesheet,
the return value is passed in subsequent calls | Callback function when used in a newly compiled stylesheet,
the return value is passed in subsequent calls | def styleInit(self, style, URI):
"""Callback function when used in a newly compiled stylesheet,
the return value is passed in subsequent calls"""
pass | [
"def",
"styleInit",
"(",
"self",
",",
"style",
",",
"URI",
")",
":",
"pass"
] | [
102,
4
] | [
105,
12
] | python | en | ['en', 'en', 'en'] | True |
extensionModule.styleShutdown | (self, style, URI, data) | Callback function when a stylesheet using it is destroyed | Callback function when a stylesheet using it is destroyed | def styleShutdown(self, style, URI, data):
"""Callback function when a stylesheet using it is destroyed"""
pass | [
"def",
"styleShutdown",
"(",
"self",
",",
"style",
",",
"URI",
",",
"data",
")",
":",
"pass"
] | [
107,
4
] | [
109,
12
] | python | en | ['en', 'en', 'en'] | True |
extensionModule.ctxtInit | (self, ctxt, URI) | Callback function when used in a new transformation process,
the return value is passed in subsequent calls | Callback function when used in a new transformation process,
the return value is passed in subsequent calls | def ctxtInit(self, ctxt, URI):
"""Callback function when used in a new transformation process,
the return value is passed in subsequent calls"""
pass | [
"def",
"ctxtInit",
"(",
"self",
",",
"ctxt",
",",
"URI",
")",
":",
"pass"
] | [
111,
4
] | [
114,
12
] | python | en | ['en', 'en', 'en'] | True |
extensionModule.ctxtShutdown | (self, ctxt, URI, data) | Callback function when a transformation using it finishes | Callback function when a transformation using it finishes | def ctxtShutdown(self, ctxt, URI, data):
"""Callback function when a transformation using it finishes"""
pass | [
"def",
"ctxtShutdown",
"(",
"self",
",",
"ctxt",
",",
"URI",
",",
"data",
")",
":",
"pass"
] | [
116,
4
] | [
118,
12
] | 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 |
scenario | (self, node="clickhouse1") | Check that ClickHouse returns 1 when user executes `SELECT 1` query.
| Check that ClickHouse returns 1 when user executes `SELECT 1` query.
| def scenario(self, node="clickhouse1"):
"""Check that ClickHouse returns 1 when user executes `SELECT 1` query.
"""
node = self.context.cluster.node(node)
with When("I execute query select 1"):
r = node.query("SELECT 1").output.strip()
with Then("the result should be 1"):
assert r ... | [
"def",
"scenario",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"with",
"When",
"(",
"\"I execute query select 1\"",
")",
":",
"r",
"=",
"node",
".",
"qu... | [
10,
0
] | [
19,
32
] | python | en | ['en', 'en', 'en'] | True |
user | (self, name, node=None) | Create a user with a given name.
| Create a user with a given name.
| def user(self, name, node=None):
"""Create a user with a given name.
"""
if node is None:
node = self.context.node
try:
with Given(f"I create user {name}"):
node.query(f"CREATE USER OR REPLACE {name} ON CLUSTER one_shard_cluster")
yield
finally:
with Fina... | [
"def",
"user",
"(",
"self",
",",
"name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"try",
":",
"with",
"Given",
"(",
"f\"I create user {name}\"",
")",
":",
"node",
".",
"q... | [
8,
0
] | [
20,
82
] | python | en | ['en', 'en', 'en'] | True |
role | (self, name, node=None) | Create a role with a given name.
| Create a role with a given name.
| def role(self, name, node=None):
"""Create a role with a given name.
"""
if node is None:
node = self.context.node
try:
with Given(f"I create role {name}"):
node.query(f"CREATE ROLE OR REPLACE {name} ON CLUSTER one_shard_cluster")
yield
finally:
with Fina... | [
"def",
"role",
"(",
"self",
",",
"name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"try",
":",
"with",
"Given",
"(",
"f\"I create role {name}\"",
")",
":",
"node",
".",
"q... | [
23,
0
] | [
35,
82
] | python | en | ['en', 'en', 'en'] | True |
table | (self, name, cluster=None, node=None) | Create a table with given name and on specified cluster, if specified.
| Create a table with given name and on specified cluster, if specified.
| def table(self, name, cluster=None, node=None):
"""Create a table with given name and on specified cluster, if specified.
"""
if node is None:
node = self.context.node
try:
if cluster:
with Given(f"I create table {name}"):
node.query(f"DROP TABLE IF EXISTS {na... | [
"def",
"table",
"(",
"self",
",",
"name",
",",
"cluster",
"=",
"None",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"try",
":",
"if",
"cluster",
":",
"with",
"Given",
"(",
... | [
38,
0
] | [
59,
57
] | python | en | ['en', 'en', 'en'] | True |
create | (self) | Check the RBAC functionality of distributed table with CREATE.
| Check the RBAC functionality of distributed table with CREATE.
| def create(self):
"""Check the RBAC functionality of distributed table with CREATE.
"""
create_scenarios=[
create_without_privilege,
create_with_privilege_granted_directly_or_via_role,
create_with_all_privilege_granted_directly_or_via_role,
]
for scenario in create_scenarios:
Sc... | [
"def",
"create",
"(",
"self",
")",
":",
"create_scenarios",
"=",
"[",
"create_without_privilege",
",",
"create_with_privilege_granted_directly_or_via_role",
",",
"create_with_all_privilege_granted_directly_or_via_role",
",",
"]",
"for",
"scenario",
"in",
"create_scenarios",
"... | [
65,
0
] | [
75,
70
] | python | en | ['en', 'en', 'en'] | True |
create_without_privilege | (self, node=None) | Check that user is unable to create a distributed table without privileges.
| Check that user is unable to create a distributed table without privileges.
| def create_without_privilege(self, node=None):
"""Check that user is unable to create a distributed table without privileges.
"""
user_name = f"user_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name = f"table1_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_n... | [
"def",
"create_without_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
78,
0
] | [
107,
47
] | python | en | ['en', 'en', 'en'] | True |
create_with_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a distributed table if and only if
they have CREATE and REMOTE privileges granted either directly or through a role.
| Check that user is able to create a distributed table if and only if
they have CREATE and REMOTE privileges granted either directly or through a role.
| def create_with_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a distributed table if and only if
they have CREATE and REMOTE privileges granted either directly or through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if... | [
"def",
"create_with_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
... | [
110,
0
] | [
136,
110
] | python | en | ['en', 'en', 'en'] | True |
create_with_privilege | (self, user_name, grant_target_name, node=None) | Grant CREATE and REMOTE privileges seperately, check the user is unable to create the table,
grant both privileges and check the user is able is create the table.
| Grant CREATE and REMOTE privileges seperately, check the user is unable to create the table,
grant both privileges and check the user is able is create the table.
| def create_with_privilege(self, user_name, grant_target_name, node=None):
"""Grant CREATE and REMOTE privileges seperately, check the user is unable to create the table,
grant both privileges and check the user is able is create the table.
"""
table0_name = f"table0_{getuid()}"
table1_name = f"table... | [
"def",
"create_with_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
139,
0
] | [
181,
61
] | python | en | ['en', 'en', 'en'] | True |
create_with_all_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a distributed table if and only if
they have ALL privilege granted either directly or through a role.
| Check that user is able to create a distributed table if and only if
they have ALL privilege granted either directly or through a role.
| def create_with_all_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a distributed table if and only if
they have ALL privilege granted either directly or through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is No... | [
"def",
"create_with_all_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context"... | [
184,
0
] | [
210,
110
] | python | en | ['en', 'en', 'en'] | True |
create_with_privilege | (self, user_name, grant_target_name, node=None) | Grant ALL privilege and check the user is able is create the table.
| Grant ALL privilege and check the user is able is create the table.
| def create_with_privilege(self, user_name, grant_target_name, node=None):
"""Grant ALL privilege and check the user is able is create the table.
"""
table0_name = f"table0_{getuid()}"
table1_name = f"table1_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
cluste... | [
"def",
"create_with_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
213,
0
] | [
237,
61
] | python | en | ['en', 'en', 'en'] | True |
select | (self) | Check the RBAC functionality of distributed table with SELECT.
| Check the RBAC functionality of distributed table with SELECT.
| def select(self):
"""Check the RBAC functionality of distributed table with SELECT.
"""
select_scenarios = [
select_without_privilege,
select_with_privilege_granted_directly_or_via_role,
select_with_all_privilege_granted_directly_or_via_role
]
for scenario in select_scenario... | [
"def",
"select",
"(",
"self",
")",
":",
"select_scenarios",
"=",
"[",
"select_without_privilege",
",",
"select_with_privilege_granted_directly_or_via_role",
",",
"select_with_all_privilege_granted_directly_or_via_role",
"]",
"for",
"scenario",
"in",
"select_scenarios",
":",
"... | [
243,
0
] | [
253,
70
] | python | en | ['en', 'en', 'en'] | True |
select_without_privilege | (self, node=None) | Check that user is unable to select from a distributed table without privileges.
| Check that user is unable to select from a distributed table without privileges.
| def select_without_privilege(self, node=None):
"""Check that user is unable to select from a distributed table without privileges.
"""
user_name = f"user_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name = f"table1_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{us... | [
"def",
"select_without_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
256,
0
] | [
290,
61
] | python | en | ['en', 'en', 'en'] | True |
select_with_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a distributed table if and only if
they have SELECT privilege for the distributed table and the table it is using.
| Check that user is able to select from a distributed table if and only if
they have SELECT privilege for the distributed table and the table it is using.
| def select_with_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a distributed table if and only if
they have SELECT privilege for the distributed table and the table it is using.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
... | [
"def",
"select_with_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
... | [
293,
0
] | [
319,
110
] | python | en | ['en', 'en', 'en'] | True |
select_with_privilege | (self, user_name, grant_target_name, node=None) | Grant SELECT privilege to the user on each table seperately, check that user is unable to select from the distribute table,
grant privilege on both tables and check the user is able to select.
| Grant SELECT privilege to the user on each table seperately, check that user is unable to select from the distribute table,
grant privilege on both tables and check the user is able to select.
| def select_with_privilege(self, user_name, grant_target_name, node=None):
"""Grant SELECT privilege to the user on each table seperately, check that user is unable to select from the distribute table,
grant privilege on both tables and check the user is able to select.
"""
table0_name = f"table0_{getuid... | [
"def",
"select_with_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
322,
0
] | [
367,
61
] | python | en | ['en', 'en', 'en'] | True |
select_with_all_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a distributed table if and only if
they have ALL privilege.
| Check that user is able to select from a distributed table if and only if
they have ALL privilege.
| def select_with_all_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a distributed table if and only if
they have ALL privilege.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node = self.context.node
... | [
"def",
"select_with_all_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context"... | [
370,
0
] | [
396,
110
] | python | en | ['en', 'en', 'en'] | True |
select_with_privilege | (self, user_name, grant_target_name, node=None) | Grant ALL and check the user is able to select from the distributed table.
| Grant ALL and check the user is able to select from the distributed table.
| def select_with_privilege(self, user_name, grant_target_name, node=None):
"""Grant ALL and check the user is able to select from the distributed table.
"""
table0_name = f"table0_{getuid()}"
table1_name = f"table1_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
... | [
"def",
"select_with_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
399,
0
] | [
426,
61
] | python | en | ['en', 'en', 'en'] | True |
insert | (self) | Check the RBAC functionality of distributed table with INSERT.
| Check the RBAC functionality of distributed table with INSERT.
| def insert(self):
"""Check the RBAC functionality of distributed table with INSERT.
"""
insert_scenarios = [
insert_without_privilege,
insert_with_privilege_granted_directly_or_via_role,
]
for scenario in insert_scenarios:
Scenario(run=scenario, setup=instrument_clickhouse_s... | [
"def",
"insert",
"(",
"self",
")",
":",
"insert_scenarios",
"=",
"[",
"insert_without_privilege",
",",
"insert_with_privilege_granted_directly_or_via_role",
",",
"]",
"for",
"scenario",
"in",
"insert_scenarios",
":",
"Scenario",
"(",
"run",
"=",
"scenario",
",",
"se... | [
432,
0
] | [
441,
70
] | python | en | ['en', 'en', 'en'] | True |
insert_without_privilege | (self, node=None) | Check that user is unable to insert into a distributed table without privileges.
| Check that user is unable to insert into a distributed table without privileges.
| def insert_without_privilege(self, node=None):
"""Check that user is unable to insert into a distributed table without privileges.
"""
user_name = f"user_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name = f"table1_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{u... | [
"def",
"insert_without_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
444,
0
] | [
480,
61
] | python | en | ['en', 'en', 'en'] | True |
insert_with_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a distributed table if and only if
they have INSERT privilege for the distributed table and the table it is using.
| Check that user is able to select from a distributed table if and only if
they have INSERT privilege for the distributed table and the table it is using.
| def insert_with_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a distributed table if and only if
they have INSERT privilege for the distributed table and the table it is using.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
... | [
"def",
"insert_with_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
... | [
483,
0
] | [
509,
110
] | python | en | ['en', 'en', 'en'] | True |
insert_with_privilege | (self, user_name, grant_target_name, node=None) | Grant INSERT privilege on each table seperately, check that the user is unable to insert into the distributed table,
grant privilege on both tables and check the user is able to insert.
| Grant INSERT privilege on each table seperately, check that the user is unable to insert into the distributed table,
grant privilege on both tables and check the user is able to insert.
| def insert_with_privilege(self, user_name, grant_target_name, node=None):
"""Grant INSERT privilege on each table seperately, check that the user is unable to insert into the distributed table,
grant privilege on both tables and check the user is able to insert.
"""
table0_name = f"table0_{getuid()}"
... | [
"def",
"insert_with_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
... | [
512,
0
] | [
570,
61
] | python | en | ['en', 'en', 'en'] | True |
special_cases | (self) | Check that the user is able to successfully execute queries on distributed tables using special tables,
such as materialized view or another distributed table, if and only if they have the required privileges.
| Check that the user is able to successfully execute queries on distributed tables using special tables,
such as materialized view or another distributed table, if and only if they have the required privileges.
| def special_cases(self):
"""Check that the user is able to successfully execute queries on distributed tables using special tables,
such as materialized view or another distributed table, if and only if they have the required privileges.
"""
special_case_scenarios = [
select_with_table_on_materi... | [
"def",
"special_cases",
"(",
"self",
")",
":",
"special_case_scenarios",
"=",
"[",
"select_with_table_on_materialized_view_privilege_granted_directly_or_via_role",
",",
"insert_with_table_on_materialized_view_privilege_granted_directly_or_via_role",
",",
"select_with_table_on_source_table_... | [
576,
0
] | [
590,
70
] | python | en | ['en', 'en', 'en'] | True |
select_with_table_on_materialized_view_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to SELECT from a distributed table that uses a materialized view if and only if
they have SELECT privilege on the distributed table and the materialized view it is built on.
| Check that user is able to SELECT from a distributed table that uses a materialized view if and only if
they have SELECT privilege on the distributed table and the materialized view it is built on.
| def select_with_table_on_materialized_view_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to SELECT from a distributed table that uses a materialized view if and only if
they have SELECT privilege on the distributed table and the materialized view it is built on.
"""
... | [
"def",
"select_with_table_on_materialized_view_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"se... | [
593,
0
] | [
619,
154
] | python | en | ['en', 'en', 'en'] | True |
select_with_table_on_materialized_view | (self, user_name, grant_target_name, node=None) | Grant SELECT on the distributed table and the materialized view seperately, check that the user is unable to select from the distributed table,
grant privilege on both and check the user is able to select.
| Grant SELECT on the distributed table and the materialized view seperately, check that the user is unable to select from the distributed table,
grant privilege on both and check the user is able to select.
| def select_with_table_on_materialized_view(self, user_name, grant_target_name, node=None):
"""Grant SELECT on the distributed table and the materialized view seperately, check that the user is unable to select from the distributed table,
grant privilege on both and check the user is able to select.
"""
... | [
"def",
"select_with_table_on_materialized_view",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\... | [
622,
0
] | [
697,
58
] | python | en | ['en', 'en', 'en'] | True |
select_with_table_on_source_table_of_materialized_view_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to SELECT from a distributed table that uses the source table of a materialized view if and only if
they have SELECT privilege on the distributed table and the table it is using.
| Check that user is able to SELECT from a distributed table that uses the source table of a materialized view if and only if
they have SELECT privilege on the distributed table and the table it is using.
| def select_with_table_on_source_table_of_materialized_view_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to SELECT from a distributed table that uses the source table of a materialized view if and only if
they have SELECT privilege on the distributed table and the table it ... | [
"def",
"select_with_table_on_source_table_of_materialized_view_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"nod... | [
700,
0
] | [
726,
154
] | python | en | ['en', 'en', 'en'] | True |
select_with_table_on_source_table_of_materialized_view | (self, user_name, grant_target_name, node=None) | Grant SELECT on the distributed table and the source table seperately, check that the user is unable to select from the distributed table,
grant privilege on both and check the user is able to select.
| Grant SELECT on the distributed table and the source table seperately, check that the user is unable to select from the distributed table,
grant privilege on both and check the user is able to select.
| def select_with_table_on_source_table_of_materialized_view(self, user_name, grant_target_name, node=None):
"""Grant SELECT on the distributed table and the source table seperately, check that the user is unable to select from the distributed table,
grant privilege on both and check the user is able to select.
... | [
"def",
"select_with_table_on_source_table_of_materialized_view",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"view_name",
"=",
"f\"... | [
729,
0
] | [
794,
58
] | python | en | ['en', 'en', 'en'] | True |
select_with_table_on_distributed_table_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to SELECT from a distributed table that uses another distributed table if and only if
they have SELECT privilege on the distributed table, the distributed table it is using and the table that the second distributed table is using.
| Check that user is able to SELECT from a distributed table that uses another distributed table if and only if
they have SELECT privilege on the distributed table, the distributed table it is using and the table that the second distributed table is using.
| def select_with_table_on_distributed_table_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to SELECT from a distributed table that uses another distributed table if and only if
they have SELECT privilege on the distributed table, the distributed table it is using and the tabl... | [
"def",
"select_with_table_on_distributed_table_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"se... | [
797,
0
] | [
823,
138
] | python | en | ['en', 'en', 'en'] | True |
select_with_table_on_distributed_table | (self, user_name, grant_target_name, node=None) | Grant SELECT privilege seperately on the distributed table, the distributed table it is using and the table that the second distributed table is using,
check that user is unable to select from the distributed table, grant privilege on all three and check the user is able to select.
| Grant SELECT privilege seperately on the distributed table, the distributed table it is using and the table that the second distributed table is using,
check that user is unable to select from the distributed table, grant privilege on all three and check the user is able to select.
| def select_with_table_on_distributed_table(self, user_name, grant_target_name, node=None):
"""Grant SELECT privilege seperately on the distributed table, the distributed table it is using and the table that the second distributed table is using,
check that user is unable to select from the distributed table, gr... | [
"def",
"select_with_table_on_distributed_table",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"table2_name",
"=",
"f\"table1_{getuid... | [
826,
0
] | [
885,
61
] | python | en | ['en', 'en', 'en'] | True |
insert_with_table_on_materialized_view_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to INSERT into a distributed table that uses a materialized view if and only if
they have INSERT privilege on the distributed table and the materialized view it is built on.
| Check that user is able to INSERT into a distributed table that uses a materialized view if and only if
they have INSERT privilege on the distributed table and the materialized view it is built on.
| def insert_with_table_on_materialized_view_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to INSERT into a distributed table that uses a materialized view if and only if
they have INSERT privilege on the distributed table and the materialized view it is built on.
"""
... | [
"def",
"insert_with_table_on_materialized_view_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"se... | [
888,
0
] | [
914,
138
] | python | en | ['en', 'en', 'en'] | True |
insert_with_table_on_materialized_view | (self, user_name, grant_target_name, node=None) | Grant INSERT on the distributed table and the materialized view seperately, check that the user is unable to insert into the distributed table,
grant privilege on both and check the user is able to insert.
| Grant INSERT on the distributed table and the materialized view seperately, check that the user is unable to insert into the distributed table,
grant privilege on both and check the user is able to insert.
| def insert_with_table_on_materialized_view(self, user_name, grant_target_name, node=None):
"""Grant INSERT on the distributed table and the materialized view seperately, check that the user is unable to insert into the distributed table,
grant privilege on both and check the user is able to insert.
"""
... | [
"def",
"insert_with_table_on_materialized_view",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"table2_name",
"=",
"f\"table2_{getuid... | [
917,
0
] | [
986,
58
] | python | en | ['en', 'en', 'en'] | True |
insert_with_table_on_source_table_of_materialized_view_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to INSERT into a distributed table that uses the source table of a materialized view if and only if
they have INSERT privilege on the distributed table and the table it is using.
| Check that user is able to INSERT into a distributed table that uses the source table of a materialized view if and only if
they have INSERT privilege on the distributed table and the table it is using.
| def insert_with_table_on_source_table_of_materialized_view_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to INSERT into a distributed table that uses the source table of a materialized view if and only if
they have INSERT privilege on the distributed table and the table it ... | [
"def",
"insert_with_table_on_source_table_of_materialized_view_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"nod... | [
989,
0
] | [
1015,
154
] | python | en | ['en', 'en', 'en'] | True |
insert_with_table_on_source_table_of_materialized_view | (self, user_name, grant_target_name, node=None) | Grant INSERT on the distributed table and the source table seperately, check that the user is unable to insert into the distributed table,
grant privilege on both and check the user is able to insert.
| Grant INSERT on the distributed table and the source table seperately, check that the user is unable to insert into the distributed table,
grant privilege on both and check the user is able to insert.
| def insert_with_table_on_source_table_of_materialized_view(self, user_name, grant_target_name, node=None):
"""Grant INSERT on the distributed table and the source table seperately, check that the user is unable to insert into the distributed table,
grant privilege on both and check the user is able to insert.
... | [
"def",
"insert_with_table_on_source_table_of_materialized_view",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"view_name",
"=",
"f\"... | [
1018,
0
] | [
1083,
58
] | python | en | ['en', 'en', 'en'] | True |
insert_with_table_on_distributed_table_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to INSERT into a distributed table that uses another distributed table if and only if
they have INSERT privilege on the distributed table, the distributed table it is using and the table that the second distributed table is using.
| Check that user is able to INSERT into a distributed table that uses another distributed table if and only if
they have INSERT privilege on the distributed table, the distributed table it is using and the table that the second distributed table is using.
| def insert_with_table_on_distributed_table_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to INSERT into a distributed table that uses another distributed table if and only if
they have INSERT privilege on the distributed table, the distributed table it is using and the tabl... | [
"def",
"insert_with_table_on_distributed_table_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"se... | [
1086,
0
] | [
1112,
138
] | python | en | ['en', 'en', 'en'] | True |
insert_with_table_on_distributed_table | (self, user_name, grant_target_name, node=None) | Grant INSERT privilege seperately on the distributed table, the distributed table it is using and the table that the second distributed table is using,
check that user is unable to insert into the distributed table, grant privilege on all three and check the user is able to insert.
| Grant INSERT privilege seperately on the distributed table, the distributed table it is using and the table that the second distributed table is using,
check that user is unable to insert into the distributed table, grant privilege on all three and check the user is able to insert.
| def insert_with_table_on_distributed_table(self, user_name, grant_target_name, node=None):
"""Grant INSERT privilege seperately on the distributed table, the distributed table it is using and the table that the second distributed table is using,
check that user is unable to insert into the distributed table, gr... | [
"def",
"insert_with_table_on_distributed_table",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"table2_name",
"=",
"f\"table1_{getuid... | [
1115,
0
] | [
1197,
61
] | python | en | ['en', 'en', 'en'] | True |
local_user | (self, cluster, node=None) | Check that a user that exists locally and not present on the remote nodes
is able to execute queries they have privileges to.
| Check that a user that exists locally and not present on the remote nodes
is able to execute queries they have privileges to.
| def local_user(self, cluster, node=None):
"""Check that a user that exists locally and not present on the remote nodes
is able to execute queries they have privileges to.
"""
user_name = f"user_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name = f"table1_{getuid()}"
if node is Non... | [
"def",
"local_user",
"(",
"self",
",",
"cluster",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"... | [
1209,
0
] | [
1254,
61
] | python | en | ['en', 'en', 'en'] | True |
multiple_node_user | (self, node=None) | Check that a user that exists on multiple nodes with different privileges on each is able to execute queries
if and only if they have the required privileges on the node they are executing the query from.
| Check that a user that exists on multiple nodes with different privileges on each is able to execute queries
if and only if they have the required privileges on the node they are executing the query from.
| def multiple_node_user(self, node=None):
"""Check that a user that exists on multiple nodes with different privileges on each is able to execute queries
if and only if they have the required privileges on the node they are executing the query from.
"""
user_name = f"user_{getuid()}"
table0_name = f... | [
"def",
"multiple_node_user",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_e... | [
1260,
0
] | [
1304,
61
] | python | en | ['en', 'en', 'en'] | True |
cluster_tests | (self, cluster, node=None) | Scenarios to be run on different cluster configurations.
| Scenarios to be run on different cluster configurations.
| def cluster_tests(self, cluster, node=None):
"""Scenarios to be run on different cluster configurations.
"""
self.context.cluster_name = cluster
tasks = []
with Pool(3) as pool:
try:
for suite in loads(current_module(), Suite):
run_scenario(pool, tasks, Suite(tes... | [
"def",
"cluster_tests",
"(",
"self",
",",
"cluster",
",",
"node",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"cluster_name",
"=",
"cluster",
"tasks",
"=",
"[",
"]",
"with",
"Pool",
"(",
"3",
")",
"as",
"pool",
":",
"try",
":",
"for",
"suit... | [
1316,
0
] | [
1327,
23
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of queries executed using distributed tables.
| Check the RBAC functionality of queries executed using distributed tables.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of queries executed using distributed tables.
"""
self.context.node = self.context.cluster.node(node)
self.context.node2 = self.context.cluster.node("clickhouse2")
self.context.node3 = self.context.cluster.node("clickhouse3")
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"self",
".",
"context",
".",
"node2",
"=",
"self",
".",
"... | [
1335,
0
] | [
1350,
23
] | python | en | ['en', 'en', 'en'] | True |
remap_overlapping_column_names | (table_op, root_table, data_columns) | Return an ``OrderedDict`` mapping possibly suffixed column names to
column names without suffixes.
Parameters
----------
table_op : TableNode
The ``TableNode`` we're selecting from.
root_table : TableNode
The root table of the expression we're selecting from.
data_columns : set ... | Return an ``OrderedDict`` mapping possibly suffixed column names to
column names without suffixes. | def remap_overlapping_column_names(table_op, root_table, data_columns):
"""Return an ``OrderedDict`` mapping possibly suffixed column names to
column names without suffixes.
Parameters
----------
table_op : TableNode
The ``TableNode`` we're selecting from.
root_table : TableNode
... | [
"def",
"remap_overlapping_column_names",
"(",
"table_op",
",",
"root_table",
",",
"data_columns",
")",
":",
"if",
"not",
"isinstance",
"(",
"table_op",
",",
"ops",
".",
"Join",
")",
":",
"return",
"None",
"left_root",
",",
"right_root",
"=",
"ops",
".",
"dis... | [
136,
0
] | [
169,
18
] | python | en | ['en', 'en', 'en'] | True |
_compute_predicates | (table_op, predicates, data, scope, **kwargs) | Compute the predicates for a table operation.
Parameters
----------
table_op : TableNode
predicates : List[ir.ColumnExpr]
data : pd.DataFrame
scope : dict
kwargs : dict
Returns
-------
computed_predicate : pd.Series[bool]
Notes
-----
This handles the cases where th... | Compute the predicates for a table operation. | def _compute_predicates(table_op, predicates, data, scope, **kwargs):
"""Compute the predicates for a table operation.
Parameters
----------
table_op : TableNode
predicates : List[ir.ColumnExpr]
data : pd.DataFrame
scope : dict
kwargs : dict
Returns
-------
computed_predica... | [
"def",
"_compute_predicates",
"(",
"table_op",
",",
"predicates",
",",
"data",
",",
"scope",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"predicate",
"in",
"predicates",
":",
"# Map each root table of the predicate to the data so that we compute",
"# predicates on the resul... | [
178,
0
] | [
221,
59
] | python | en | ['en', 'en', 'en'] | True |
execute_series_lead_lag_timedelta | (
op, data, offset, default, aggcontext=None, **kwargs
) | An implementation of shifting a column relative to another one that is
in units of time rather than rows.
| An implementation of shifting a column relative to another one that is
in units of time rather than rows.
| def execute_series_lead_lag_timedelta(
op, data, offset, default, aggcontext=None, **kwargs
):
"""An implementation of shifting a column relative to another one that is
in units of time rather than rows.
"""
# lagging adds time (delayed), leading subtracts time (moved up)
func = operator.add if ... | [
"def",
"execute_series_lead_lag_timedelta",
"(",
"op",
",",
"data",
",",
"offset",
",",
"default",
",",
"aggcontext",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# lagging adds time (delayed), leading subtracts time (moved up)",
"func",
"=",
"operator",
".",
"a... | [
249,
0
] | [
284,
41
] | python | en | ['en', 'en', 'en'] | True |
listDistInts | (refSeqs, querySeqs, self=True) | Gets the ref and query ID for each row of the distance matrix
Returns an iterable with ref and query ID pairs by row.
Args:
refSeqs (list)
List of reference sequence names.
querySeqs (list)
List of query sequence names.
self (bool)
Whether a self-com... | Gets the ref and query ID for each row of the distance matrix | def listDistInts(refSeqs, querySeqs, self=True):
"""Gets the ref and query ID for each row of the distance matrix
Returns an iterable with ref and query ID pairs by row.
Args:
refSeqs (list)
List of reference sequence names.
querySeqs (list)
List of query sequence n... | [
"def",
"listDistInts",
"(",
"refSeqs",
",",
"querySeqs",
",",
"self",
"=",
"True",
")",
":",
"num_ref",
"=",
"len",
"(",
"refSeqs",
")",
"num_query",
"=",
"len",
"(",
"querySeqs",
")",
"if",
"self",
":",
"if",
"refSeqs",
"!=",
"querySeqs",
":",
"raise"... | [
31,
0
] | [
61,
27
] | python | en | ['en', 'en', 'en'] | True |
isolateNameToLabel | (names) | Function to process isolate names to labels
appropriate for visualisation.
Args:
names (list)
List of isolate names.
Returns:
labels (list)
List of isolate labels.
| Function to process isolate names to labels
appropriate for visualisation. | def isolateNameToLabel(names):
"""Function to process isolate names to labels
appropriate for visualisation.
Args:
names (list)
List of isolate names.
Returns:
labels (list)
List of isolate labels.
"""
# useful to have as a function in case we
# want ... | [
"def",
"isolateNameToLabel",
"(",
"names",
")",
":",
"# useful to have as a function in case we",
"# want to remove certain characters",
"labels",
"=",
"[",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"name",
")",
")",
"[",
... | [
63,
0
] | [
77,
17
] | python | en | ['en', 'en', 'en'] | True |
regression | (self, local, clickhouse_binary_path, stress=None, parallel=None) | Window functions regression.
| Window functions regression.
| def regression(self, local, clickhouse_binary_path, stress=None, parallel=None):
"""Window functions regression.
"""
top().terminating = False
nodes = {
"clickhouse":
("clickhouse1", "clickhouse2", "clickhouse3")
}
if stress is not None:
self.context.stress = stress
... | [
"def",
"regression",
"(",
"self",
",",
"local",
",",
"clickhouse_binary_path",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"top",
"(",
")",
".",
"terminating",
"=",
"False",
"nodes",
"=",
"{",
"\"clickhouse\"",
":",
"(",
"\"clickh... | [
91,
0
] | [
109,
80
] | python | en | ['en', 'en', 'en'] | True |
create | (self, node=None) | Test the RBAC functionality of the `CREATE LIVE VIEW` command.
| Test the RBAC functionality of the `CREATE LIVE VIEW` command.
| def create(self, node=None):
"""Test the RBAC functionality of the `CREATE LIVE VIEW` command.
"""
Scenario(run=create_without_create_view_privilege, setup=instrument_clickhouse_server_log)
Scenario(run=create_with_create_view_privilege_granted_directly_or_via_role, setup=instrument_clickhouse_server_lo... | [
"def",
"create",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"Scenario",
"(",
"run",
"=",
"create_without_create_view_privilege",
",",
"setup",
"=",
"instrument_clickhouse_server_log",
")",
"Scenario",
"(",
"run",
"=",
"create_with_create_view_privilege_granted_d... | [
29,
0
] | [
40,
121
] | python | en | ['en', 'en', 'en'] | True |
create_without_create_view_privilege | (self, node=None) | Check that user is unable to create a live view without CREATE VIEW privilege.
| Check that user is unable to create a live view without CREATE VIEW privilege.
| def create_without_create_view_privilege(self, node=None):
"""Check that user is unable to create a live view without CREATE VIEW privilege.
"""
user_name = f"user_{getuid()}"
view_name = f"view_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
if node is None:
... | [
"def",
"create_without_create_view_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
... | [
43,
0
] | [
56,
51
] | python | en | ['en', 'en', 'en'] | True |
create_with_create_view_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a live view with CREATE VIEW privilege, either granted directly or through a role.
| Check that user is able to create a live view with CREATE VIEW privilege, either granted directly or through a role.
| def create_with_create_view_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a live view with CREATE VIEW privilege, either granted directly or through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
nod... | [
"def",
"create_with_create_view_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"... | [
59,
0
] | [
75,
126
] | python | en | ['en', 'en', 'en'] | True |
create_with_create_view_privilege | (self, grant_target_name, user_name, node=None) | Check that user is able to create a live view with the granted privileges.
| Check that user is able to create a live view with the granted privileges.
| def create_with_create_view_privilege(self, grant_target_name, user_name, node=None):
"""Check that user is able to create a live view with the granted privileges.
"""
view_name = f"view_{getuid()}"
if node is None:
node = self.context.node
try:
with When("I grant the CREATE VIEW pr... | [
"def",
"create_with_create_view_privilege",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node"... | [
78,
0
] | [
95,
58
] | python | en | ['en', 'en', 'en'] | True |
create_with_revoked_create_view_privilege_revoked_directly_or_from_role | (self, node=None) | Check that user is unable to create live view after the CREATE VIEW privilege is revoked, either directly or from a role.
| Check that user is unable to create live view after the CREATE VIEW privilege is revoked, either directly or from a role.
| def create_with_revoked_create_view_privilege_revoked_directly_or_from_role(self, node=None):
"""Check that user is unable to create live view after the CREATE VIEW privilege is revoked, either directly or from a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is Non... | [
"def",
"create_with_revoked_create_view_privilege_revoked_directly_or_from_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
... | [
98,
0
] | [
114,
123
] | python | en | ['en', 'en', 'en'] | True |
create_with_revoked_create_view_privilege | (self, grant_target_name, user_name, node=None) | Revoke CREATE VIEW privilege and check the user is unable to create a live view.
| Revoke CREATE VIEW privilege and check the user is unable to create a live view.
| def create_with_revoked_create_view_privilege(self, grant_target_name, user_name, node=None):
"""Revoke CREATE VIEW privilege and check the user is unable to create a live view.
"""
view_name = f"view_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
if node is None:... | [
"def",
"create_with_revoked_create_view_privilege",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"... | [
117,
0
] | [
133,
47
] | python | en | ['en', 'en', 'en'] | True |
create_without_source_table_privilege | (self, node=None) | Check that user is unable to create a live view without select
privilege on the source table.
| Check that user is unable to create a live view without select
privilege on the source table.
| def create_without_source_table_privilege(self, node=None):
"""Check that user is unable to create a live view without select
privilege on the source table.
"""
user_name = f"user_{getuid()}"
view_name = f"view_{getuid()}"
table_name = f"table_{getuid()}"
exitcode, message = errors.not_enoug... | [
"def",
"create_without_source_table_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
... | [
136,
0
] | [
154,
55
] | python | en | ['en', 'en', 'en'] | True |
create_with_source_table_privilege_granted_directly_or_via_role | (self, node=None) | Check that a user is able to create a live view if and only if the user has CREATE VIEW privilege and
select privilege on the source table, either granted directly or through a role.
| Check that a user is able to create a live view if and only if the user has CREATE VIEW privilege and
select privilege on the source table, either granted directly or through a role.
| def create_with_source_table_privilege_granted_directly_or_via_role(self, node=None):
"""Check that a user is able to create a live view if and only if the user has CREATE VIEW privilege and
select privilege on the source table, either granted directly or through a role.
"""
user_name = f"user_{getuid()... | [
"def",
"create_with_source_table_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
... | [
157,
0
] | [
174,
137
] | python | en | ['en', 'en', 'en'] | True |
create_with_source_table_privilege | (self, user_name, grant_target_name, node=None) | Check that user is unable to create a live view without SELECT privilege on the source table.
| Check that user is unable to create a live view without SELECT privilege on the source table.
| def create_with_source_table_privilege(self, user_name, grant_target_name, node=None):
"""Check that user is unable to create a live view without SELECT privilege on the source table.
"""
view_name = f"view_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
node = self.context.no... | [
"def",
"create_with_source_table_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
... | [
177,
0
] | [
203,
62
] | python | en | ['en', 'en', 'en'] | True |
create_with_subquery_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a live view where the stored query has two subqueries
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
| Check that user is able to create a live view where the stored query has two subqueries
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
| def create_with_subquery_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a live view where the stored query has two subqueries
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
"""
user_name = f... | [
"def",
"create_with_subquery_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"con... | [
206,
0
] | [
224,
124
] | python | en | ['en', 'en', 'en'] | True |
create_with_subquery | (self, user_name, grant_target_name, node=None) | Grant SELECT and CREATE VIEW privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| Grant SELECT and CREATE VIEW privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| def create_with_subquery(self, user_name, grant_target_name, node=None):
"""Grant SELECT and CREATE VIEW privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_na... | [
"def",
"create_with_subquery",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"table2_name... | [
227,
0
] | [
266,
62
] | python | en | ['en', 'en', 'en'] | True |
create_with_join_query_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a live view where the stored query includes a `JOIN` statement
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
| Check that user is able to create a live view where the stored query includes a `JOIN` statement
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
| def create_with_join_query_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a live view where the stored query includes a `JOIN` statement
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
"""
us... | [
"def",
"create_with_join_query_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"c... | [
269,
0
] | [
287,
126
] | python | en | ['en', 'en', 'en'] | True |
create_with_join_query | (self, grant_target_name, user_name, node=None) | Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| def create_with_join_query(self, grant_target_name, user_name, node=None):
"""Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_... | [
"def",
"create_with_join_query",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode"... | [
290,
0
] | [
328,
62
] | python | en | ['en', 'en', 'en'] | True |
create_with_join_subquery_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a live view with a stored query that includes `JOIN` and two subqueries
if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
| Check that user is able to create a live view with a stored query that includes `JOIN` and two subqueries
if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
| def create_with_join_subquery_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a live view with a stored query that includes `JOIN` and two subqueries
if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
""... | [
"def",
"create_with_join_subquery_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
... | [
331,
0
] | [
348,
129
] | python | en | ['en', 'en', 'en'] | True |
create_with_join_subquery | (self, grant_target_name, user_name, node=None) | Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| def create_with_join_subquery(self, grant_target_name, user_name, node=None):
"""Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
tabl... | [
"def",
"create_with_join_subquery",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"table2... | [
351,
0
] | [
392,
62
] | python | en | ['en', 'en', 'en'] | True |
create_with_nested_views_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a live view with a stored query that includes other views if and only if
they have SELECT privilege on all the views and the source tables for those views.
| Check that user is able to create a live view with a stored query that includes other views if and only if
they have SELECT privilege on all the views and the source tables for those views.
| def create_with_nested_views_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a live view with a stored query that includes other views if and only if
they have SELECT privilege on all the views and the source tables for those views.
"""
user_name = f"user_{g... | [
"def",
"create_with_nested_views_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
... | [
395,
0
] | [
412,
128
] | python | en | ['en', 'en', 'en'] | True |
create_with_nested_views | (self, grant_target_name, user_name, node=None) | Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
| def create_with_nested_views(self, grant_target_name, user_name, node=None):
"""Grant select and create view privileges and check that user is able to create a live view
if and only if they have all necessary privileges.
"""
view0_name = f"view0_{getuid()}"
view1_name = f"view1_{getuid()}"
view2... | [
"def",
"create_with_nested_views",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view0_name",
"=",
"f\"view0_{getuid()}\"",
"view1_name",
"=",
"f\"view1_{getuid()}\"",
"view2_name",
"=",
"f\"view2_{getuid()}\"",
"table0_na... | [
415,
0
] | [
466,
67
] | python | en | ['en', 'en', 'en'] | True |
select | (self, node=None) | Test the RBAC functionality of the `SELECT FROM live view` command.
| Test the RBAC functionality of the `SELECT FROM live view` command.
| def select(self, node=None):
"""Test the RBAC functionality of the `SELECT FROM live view` command.
"""
Scenario(run=select_without_select_privilege, setup=instrument_clickhouse_server_log)
Scenario(run=select_with_select_privilege_granted_directly_or_via_role, setup=instrument_clickhouse_server_log)
... | [
"def",
"select",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"Scenario",
"(",
"run",
"=",
"select_without_select_privilege",
",",
"setup",
"=",
"instrument_clickhouse_server_log",
")",
"Scenario",
"(",
"run",
"=",
"select_with_select_privilege_granted_directly_or... | [
472,
0
] | [
483,
121
] | python | en | ['en', 'en', 'en'] | True |
select_without_select_privilege | (self, node=None) | Check that user is unable to select on a view without view SELECT privilege.
| Check that user is unable to select on a view without view SELECT privilege.
| def select_without_select_privilege(self, node=None):
"""Check that user is unable to select on a view without view SELECT privilege.
"""
user_name = f"user_{getuid()}"
view_name = f"view_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
if node is None:
... | [
"def",
"select_without_select_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
... | [
486,
0
] | [
507,
62
] | python | en | ['en', 'en', 'en'] | True |
select_with_select_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a view if and only if they have select privilege on that view, either directly or from a role.
| Check that user is able to select from a view if and only if they have select privilege on that view, either directly or from a role.
| def select_with_select_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a view if and only if they have select privilege on that view, either directly or from a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:... | [
"def",
"select_with_select_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"conte... | [
510,
0
] | [
526,
121
] | python | en | ['en', 'en', 'en'] | True |
select_with_select_privilege | (self, user_name, grant_target_name, node=None) | Grant SELECT privilege on a view and check the user is able to SELECT from it.
| Grant SELECT privilege on a view and check the user is able to SELECT from it.
| def select_with_select_privilege(self, user_name, grant_target_name, node=None):
"""Grant SELECT privilege on a view and check the user is able to SELECT from it.
"""
view_name = f"view_{getuid()}"
if node is None:
node = self.context.node
try:
with When("I have a view"):
... | [
"def",
"select_with_select_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"... | [
529,
0
] | [
550,
58
] | python | en | ['en', 'en', 'en'] | True |
select_with_select_privilege_revoked_directly_or_from_role | (self, node=None) | Check that user is unable to select from a view if their SELECT privilege is revoked, either directly or from a role.
| Check that user is unable to select from a view if their SELECT privilege is revoked, either directly or from a role.
| def select_with_select_privilege_revoked_directly_or_from_role(self, node=None):
"""Check that user is unable to select from a view if their SELECT privilege is revoked, either directly or from a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node =... | [
"def",
"select_with_select_privilege_revoked_directly_or_from_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"cont... | [
553,
0
] | [
569,
118
] | python | en | ['en', 'en', 'en'] | True |
select_with_revoked_select_privilege | (self, user_name, grant_target_name, node=None) | Grant and revoke SELECT privilege on a view and check the user is unable to SELECT from it.
| Grant and revoke SELECT privilege on a view and check the user is unable to SELECT from it.
| def select_with_revoked_select_privilege(self, user_name, grant_target_name, node=None):
"""Grant and revoke SELECT privilege on a view and check the user is unable to SELECT from it.
"""
view_name = f"view_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
if node is... | [
"def",
"select_with_revoked_select_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name"... | [
572,
0
] | [
596,
58
] | python | en | ['en', 'en', 'en'] | True |
select_without_source_table_privilege | (self, node=None) | Check that user is unable to select from a view without SELECT privilege for the source table.
| Check that user is unable to select from a view without SELECT privilege for the source table.
| def select_without_source_table_privilege(self, node=None):
"""Check that user is unable to select from a view without SELECT privilege for the source table.
"""
user_name = f"user_{getuid()}"
view_name = f"view_{getuid()}"
table_name = f"table_{getuid()}"
exitcode, message = errors.not_enough_p... | [
"def",
"select_without_source_table_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
... | [
599,
0
] | [
624,
66
] | python | en | ['en', 'en', 'en'] | True |
select_with_source_table_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a view, with source table in the stored query, if and only if
the user has SELECT privilege for the view and the source table, either directly or from a role.
| Check that user is able to select from a view, with source table in the stored query, if and only if
the user has SELECT privilege for the view and the source table, either directly or from a role.
| def select_with_source_table_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a view, with source table in the stored query, if and only if
the user has SELECT privilege for the view and the source table, either directly or from a role.
"""
user_name = f... | [
"def",
"select_with_source_table_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
... | [
627,
0
] | [
644,
128
] | python | en | ['en', 'en', 'en'] | True |
select_with_source_table_privilege | (self, user_name, grant_target_name, node=None) | Grant SELECT privilege on view and the source table for that view and check the user is able to SELECT from the view.
| Grant SELECT privilege on view and the source table for that view and check the user is able to SELECT from the view.
| def select_with_source_table_privilege(self, user_name, grant_target_name, node=None):
"""Grant SELECT privilege on view and the source table for that view and check the user is able to SELECT from the view.
"""
view_name = f"view_{getuid()}"
table_name = f"table_{getuid()}"
if node is None:
... | [
"def",
"select_with_source_table_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table_name",
"=",
"f\"table_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
... | [
647,
0
] | [
671,
62
] | python | en | ['en', 'en', 'en'] | True |
select_with_subquery_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a view where the stored query has two subqueries if and only if
the user has SELECT privilege for that view and all tables, either directly or through a role.
| Check that user is able to select from a view where the stored query has two subqueries if and only if
the user has SELECT privilege for that view and all tables, either directly or through a role.
| def select_with_subquery_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a view where the stored query has two subqueries if and only if
the user has SELECT privilege for that view and all tables, either directly or through a role.
"""
user_name = f"use... | [
"def",
"select_with_subquery_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"con... | [
674,
0
] | [
691,
124
] | python | en | ['en', 'en', 'en'] | True |
select_with_subquery | (self, user_name, grant_target_name, node=None) | Grant SELECT on the view and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
| Grant SELECT on the view and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
| def select_with_subquery(self, user_name, grant_target_name, node=None):
"""Grant SELECT on the view and tables in the stored query and check the user is able to SELECT if and only if they have SELECT privilege on all of them.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
tab... | [
"def",
"select_with_subquery",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"table2_name... | [
694,
0
] | [
731,
62
] | python | en | ['en', 'en', 'en'] | True |
select_with_join_query_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a view where the stored query includes a `JOIN` statement if and only if
the user has SELECT privilege on all the tables and the view, either directly or through a role.
| Check that user is able to select from a view where the stored query includes a `JOIN` statement if and only if
the user has SELECT privilege on all the tables and the view, either directly or through a role.
| def select_with_join_query_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a view where the stored query includes a `JOIN` statement if and only if
the user has SELECT privilege on all the tables and the view, either directly or through a role.
"""
user... | [
"def",
"select_with_join_query_privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"c... | [
734,
0
] | [
751,
120
] | 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.