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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
replicated_privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `SYSTEM REPLICATED SENDS` commands if and only if
the privilege has been granted via role.
| Check that a user is able to execute `SYSTEM REPLICATED SENDS` 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 REPLICATED SENDS` 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 = self.... | [
"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 REPLICATED SENDS privilege.
| Run checks for commands that require SYSTEM REPLICATED SENDS privilege.
| def check_replicated_privilege(self, privilege, on, grant_target_name, user_name, node=None):
"""Run checks for commands that require SYSTEM REPLICATED SENDS privilege.
"""
if node is None:
node = self.context.node
Suite(test=start_replicated_sends)(privilege=privilege, on=on, grant_target_nam... | [
"def",
"check_replicated_privilege",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"Suite",
"("... | [
63,
0
] | [
71,
123
] | python | en | ['en', 'en', 'en'] | True |
start_replicated_sends | (self, privilege, on, grant_target_name, user_name, node=None) | Check that user is only able to execute `SYSTEM START REPLICATED SENDS` when they have privilege.
| Check that user is only able to execute `SYSTEM START REPLICATED SENDS` when they have privilege.
| def start_replicated_sends(self, privilege, on, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SYSTEM START REPLICATED SENDS` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table_name = f"table_name_{getuid()}"
i... | [
"def",
"start_replicated_sends",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
... | [
74,
0
] | [
117,
55
] | python | en | ['en', 'en', 'en'] | True |
stop_replicated_sends | (self, privilege, on, grant_target_name, user_name, node=None) | Check that user is only able to execute `SYSTEM STOP REPLICATED SENDS` when they have privilege.
| Check that user is only able to execute `SYSTEM STOP REPLICATED SENDS` when they have privilege.
| def stop_replicated_sends(self, privilege, on, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SYSTEM STOP REPLICATED SENDS` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table_name = f"table_name_{getuid()}"
if ... | [
"def",
"stop_replicated_sends",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
... | [
120,
0
] | [
163,
55
] | python | en | ['en', 'en', 'en'] | True |
distributed_privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SYSTEM DISTRIBUTED SENDS` commands if and only if
the privilege has been granted directly.
| Check that a user is able to execute `SYSTEM DISTRIBUTED SENDS` commands if and only if
the privilege has been granted directly.
| def distributed_privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `SYSTEM DISTRIBUTED SENDS` 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",
"distributed_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
... | [
166,
0
] | [
181,
80
] | python | en | ['en', 'en', 'en'] | True |
distributed_privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `SYSTEM DISTRIBUTED SENDS` commands if and only if
the privilege has been granted via role.
| Check that a user is able to execute `SYSTEM DISTRIBUTED SENDS` commands if and only if
the privilege has been granted via role.
| def distributed_privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `SYSTEM DISTRIBUTED SENDS` 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",
"distributed_privileges_granted_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"role_name",
"=",
"f\"role_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"nod... | [
184,
0
] | [
203,
80
] | python | en | ['en', 'en', 'en'] | True |
check_distributed_privilege | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Run checks for commands that require SYSTEM DISTRIBUTED SENDS privilege.
| Run checks for commands that require SYSTEM DISTRIBUTED SENDS privilege.
| def check_distributed_privilege(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Run checks for commands that require SYSTEM DISTRIBUTED SENDS privilege.
"""
if node is None:
node = self.context.node
Suite(test=start_distributed_moves)(privilege=privilege, on=on, g... | [
"def",
"check_distributed_privilege",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
... | [
223,
0
] | [
231,
147
] | python | en | ['en', 'en', 'en'] | True |
start_distributed_moves | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Check that user is only able to execute `SYSTEM START DISTRIBUTED SENDS` when they have privilege.
| Check that user is only able to execute `SYSTEM START DISTRIBUTED SENDS` when they have privilege.
| def start_distributed_moves(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Check that user is only able to execute `SYSTEM START DISTRIBUTED SENDS` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table0_name = f"table0_{getuid... | [
"def",
"start_distributed_moves",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",... | [
234,
0
] | [
284,
64
] | python | en | ['en', 'en', 'en'] | True |
stop_distributed_moves | (self, privilege, on, grant_target_name, user_name, table_name, node=None) | Check that user is only able to execute `SYSTEM STOP DISTRIBUTED SENDS` when they have privilege.
| Check that user is only able to execute `SYSTEM STOP DISTRIBUTED SENDS` when they have privilege.
| def stop_distributed_moves(self, privilege, on, grant_target_name, user_name, table_name, node=None):
"""Check that user is only able to execute `SYSTEM STOP DISTRIBUTED SENDS` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table0_name = f"table0_{getuid()... | [
"def",
"stop_distributed_moves",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"table_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
... | [
287,
0
] | [
336,
64
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SYSTEM SENDS.
| Check the RBAC functionality of SYSTEM SENDS.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SYSTEM SENDS.
"""
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, setup=instrumen... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"replicated_privileges_granted_directly... | [
345,
0
] | [
353,
94
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check show create settings profile query syntax.
```sql
SHOW CREATE [SETTINGS] PROFILE name
```
| Check show create settings profile query syntax. | def feature(self, node="clickhouse1"):
"""Check show create settings profile query syntax.
```sql
SHOW CREATE [SETTINGS] PROFILE name
```
"""
node = self.context.cluster.node(node)
@contextmanager
def cleanup(profile):
try:
with Given("I have a settings profile"):
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"cleanup",
"(",
"profile",
")",
":",
"try",
":",
"with",
"... | [
8,
0
] | [
37,
58
] | python | en | ['pt', '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 |
empty_server_name | (self, timeout=60) | Check that empty string as a server name is not allowed.
| Check that empty string as a server name is not allowed.
| def empty_server_name(self, timeout=60):
"""Check that empty string as a server name is not allowed.
"""
servers = {"": {"host": "foo", "port": "389", "enable_tls": "no",
"auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com"
}}
invalid_server_config(servers, timeout=ti... | [
"def",
"empty_server_name",
"(",
"self",
",",
"timeout",
"=",
"60",
")",
":",
"servers",
"=",
"{",
"\"\"",
":",
"{",
"\"host\"",
":",
"\"foo\"",
",",
"\"port\"",
":",
"\"389\"",
",",
"\"enable_tls\"",
":",
"\"no\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"... | [
14,
0
] | [
20,
51
] | python | en | ['en', 'en', 'en'] | True |
invalid_host | (self) | Check that server returns an error when LDAP server
host name is invalid.
| Check that server returns an error when LDAP server
host name is invalid.
| def invalid_host(self):
"""Check that server returns an error when LDAP server
host name is invalid.
"""
servers = {"foo": {"host": "foo", "port": "389", "enable_tls": "no"}}
users = [{
"server": "foo", "username": "user1", "password": "user1", "login": True,
"exitcode": 4, "message"... | [
"def",
"invalid_host",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"foo\"",
":",
"{",
"\"host\"",
":",
"\"foo\"",
",",
"\"port\"",
":",
"\"389\"",
",",
"\"enable_tls\"",
":",
"\"no\"",
"}",
"}",
"users",
"=",
"[",
"{",
"\"server\"",
":",
"\"foo\"",
"... | [
27,
0
] | [
36,
33
] | python | en | ['en', 'lb', 'en'] | True |
empty_host | (self, tail=30, timeout=300) | Check that server returns an error when LDAP server
host value is empty.
| Check that server returns an error when LDAP server
host value is empty.
| def empty_host(self, tail=30, timeout=300):
"""Check that server returns an error when LDAP server
host value is empty.
"""
node = current().context.node
message = "DB::Exception: Empty 'host' entry"
servers = {"foo": {"host": "", "port": "389", "enable_tls": "no"}}
invalid_server_config(s... | [
"def",
"empty_host",
"(",
"self",
",",
"tail",
"=",
"30",
",",
"timeout",
"=",
"300",
")",
":",
"node",
"=",
"current",
"(",
")",
".",
"context",
".",
"node",
"message",
"=",
"\"DB::Exception: Empty 'host' entry\"",
"servers",
"=",
"{",
"\"foo\"",
":",
"... | [
43,
0
] | [
52,
77
] | python | en | ['en', 'lb', 'en'] | True |
missing_host | (self, tail=30, timeout=300) | Check that server returns an error when LDAP server
host is missing.
| Check that server returns an error when LDAP server
host is missing.
| def missing_host(self, tail=30, timeout=300):
"""Check that server returns an error when LDAP server
host is missing.
"""
node = current().context.node
message = "DB::Exception: Missing 'host' entry"
servers = {"foo": {"port": "389", "enable_tls": "no"}}
users = [{
"server": "foo", ... | [
"def",
"missing_host",
"(",
"self",
",",
"tail",
"=",
"30",
",",
"timeout",
"=",
"300",
")",
":",
"node",
"=",
"current",
"(",
")",
".",
"context",
".",
"node",
"message",
"=",
"\"DB::Exception: Missing 'host' entry\"",
"servers",
"=",
"{",
"\"foo\"",
":",... | [
59,
0
] | [
84,
41
] | python | en | ['en', 'lb', 'en'] | True |
invalid_port | (self) | Check that server returns an error when LDAP server
port is not valid.
| Check that server returns an error when LDAP server
port is not valid.
| def invalid_port(self):
"""Check that server returns an error when LDAP server
port is not valid.
"""
servers = {"openldap1": {"host": "openldap1", "port": "3890", "enable_tls": "no"}}
users = [{
"server": "openldap1", "username": "user1", "password": "user1", "login": True,
"exitcod... | [
"def",
"invalid_port",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
",",
"\"port\"",
":",
"\"3890\"",
",",
"\"enable_tls\"",
":",
"\"no\"",
"}",
"}",
"users",
"=",
"[",
"{",
"\"server\"",
":",
"... | [
90,
0
] | [
99,
39
] | python | en | ['en', 'lb', 'en'] | True |
invalid_auth_dn_prefix | (self) | Check that server returns an error when LDAP server definition
has invalid auth_dn_prefix.
| Check that server returns an error when LDAP server definition
has invalid auth_dn_prefix.
| def invalid_auth_dn_prefix(self):
"""Check that server returns an error when LDAP server definition
has invalid auth_dn_prefix.
"""
servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "no",
"auth_dn_prefix": "foo=", "auth_dn_suffix": ",ou=users,dc=company,dc=com"
}}
... | [
"def",
"invalid_auth_dn_prefix",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
",",
"\"port\"",
":",
"\"389\"",
",",
"\"enable_tls\"",
":",
"\"no\"",
",",
"\"auth_dn_prefix\"",
":",
"\"foo=\"",
",",
"\... | [
106,
0
] | [
117,
39
] | python | en | ['en', 'lb', 'en'] | True |
invalid_auth_dn_suffix | (self) | Check that server returns an error when LDAP server definition
has invalid auth_dn_suffix.
| Check that server returns an error when LDAP server definition
has invalid auth_dn_suffix.
| def invalid_auth_dn_suffix(self):
"""Check that server returns an error when LDAP server definition
has invalid auth_dn_suffix.
"""
servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "no",
"auth_dn_prefix": "cn=", "auth_dn_suffix": ",foo=users,dc=company,dc=com"
}}
... | [
"def",
"invalid_auth_dn_suffix",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
",",
"\"port\"",
":",
"\"389\"",
",",
"\"enable_tls\"",
":",
"\"no\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"",
",",
"\"... | [
124,
0
] | [
135,
39
] | python | en | ['en', 'lb', 'en'] | True |
invalid_enable_tls_value | (self, timeout=60) | Check that server returns an error when enable_tls
option has invalid value.
| Check that server returns an error when enable_tls
option has invalid value.
| def invalid_enable_tls_value(self, timeout=60):
"""Check that server returns an error when enable_tls
option has invalid value.
"""
message = "Syntax error: Cannot convert to boolean: foo"
servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "foo",
"auth_dn_prefix": "cn... | [
"def",
"invalid_enable_tls_value",
"(",
"self",
",",
"timeout",
"=",
"60",
")",
":",
"message",
"=",
"\"Syntax error: Cannot convert to boolean: foo\"",
"servers",
"=",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
",",
"\"port\"",
":",
"\"389\""... | [
142,
0
] | [
150,
77
] | python | en | ['en', 'en', 'en'] | True |
invalid_tls_require_cert_value | (self) | Check that server returns an error when tls_require_cert
option has invalid value.
| Check that server returns an error when tls_require_cert
option has invalid value.
| def invalid_tls_require_cert_value(self):
"""Check that server returns an error when tls_require_cert
option has invalid value.
"""
servers = {"openldap2": {
"host": "openldap2", "port": "636", "enable_tls": "yes",
"auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com",... | [
"def",
"invalid_tls_require_cert_value",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap2\"",
":",
"{",
"\"host\"",
":",
"\"openldap2\"",
",",
"\"port\"",
":",
"\"636\"",
",",
"\"enable_tls\"",
":",
"\"yes\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"",
"... | [
157,
0
] | [
172,
39
] | python | en | ['en', 'lb', 'en'] | True |
empty_ca_cert_dir | (self) | Check that server returns an error when ca_cert_dir is empty.
| Check that server returns an error when ca_cert_dir is empty.
| def empty_ca_cert_dir(self):
"""Check that server returns an error when ca_cert_dir is empty.
"""
servers = {"openldap2": {"host": "openldap2", "port": "636", "enable_tls": "yes",
"auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com",
"tls_require_cert": "demand",
... | [
"def",
"empty_ca_cert_dir",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap2\"",
":",
"{",
"\"host\"",
":",
"\"openldap2\"",
",",
"\"port\"",
":",
"\"636\"",
",",
"\"enable_tls\"",
":",
"\"yes\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"",
",",
"\"auth... | [
179,
0
] | [
193,
39
] | python | en | ['en', 'lb', 'en'] | True |
empty_ca_cert_file | (self) | Check that server returns an error when ca_cert_file is empty.
| Check that server returns an error when ca_cert_file is empty.
| def empty_ca_cert_file(self):
"""Check that server returns an error when ca_cert_file is empty.
"""
servers = {"openldap2": {"host": "openldap2", "port": "636", "enable_tls": "yes",
"auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com",
"tls_require_cert": "demand",
... | [
"def",
"empty_ca_cert_file",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap2\"",
":",
"{",
"\"host\"",
":",
"\"openldap2\"",
",",
"\"port\"",
":",
"\"636\"",
",",
"\"enable_tls\"",
":",
"\"yes\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"",
",",
"\"aut... | [
200,
0
] | [
214,
39
] | python | en | ['en', 'en', 'en'] | True |
auth_dn_value | (self) | Check that server configuration can properly define the `dn` value of the user. | Check that server configuration can properly define the `dn` value of the user. | def auth_dn_value(self):
"""Check that server configuration can properly define the `dn` value of the user."""
servers = {
"openldap1": {
"host": "openldap1", "port": "389", "enable_tls": "no",
"auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com"
}}
... | [
"def",
"auth_dn_value",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
",",
"\"port\"",
":",
"\"389\"",
",",
"\"enable_tls\"",
":",
"\"no\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"",
",",
"\"auth_dn_s... | [
222,
0
] | [
231,
37
] | python | en | ['en', 'en', 'en'] | True |
invalid_verification_cooldown_value | (self, invalid_value, timeout=300) | Check that server returns an error when LDAP server
verification cooldown parameter is invalid.
| Check that server returns an error when LDAP server
verification cooldown parameter is invalid.
| def invalid_verification_cooldown_value(self, invalid_value, timeout=300):
"""Check that server returns an error when LDAP server
verification cooldown parameter is invalid.
"""
error_message = ("<Error> Access(user directories): Could not parse LDAP server"
" \\`openldap1\\`: Poco::Exception. ... | [
"def",
"invalid_verification_cooldown_value",
"(",
"self",
",",
"invalid_value",
",",
"timeout",
"=",
"300",
")",
":",
"error_message",
"=",
"(",
"\"<Error> Access(user directories): Could not parse LDAP server\"",
"\" \\\\`openldap1\\\\`: Poco::Exception. Code: 1000, e.code() = 0,\"... | [
245,
0
] | [
261,
87
] | python | en | ['en', 'lb', 'en'] | True |
syntax | (self) | Check that server configuration with valid syntax can be loaded.
```xml
<yandex>
<ldap_server>
<host>localhost</host>
<port>636</port>
<auth_dn_prefix>cn=</auth_dn_prefix>
<auth_dn_suffix>, ou=users, dc=example, dc=com</auth_dn_suffix>
<verific... | Check that server configuration with valid syntax can be loaded.
```xml
<yandex>
<ldap_server>
<host>localhost</host>
<port>636</port>
<auth_dn_prefix>cn=</auth_dn_prefix>
<auth_dn_suffix>, ou=users, dc=example, dc=com</auth_dn_suffix>
<verific... | def syntax(self):
"""Check that server configuration with valid syntax can be loaded.
```xml
<yandex>
<ldap_server>
<host>localhost</host>
<port>636</port>
<auth_dn_prefix>cn=</auth_dn_prefix>
<auth_dn_suffix>, ou=users, dc=example, dc=com</auth_dn_suf... | [
"def",
"syntax",
"(",
"self",
")",
":",
"servers",
"=",
"{",
"\"openldap2\"",
":",
"{",
"\"host\"",
":",
"\"openldap2\"",
",",
"\"port\"",
":",
"\"389\"",
",",
"\"auth_dn_prefix\"",
":",
"\"cn=\"",
",",
"\"auth_dn_suffix\"",
":",
"\",ou=users,dc=company,dc=com\"",... | [
267,
0
] | [
307,
12
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check LDAP server configuration.
| Check LDAP server configuration.
| def feature(self, node="clickhouse1"):
"""Check LDAP server configuration.
"""
self.context.node = self.context.cluster.node(node)
for scenario in loads(current_module(), Scenario):
scenario() | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",... | [
311,
0
] | [
316,
18
] | python | en | ['en', 'pt', 'en'] | True |
viz | (statecode: str) |
Visualize state unemployment rate from [Federal Reserve Economic Data](https://fred.stlouisfed.org/) 📈
### Path Parameter
`statecode`: The [USPS 2 letter abbreviation](https://en.wikipedia.org/wiki/List_of_U.S._state_and_territory_abbreviations#Table)
(case insensitive) for any of the 50 states ... |
Visualize state unemployment rate from [Federal Reserve Economic Data](https://fred.stlouisfed.org/) 📈
### Path Parameter
`statecode`: The [USPS 2 letter abbreviation](https://en.wikipedia.org/wiki/List_of_U.S._state_and_territory_abbreviations#Table)
(case insensitive) for any of the 50 states ... | async def viz(statecode: str):
"""
Visualize state unemployment rate from [Federal Reserve Economic Data](https://fred.stlouisfed.org/) 📈
### Path Parameter
`statecode`: The [USPS 2 letter abbreviation](https://en.wikipedia.org/wiki/List_of_U.S._state_and_territory_abbreviations#Table)
(case ... | [
"async",
"def",
"viz",
"(",
"statecode",
":",
"str",
")",
":",
"# Validate the state code",
"statecodes",
"=",
"{",
"'AL'",
":",
"'Alabama'",
",",
"'AK'",
":",
"'Alaska'",
",",
"'AZ'",
":",
"'Arizona'",
",",
"'AR'",
":",
"'Arkansas'",
",",
"'CA'",
":",
"... | [
8,
0
] | [
53,
24
] | python | en | ['en', 'error', 'th'] | False |
fit2dMultiGaussian | (X, dpgmm_max_K = 2) | Main function to fit BGMM model, called from :func:`~PopPUNK.models.BGMMFit.fit`
Fits the mixture model specified, saves model parameters to a file, and assigns the samples to
a component. Write fit summary stats to STDERR.
Args:
X (np.array)
n x 2 array of core and accessory distances... | Main function to fit BGMM model, called from :func:`~PopPUNK.models.BGMMFit.fit` | def fit2dMultiGaussian(X, dpgmm_max_K = 2):
"""Main function to fit BGMM model, called from :func:`~PopPUNK.models.BGMMFit.fit`
Fits the mixture model specified, saves model parameters to a file, and assigns the samples to
a component. Write fit summary stats to STDERR.
Args:
X (np.array)
... | [
"def",
"fit2dMultiGaussian",
"(",
"X",
",",
"dpgmm_max_K",
"=",
"2",
")",
":",
"# fit bgmm model",
"dpgmm",
"=",
"mixture",
".",
"BayesianGaussianMixture",
"(",
"n_components",
"=",
"dpgmm_max_K",
",",
"n_init",
"=",
"5",
",",
"covariance_type",
"=",
"'full'",
... | [
19,
0
] | [
44,
16
] | python | en | ['en', 'en', 'en'] | True |
findWithinLabel | (means, assignments, rank = 0) | Identify within-strain links
Finds the component with mean closest to the origin and also akes sure
some samples are assigned to it (in the case of small weighted
components with a Dirichlet prior some components are unused)
Args:
means (numpy.array)
K x 2 array of mixture componen... | Identify within-strain links | def findWithinLabel(means, assignments, rank = 0):
"""Identify within-strain links
Finds the component with mean closest to the origin and also akes sure
some samples are assigned to it (in the case of small weighted
components with a Dirichlet prior some components are unused)
Args:
means... | [
"def",
"findWithinLabel",
"(",
"means",
",",
"assignments",
",",
"rank",
"=",
"0",
")",
":",
"min_dists",
"=",
"{",
"}",
"for",
"mixture_component",
",",
"distance",
"in",
"enumerate",
"(",
"np",
".",
"apply_along_axis",
"(",
"np",
".",
"linalg",
".",
"n... | [
47,
0
] | [
74,
33
] | python | en | ['en', 'pl', 'en'] | True |
log_likelihood | (X, weights, means, covars, scale) | modified sklearn GMM function predicting distribution membership
Returns the mixture LL for points X. Used by :func:`~assign_samples` and
:func:`~PopPUNK.plot.plot_contours`
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n samples
weights (numpy.array)
... | modified sklearn GMM function predicting distribution membership | def log_likelihood(X, weights, means, covars, scale):
"""modified sklearn GMM function predicting distribution membership
Returns the mixture LL for points X. Used by :func:`~assign_samples` and
:func:`~PopPUNK.plot.plot_contours`
Args:
X (numpy.array)
n x 2 array of core and acces... | [
"def",
"log_likelihood",
"(",
"X",
",",
"weights",
",",
"means",
",",
"covars",
",",
"scale",
")",
":",
"lpr",
"=",
"(",
"log_multivariate_normal_density",
"(",
"X",
"/",
"scale",
",",
"means",
",",
"covars",
")",
"+",
"np",
".",
"log",
"(",
"weights",... | [
77,
0
] | [
105,
24
] | python | en | ['ms', 'en', 'en'] | True |
log_multivariate_normal_density | (X, means, covars, min_covar=1.e-7) | Log likelihood of multivariate normal density distribution
Used to calculate per component Gaussian likelihood in
:func:`~assign_samples`
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n samples
means (numpy.array)
Component means from :func:`... | Log likelihood of multivariate normal density distribution | def log_multivariate_normal_density(X, means, covars, min_covar=1.e-7):
"""Log likelihood of multivariate normal density distribution
Used to calculate per component Gaussian likelihood in
:func:`~assign_samples`
Args:
X (numpy.array)
n x 2 array of core and accessory distances for... | [
"def",
"log_multivariate_normal_density",
"(",
"X",
",",
"means",
",",
"covars",
",",
"min_covar",
"=",
"1.e-7",
")",
":",
"n_samples",
",",
"n_dim",
"=",
"X",
".",
"shape",
"nmix",
"=",
"len",
"(",
"means",
")",
"log_prob",
"=",
"np",
".",
"empty",
"(... | [
108,
0
] | [
151,
19
] | python | en | ['en', 'af', 'en'] | True |
build_configmap_generators | (kustomize_dir) | Return a dictionary mapping configMapGenerator name to files.
The dictionary will be used to copy over the files to the test directory
and generate an updated configMapGenerator in the kustomization.yaml
Returns:
dict: config map name to list of files used for the configmap generator
| Return a dictionary mapping configMapGenerator name to files. | def build_configmap_generators(kustomize_dir):
"""Return a dictionary mapping configMapGenerator name to files.
The dictionary will be used to copy over the files to the test directory
and generate an updated configMapGenerator in the kustomization.yaml
Returns:
dict: config map name to list of files used ... | [
"def",
"build_configmap_generators",
"(",
"kustomize_dir",
")",
":",
"kustomize_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"kustomize_dir",
",",
"\"kustomization.yaml\"",
")",
"with",
"open",
"(",
"kustomize_file",
")",
"as",
"hf",
":",
"kustomize",
"=",
... | [
48,
0
] | [
71,
19
] | python | en | ['en', 'en', 'en'] | True |
GenerateLegacyTests.generate | (kfdef, test_path) | Generate the kustomization.yaml files.
Args:
kfdef: Path to the kfdef file.
test_path: The path where the tests should be written.
| Generate the kustomization.yaml files. | def generate(kfdef, test_path):
"""Generate the kustomization.yaml files.
Args:
kfdef: Path to the kfdef file.
test_path: The path where the tests should be written.
"""
this_dir = os.path.dirname(__file__)
repo_root = os.path.abspath(os.path.join(this_dir, ".."))
test_path = os.pa... | [
"def",
"generate",
"(",
"kfdef",
",",
"test_path",
")",
":",
"this_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
"repo_root",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"this_dir",
",",
"... | [
75,
2
] | [
173,
36
] | python | en | ['en', 'ny', 'en'] | True |
reference_times | (self, node="clickhouse1") | Check how ClickHouse converts a set of particular timestamps
to DateTime64 for all timezones and compare the result to pytz.
| Check how ClickHouse converts a set of particular timestamps
to DateTime64 for all timezones and compare the result to pytz.
| def reference_times(self, node="clickhouse1"):
"""Check how ClickHouse converts a set of particular timestamps
to DateTime64 for all timezones and compare the result to pytz.
"""
self.context.node = self.context.cluster.node(node)
timestamps = [9961200, 73476000, 325666800, 354675600, 370400400, 38... | [
"def",
"reference_times",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"timestamps",
"=",
"[",
"9961200",
",",
"73476000",
"... | [
14,
0
] | [
37,
42
] | python | en | ['en', 'en', 'en'] | True |
TestCreateBase.test_create_partition | (self, connect, collection) |
target: test create partition, check status returned
method: call function: create_partition
expected: status ok
|
target: test create partition, check status returned
method: call function: create_partition
expected: status ok
| def test_create_partition(self, connect, collection):
'''
target: test create partition, check status returned
method: call function: create_partition
expected: status ok
'''
status = connect.create_partition(collection, tag)
assert status.OK() | [
"def",
"test_create_partition",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")"
] | [
26,
4
] | [
33,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_limit | (self, connect, collection, args) |
target: test create partitions, check status returned
method: call function: create_partition for 4097 times
expected: status not ok
|
target: test create partitions, check status returned
method: call function: create_partition for 4097 times
expected: status not ok
| def test_create_partition_limit(self, connect, collection, args):
'''
target: test create partitions, check status returned
method: call function: create_partition for 4097 times
expected: status not ok
'''
if args["handler"] == "HTTP":
pytest.skip("skip in ht... | [
"def",
"test_create_partition_limit",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"args",
")",
":",
"if",
"args",
"[",
"\"handler\"",
"]",
"==",
"\"HTTP\"",
":",
"pytest",
".",
"skip",
"(",
"\"skip in http mode\"",
")",
"for",
"i",
"in",
"range",
... | [
36,
4
] | [
50,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_repeat | (self, connect, collection) |
target: test create partition, check status returned
method: call function: create_partition
expected: status ok
|
target: test create partition, check status returned
method: call function: create_partition
expected: status ok
| def test_create_partition_repeat(self, connect, collection):
'''
target: test create partition, check status returned
method: call function: create_partition
expected: status ok
'''
status = connect.create_partition(collection, tag)
assert status.OK()
stat... | [
"def",
"test_create_partition_repeat",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"status",
"=",
"connect",
".",
... | [
52,
4
] | [
61,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_collection_not_existed | (self, connect) |
target: test create partition, its owner collection name not existed in db, check status returned
method: call function: create_partition
expected: status not ok
|
target: test create partition, its owner collection name not existed in db, check status returned
method: call function: create_partition
expected: status not ok
| def test_create_partition_collection_not_existed(self, connect):
'''
target: test create partition, its owner collection name not existed in db, check status returned
method: call function: create_partition
expected: status not ok
'''
collection_name = gen_unique_str()
... | [
"def",
"test_create_partition_collection_not_existed",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection_name",
",",
"tag",
")",
"assert",
"not",
"status",
... | [
63,
4
] | [
71,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_tag_name_None | (self, connect, collection) |
target: test create partition, tag name set None, check status returned
method: call function: create_partition
expected: status ok
|
target: test create partition, tag name set None, check status returned
method: call function: create_partition
expected: status ok
| def test_create_partition_tag_name_None(self, connect, collection):
'''
target: test create partition, tag name set None, check status returned
method: call function: create_partition
expected: status ok
'''
tag_name = None
with pytest.raises(Exception) as e:
... | [
"def",
"test_create_partition_tag_name_None",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"tag_name",
"=",
"None",
"with",
"pytest",
".",
"raises",
"(",
"Exception",
")",
"as",
"e",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"... | [
73,
4
] | [
81,
67
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_different_partition_tags | (self, connect, collection) |
target: test create partition twice with different names
method: call function: create_partition, and again
expected: status ok
|
target: test create partition twice with different names
method: call function: create_partition, and again
expected: status ok
| def test_create_different_partition_tags(self, connect, collection):
'''
target: test create partition twice with different names
method: call function: create_partition, and again
expected: status ok
'''
status = connect.create_partition(collection, tag)
assert s... | [
"def",
"test_create_different_partition_tags",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"tag_name",
"=",
"gen_uniqu... | [
83,
4
] | [
101,
37
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_insert_default | (self, connect, collection) |
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
|
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
| def test_create_partition_insert_default(self, connect, collection):
'''
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
'''
status = connect.create_partition(collection, tag)
ass... | [
"def",
"test_create_partition_insert_default",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"nq",
"=",
"100",
"vector... | [
103,
4
] | [
115,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_insert_with_tag | (self, connect, collection) |
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
|
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
| def test_create_partition_insert_with_tag(self, connect, collection):
'''
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
'''
status = connect.create_partition(collection, tag)
as... | [
"def",
"test_create_partition_insert_with_tag",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"nq",
"=",
"100",
"vecto... | [
117,
4
] | [
129,
26
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_insert_with_tag_not_existed | (self, connect, collection) |
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status not ok
|
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status not ok
| def test_create_partition_insert_with_tag_not_existed(self, connect, collection):
'''
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status not ok
'''
tag_new = "tag_new"
status = connect.... | [
"def",
"test_create_partition_insert_with_tag_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"tag_new",
"=",
"\"tag_new\"",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK... | [
131,
4
] | [
144,
30
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_insert_same_tags | (self, connect, collection) |
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
|
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
| def test_create_partition_insert_same_tags(self, connect, collection):
'''
target: test create partition, and insert vectors, check status returned
method: call function: create_partition
expected: status ok
'''
status = connect.create_partition(collection, tag)
a... | [
"def",
"test_create_partition_insert_same_tags",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"nq",
"=",
"100",
"vect... | [
146,
4
] | [
164,
28
] | python | en | ['en', 'error', 'th'] | False |
TestCreateBase.test_create_partition_insert_same_tags_two_collections | (self, connect, collection) |
target: test create two partitions, and insert vectors with the same tag to each collection, check status returned
method: call function: create_partition
expected: status ok, collection length is correct
|
target: test create two partitions, and insert vectors with the same tag to each collection, check status returned
method: call function: create_partition
expected: status ok, collection length is correct
| def test_create_partition_insert_same_tags_two_collections(self, connect, collection):
'''
target: test create two partitions, and insert vectors with the same tag to each collection, check status returned
method: call function: create_partition
expected: status ok, collection length is ... | [
"def",
"test_create_partition_insert_same_tags_two_collections",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"collection_n... | [
166,
4
] | [
192,
24
] | python | en | ['en', 'error', 'th'] | False |
TestShowBase.test_list_partitions | (self, connect, collection) |
target: test show partitions, check status and partitions returned
method: create partition first, then call function: list_partitions
expected: status ok, partition correct
|
target: test show partitions, check status and partitions returned
method: create partition first, then call function: list_partitions
expected: status ok, partition correct
| def test_list_partitions(self, connect, collection):
'''
target: test show partitions, check status and partitions returned
method: create partition first, then call function: list_partitions
expected: status ok, partition correct
'''
status = connect.create_partition(col... | [
"def",
"test_list_partitions",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
",",
"res",
"=",
"connect",
".",
"list_partitions",
"(",
"collection",
"... | [
202,
4
] | [
210,
26
] | python | en | ['en', 'error', 'th'] | False |
TestShowBase.test_list_partitions_no_partition | (self, connect, collection) |
target: test show partitions with collection name, check status and partitions returned
method: call function: list_partitions
expected: status ok, partitions correct
|
target: test show partitions with collection name, check status and partitions returned
method: call function: list_partitions
expected: status ok, partitions correct
| def test_list_partitions_no_partition(self, connect, collection):
'''
target: test show partitions with collection name, check status and partitions returned
method: call function: list_partitions
expected: status ok, partitions correct
'''
status, res = connect.list_part... | [
"def",
"test_list_partitions_no_partition",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
",",
"res",
"=",
"connect",
".",
"list_partitions",
"(",
"collection",
")",
"assert",
"status",
".",
"OK",
"(",
")"
] | [
212,
4
] | [
219,
26
] | python | en | ['en', 'error', 'th'] | False |
TestShowBase.test_show_multi_partitions | (self, connect, collection) |
target: test show partitions, check status and partitions returned
method: create partitions first, then call function: list_partitions
expected: status ok, partitions correct
|
target: test show partitions, check status and partitions returned
method: create partitions first, then call function: list_partitions
expected: status ok, partitions correct
| def test_show_multi_partitions(self, connect, collection):
'''
target: test show partitions, check status and partitions returned
method: create partitions first, then call function: list_partitions
expected: status ok, partitions correct
'''
tag_new = gen_unique_str()
... | [
"def",
"test_show_multi_partitions",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"tag_new",
"=",
"gen_unique_str",
"(",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
"=",
"connect",
".",
"... | [
221,
4
] | [
231,
26
] | python | en | ['en', 'error', 'th'] | False |
TestHasBase.test_has_partition | (self, connect, collection) |
target: test has_partition, check status and result
method: create partition first, then call function: has_partition
expected: status ok, result true
|
target: test has_partition, check status and result
method: create partition first, then call function: has_partition
expected: status ok, result true
| def test_has_partition(self, connect, collection):
'''
target: test has_partition, check status and result
method: create partition first, then call function: has_partition
expected: status ok, result true
'''
status = connect.create_partition(collection, tag)
sta... | [
"def",
"test_has_partition",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
",",
"res",
"=",
"connect",
".",
"has_partition",
"(",
"collection",
",",
... | [
248,
4
] | [
258,
18
] | python | en | ['en', 'error', 'th'] | False |
TestHasBase.test_has_partition_multi_partitions | (self, connect, collection) |
target: test has_partition, check status and result
method: create partition first, then call function: has_partition
expected: status ok, result true
|
target: test has_partition, check status and result
method: create partition first, then call function: has_partition
expected: status ok, result true
| def test_has_partition_multi_partitions(self, connect, collection):
'''
target: test has_partition, check status and result
method: create partition first, then call function: has_partition
expected: status ok, result true
'''
for tag_name in [tag, "tag_new", "tag_new_new... | [
"def",
"test_has_partition_multi_partitions",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"for",
"tag_name",
"in",
"[",
"tag",
",",
"\"tag_new\"",
",",
"\"tag_new_new\"",
"]",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection... | [
260,
4
] | [
271,
22
] | python | en | ['en', 'error', 'th'] | False |
TestHasBase.test_has_partition_tag_not_existed | (self, connect, collection) |
target: test has_partition, check status and result
method: then call function: has_partition, with tag not existed
expected: status ok, result empty
|
target: test has_partition, check status and result
method: then call function: has_partition, with tag not existed
expected: status ok, result empty
| def test_has_partition_tag_not_existed(self, connect, collection):
'''
target: test has_partition, check status and result
method: then call function: has_partition, with tag not existed
expected: status ok, result empty
'''
status, res = connect.has_partition(collection,... | [
"def",
"test_has_partition_tag_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
",",
"res",
"=",
"connect",
".",
"has_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status",
".",
"OK",
"(",
")",
"logging",
".",
... | [
273,
4
] | [
282,
22
] | python | en | ['en', 'error', 'th'] | False |
TestHasBase.test_has_partition_collection_not_existed | (self, connect, collection) |
target: test has_partition, check status and result
method: then call function: has_partition, with collection not existed
expected: status not ok
|
target: test has_partition, check status and result
method: then call function: has_partition, with collection not existed
expected: status not ok
| def test_has_partition_collection_not_existed(self, connect, collection):
'''
target: test has_partition, check status and result
method: then call function: has_partition, with collection not existed
expected: status not ok
'''
status, res = connect.has_partition("not_ex... | [
"def",
"test_has_partition_collection_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
",",
"res",
"=",
"connect",
".",
"has_partition",
"(",
"\"not_existed_collection\"",
",",
"tag",
")",
"assert",
"not",
"status",
".",
"OK",
"(... | [
284,
4
] | [
291,
30
] | python | en | ['en', 'error', 'th'] | False |
TestHasBase.test_has_partition_with_invalid_tag_name | (self, connect, collection, get_tag_name) |
target: test has partition, with invalid tag name, check status returned
method: call function: has_partition
expected: status ok
|
target: test has partition, with invalid tag name, check status returned
method: call function: has_partition
expected: status ok
| def test_has_partition_with_invalid_tag_name(self, connect, collection, get_tag_name):
'''
target: test has partition, with invalid tag name, check status returned
method: call function: has_partition
expected: status ok
'''
tag_name = get_tag_name
status = connec... | [
"def",
"test_has_partition_with_invalid_tag_name",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_tag_name",
")",
":",
"tag_name",
"=",
"get_tag_name",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
",",... | [
294,
4
] | [
303,
26
] | python | en | ['en', 'error', 'th'] | False |
TestDropBase.test_drop_partition | (self, connect, collection) |
target: test drop partition, check status and partition if existed
method: create partitions first, then call function: drop_partition
expected: status ok, no partitions in db
|
target: test drop partition, check status and partition if existed
method: create partitions first, then call function: drop_partition
expected: status ok, no partitions in db
| def test_drop_partition(self, connect, collection):
'''
target: test drop partition, check status and partition if existed
method: create partitions first, then call function: drop_partition
expected: status ok, no partitions in db
'''
status = connect.create_partition(co... | [
"def",
"test_drop_partition",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
"=",
"connect",
".",
"drop_partition",
"(",
"collection",
",",
"tag",
")"... | [
313,
4
] | [
326,
34
] | python | en | ['en', 'error', 'th'] | False |
TestDropBase.test_drop_partition_tag_not_existed | (self, connect, collection) |
target: test drop partition, but tag not existed
method: create partitions first, then call function: drop_partition
expected: status not ok
|
target: test drop partition, but tag not existed
method: create partitions first, then call function: drop_partition
expected: status not ok
| def test_drop_partition_tag_not_existed(self, connect, collection):
'''
target: test drop partition, but tag not existed
method: create partitions first, then call function: drop_partition
expected: status not ok
'''
status = connect.create_partition(collection, tag)
... | [
"def",
"test_drop_partition_tag_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"new_tag",
"=",
"\"new_tag\"",
"status",
"=",
"connect",
".",
"drop_par... | [
328,
4
] | [
337,
30
] | python | en | ['en', 'error', 'th'] | False |
TestDropBase.test_drop_partition_tag_not_existed_A | (self, connect, collection) |
target: test drop partition, but collection not existed
method: create partitions first, then call function: drop_partition
expected: status not ok
|
target: test drop partition, but collection not existed
method: create partitions first, then call function: drop_partition
expected: status not ok
| def test_drop_partition_tag_not_existed_A(self, connect, collection):
'''
target: test drop partition, but collection not existed
method: create partitions first, then call function: drop_partition
expected: status not ok
'''
status = connect.create_partition(collection, ... | [
"def",
"test_drop_partition_tag_not_existed_A",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"new_collection",
"=",
"gen_unique_str",
"(",
")",
"status",
"=",
"co... | [
339,
4
] | [
348,
30
] | python | en | ['en', 'error', 'th'] | False |
TestDropBase.test_drop_partition_repeatedly | (self, connect, collection) |
target: test drop partition twice, check status and partition if existed
method: create partitions first, then call function: drop_partition
expected: status not ok, no partitions in db
|
target: test drop partition twice, check status and partition if existed
method: create partitions first, then call function: drop_partition
expected: status not ok, no partitions in db
| def test_drop_partition_repeatedly(self, connect, collection):
'''
target: test drop partition twice, check status and partition if existed
method: create partitions first, then call function: drop_partition
expected: status not ok, no partitions in db
'''
status = connec... | [
"def",
"test_drop_partition_repeatedly",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
"=",
"connect",
".",
"drop_partition",
"(",
"collection",
",",
"... | [
351,
4
] | [
366,
34
] | python | en | ['en', 'error', 'th'] | False |
TestDropBase.test_drop_partition_create | (self, connect, collection) |
target: test drop partition, and create again, check status
method: create partitions first, then call function: drop_partition, create_partition
expected: status not ok, partition in db
|
target: test drop partition, and create again, check status
method: create partitions first, then call function: drop_partition, create_partition
expected: status not ok, partition in db
| def test_drop_partition_create(self, connect, collection):
'''
target: test drop partition, and create again, check status
method: create partitions first, then call function: drop_partition, create_partition
expected: status not ok, partition in db
'''
status = connect.c... | [
"def",
"test_drop_partition_create",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
"=",
"connect",
".",
"drop_partition",
"(",
"collection",
",",
"tag"... | [
368,
4
] | [
383,
30
] | python | en | ['en', 'error', 'th'] | False |
TestNameInvalid.test_drop_partition_with_invalid_collection_name | (self, connect, collection, get_collection_name) |
target: test drop partition, with invalid collection name, check status returned
method: call function: drop_partition
expected: status not ok
|
target: test drop partition, with invalid collection name, check status returned
method: call function: drop_partition
expected: status not ok
| def test_drop_partition_with_invalid_collection_name(self, connect, collection, get_collection_name):
'''
target: test drop partition, with invalid collection name, check status returned
method: call function: drop_partition
expected: status not ok
'''
collection_name = g... | [
"def",
"test_drop_partition_with_invalid_collection_name",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_collection_name",
")",
":",
"collection_name",
"=",
"get_collection_name",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"ta... | [
401,
4
] | [
410,
30
] | python | en | ['en', 'error', 'th'] | False |
TestNameInvalid.test_drop_partition_with_invalid_tag_name | (self, connect, collection, get_tag_name) |
target: test drop partition, with invalid tag name, check status returned
method: call function: drop_partition
expected: status not ok
|
target: test drop partition, with invalid tag name, check status returned
method: call function: drop_partition
expected: status not ok
| def test_drop_partition_with_invalid_tag_name(self, connect, collection, get_tag_name):
'''
target: test drop partition, with invalid tag name, check status returned
method: call function: drop_partition
expected: status not ok
'''
tag_name = get_tag_name
status =... | [
"def",
"test_drop_partition_with_invalid_tag_name",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_tag_name",
")",
":",
"tag_name",
"=",
"get_tag_name",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"status",
"="... | [
412,
4
] | [
421,
30
] | python | en | ['en', 'error', 'th'] | False |
TestNameInvalid.test_list_partitions_with_invalid_collection_name | (self, connect, collection, get_collection_name) |
target: test show partitions, with invalid collection name, check status returned
method: call function: list_partitions
expected: status not ok
|
target: test show partitions, with invalid collection name, check status returned
method: call function: list_partitions
expected: status not ok
| def test_list_partitions_with_invalid_collection_name(self, connect, collection, get_collection_name):
'''
target: test show partitions, with invalid collection name, check status returned
method: call function: list_partitions
expected: status not ok
'''
collection_name ... | [
"def",
"test_list_partitions_with_invalid_collection_name",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_collection_name",
")",
":",
"collection_name",
"=",
"get_collection_name",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"t... | [
423,
4
] | [
432,
30
] | python | en | ['en', 'error', 'th'] | False |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SYSTEM RESTART REPLICA` commands if and only if
the privilege has been granted directly.
| Check that a user is able to execute `SYSTEM RESTART REPLICA` commands if and only if
the privilege has been granted directly.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `SYSTEM RESTART REPLICA` 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, f"{user_name}... | [
"def",
"privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{user_... | [
8,
0
] | [
22,
80
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `SYSTEM RESTART REPLICA` commands if and only if
the privilege has been granted via role.
| Check that a user is able to execute `SYSTEM RESTART REPLICA` commands if and only if
the privilege has been granted via role.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `SYSTEM RESTART REPLICA` 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 = self.context.node... | [
"def",
"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",
"with"... | [
25,
0
] | [
43,
80
] | python | en | ['en', 'en', 'en'] | True |
restart_replica | (self, privilege, on, grant_target_name, user_name, node=None) | Check that user is only able to execute `SYSTEM RESTARTE REPLICA` when they have privilege.
| Check that user is only able to execute `SYSTEM RESTARTE REPLICA` when they have privilege.
| def restart_replica(self, privilege, on, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SYSTEM RESTARTE REPLICA` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table_name = f"table_name_{getuid()}"
if node is Non... | [
"def",
"restart_replica",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
... | [
52,
0
] | [
95,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SYSTEM RESTART REPLICA.
| Check the RBAC functionality of SYSTEM RESTART REPLICA.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SYSTEM RESTART REPLICA.
"""
self.context.node = self.context.cluster.node(node)
Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log)
Suite(run=privileges_granted_via_role, setup=instrument_clickhouse... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"privileges_granted_directly",
",",
... | [
104,
0
] | [
110,
82
] | python | en | ['en', 'en', 'en'] | True |
vis | (src, flags=VIS_WHITE) |
Encodes the string `src` into libbsd's vis encoding.
`flags` must be one of the VIS_* constants
C definition:
int strvis(char *dst, char *src, int flags);
|
Encodes the string `src` into libbsd's vis encoding.
`flags` must be one of the VIS_* constants | def vis(src, flags=VIS_WHITE):
"""
Encodes the string `src` into libbsd's vis encoding.
`flags` must be one of the VIS_* constants
C definition:
int strvis(char *dst, char *src, int flags);
"""
src = bytes(src, 'utf-8')
dst_p = c_char_p(bytes(len(src) * 4))
src_p = c_char_p(src)
... | [
"def",
"vis",
"(",
"src",
",",
"flags",
"=",
"VIS_WHITE",
")",
":",
"src",
"=",
"bytes",
"(",
"src",
",",
"'utf-8'",
")",
"dst_p",
"=",
"c_char_p",
"(",
"bytes",
"(",
"len",
"(",
"src",
")",
"*",
"4",
")",
")",
"src_p",
"=",
"c_char_p",
"(",
"s... | [
90,
0
] | [
107,
38
] | python | en | ['en', 'error', 'th'] | False |
unvis | (src) |
Decodes a string encoded by vis.
C definition:
int strunvis(char *dst, char *src);
|
Decodes a string encoded by vis. | def unvis(src):
"""
Decodes a string encoded by vis.
C definition:
int strunvis(char *dst, char *src);
"""
src = bytes(src, 'utf-8')
dst_p = c_char_p(bytes(len(src)))
src_p = c_char_p(src)
bytes_written = _strunvis(dst_p, src_p)
if -1 == bytes_written:
raise RuntimeErro... | [
"def",
"unvis",
"(",
"src",
")",
":",
"src",
"=",
"bytes",
"(",
"src",
",",
"'utf-8'",
")",
"dst_p",
"=",
"c_char_p",
"(",
"bytes",
"(",
"len",
"(",
"src",
")",
")",
")",
"src_p",
"=",
"c_char_p",
"(",
"src",
")",
"bytes_written",
"=",
"_strunvis",... | [
110,
0
] | [
125,
38
] | python | en | ['en', 'error', 'th'] | False |
regression | (self, local, clickhouse_binary_path, stress=None, parallel=None) | Simple example of how you can use TestFlows to test ClickHouse.
| Simple example of how you can use TestFlows to test ClickHouse.
| def regression(self, local, clickhouse_binary_path, stress=None, parallel=None):
"""Simple example of how you can use TestFlows to test ClickHouse.
"""
top().terminating = False
nodes = {
"clickhouse": ("clickhouse1",),
}
if stress is not None:
self.context.stress = stress
i... | [
"def",
"regression",
"(",
"self",
",",
"local",
",",
"clickhouse_binary_path",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"top",
"(",
")",
".",
"terminating",
"=",
"False",
"nodes",
"=",
"{",
"\"clickhouse\"",
":",
"(",
"\"clickh... | [
13,
0
] | [
30,
63
] | python | en | ['en', 'en', 'en'] | True |
permutations | (table_type) | Uses stress flag and table type, returns list of all permutations to run
Stress test (stress=True): all permutations for all tables
| Uses stress flag and table type, returns list of all permutations to run | def permutations(table_type):
"""Uses stress flag and table type, returns list of all permutations to run
Stress test (stress=True): all permutations for all tables
"""
if current().context.stress:
return [*range(permutation_count + len(aliases["ALTER COLUMN"]))]
else:
# Selected pe... | [
"def",
"permutations",
"(",
"table_type",
")",
":",
"if",
"current",
"(",
")",
".",
"context",
".",
"stress",
":",
"return",
"[",
"*",
"range",
"(",
"permutation_count",
"+",
"len",
"(",
"aliases",
"[",
"\"ALTER COLUMN\"",
"]",
")",
")",
"]",
"else",
"... | [
32,
0
] | [
48,
73
] | python | en | ['en', 'en', 'en'] | True |
alter_column_privileges | (grants: int) | Takes in an integer, and returns the corresponding set of tests to grant and
not grant using the binary string. Each integer corresponds to a unique permutation
of grants.
Columns represents columns to grant privileges on, with format "col1,col2,col3"
| Takes in an integer, and returns the corresponding set of tests to grant and
not grant using the binary string. Each integer corresponds to a unique permutation
of grants.
Columns represents columns to grant privileges on, with format "col1,col2,col3"
| def alter_column_privileges(grants: int):
"""Takes in an integer, and returns the corresponding set of tests to grant and
not grant using the binary string. Each integer corresponds to a unique permutation
of grants.
Columns represents columns to grant privileges on, with format "col1,col2,col3"
"""... | [
"def",
"alter_column_privileges",
"(",
"grants",
":",
"int",
")",
":",
"note",
"(",
"grants",
")",
"privileges",
"=",
"[",
"]",
"# extra iteration for ALTER COLUMN",
"if",
"grants",
">=",
"permutation_count",
":",
"privileges",
".",
"append",
"(",
"aliases",
"["... | [
50,
0
] | [
79,
32
] | python | en | ['en', 'en', 'en'] | True |
on_columns | (privileges, columns) | For column-based tests. Takes in string output of alter_column_privileges()
and adds columns for those privileges.
| For column-based tests. Takes in string output of alter_column_privileges()
and adds columns for those privileges.
| def on_columns(privileges, columns):
"""For column-based tests. Takes in string output of alter_column_privileges()
and adds columns for those privileges.
"""
privileges = privileges.split(',')
privileges = [privilege + f"({columns})" for privilege in privileges]
return ', '.join(privileges) | [
"def",
"on_columns",
"(",
"privileges",
",",
"columns",
")",
":",
"privileges",
"=",
"privileges",
".",
"split",
"(",
"','",
")",
"privileges",
"=",
"[",
"privilege",
"+",
"f\"({columns})\"",
"for",
"privilege",
"in",
"privileges",
"]",
"return",
"', '",
"."... | [
81,
0
] | [
87,
32
] | python | en | ['en', 'en', 'en'] | True |
alter_column_privilege_handler | (grants, table, user, node, columns=None) | For all 6 subprivileges, if the privilege is granted: run test to ensure correct behavior,
and if the privilege is not granted, run test to ensure correct behavior there as well
If `columns` are passed in, they must be columns that do not exist on the table.
This is necessary for full testing (add column, ... | For all 6 subprivileges, if the privilege is granted: run test to ensure correct behavior,
and if the privilege is not granted, run test to ensure correct behavior there as well | def alter_column_privilege_handler(grants, table, user, node, columns=None):
"""For all 6 subprivileges, if the privilege is granted: run test to ensure correct behavior,
and if the privilege is not granted, run test to ensure correct behavior there as well
If `columns` are passed in, they must be columns ... | [
"def",
"alter_column_privilege_handler",
"(",
"grants",
",",
"table",
",",
"user",
",",
"node",
",",
"columns",
"=",
"None",
")",
":",
"note",
"(",
"f\"GRANTS: {grants}\"",
")",
"# testing ALTER COLUMN is the same as testing all subprivileges",
"if",
"grants",
">",
"p... | [
89,
0
] | [
142,
90
] | python | en | ['en', 'en', 'en'] | True |
check_add_column_when_privilege_is_granted | (table, user, node, column=None) | Ensures ADD COLUMN runs as expected when the privilege is granted
to the specified user.
| Ensures ADD COLUMN runs as expected when the privilege is granted
to the specified user.
| def check_add_column_when_privilege_is_granted(table, user, node, column=None):
"""Ensures ADD COLUMN runs as expected when the privilege is granted
to the specified user.
"""
if column is None:
column = 'add'
with Given(f"I add column '{column}'"):
node.query(f"ALTER TABLE {table} ... | [
"def",
"check_add_column_when_privilege_is_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'add'",
"with",
"Given",
"(",
"f\"I add column '{column}'\"",
")",
":",
"node"... | [
144,
0
] | [
167,
63
] | python | en | ['en', 'en', 'en'] | True |
check_clear_column_when_privilege_is_granted | (table, user, node, column=None) | Ensures CLEAR COLUMN runs as expected when the privilege is granted
to the specified user.
| Ensures CLEAR COLUMN runs as expected when the privilege is granted
to the specified user.
| def check_clear_column_when_privilege_is_granted(table, user, node, column=None):
"""Ensures CLEAR COLUMN runs as expected when the privilege is granted
to the specified user.
"""
if column is None:
column = 'clear'
with Given(f"I add the column {column}"):
node.query(f"ALTER TABLE ... | [
"def",
"check_clear_column_when_privilege_is_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'clear'",
"with",
"Given",
"(",
"f\"I add the column {column}\"",
")",
":",
... | [
169,
0
] | [
194,
63
] | python | en | ['en', 'en', 'en'] | True |
check_modify_column_when_privilege_is_granted | (table, user, node, column=None) | Ensures MODIFY COLUMN runs as expected when the privilege is granted
to the specified user.
| Ensures MODIFY COLUMN runs as expected when the privilege is granted
to the specified user.
| def check_modify_column_when_privilege_is_granted(table, user, node, column=None):
"""Ensures MODIFY COLUMN runs as expected when the privilege is granted
to the specified user.
"""
if column is None:
column = 'modify'
with Given(f"I add the column {column}"):
node.query(f"ALTER TAB... | [
"def",
"check_modify_column_when_privilege_is_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'modify'",
"with",
"Given",
"(",
"f\"I add the column {column}\"",
")",
":",
... | [
196,
0
] | [
234,
63
] | python | en | ['en', 'en', 'en'] | True |
check_rename_column_when_privilege_is_granted | (table, user, node, column=None) | Ensures RENAME COLUMN runs as expected when the privilege is granted
to the specified user.
| Ensures RENAME COLUMN runs as expected when the privilege is granted
to the specified user.
| def check_rename_column_when_privilege_is_granted(table, user, node, column=None):
"""Ensures RENAME COLUMN runs as expected when the privilege is granted
to the specified user.
"""
if column is None:
column = 'rename'
new_column = f"{column}_new"
with Given(f"I add the column {column}... | [
"def",
"check_rename_column_when_privilege_is_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'rename'",
"new_column",
"=",
"f\"{column}_new\"",
"with",
"Given",
"(",
"f... | [
236,
0
] | [
280,
63
] | python | en | ['en', 'en', 'en'] | True |
check_comment_column_when_privilege_is_granted | (table, user, node, column='x') | Ensures COMMENT COLUMN runs as expected when the privilege is granted
to the specified user.
| Ensures COMMENT COLUMN runs as expected when the privilege is granted
to the specified user.
| def check_comment_column_when_privilege_is_granted(table, user, node, column='x'):
"""Ensures COMMENT COLUMN runs as expected when the privilege is granted
to the specified user.
"""
if column is None:
column = 'comment'
with Given(f"I add the column {column}"):
node.query(f"ALTER T... | [
"def",
"check_comment_column_when_privilege_is_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"'x'",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'comment'",
"with",
"Given",
"(",
"f\"I add the column {column}\"",
")",
":",... | [
282,
0
] | [
313,
15
] | python | en | ['en', 'en', 'en'] | True |
check_drop_column_when_privilege_is_granted | (table, user, node, column=None) | Ensures DROP COLUMN runs as expected when the privilege is granted
to the specified user.
| Ensures DROP COLUMN runs as expected when the privilege is granted
to the specified user.
| def check_drop_column_when_privilege_is_granted(table, user, node, column=None):
"""Ensures DROP COLUMN runs as expected when the privilege is granted
to the specified user.
"""
with When("I try to drop nonexistent column, throws exception"):
# if user has privilege for all columns, error is 'wr... | [
"def",
"check_drop_column_when_privilege_is_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"with",
"When",
"(",
"\"I try to drop nonexistent column, throws exception\"",
")",
":",
"# if user has privilege for all columns, error is 'wro... | [
315,
0
] | [
342,
76
] | python | en | ['en', 'en', 'en'] | True |
check_add_column_when_privilege_is_not_granted | (table, user, node, column=None) | Ensures ADD COLUMN errors as expected without the required privilege
for the specified user.
| Ensures ADD COLUMN errors as expected without the required privilege
for the specified user.
| def check_add_column_when_privilege_is_not_granted(table, user, node, column=None):
"""Ensures ADD COLUMN errors as expected without the required privilege
for the specified user.
"""
if column is None:
column = 'add'
with When("I try to use privilege that has not been granted"):
ex... | [
"def",
"check_add_column_when_privilege_is_not_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'add'",
"with",
"When",
"(",
"\"I try to use privilege that has not been granted... | [
344,
0
] | [
358,
76
] | python | en | ['en', 'en', 'en'] | True |
check_clear_column_when_privilege_is_not_granted | (table, user, node, column=None) | Ensures CLEAR COLUMN errors as expected without the required privilege
for the specified user.
| Ensures CLEAR COLUMN errors as expected without the required privilege
for the specified user.
| def check_clear_column_when_privilege_is_not_granted(table, user, node, column=None):
"""Ensures CLEAR COLUMN errors as expected without the required privilege
for the specified user.
"""
if column is None:
column = 'clear'
with When("I try to use privilege that has not been granted"):
... | [
"def",
"check_clear_column_when_privilege_is_not_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'clear'",
"with",
"When",
"(",
"\"I try to use privilege that has not been gra... | [
360,
0
] | [
377,
76
] | python | en | ['en', 'en', 'en'] | True |
check_modify_column_when_privilege_is_not_granted | (table, user, node, column=None) | Ensures MODIFY COLUMN errors as expected without the required privilege
for the specified user.
| Ensures MODIFY COLUMN errors as expected without the required privilege
for the specified user.
| def check_modify_column_when_privilege_is_not_granted(table, user, node, column=None):
"""Ensures MODIFY COLUMN errors as expected without the required privilege
for the specified user.
"""
if column is None:
column = 'modify'
with When("I try to use privilege that has not been granted"):
... | [
"def",
"check_modify_column_when_privilege_is_not_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'modify'",
"with",
"When",
"(",
"\"I try to use privilege that has not been g... | [
379,
0
] | [
396,
76
] | python | en | ['en', 'en', 'en'] | True |
check_rename_column_when_privilege_is_not_granted | (table, user, node, column=None) | Ensures RENAME COLUMN errors as expected without the required privilege
for the specified user.
| Ensures RENAME COLUMN errors as expected without the required privilege
for the specified user.
| def check_rename_column_when_privilege_is_not_granted(table, user, node, column=None):
"""Ensures RENAME COLUMN errors as expected without the required privilege
for the specified user.
"""
if column is None:
column = 'rename'
new_column = f"{column}_new"
with When("I try to use privil... | [
"def",
"check_rename_column_when_privilege_is_not_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'rename'",
"new_column",
"=",
"f\"{column}_new\"",
"with",
"When",
"(",
... | [
398,
0
] | [
417,
76
] | python | en | ['en', 'en', 'en'] | True |
check_comment_column_when_privilege_is_not_granted | (table, user, node, column=None) | Ensures COMMENT COLUMN errors as expected without the required privilege
for the specified user.
| Ensures COMMENT COLUMN errors as expected without the required privilege
for the specified user.
| def check_comment_column_when_privilege_is_not_granted(table, user, node, column=None):
"""Ensures COMMENT COLUMN errors as expected without the required privilege
for the specified user.
"""
if column is None:
column = 'comment'
with When("I try to use privilege that has not been granted")... | [
"def",
"check_comment_column_when_privilege_is_not_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'comment'",
"with",
"When",
"(",
"\"I try to use privilege that has not been... | [
419,
0
] | [
436,
76
] | python | en | ['en', 'en', 'en'] | True |
check_drop_column_when_privilege_is_not_granted | (table, user, node, column=None) | Ensures DROP COLUMN errors as expected without the required privilege
for the specified user.
| Ensures DROP COLUMN errors as expected without the required privilege
for the specified user.
| def check_drop_column_when_privilege_is_not_granted(table, user, node, column=None):
"""Ensures DROP COLUMN errors as expected without the required privilege
for the specified user.
"""
if column is None:
column = 'drop'
with When("I try to use privilege that has not been granted"):
... | [
"def",
"check_drop_column_when_privilege_is_not_granted",
"(",
"table",
",",
"user",
",",
"node",
",",
"column",
"=",
"None",
")",
":",
"if",
"column",
"is",
"None",
":",
"column",
"=",
"'drop'",
"with",
"When",
"(",
"\"I try to use privilege that has not been grant... | [
438,
0
] | [
455,
76
] | python | en | ['en', 'en', 'en'] | True |
user_with_some_privileges | (self, permutation, table_type, node=None) | Check that user with some privileges of ALTER COLUMN is able
to alter the table for privileges granted, and not for privileges not granted.
| Check that user with some privileges of ALTER COLUMN is able
to alter the table for privileges granted, and not for privileges not granted.
| def user_with_some_privileges(self, permutation, table_type, node=None):
"""Check that user with some privileges of ALTER COLUMN is able
to alter the table for privileges granted, and not for privileges not granted.
"""
privileges = alter_column_privileges(permutation)
if node is None:
node ... | [
"def",
"user_with_some_privileges",
"(",
"self",
",",
"permutation",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"con... | [
458,
0
] | [
475,
88
] | python | en | ['en', 'en', 'en'] | True |
user_with_revoked_privileges | (self, permutation, table_type, node=None) | Check that user is unable to alter columns on table after ALTER COLUMN privilege
on that table has been revoked from the user.
| Check that user is unable to alter columns on table after ALTER COLUMN privilege
on that table has been revoked from the user.
| def user_with_revoked_privileges(self, permutation, table_type, node=None):
"""Check that user is unable to alter columns on table after ALTER COLUMN privilege
on that table has been revoked from the user.
"""
privileges = alter_column_privileges(permutation)
if node is None:
node = self.con... | [
"def",
"user_with_revoked_privileges",
"(",
"self",
",",
"permutation",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"... | [
481,
0
] | [
502,
78
] | python | en | ['en', 'en', 'en'] | True |
user_with_privileges_on_columns | (self, table_type, permutation, node=None) | Passes in examples to user_column_privileges() below to test granting
of sub-privileges on columns
| Passes in examples to user_column_privileges() below to test granting
of sub-privileges on columns
| def user_with_privileges_on_columns(self, table_type, permutation, node=None):
"""Passes in examples to user_column_privileges() below to test granting
of sub-privileges on columns
"""
examples=Examples("grant_columns revoke_columns alter_columns_fail table_type permutation",
[tuple(list(row)+[t... | [
"def",
"user_with_privileges_on_columns",
"(",
"self",
",",
"table_type",
",",
"permutation",
",",
"node",
"=",
"None",
")",
":",
"examples",
"=",
"Examples",
"(",
"\"grant_columns revoke_columns alter_columns_fail table_type permutation\"",
",",
"[",
"tuple",
"(",
"lis... | [
510,
0
] | [
517,
62
] | python | en | ['en', 'en', 'en'] | True |
user_column_privileges | (self, grant_columns, revoke_columns, alter_columns_fail, table_type,
permutation, node=None) | Check that user is able to alter on granted columns
and unable to alter on not granted or revoked columns.
| Check that user is able to alter on granted columns
and unable to alter on not granted or revoked columns.
| def user_column_privileges(self, grant_columns, revoke_columns, alter_columns_fail, table_type,
permutation, node=None):
"""Check that user is able to alter on granted columns
and unable to alter on not granted or revoked columns.
"""
privileges = alter_column_privileges(permutation)
if node... | [
"def",
"user_column_privileges",
"(",
"self",
",",
"grant_columns",
",",
"revoke_columns",
",",
"alter_columns_fail",
",",
"table_type",
",",
"permutation",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
... | [
523,
0
] | [
555,
110
] | python | en | ['en', 'en', 'en'] | True |
role_with_some_privileges | (self, permutation, table_type, node=None) | Check that user can alter column on a table after it is granted a role that
has the alter column privilege for that table.
| Check that user can alter column on a table after it is granted a role that
has the alter column privilege for that table.
| def role_with_some_privileges(self, permutation, table_type, node=None):
"""Check that user can alter column on a table after it is granted a role that
has the alter column privilege for that table.
"""
privileges = alter_column_privileges(permutation)
if node is None:
node = self.context.no... | [
"def",
"role_with_some_privileges",
"(",
"self",
",",
"permutation",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"con... | [
561,
0
] | [
582,
88
] | python | en | ['en', 'en', 'en'] | True |
user_with_revoked_role | (self, permutation, table_type, node=None) | Check that user with a role that has alter column privilege on a table is unable to
alter column from that table after the role with privilege has been revoked from the user.
| Check that user with a role that has alter column privilege on a table is unable to
alter column from that table after the role with privilege has been revoked from the user.
| def user_with_revoked_role(self, permutation, table_type, node=None):
"""Check that user with a role that has alter column privilege on a table is unable to
alter column from that table after the role with privilege has been revoked from the user.
"""
privileges = alter_column_privileges(permutation)
... | [
"def",
"user_with_revoked_role",
"(",
"self",
",",
"permutation",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"contex... | [
585,
0
] | [
610,
78
] | python | en | ['en', 'en', 'en'] | True |
role_with_privileges_on_columns | (self, table_type, permutation, node=None) | Passes in examples to role_column_privileges() below to test granting
of subprivileges on columns
| Passes in examples to role_column_privileges() below to test granting
of subprivileges on columns
| def role_with_privileges_on_columns(self, table_type, permutation, node=None):
"""Passes in examples to role_column_privileges() below to test granting
of subprivileges on columns
"""
examples=Examples("grant_columns revoke_columns alter_columns_fail table_type permutation",
[tuple(list(row)+[ta... | [
"def",
"role_with_privileges_on_columns",
"(",
"self",
",",
"table_type",
",",
"permutation",
",",
"node",
"=",
"None",
")",
":",
"examples",
"=",
"Examples",
"(",
"\"grant_columns revoke_columns alter_columns_fail table_type permutation\"",
",",
"[",
"tuple",
"(",
"lis... | [
618,
0
] | [
625,
62
] | python | en | ['en', 'en', 'en'] | True |
role_column_privileges | (self, grant_columns, revoke_columns, alter_columns_fail, table_type,
permutation, node=None) | Check that user is able to alter column from granted columns and unable
to alter column from not granted or revoked columns.
| Check that user is able to alter column from granted columns and unable
to alter column from not granted or revoked columns.
| def role_column_privileges(self, grant_columns, revoke_columns, alter_columns_fail, table_type,
permutation, node=None):
"""Check that user is able to alter column from granted columns and unable
to alter column from not granted or revoked columns.
"""
privileges = alter_column_privileges(permutatio... | [
"def",
"role_column_privileges",
"(",
"self",
",",
"grant_columns",
",",
"revoke_columns",
",",
"alter_columns_fail",
",",
"table_type",
",",
"permutation",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
... | [
631,
0
] | [
667,
106
] | python | en | ['en', 'en', 'en'] | True |
user_with_privileges_on_cluster | (self, permutation, table_type, node=None) | Check that user is able to alter column on a table with
privilege granted on a cluster.
| Check that user is able to alter column on a table with
privilege granted on a cluster.
| def user_with_privileges_on_cluster(self, permutation, table_type, node=None):
"""Check that user is able to alter column on a table with
privilege granted on a cluster.
"""
privileges = alter_column_privileges(permutation)
if node is None:
node = self.context.node
table_name = f"merge_... | [
"def",
"user_with_privileges_on_cluster",
"(",
"self",
",",
"permutation",
",",
"table_type",
",",
"node",
"=",
"None",
")",
":",
"privileges",
"=",
"alter_column_privileges",
"(",
"permutation",
")",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
... | [
673,
0
] | [
697,
83
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Runs test suites above which check correctness over scenarios and permutations.
| Runs test suites above which check correctness over scenarios and permutations.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Runs test suites above which check correctness over scenarios and permutations.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
721,
0
] | [
747,
31
] | python | en | ['en', 'en', 'en'] | True |
CTCTrainer.training_step | (
self, model: nn.Module, inputs: Dict[str, Union[torch.Tensor, Any]]
) |
Perform a training step on a batch of inputs.
Subclass and override to inject custom behavior.
Args:
model (:obj:`nn.Module`):
The model to train.
inputs (:obj:`Dict[str, Union[torch.Tensor, Any]]`):
The inputs and targets of the model.
... |
Perform a training step on a batch of inputs. | def training_step(
self, model: nn.Module, inputs: Dict[str, Union[torch.Tensor, Any]]
) -> torch.Tensor:
"""
Perform a training step on a batch of inputs.
Subclass and override to inject custom behavior.
Args:
model (:obj:`nn.Module`):
The model... | [
"def",
"training_step",
"(",
"self",
",",
"model",
":",
"nn",
".",
"Module",
",",
"inputs",
":",
"Dict",
"[",
"str",
",",
"Union",
"[",
"torch",
".",
"Tensor",
",",
"Any",
"]",
"]",
")",
"->",
"torch",
".",
"Tensor",
":",
"model",
".",
"train",
"... | [
156,
4
] | [
209,
28
] | python | en | ['en', 'error', 'th'] | False |
GdpRecess.__init__ | (self,
id_cost,
N_region,
N_country,
ratio_death_to_R,
scale_factor=1,
range_constraints=(20, 160)) |
Economic cost computed as GDP recess due to diseased and dead people, as well as partial unemployment due to lock-downs.
GDP is expressed in billions.
Parameters
----------
id_cost: int
Identifier of the cost in the list of costs
N_region: int
Nu... |
Economic cost computed as GDP recess due to diseased and dead people, as well as partial unemployment due to lock-downs.
GDP is expressed in billions. | def __init__(self,
id_cost,
N_region,
N_country,
ratio_death_to_R,
scale_factor=1,
range_constraints=(20, 160)):
"""
Economic cost computed as GDP recess due to diseased and dead people, as well as part... | [
"def",
"__init__",
"(",
"self",
",",
"id_cost",
",",
"N_region",
",",
"N_country",
",",
"ratio_death_to_R",
",",
"scale_factor",
"=",
"1",
",",
"range_constraints",
"=",
"(",
"20",
",",
"160",
")",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"sc... | [
5,
4
] | [
56,
45
] | python | en | ['en', 'error', 'th'] | False |
GdpRecess.compute_current_infected | (self, state, label_to_id) |
Computes the current share of individuals infected, including hospitalized and dead.
Parameters
----------
state: nd.array
Current model state (either 1D or 2D with first dimension # of states).
label_to_id: dict
Mapping between state labels and indices ... |
Computes the current share of individuals infected, including hospitalized and dead. | def compute_current_infected(self, state, label_to_id):
"""
Computes the current share of individuals infected, including hospitalized and dead.
Parameters
----------
state: nd.array
Current model state (either 1D or 2D with first dimension # of states).
labe... | [
"def",
"compute_current_infected",
"(",
"self",
",",
"state",
",",
"label_to_id",
")",
":",
"if",
"state",
".",
"ndim",
"==",
"2",
":",
"infected",
"=",
"state",
"[",
":",
",",
"label_to_id",
"[",
"'I'",
"]",
"]",
"+",
"state",
"[",
":",
",",
"label_... | [
58,
4
] | [
79,
23
] | python | en | ['en', 'error', 'th'] | False |
GdpRecess.compute_cost | (self, previous_state, state, label_to_id, action, others={}) |
Computes GDP loss since the last state.
Parameters
----------
previous_state: 2D nd.array
Previous model states (either 1D or 2D with first dimension # of states).
state: 2D nd.array
Current model states (either 1D or 2D with first dimension # of states)... |
Computes GDP loss since the last state. | def compute_cost(self, previous_state, state, label_to_id, action, others={}):
"""
Computes GDP loss since the last state.
Parameters
----------
previous_state: 2D nd.array
Previous model states (either 1D or 2D with first dimension # of states).
state: 2D nd... | [
"def",
"compute_cost",
"(",
"self",
",",
"previous_state",
",",
"state",
",",
"label_to_id",
",",
"action",
",",
"others",
"=",
"{",
"}",
")",
":",
"time_jump",
"=",
"others",
"[",
"'jump_of'",
"]",
"lockdown",
"=",
"state",
"[",
":",
",",
"label_to_id",... | [
81,
4
] | [
112,
28
] | python | en | ['en', 'error', 'th'] | False |
GdpRecess.compute_cumulative_cost | (self, previous_state, state, label_to_id, action, others={}) |
Compute cumulative costs since start of episode.
Parameters
----------
Parameters
----------
previous_state: 2D nd.array
Previous model states (either 1D or 2D with first dimension # of states).
state: 2D nd.array
Current model sta... |
Compute cumulative costs since start of episode. | def compute_cumulative_cost(self, previous_state, state, label_to_id, action, others={}):
"""
Compute cumulative costs since start of episode.
Parameters
----------
Parameters
----------
previous_state: 2D nd.array
Previous model states (either... | [
"def",
"compute_cumulative_cost",
"(",
"self",
",",
"previous_state",
",",
"state",
",",
"label_to_id",
",",
"action",
",",
"others",
"=",
"{",
"}",
")",
":",
"cumulative_cost",
"=",
"state",
"[",
":",
",",
"label_to_id",
"[",
"'cumulative_cost_{}'",
".",
"f... | [
114,
4
] | [
137,
30
] | 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.