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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
PandasClient.get_schema | (self, table_name, database=None) |
Return a Schema object for the indicated table and database
Parameters
----------
table_name : string
May be fully qualified
database : string, default None
Returns
-------
schema : ibis Schema
|
Return a Schema object for the indicated table and database | def get_schema(self, table_name, database=None):
"""
Return a Schema object for the indicated table and database
Parameters
----------
table_name : string
May be fully qualified
database : string, default None
Returns
-------
schema : i... | [
"def",
"get_schema",
"(",
"self",
",",
"table_name",
",",
"database",
"=",
"None",
")",
":",
"return",
"sch",
".",
"infer",
"(",
"self",
".",
"dictionary",
"[",
"table_name",
"]",
")"
] | [
408,
4
] | [
422,
53
] | python | en | ['en', 'error', 'th'] | False |
PandasClient.exists_table | (self, name) |
Determine if the indicated table or view exists
Parameters
----------
name : string
database : string, default None
Returns
-------
if_exists : boolean
|
Determine if the indicated table or view exists | def exists_table(self, name):
"""
Determine if the indicated table or view exists
Parameters
----------
name : string
database : string, default None
Returns
-------
if_exists : boolean
"""
return bool(self.list_tables(like=name)) | [
"def",
"exists_table",
"(",
"self",
",",
"name",
")",
":",
"return",
"bool",
"(",
"self",
".",
"list_tables",
"(",
"like",
"=",
"name",
")",
")"
] | [
424,
4
] | [
437,
48
] | python | en | ['en', 'error', 'th'] | False |
kerberos_not_enabled | (self) | ClickHouse SHALL reject Kerberos authentication if user is properly configured for Kerberos,
but Kerberos itself is not enabled in config.xml.
| ClickHouse SHALL reject Kerberos authentication if user is properly configured for Kerberos,
but Kerberos itself is not enabled in config.xml.
| def kerberos_not_enabled(self):
"""ClickHouse SHALL reject Kerberos authentication if user is properly configured for Kerberos,
but Kerberos itself is not enabled in config.xml.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml"
def m... | [
"def",
"kerberos_not_enabled",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"return",
"xmltree",
".",... | [
13,
0
] | [
24,
56
] | python | en | ['en', 'en', 'en'] | True |
multiple_kerberos | (self) | ClickHouse SHALL disable Kerberos authentication if more than one kerberos sections specified in config.xml.
| ClickHouse SHALL disable Kerberos authentication if more than one kerberos sections specified in config.xml.
| def multiple_kerberos(self):
"""ClickHouse SHALL disable Kerberos authentication if more than one kerberos sections specified in config.xml.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml"
def modify_file(root):
second_section ... | [
"def",
"multiple_kerberos",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"second_section",
"=",
"\"<k... | [
31,
0
] | [
43,
104
] | python | en | ['en', 'en', 'en'] | True |
wrong_user_realm | (self) | ClickHouse SHALL reject Kerberos authentication if user's realm specified in users.xml
doesn't match the realm of the principal trying to authenticate.
| ClickHouse SHALL reject Kerberos authentication if user's realm specified in users.xml
doesn't match the realm of the principal trying to authenticate.
| def wrong_user_realm(self):
"""ClickHouse SHALL reject Kerberos authentication if user's realm specified in users.xml
doesn't match the realm of the principal trying to authenticate.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/users.d/kerberos-users.xml"... | [
"def",
"wrong_user_realm",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/users.d/kerberos-users.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"krb",
"=",
"root",
".... | [
50,
0
] | [
64,
54
] | python | en | ['en', 'en', 'en'] | True |
multiple_auth_methods | (self) | ClickHouse SHALL reject Kerberos authentication if other
auth method is specified for user alongside with Kerberos.
| ClickHouse SHALL reject Kerberos authentication if other
auth method is specified for user alongside with Kerberos.
| def multiple_auth_methods(self):
"""ClickHouse SHALL reject Kerberos authentication if other
auth method is specified for user alongside with Kerberos.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/users.d/kerberos-users.xml"
def modify_file(root):
... | [
"def",
"multiple_auth_methods",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/users.d/kerberos-users.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"krb",
"=",
"root",... | [
71,
0
] | [
84,
84
] | python | en | ['en', 'en', 'en'] | True |
principal_and_realm_specified | (self) | ClickHouse SHALL drop an exception if both realm and principal fields are specified in config.xml.
| ClickHouse SHALL drop an exception if both realm and principal fields are specified in config.xml.
| def principal_and_realm_specified(self):
"""ClickHouse SHALL drop an exception if both realm and principal fields are specified in config.xml.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml"
def modify_file(root):
krb = root.fi... | [
"def",
"principal_and_realm_specified",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"krb",
"=",
"roo... | [
91,
0
] | [
104,
56
] | python | en | ['en', 'en', 'en'] | True |
multiple_realm | (self) | ClickHouse SHALL throw an exception and disable Kerberos if more than one realm is specified in config.xml.
| ClickHouse SHALL throw an exception and disable Kerberos if more than one realm is specified in config.xml.
| def multiple_realm(self):
"""ClickHouse SHALL throw an exception and disable Kerberos if more than one realm is specified in config.xml.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml"
def modify_file(root):
krb = root.find('ke... | [
"def",
"multiple_realm",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"krb",
"=",
"root",
".",
"f... | [
111,
0
] | [
123,
75
] | python | en | ['en', 'en', 'en'] | True |
multiple_principal | (self) | ClickHouse SHALL throw an exception and disable Kerberos if more than one principal is specified in config.xml.
| ClickHouse SHALL throw an exception and disable Kerberos if more than one principal is specified in config.xml.
| def multiple_principal(self):
"""ClickHouse SHALL throw an exception and disable Kerberos if more than one principal is specified in config.xml.
"""
ch_nodes = self.context.ch_nodes
config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml"
def modify_file(root):
krb = root.... | [
"def",
"multiple_principal",
"(",
"self",
")",
":",
"ch_nodes",
"=",
"self",
".",
"context",
".",
"ch_nodes",
"config_path",
"=",
"f\"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml\"",
"def",
"modify_file",
"(",
"root",
")",
":",
"krb",
"=",
"root",
".",
... | [
130,
0
] | [
144,
79
] | python | en | ['en', 'en', 'en'] | True |
config | (self) | Perform ClickHouse Kerberos authentication testing for incorrect configuration files
| Perform ClickHouse Kerberos authentication testing for incorrect configuration files
| def config(self):
"""Perform ClickHouse Kerberos authentication testing for incorrect configuration files
"""
self.context.ch_nodes = [self.context.cluster.node(f"clickhouse{i}") for i in range(1, 4)]
self.context.krb_server = self.context.cluster.node("kerberos")
self.context.clients = [self.conte... | [
"def",
"config",
"(",
"self",
")",
":",
"self",
".",
"context",
".",
"ch_nodes",
"=",
"[",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"f\"clickhouse{i}\"",
")",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"4",
")",
"]",
"self",
".",
... | [
153,
0
] | [
162,
40
] | python | en | ['la', 'en', 'en'] | True |
create | (self, node=None) | Test the RBAC functionality of the `CREATE VIEW` command.
| Test the RBAC functionality of the `CREATE VIEW` command.
| def create(self, node=None):
"""Test the RBAC functionality of the `CREATE 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_log)
... | [
"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... | [
11,
0
] | [
23,
121
] | python | en | ['en', 'en', 'en'] | True |
create_without_create_view_privilege | (self, node=None) | Check that user is unable to create a view without CREATE VIEW privilege.
| Check that user is unable to create a view without CREATE VIEW privilege.
| def create_without_create_view_privilege(self, node=None):
"""Check that user is unable to create a 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",
... | [
26,
0
] | [
39,
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 view with CREATE VIEW privilege, either granted directly or through a role.
| Check that user is able to create a 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 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:
node = s... | [
"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",
".",
"... | [
42,
0
] | [
58,
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 view with the granted privileges.
| Check that user is able to create a 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 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 privile... | [
"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"... | [
61,
0
] | [
78,
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 view after the CREATE VIEW privilege is revoked, either directly or from a role.
| Check that user is unable to create 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 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 None:
... | [
"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",
... | [
81,
0
] | [
97,
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 view.
| Revoke CREATE VIEW privilege and check the user is unable to create a 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 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",
"(",
"... | [
100,
0
] | [
116,
47
] | python | en | ['en', 'en', 'en'] | True |
create_without_source_table_privilege | (self, node=None) | Check that user is unable to create a view without select
privilege on the source table.
| Check that user is unable to create a 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 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_enough_pri... | [
"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",
... | [
119,
0
] | [
137,
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 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 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 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",
".",
... | [
140,
0
] | [
157,
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 view without SELECT privilege on the source table.
| Check that user is unable to create a 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 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.node
... | [
"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",
... | [
160,
0
] | [
186,
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 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 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 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"user... | [
"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... | [
189,
0
] | [
207,
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 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 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 view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name = ... | [
"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... | [
210,
0
] | [
249,
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 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 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 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.
"""
user_na... | [
"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... | [
252,
0
] | [
270,
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 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 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 view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name ... | [
"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"... | [
273,
0
] | [
311,
62
] | python | en | ['en', 'en', 'en'] | True |
create_with_union_query_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a view where the stored query includes a `UNION ALL` 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 view where the stored query includes a `UNION ALL` 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_union_query_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a view where the stored query includes a `UNION ALL` statement
if and only if the user has SELECT privilege on all of the tables,
either granted directly or through a role.
"""
u... | [
"def",
"create_with_union_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",
".",
"... | [
314,
0
] | [
332,
127
] | python | en | ['en', 'en', 'en'] | True |
create_with_union_query | (self, grant_target_name, user_name, node=None) | Grant select and create view privileges and check that user is able to create a 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 view
if and only if they have all necessary privileges.
| def create_with_union_query(self, grant_target_name, user_name, node=None):
"""Grant select and create view privileges and check that user is able to create a view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
table1_name... | [
"def",
"create_with_union_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... | [
335,
0
] | [
373,
62
] | python | en | ['en', 'en', 'en'] | True |
create_with_join_union_subquery_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to create a view with a stored query that includes `UNION ALL`, `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 view with a stored query that includes `UNION ALL`, `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_union_subquery_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to create a view with a stored query that includes `UNION ALL`, `JOIN` and two subqueries
if and only if the user has SELECT privilege on all of the tables, either granted directly or through ... | [
"def",
"create_with_join_union_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",
... | [
376,
0
] | [
393,
135
] | python | en | ['en', 'en', 'en'] | True |
create_with_join_union_subquery | (self, grant_target_name, user_name, node=None) | Grant select and create view privileges and check that user is able to create a 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 view
if and only if they have all necessary privileges.
| def create_with_join_union_subquery(self, grant_target_name, user_name, node=None):
"""Grant select and create view privileges and check that user is able to create a view
if and only if they have all necessary privileges.
"""
view_name = f"view_{getuid()}"
table0_name = f"table0_{getuid()}"
tab... | [
"def",
"create_with_join_union_subquery",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"... | [
396,
0
] | [
439,
66
] | 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 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 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 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_{getuid... | [
"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",
".",
... | [
442,
0
] | [
459,
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 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 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 view
if and only if they have all necessary privileges.
"""
view0_name = f"view0_{getuid()}"
view1_name = f"view1_{getuid()}"
view2_name... | [
"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()}\"",
"view3_nam... | [
462,
0
] | [
518,
67
] | python | en | ['en', 'en', 'en'] | True |
select | (self, node=None) | Test the RBAC functionality of the `SELECT FROM view` command.
| Test the RBAC functionality of the `SELECT FROM view` command.
| def select(self, node=None):
"""Test the RBAC functionality of the `SELECT FROM 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)
Sce... | [
"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... | [
524,
0
] | [
536,
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",
"=",
... | [
539,
0
] | [
560,
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... | [
563,
0
] | [
579,
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",
"... | [
582,
0
] | [
603,
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... | [
606,
0
] | [
622,
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()}"
if node is None:
node = self.context.node
try:
with When("I have... | [
"def",
"select_with_revoked_select_privilege",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"no... | [
625,
0
] | [
648,
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",
... | [
651,
0
] | [
676,
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",
".",
... | [
679,
0
] | [
696,
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",
... | [
699,
0
] | [
723,
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... | [
726,
0
] | [
743,
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... | [
746,
0
] | [
783,
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... | [
786,
0
] | [
803,
120
] | python | en | ['en', 'en', 'en'] | True |
select_with_join_query | (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_join_query(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()}"
t... | [
"def",
"select_with_join_query",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode"... | [
806,
0
] | [
841,
62
] | python | en | ['en', 'en', 'en'] | True |
select_with_union_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 `UNION ALL` 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 `UNION ALL` 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_union_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 `UNION ALL` 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_union_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",
".",
"... | [
844,
0
] | [
861,
121
] | python | en | ['en', 'en', 'en'] | True |
select_with_union_query | (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_union_query(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()}"
... | [
"def",
"select_with_union_query",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"exitcode... | [
864,
0
] | [
899,
62
] | python | en | ['en', 'en', 'en'] | True |
select_with_join_union_subquery_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a view with a stored query that includes `UNION ALL`, `JOIN` and two subqueries
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 with a stored query that includes `UNION ALL`, `JOIN` and two subqueries
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_union_subquery_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a view with a stored query that includes `UNION ALL`, `JOIN` and two subqueries
if and only if the user has SELECT privilege on all the tables and the view, either directly or t... | [
"def",
"select_with_join_union_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",
... | [
902,
0
] | [
919,
135
] | python | en | ['en', 'en', 'en'] | True |
select_with_join_union_subquery | (self, grant_target_name, user_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_join_union_subquery(self, grant_target_name, user_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(... | [
"def",
"select_with_join_union_subquery",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"table0_name",
"=",
"f\"table0_{getuid()}\"",
"table1_name",
"=",
"f\"table1_{getuid()}\"",
"... | [
922,
0
] | [
960,
62
] | python | en | ['en', 'en', 'en'] | True |
select_with_nested_views_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to select from a view with a stored query that includes other views if and only if
the user has select privilege on all of the views and the source tables for those views, either directly or through a role.
| Check that user is able to select from a view with a stored query that includes other views if and only if
the user has select privilege on all of the views and the source tables for those views, either directly or through a role.
| def select_with_nested_views_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to select from a view with a stored query that includes other views if and only if
the user has select privilege on all of the views and the source tables for those views, either directly or through ... | [
"def",
"select_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",
".",
... | [
963,
0
] | [
980,
128
] | python | en | ['en', 'en', 'en'] | True |
select_with_nested_views | (self, grant_target_name, user_name, node=None) | Grant SELECT on views 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 views 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_nested_views(self, grant_target_name, user_name, node=None):
"""Grant SELECT on views 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.
"""
view0_name = f"view0_{getuid()}"
view1_name = f"view1_{getuid()}"
vi... | [
"def",
"select_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()}\"",
"view3_nam... | [
983,
0
] | [
1032,
67
] | python | en | ['en', 'en', 'en'] | True |
drop | (self, node=None) | Test the RBAC functionality of the `DROP VIEW` command.
| Test the RBAC functionality of the `DROP VIEW` command.
| def drop(self, node=None):
"""Test the RBAC functionality of the `DROP VIEW` command.
"""
Scenario(run=drop_with_privilege_granted_directly_or_via_role, setup=instrument_clickhouse_server_log)
Scenario(run=drop_with_revoked_privilege_revoked_directly_or_from_role, setup=instrument_clickhouse_server_log) | [
"def",
"drop",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"Scenario",
"(",
"run",
"=",
"drop_with_privilege_granted_directly_or_via_role",
",",
"setup",
"=",
"instrument_clickhouse_server_log",
")",
"Scenario",
"(",
"run",
"=",
"drop_with_revoked_privilege_revok... | [
1038,
0
] | [
1042,
115
] | python | en | ['en', 'en', 'en'] | True |
drop_with_privilege_granted_directly_or_via_role | (self, node=None) | Check that user is able to drop view with DROP VIEW privilege if the user has privilege directly or through a role.
| Check that user is able to drop view with DROP VIEW privilege if the user has privilege directly or through a role.
| def drop_with_privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is able to drop view with DROP VIEW privilege if the user has privilege directly or through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node = self.contex... | [
"def",
"drop_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",
".... | [
1046,
0
] | [
1062,
107
] | python | en | ['en', 'en', 'en'] | True |
drop_with_privilege | (self, grant_target_name, user_name, node=None) | Grant DROP VIEW privilege and check the user is able to successfully drop a view.
| Grant DROP VIEW privilege and check the user is able to successfully drop a view.
| def drop_with_privilege(self, grant_target_name, user_name, node=None):
"""Grant DROP VIEW privilege and check the user is able to successfully drop a view.
"""
view_name = f"view_{getuid()}"
exitcode, message = errors.table_does_not_exist(name=f"default.{view_name}")
if node is None:
node ... | [
"def",
"drop_with_privilege",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"table_does_not_exist",
"(",
"name",
"=",
"f\"def... | [
1065,
0
] | [
1089,
58
] | python | en | ['en', 'en', 'en'] | True |
drop_with_revoked_privilege_revoked_directly_or_from_role | (self, node=None) | Check that user is unable to drop view with DROP VIEW privilege revoked directly or from a role.
| Check that user is unable to drop view with DROP VIEW privilege revoked directly or from a role.
| def drop_with_revoked_privilege_revoked_directly_or_from_role(self, node=None):
"""Check that user is unable to drop view with DROP VIEW privilege revoked directly or from a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node = self.context.node
... | [
"def",
"drop_with_revoked_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",
".",
"conte... | [
1092,
0
] | [
1108,
104
] | python | en | ['en', 'en', 'en'] | True |
drop_with_revoked_privilege | (self, grant_target_name, user_name, node=None) | Revoke DROP VIEW privilege and check the user is unable to DROP a view.
| Revoke DROP VIEW privilege and check the user is unable to DROP a view.
| def drop_with_revoked_privilege(self, grant_target_name, user_name, node=None):
"""Revoke DROP VIEW privilege and check the user is unable to DROP a view.
"""
view_name = f"view_{getuid()}"
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
if node is None:
node = self.co... | [
"def",
"drop_with_revoked_privilege",
"(",
"self",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"view_name",
"=",
"f\"view_{getuid()}\"",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
... | [
1111,
0
] | [
1136,
58
] | python | en | ['en', 'en', 'en'] | True |
privilege_granted_directly_or_via_role | (self, node=None) | Check that user is only able to execute ATTACH DATABASE when they have required privilege, either directly or via role.
| Check that user is only able to execute ATTACH DATABASE when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is only able to execute ATTACH DATABASE when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
5,
0
] | [
27,
92
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege"):
db_name = f"db_{getuid()}"
try:
... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"with",
"Scenario",
"(",
"\"user without... | [
29,
0
] | [
116,
64
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of ATTACH DATABASE.
| Check the RBAC functionality of ATTACH DATABASE.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of ATTACH DATABASE.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = stres... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
125,
0
] | [
136,
48
] | python | en | ['en', 'en', 'en'] | True |
privilege_granted_directly_or_via_role | (self, node=None) | Check that user is only able to execute ATTACH TABLE when they have required privilege, either directly or via role.
| Check that user is only able to execute ATTACH TABLE when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is only able to execute ATTACH TABLE when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
5,
0
] | [
27,
92
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege"):
table_name = f"table_{getuid()}"
try:
... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"with",
"Scenario",
"(",
"\"user without... | [
29,
0
] | [
116,
64
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of ATTACH TABLE.
| Check the RBAC functionality of ATTACH TABLE.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of ATTACH TABLE.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = stress
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
125,
0
] | [
136,
48
] | python | en | ['en', 'en', 'en'] | True |
TestRemoveFile.test_rm | (self, mock_os) |
Test case: Check if the Remove function
|
Test case: Check if the Remove function
| def test_rm(self, mock_os):
"""
Test case: Check if the Remove function
"""
# Input file path into Remove function
rm("dir1/dir2/file.py")
# Mock the Remove function
mock_os.remove.assert_called_with("dir1/dir2/file.py") | [
"def",
"test_rm",
"(",
"self",
",",
"mock_os",
")",
":",
"# Input file path into Remove function\r",
"rm",
"(",
"\"dir1/dir2/file.py\"",
")",
"# Mock the Remove function\r",
"mock_os",
".",
"remove",
".",
"assert_called_with",
"(",
"\"dir1/dir2/file.py\"",
")"
] | [
12,
2
] | [
19,
58
] | python | en | ['en', 'ja', 'th'] | False |
is_good_response | (resp) |
Returns True if the response seems to be HTML, False otherwise.
|
Returns True if the response seems to be HTML, False otherwise.
| def is_good_response(resp):
"""
Returns True if the response seems to be HTML, False otherwise.
"""
content_type = resp.headers['Content-Type'].lower()
return (resp.status_code == 200
and content_type is not None
and content_type.find('html') > -1) | [
"def",
"is_good_response",
"(",
"resp",
")",
":",
"content_type",
"=",
"resp",
".",
"headers",
"[",
"'Content-Type'",
"]",
".",
"lower",
"(",
")",
"return",
"(",
"resp",
".",
"status_code",
"==",
"200",
"and",
"content_type",
"is",
"not",
"None",
"and",
... | [
42,
0
] | [
49,
47
] | python | en | ['en', 'error', 'th'] | False |
bucket | (arg, buckets, closed='left', close_extreme=True,
include_under=False, include_over=False) |
Compute a discrete binning of a numeric array
Parameters
----------
arg : numeric array expression
buckets : list
closed : {'left', 'right'}, default 'left'
Which side of each interval is closed. For example
buckets = [0, 100, 200]
closed = 'left': 100 falls in 2nd bucket
... |
Compute a discrete binning of a numeric array | def bucket(arg, buckets, closed='left', close_extreme=True,
include_under=False, include_over=False):
"""
Compute a discrete binning of a numeric array
Parameters
----------
arg : numeric array expression
buckets : list
closed : {'left', 'right'}, default 'left'
Which side ... | [
"def",
"bucket",
"(",
"arg",
",",
"buckets",
",",
"closed",
"=",
"'left'",
",",
"close_extreme",
"=",
"True",
",",
"include_under",
"=",
"False",
",",
"include_over",
"=",
"False",
")",
":",
"op",
"=",
"Bucket",
"(",
"arg",
",",
"buckets",
",",
"closed... | [
89,
0
] | [
111,
23
] | python | en | ['en', 'error', 'th'] | False |
histogram | (arg, nbins=None, binwidth=None, base=None, closed='left',
aux_hash=None) |
Compute a histogram with fixed width bins
Parameters
----------
arg : numeric array expression
nbins : int, default None
If supplied, will be used to compute the binwidth
binwidth : number, default None
If not supplied, computed from the data (actual max and min values)
base : ... |
Compute a histogram with fixed width bins | def histogram(arg, nbins=None, binwidth=None, base=None, closed='left',
aux_hash=None):
"""
Compute a histogram with fixed width bins
Parameters
----------
arg : numeric array expression
nbins : int, default None
If supplied, will be used to compute the binwidth
binwidth... | [
"def",
"histogram",
"(",
"arg",
",",
"nbins",
"=",
"None",
",",
"binwidth",
"=",
"None",
",",
"base",
"=",
"None",
",",
"closed",
"=",
"'left'",
",",
"aux_hash",
"=",
"None",
")",
":",
"op",
"=",
"Histogram",
"(",
"arg",
",",
"nbins",
",",
"binwidt... | [
114,
0
] | [
136,
23
] | python | en | ['en', 'error', 'th'] | False |
category_label | (arg, labels, nulls=None) |
Format a known number of categories as strings
Parameters
----------
labels : list of string
nulls : string, optional
How to label any null values among the categories
Returns
-------
string_categories : string value expression
|
Format a known number of categories as strings | def category_label(arg, labels, nulls=None):
"""
Format a known number of categories as strings
Parameters
----------
labels : list of string
nulls : string, optional
How to label any null values among the categories
Returns
-------
string_categories : string value expression... | [
"def",
"category_label",
"(",
"arg",
",",
"labels",
",",
"nulls",
"=",
"None",
")",
":",
"op",
"=",
"CategoryLabel",
"(",
"arg",
",",
"labels",
",",
"nulls",
")",
"return",
"op",
".",
"to_expr",
"(",
")"
] | [
139,
0
] | [
154,
23
] | python | en | ['en', 'error', 'th'] | False |
calculate | (x, n, ctx) | Do a simple computation with a context | Do a simple computation with a context | def calculate(x, n, ctx):
""" Do a simple computation with a context"""
assert x.ctx == ctx
assert x.ctx != main_ctx()
# Parallel creation of z3 object
condition = And(x < 2, x > n, ctx)
# Parallel solving
solver = Solver(ctx=ctx)
solver.add(condition)
solver.check() | [
"def",
"calculate",
"(",
"x",
",",
"n",
",",
"ctx",
")",
":",
"assert",
"x",
".",
"ctx",
"==",
"ctx",
"assert",
"x",
".",
"ctx",
"!=",
"main_ctx",
"(",
")",
"# Parallel creation of z3 object",
"condition",
"=",
"And",
"(",
"x",
"<",
"2",
",",
"x",
... | [
10,
0
] | [
21,
18
] | python | en | ['en', 'en', 'en'] | True |
GetFileContents | (path) | Get a file's contents as a string.
Args:
path: str, Path to file.
Returns:
str, Contents of file.
Raises:
IOError: An error occurred opening or reading the file.
| Get a file's contents as a string. | def GetFileContents(path):
"""Get a file's contents as a string.
Args:
path: str, Path to file.
Returns:
str, Contents of file.
Raises:
IOError: An error occurred opening or reading the file.
"""
fileobj = None
try:
fileobj = codecs.open(path, encoding='utf-8-sig')
return fileobj.r... | [
"def",
"GetFileContents",
"(",
"path",
")",
":",
"fileobj",
"=",
"None",
"try",
":",
"fileobj",
"=",
"codecs",
".",
"open",
"(",
"path",
",",
"encoding",
"=",
"'utf-8-sig'",
")",
"return",
"fileobj",
".",
"read",
"(",
")",
"except",
"IOError",
"as",
"e... | [
109,
0
] | [
131,
21
] | python | en | ['en', 'en', 'en'] | True |
Source.__init__ | (self, source) | Initialize a source.
Args:
source: str, The JavaScript source.
| Initialize a source. | def __init__(self, source):
"""Initialize a source.
Args:
source: str, The JavaScript source.
"""
self.provides = set()
self.requires = set()
self.is_goog_module = False
self._source = source
self._ScanSource() | [
"def",
"__init__",
"(",
"self",
",",
"source",
")",
":",
"self",
".",
"provides",
"=",
"set",
"(",
")",
"self",
".",
"requires",
"=",
"set",
"(",
")",
"self",
".",
"is_goog_module",
"=",
"False",
"self",
".",
"_source",
"=",
"source",
"self",
".",
... | [
49,
2
] | [
61,
22
] | python | en | ['en', 'en', 'en'] | True |
Source.GetSource | (self) | Get the source as a string. | Get the source as a string. | def GetSource(self):
"""Get the source as a string."""
return self._source | [
"def",
"GetSource",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source"
] | [
63,
2
] | [
65,
23
] | python | en | ['en', 'en', 'en'] | True |
Source._HasProvideGoogFlag | (cls, source) | Determines whether the @provideGoog flag is in a comment. | Determines whether the | def _HasProvideGoogFlag(cls, source):
"""Determines whether the @provideGoog flag is in a comment."""
for comment_content in cls._COMMENT_REGEX.findall(source):
if '@provideGoog' in comment_content:
return True
return False | [
"def",
"_HasProvideGoogFlag",
"(",
"cls",
",",
"source",
")",
":",
"for",
"comment_content",
"in",
"cls",
".",
"_COMMENT_REGEX",
".",
"findall",
"(",
"source",
")",
":",
"if",
"'@provideGoog'",
"in",
"comment_content",
":",
"return",
"True",
"return",
"False"
... | [
72,
2
] | [
78,
16
] | python | en | ['en', 'en', 'en'] | True |
Source._ScanSource | (self) | Fill in provides and requires by scanning the source. | Fill in provides and requires by scanning the source. | def _ScanSource(self):
"""Fill in provides and requires by scanning the source."""
stripped_source = self._StripComments(self.GetSource())
source_lines = stripped_source.splitlines()
for line in source_lines:
match = _PROVIDE_REGEX.match(line)
if match:
self.provides.add(match.grou... | [
"def",
"_ScanSource",
"(",
"self",
")",
":",
"stripped_source",
"=",
"self",
".",
"_StripComments",
"(",
"self",
".",
"GetSource",
"(",
")",
")",
"source_lines",
"=",
"stripped_source",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"source_lines",
":",
... | [
80,
2
] | [
106,
31
] | python | en | ['en', 'en', 'en'] | True |
first_value | (self) | Check `first_value` function.
| Check `first_value` function.
| def first_value(self):
"""Check `first_value` function.
"""
expected = convert_output("""
first_value | ten | four
-------------+-----+------
0 | 0 | 0
0 | 0 | 0
0 | 4 | 0
1 | 1 | 1
1 | 1 | 1
... | [
"def",
"first_value",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n first_value | ten | four\n -------------+-----+------\n 0 | 0 | 0\n 0 | 0 | 0\n 0 | 4 | 0\n 1 | 1 | 1\n ... | [
9,
0
] | [
37,
9
] | python | en | ['en', 'en', 'en'] | True |
last_value | (self) | Check `last_value` function.
| Check `last_value` function.
| def last_value(self):
"""Check `last_value` function.
"""
with Example("order by window", description="""
Check that last_value returns the last row of the frame that is CURRENT ROW in ORDER BY window
"""):
expected = convert_output("""
last_value | ten | four
------... | [
"def",
"last_value",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"order by window\"",
",",
"description",
"=",
"\"\"\"\n Check that last_value returns the last row of the frame that is CURRENT ROW in ORDER BY window\n \"\"\"",
")",
":",
"expected",
"=",
"conver... | [
43,
0
] | [
108,
13
] | python | en | ['en', 'en', 'en'] | True |
lag | (self) | Check `lag` function workaround.
| Check `lag` function workaround.
| def lag(self):
"""Check `lag` function workaround.
"""
with Example("anyOrNull"):
expected = convert_output("""
lag | ten | four
-----+-----+------
\\N | 0 | 0
0 | 0 | 0
0 | 4 | 0
\\N | 1 | 1
1 | 1 | 1
... | [
"def",
"lag",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"anyOrNull\"",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n lag | ten | four\n -----+-----+------\n \\\\N | 0 | 0\n 0 | 0 | 0\n 0 | 4 | 0\n ... | [
114,
0
] | [
178,
9
] | python | de | ['nl', 'de', 'en'] | False |
lead | (self) | Check `lead` function workaround.
| Check `lead` function workaround.
| def lead(self):
"""Check `lead` function workaround.
"""
with Example("anyOrNull"):
expected = convert_output("""
lead | ten | four
------+-----+------
0 | 0 | 0
4 | 0 | 0
\\N | 4 | 0
1 | 1 | 1
7 | 1 | ... | [
"def",
"lead",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"anyOrNull\"",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n lead | ten | four\n ------+-----+------\n 0 | 0 | 0\n 4 | 0 | 0\n \\\\N | 4 | 0\n ... | [
184,
0
] | [
270,
9
] | python | en | ['nl', 'en', 'en'] | True |
row_number | (self) | Check `row_number` function.
| Check `row_number` function.
| def row_number(self):
"""Check `row_number` function.
"""
expected = convert_output("""
row_number
------------
1
2
3
4
5
6
7
8
9
10
""")
execute_query... | [
"def",
"row_number",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n row_number\n ------------\n 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n 10... | [
276,
0
] | [
297,
5
] | python | en | ['en', 'en', 'en'] | True |
rank | (self) | Check `rank` function.
| Check `rank` function.
| def rank(self):
"""Check `rank` function.
"""
expected = convert_output("""
rank_1 | ten | four
--------+-----+------
1 | 0 | 0
1 | 0 | 0
3 | 4 | 0
1 | 1 | 1
1 | 1 | 1
3 | 7 | 1
4 | 9 | 1
... | [
"def",
"rank",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n rank_1 | ten | four\n --------+-----+------\n 1 | 0 | 0\n 1 | 0 | 0\n 3 | 4 | 0\n 1 | 1 | 1\n 1 | 1 | 1\n 3 | 7 | 1\n... | [
303,
0
] | [
324,
5
] | python | en | ['en', 'en', 'en'] | True |
dense_rank | (self) | Check `dense_rank` function.
| Check `dense_rank` function.
| def dense_rank(self):
"""Check `dense_rank` function.
"""
expected = convert_output("""
dense_rank | ten | four
------------+-----+------
1 | 0 | 0
1 | 0 | 0
2 | 4 | 0
1 | 1 | 1
1 | 1 | 1
2 ... | [
"def",
"dense_rank",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n dense_rank | ten | four\n ------------+-----+------\n 1 | 0 | 0\n 1 | 0 | 0\n 2 | 4 | 0\n 1 | 1 | 1\n 1 | 1 ... | [
330,
0
] | [
351,
5
] | python | en | ['en', 'gl', 'en'] | True |
last_value_with_no_frame | (self) | Check last_value function with no frame.
| Check last_value function with no frame.
| def last_value_with_no_frame(self):
"""Check last_value function with no frame.
"""
expected = convert_output("""
four | ten | sum | last_value
------+-----+-----+------------
0 | 0 | 0 | 0
0 | 2 | 2 | 2
0 | 4 | 6 | 4
0 | 6 | ... | [
"def",
"last_value_with_no_frame",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n four | ten | sum | last_value\n ------+-----+-----+------------\n 0 | 0 | 0 | 0\n 0 | 2 | 2 | 2\n 0 | 4 | 6 | 4\n ... | [
354,
0
] | [
387,
5
] | python | en | ['en', 'en', 'en'] | True |
last_value_with_lag_workaround | (self) | Check last value with lag workaround.
| Check last value with lag workaround.
| def last_value_with_lag_workaround(self):
"""Check last value with lag workaround.
"""
expected = convert_output("""
last_value | lag | salary
------------+------+--------
4500 | 0 | 3500
4800 | 3500 | 3900
5200 | 3900 | 4200
5200 | 4200 | 450... | [
"def",
"last_value_with_lag_workaround",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n last_value | lag | salary\n ------------+------+--------\n 4500 | 0 | 3500\n 4800 | 3500 | 3900\n 5200 | 3900 | 4200\n 5200 |... | [
394,
0
] | [
417,
5
] | python | en | ['en', 'en', 'en'] | True |
first_value_with_lead_workaround | (self) | Check first value with lead workaround.
| Check first value with lead workaround.
| def first_value_with_lead_workaround(self):
"""Check first value with lead workaround.
"""
expected = convert_output("""
first_value | lead | salary
-------------+------+--------
3500 | 3900 | 3500
3500 | 4200 | 3900
3500 | 4500 | 4200
3500 | 48... | [
"def",
"first_value_with_lead_workaround",
"(",
"self",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n first_value | lead | salary\n -------------+------+--------\n 3500 | 3900 | 3500\n 3500 | 4200 | 3900\n 3500 | 4500 | 4200\n ... | [
424,
0
] | [
447,
5
] | python | en | ['en', 'en', 'en'] | True |
leadInFrame | (self) | Check `leadInFrame` function.
| Check `leadInFrame` function.
| def leadInFrame(self):
"""Check `leadInFrame` function.
"""
with Example("non default offset"):
expected = convert_output("""
empno | salary | lead
--------+--------+-------
1 | 5000 | 5000
2 | 3900 | 3900
3 | 4800 | 4800
... | [
"def",
"leadInFrame",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"non default offset\"",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | lead\n --------+--------+-------\n 1 | 5000 | 5000\n 2 | 3900 | 39... | [
453,
0
] | [
554,
9
] | python | en | ['en', 'en', 'en'] | True |
lagInFrame | (self) | Check `lagInFrame` function.
| Check `lagInFrame` function.
| def lagInFrame(self):
"""Check `lagInFrame` function.
"""
with Example("non default offset"):
expected = convert_output("""
empno | salary | lag
--------+--------+-------
1 | 5000 | 5000
2 | 3900 | 3900
3 | 4800 | 4800
4... | [
"def",
"lagInFrame",
"(",
"self",
")",
":",
"with",
"Example",
"(",
"\"non default offset\"",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n empno | salary | lag\n --------+--------+-------\n 1 | 5000 | 5000\n 2 | 3900 | 3900... | [
560,
0
] | [
661,
9
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check true window functions.
| Check true window functions.
| def feature(self):
"""Check true window functions.
"""
for scenario in loads(current_module(), Scenario):
Scenario(run=scenario, flags=TE) | [
"def",
"feature",
"(",
"self",
")",
":",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",
")",
",",
"Scenario",
")",
":",
"Scenario",
"(",
"run",
"=",
"scenario",
",",
"flags",
"=",
"TE",
")"
] | [
665,
0
] | [
669,
40
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check alter settings profile query syntax.
```sql
ALTER SETTINGS PROFILE [IF EXISTS] name
[ON CLUSTER cluster_name]
[RENAME TO new_name]
[SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | INHERIT 'profile_name'] [,...]
[TO {user_or_role [,...] | NONE | AL... | Check alter settings profile query syntax. | def feature(self, node="clickhouse1"):
"""Check alter settings profile query syntax.
```sql
ALTER SETTINGS PROFILE [IF EXISTS] name
[ON CLUSTER cluster_name]
[RENAME TO new_name]
[SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | INHERIT 'profile_name'] [... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"def",
"cleanup_profile",
"(",
"profile",
")",
":",
"with",
"Given",
"(",
"f\"I ensure that ... | [
10,
0
] | [
231,
52
] | python | en | ['fr', 'en', 'en'] | True |
DepotToolsConan._dereference_symlinks | (self) |
Windows 10 started to introduce support for symbolic links. Unfortunately
it caused a lot of trouble during packaging. Namely, opening symlinks causes
`OSError: Invalid argument` rather than actually following the symlinks.
Therefore, this workaround simply copies the destination file o... |
Windows 10 started to introduce support for symbolic links. Unfortunately
it caused a lot of trouble during packaging. Namely, opening symlinks causes
`OSError: Invalid argument` rather than actually following the symlinks.
Therefore, this workaround simply copies the destination file o... | def _dereference_symlinks(self):
"""
Windows 10 started to introduce support for symbolic links. Unfortunately
it caused a lot of trouble during packaging. Namely, opening symlinks causes
`OSError: Invalid argument` rather than actually following the symlinks.
Therefore, this wor... | [
"def",
"_dereference_symlinks",
"(",
"self",
")",
":",
"if",
"self",
".",
"settings",
".",
"os",
"!=",
"\"Windows\"",
":",
"return",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"_source_subfolder",
")",
":",
"sy... | [
22,
4
] | [
38,
106
] | python | en | ['en', 'error', 'th'] | False |
bad_request | (error) | Custom error handler for bad requests | Custom error handler for bad requests | def bad_request(error):
"""Custom error handler for bad requests"""
return jsonify(dict(error = 'Bad request, please add input details')), 400 | [
"def",
"bad_request",
"(",
"error",
")",
":",
"return",
"jsonify",
"(",
"dict",
"(",
"error",
"=",
"'Bad request, please add input details'",
")",
")",
",",
"400"
] | [
27,
0
] | [
29,
78
] | python | da | ['da', 'nl', 'en'] | False |
unauthorised | (error) | Custom error handler for bad requests | Custom error handler for bad requests | def unauthorised(error):
"""Custom error handler for bad requests"""
return jsonify(dict(error = 'Unauthorised, request lacks valid authentication details.')), 401 | [
"def",
"unauthorised",
"(",
"error",
")",
":",
"return",
"jsonify",
"(",
"dict",
"(",
"error",
"=",
"'Unauthorised, request lacks valid authentication details.'",
")",
")",
",",
"401"
] | [
32,
0
] | [
34,
98
] | python | da | ['da', 'nl', 'en'] | False |
not_found | (error) | Custom error handler for bad requests | Custom error handler for bad requests | def not_found(error):
"""Custom error handler for bad requests"""
return jsonify(dict(error = 'Not Found, resource not found')), 404 | [
"def",
"not_found",
"(",
"error",
")",
":",
"return",
"jsonify",
"(",
"dict",
"(",
"error",
"=",
"'Not Found, resource not found'",
")",
")",
",",
"404"
] | [
37,
0
] | [
39,
70
] | python | da | ['da', 'nl', 'en'] | False |
internal_server_error | (error) | Custom error handler for bad requests | Custom error handler for bad requests | def internal_server_error(error):
"""Custom error handler for bad requests"""
return jsonify(dict(error = 'Internal server error')), 500 | [
"def",
"internal_server_error",
"(",
"error",
")",
":",
"return",
"jsonify",
"(",
"dict",
"(",
"error",
"=",
"'Internal server error'",
")",
")",
",",
"500"
] | [
42,
0
] | [
44,
62
] | python | da | ['da', 'nl', 'en'] | False |
home_route | () | HomePage route | HomePage route | def home_route():
""" HomePage route """
response = jsonify({'Message': 'Welcome to Hello Library'})
return response | [
"def",
"home_route",
"(",
")",
":",
"response",
"=",
"jsonify",
"(",
"{",
"'Message'",
":",
"'Welcome to Hello Library'",
"}",
")",
"return",
"response"
] | [
47,
0
] | [
50,
19
] | python | en | ['en', 'en', 'en'] | False |
import_class | (val) |
Import a class from a string module path.
Pattern borrowed from Django REST Framework.
See rest_framework/settings.py#L170-L182
|
Import a class from a string module path. | def import_class(val):
"""
Import a class from a string module path.
Pattern borrowed from Django REST Framework.
See rest_framework/settings.py#L170-L182
"""
try:
parts = val.split('.')
module_path, class_name = '.'.join(parts[:-1]), parts[-1]
module = import_module(mod... | [
"def",
"import_class",
"(",
"val",
")",
":",
"try",
":",
"parts",
"=",
"val",
".",
"split",
"(",
"'.'",
")",
"module_path",
",",
"class_name",
"=",
"'.'",
".",
"join",
"(",
"parts",
"[",
":",
"-",
"1",
"]",
")",
",",
"parts",
"[",
"-",
"1",
"]"... | [
3,
0
] | [
20,
30
] | python | en | ['en', 'error', 'th'] | False |
replicated_privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SYSTEM REPLICATION QUEUES` commands if and only if
the privilege has been granted directly.
| Check that a user is able to execute `SYSTEM REPLICATION QUEUES` commands if and only if
the privilege has been granted directly.
| def replicated_privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `SYSTEM REPLICATION QUEUES` commands if and only if
the privilege has been granted directly.
"""
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
with user(node,... | [
"def",
"replicated_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
... | [
8,
0
] | [
22,
80
] | python | en | ['en', 'en', 'en'] | True |
replicated_privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `SYSTEM REPLICATION QUEUES` commands if and only if
the privilege has been granted via role.
| Check that a user is able to execute `SYSTEM REPLICATION QUEUES` commands if and only if
the privilege has been granted via role.
| def replicated_privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `SYSTEM REPLICATION QUEUES` commands if and only if
the privilege has been granted via role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node = sel... | [
"def",
"replicated_privileges_granted_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
25,
0
] | [
43,
80
] | python | en | ['en', 'en', 'en'] | True |
check_replicated_privilege | (self, privilege, on, grant_target_name, user_name, node=None) | Run checks for commands that require SYSTEM REPLICATION QUEUES privilege.
| Run checks for commands that require SYSTEM REPLICATION QUEUES privilege.
| def check_replicated_privilege(self, privilege, on, grant_target_name, user_name, node=None):
"""Run checks for commands that require SYSTEM REPLICATION QUEUES privilege.
"""
if node is None:
node = self.context.node
Suite(test=start_replication_queues)(privilege=privilege, on=on, grant_target... | [
"def",
"check_replicated_privilege",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"Suite",
"("... | [
55,
0
] | [
63,
125
] | python | en | ['en', 'en', 'en'] | True |
start_replication_queues | (self, privilege, on, grant_target_name, user_name, node=None) | Check that user is only able to execute `SYSTEM START REPLICATION QUEUES` when they have privilege.
| Check that user is only able to execute `SYSTEM START REPLICATION QUEUES` when they have privilege.
| def start_replication_queues(self, privilege, on, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SYSTEM START REPLICATION QUEUES` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table_name = f"table_name_{getuid()}"
... | [
"def",
"start_replication_queues",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",... | [
66,
0
] | [
109,
55
] | python | en | ['en', 'en', 'en'] | True |
stop_replication_queues | (self, privilege, on, grant_target_name, user_name, node=None) | Check that user is only able to execute `SYSTEM STOP REPLICATION QUEUES` when they have privilege.
| Check that user is only able to execute `SYSTEM STOP REPLICATION QUEUES` when they have privilege.
| def stop_replication_queues(self, privilege, on, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SYSTEM STOP REPLICATION QUEUES` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table_name = f"table_name_{getuid()}"
... | [
"def",
"stop_replication_queues",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
... | [
112,
0
] | [
155,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SYSTEM REPLICATION QUEUES.
| Check the RBAC functionality of SYSTEM REPLICATION QUEUES.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SYSTEM REPLICATION QUEUES.
"""
self.context.node = self.context.cluster.node(node)
Suite(run=replicated_privileges_granted_directly, setup=instrument_clickhouse_server_log)
Suite(run=replicated_privileges_granted_via_role, se... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"replicated_privileges_granted_directly... | [
164,
0
] | [
170,
93
] | python | en | ['en', 'en', 'en'] | True |
TestMcrouterSanityMock.data | (self, n) | generate n random (key, value) pairs | generate n random (key, value) pairs | def data(self, n):
""" generate n random (key, value) pairs """
prefixes = ['foo:', 'bar:', 'baz:', 'wc:', 'lat:']
keys = [random.choice(prefixes) + randstring(random.randint(3, 10))
for i in range(n)]
keys = list(set(keys))
vals = [randstring(random.randint(3, 10... | [
"def",
"data",
"(",
"self",
",",
"n",
")",
":",
"prefixes",
"=",
"[",
"'foo:'",
",",
"'bar:'",
",",
"'baz:'",
",",
"'wc:'",
",",
"'lat:'",
"]",
"keys",
"=",
"[",
"random",
".",
"choice",
"(",
"prefixes",
")",
"+",
"randstring",
"(",
"random",
".",
... | [
53,
4
] | [
60,
30
] | python | en | ['en', 'af', 'en'] | True |
table | (schema, name=None) |
Create an unbound Ibis table for creating expressions. Cannot be executed
without being bound to some physical table.
Useful for testing
Parameters
----------
schema : ibis Schema
name : string, default None
Name for table
Returns
-------
table : TableExpr
|
Create an unbound Ibis table for creating expressions. Cannot be executed
without being bound to some physical table. | def table(schema, name=None):
"""
Create an unbound Ibis table for creating expressions. Cannot be executed
without being bound to some physical table.
Useful for testing
Parameters
----------
schema : ibis Schema
name : string, default None
Name for table
Returns
------... | [
"def",
"table",
"(",
"schema",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"schema",
",",
"Schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"dict",
")",
":",
"schema",
"=",
"Schema",
".",
"from_dict",
"(",
"schema",
... | [
141,
0
] | [
165,
25
] | python | en | ['en', 'error', 'th'] | False |
desc | (expr) |
Create a sort key (when used in sort_by) by the passed array expression or
column name.
Parameters
----------
expr : array expression or string
Can be a column name in the table being sorted
Examples
--------
>>> import ibis
>>> t = ibis.table([('g', 'string')])
>>> resu... |
Create a sort key (when used in sort_by) by the passed array expression or
column name. | def desc(expr):
"""
Create a sort key (when used in sort_by) by the passed array expression or
column name.
Parameters
----------
expr : array expression or string
Can be a column name in the table being sorted
Examples
--------
>>> import ibis
>>> t = ibis.table([('g', '... | [
"def",
"desc",
"(",
"expr",
")",
":",
"if",
"not",
"isinstance",
"(",
"expr",
",",
"Expr",
")",
":",
"return",
"ops",
".",
"DeferredSortKey",
"(",
"expr",
",",
"ascending",
"=",
"False",
")",
"else",
":",
"return",
"ops",
".",
"SortKey",
"(",
"expr",... | [
168,
0
] | [
187,
59
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.