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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
invalid_username_and_valid_password | (self, server, rbac=False) | Check that we can't login using slightly invalid username but valid password.
| Check that we can't login using slightly invalid username but valid password.
| def invalid_username_and_valid_password(self, server, rbac=False):
"""Check that we can't login using slightly invalid username but valid password.
"""
username = "invalid_username_and_valid_password"
user = {"cn": username, "userpassword": username}
login = {"username": user["cn"] + "1"}
exitc... | [
"def",
"invalid_username_and_valid_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"invalid_username_and_valid_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"username",
"}",
"... | [
432,
0
] | [
442,
116
] | python | en | ['en', 'en', 'en'] | True |
valid_utf8_username_and_ascii_password | (self, server, rbac=False) | Check that we can login using valid utf-8 username with ascii password.
| Check that we can login using valid utf-8 username with ascii password.
| def valid_utf8_username_and_ascii_password(self, server, rbac=False):
"""Check that we can login using valid utf-8 username with ascii password.
"""
username = "utf8_username_Gãńdåłf_Thê_Gręât"
user = {"cn": username, "userpassword": "utf8_username"}
add_user_to_ldap_and_login(user=user, server=ser... | [
"def",
"valid_utf8_username_and_ascii_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"utf8_username_Gãńdåłf_Thê_Gręât\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"\"utf8_username\"",
... | [
450,
0
] | [
456,
67
] | python | en | ['en', 'en', 'en'] | True |
valid_ascii_username_and_utf8_password | (self, server, rbac=False) | Check that we can login using valid ascii username with utf-8 password.
| Check that we can login using valid ascii username with utf-8 password.
| def valid_ascii_username_and_utf8_password(self, server, rbac=False):
"""Check that we can login using valid ascii username with utf-8 password.
"""
username = "utf8_password"
user = {"cn": username, "userpassword": "utf8_password_Gãńdåłf_Thê_Gręât"}
add_user_to_ldap_and_login(user=user, server=ser... | [
"def",
"valid_ascii_username_and_utf8_password",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"username",
"=",
"\"utf8_password\"",
"user",
"=",
"{",
"\"cn\"",
":",
"username",
",",
"\"userpassword\"",
":",
"\"utf8_password_Gãńdåłf_Thê_Gręât\"}",
... | [
463,
0
] | [
469,
67
] | python | en | ['en', 'en', 'en'] | True |
empty_username_and_empty_password | (self, server=None, rbac=False) | Check that we can login using empty username and empty password as
it will use the default user and that has an empty password.
| Check that we can login using empty username and empty password as
it will use the default user and that has an empty password.
| def empty_username_and_empty_password(self, server=None, rbac=False):
"""Check that we can login using empty username and empty password as
it will use the default user and that has an empty password.
"""
login_and_execute_query(username="", password="") | [
"def",
"empty_username_and_empty_password",
"(",
"self",
",",
"server",
"=",
"None",
",",
"rbac",
"=",
"False",
")",
":",
"login_and_execute_query",
"(",
"username",
"=",
"\"\"",
",",
"password",
"=",
"\"\"",
")"
] | [
472,
0
] | [
476,
53
] | python | en | ['en', 'en', 'en'] | True |
default_verification_cooldown_value | (self, server, rbac=False) | Check that the default value (0) for the verification cooldown parameter
disables caching and forces contacting the LDAP server for each
authentication request.
| Check that the default value (0) for the verification cooldown parameter
disables caching and forces contacting the LDAP server for each
authentication request.
| def default_verification_cooldown_value(self, server, rbac=False):
"""Check that the default value (0) for the verification cooldown parameter
disables caching and forces contacting the LDAP server for each
authentication request.
"""
error_message = "DB::Exception: testVCD: Authentication failed: ... | [
"def",
"default_verification_cooldown_value",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"error_message",
"=",
"\"DB::Exception: testVCD: Authentication failed: password is incorrect or there is no user with such name\"",
"error_exitcode",
"=",
"4",
"user",
... | [
483,
0
] | [
520,
58
] | python | en | ['en', 'en', 'en'] | True |
valid_verification_cooldown_value_cn_change | (self, server, rbac=False) | Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set and the user cn is changed.
| Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set and the user cn is changed.
| def valid_verification_cooldown_value_cn_change(self, server, rbac=False):
"""Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set and the user cn is changed.
"""
user = None
new_user = None
wit... | [
"def",
"valid_verification_cooldown_value_cn_change",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"user",
"=",
"None",
"new_user",
"=",
"None",
"with",
"Given",
"(",
"\"I have an LDAP configuration that sets verification_cooldown parameter to 2 sec\"",
... | [
527,
0
] | [
565,
62
] | python | en | ['en', 'en', 'en'] | True |
valid_verification_cooldown_value_password_change | (self, server, rbac=False) | Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set and the user password is changed.
| Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set and the user password is changed.
| def valid_verification_cooldown_value_password_change(self, server, rbac=False):
"""Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set and the user password is changed.
"""
user = None
with Given(... | [
"def",
"valid_verification_cooldown_value_password_change",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"user",
"=",
"None",
"with",
"Given",
"(",
"\"I have an LDAP configuration that sets verification_cooldown parameter to 2 sec\"",
")",
":",
"servers"... | [
572,
0
] | [
609,
58
] | python | en | ['en', 'en', 'en'] | True |
valid_verification_cooldown_value_ldap_unavailable | (self, server, rbac=False) | Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set, even when the LDAP server is offline.
| Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set, even when the LDAP server is offline.
| def valid_verification_cooldown_value_ldap_unavailable(self, server, rbac=False):
"""Check that we can perform requests without contacting the LDAP server
after successful authentication when the verification_cooldown parameter
is set, even when the LDAP server is offline.
"""
user = None
with ... | [
"def",
"valid_verification_cooldown_value_ldap_unavailable",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"user",
"=",
"None",
"with",
"Given",
"(",
"\"I have an LDAP configuration that sets verification_cooldown parameter to 2 sec\"",
")",
":",
"servers... | [
616,
0
] | [
660,
58
] | python | en | ['en', 'en', 'en'] | True |
repeat_requests | (self, server, iterations, vcd_value, rbac=False, timeout=600) | Run repeated requests from some user to the LDAP server.
| Run repeated requests from some user to the LDAP server.
| def repeat_requests(self, server, iterations, vcd_value, rbac=False, timeout=600):
"""Run repeated requests from some user to the LDAP server.
"""
user = None
with Given(f"I have an LDAP configuration that sets verification_cooldown parameter to {vcd_value} sec"):
servers = { "openldap1": {
... | [
"def",
"repeat_requests",
"(",
"self",
",",
"server",
",",
"iterations",
",",
"vcd_value",
",",
"rbac",
"=",
"False",
",",
"timeout",
"=",
"600",
")",
":",
"user",
"=",
"None",
"with",
"Given",
"(",
"f\"I have an LDAP configuration that sets verification_cooldown ... | [
663,
0
] | [
698,
58
] | python | en | ['en', 'en', 'en'] | True |
verification_cooldown_performance | (self, server, rbac=False, iterations=5000) | Check that login performance is better when the verification cooldown
parameter is set to a positive value when comparing to the case when
the verification cooldown parameter is turned off.
| Check that login performance is better when the verification cooldown
parameter is set to a positive value when comparing to the case when
the verification cooldown parameter is turned off.
| def verification_cooldown_performance(self, server, rbac=False, iterations=5000):
"""Check that login performance is better when the verification cooldown
parameter is set to a positive value when comparing to the case when
the verification cooldown parameter is turned off.
"""
vcd_time = 0
no_... | [
"def",
"verification_cooldown_performance",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
",",
"iterations",
"=",
"5000",
")",
":",
"vcd_time",
"=",
"0",
"no_vcd_time",
"=",
"0",
"with",
"Example",
"(",
"f\"Repeated requests with verification cooldown param... | [
705,
0
] | [
723,
96
] | python | en | ['en', 'en', 'en'] | True |
check_verification_cooldown_reset_on_core_server_parameter_change | (self, server,
parameter_name, parameter_value, rbac=False) | Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after one of the core server
parameters is changed in the LDAP server configuration.
| Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after one of the core server
parameters is changed in the LDAP server configuration.
| def check_verification_cooldown_reset_on_core_server_parameter_change(self, server,
parameter_name, parameter_value, rbac=False):
"""Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after one of the core server
parameters is c... | [
"def",
"check_verification_cooldown_reset_on_core_server_parameter_change",
"(",
"self",
",",
"server",
",",
"parameter_name",
",",
"parameter_value",
",",
"rbac",
"=",
"False",
")",
":",
"config_d_dir",
"=",
"\"/etc/clickhouse-server/config.d\"",
"config_file",
"=",
"\"lda... | [
726,
0
] | [
786,
107
] | python | en | ['en', 'en', 'en'] | True |
verification_cooldown_reset_on_server_host_parameter_change | (self, server, rbac=False) | Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server host name
is changed in the LDAP server configuration.
| Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server host name
is changed in the LDAP server configuration.
| def verification_cooldown_reset_on_server_host_parameter_change(self, server, rbac=False):
"""Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server host name
is changed in the LDAP server configuration.
"""
check_veri... | [
"def",
"verification_cooldown_reset_on_server_host_parameter_change",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"check_verification_cooldown_reset_on_core_server_parameter_change",
"(",
"server",
"=",
"server",
",",
"parameter_name",
"=",
"\"host\"",
... | [
793,
0
] | [
800,
70
] | python | en | ['en', 'en', 'en'] | True |
verification_cooldown_reset_on_server_port_parameter_change | (self, server, rbac=False) | Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server port is changed in the
LDAP server configuration.
| Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server port is changed in the
LDAP server configuration.
| def verification_cooldown_reset_on_server_port_parameter_change(self, server, rbac=False):
"""Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server port is changed in the
LDAP server configuration.
"""
check_verificat... | [
"def",
"verification_cooldown_reset_on_server_port_parameter_change",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"check_verification_cooldown_reset_on_core_server_parameter_change",
"(",
"server",
"=",
"server",
",",
"parameter_name",
"=",
"\"port\"",
... | [
807,
0
] | [
814,
65
] | python | en | ['en', 'en', 'en'] | True |
verification_cooldown_reset_on_server_auth_dn_prefix_parameter_change | (self, server, rbac=False) | Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server auth_dn_prefix
is changed in the LDAP server configuration.
| Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server auth_dn_prefix
is changed in the LDAP server configuration.
| def verification_cooldown_reset_on_server_auth_dn_prefix_parameter_change(self, server, rbac=False):
"""Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server auth_dn_prefix
is changed in the LDAP server configuration.
"""
... | [
"def",
"verification_cooldown_reset_on_server_auth_dn_prefix_parameter_change",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"check_verification_cooldown_reset_on_core_server_parameter_change",
"(",
"server",
"=",
"server",
",",
"parameter_name",
"=",
"\"a... | [
821,
0
] | [
828,
75
] | python | en | ['en', 'en', 'en'] | True |
verification_cooldown_reset_on_server_auth_dn_suffix_parameter_change | (self, server, rbac=False) | Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server auth_dn_suffix
is changed in the LDAP server configuration.
| Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server auth_dn_suffix
is changed in the LDAP server configuration.
| def verification_cooldown_reset_on_server_auth_dn_suffix_parameter_change(self, server, rbac=False):
"""Check that the LDAP login cache is reset for all the LDAP authentication users
when verification_cooldown parameter is set after server auth_dn_suffix
is changed in the LDAP server configuration.
"""
... | [
"def",
"verification_cooldown_reset_on_server_auth_dn_suffix_parameter_change",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"check_verification_cooldown_reset_on_core_server_parameter_change",
"(",
"server",
"=",
"server",
",",
"parameter_name",
"=",
"\"a... | [
835,
0
] | [
843,
65
] | python | en | ['en', 'en', 'en'] | True |
scenario | (self, server, rbac=False) | Check that cached bind requests for the user are discarded when
the user provides invalid login credentials.
| Check that cached bind requests for the user are discarded when
the user provides invalid login credentials.
| def scenario(self, server, rbac=False):
"""Check that cached bind requests for the user are discarded when
the user provides invalid login credentials.
"""
user = None
error_exitcode = 4
error_message = "DB::Exception: testVCD: Authentication failed: password is incorrect or there is no user wi... | [
"def",
"scenario",
"(",
"self",
",",
"server",
",",
"rbac",
"=",
"False",
")",
":",
"user",
"=",
"None",
"error_exitcode",
"=",
"4",
"error_message",
"=",
"\"DB::Exception: testVCD: Authentication failed: password is incorrect or there is no user with such name\"",
"with",
... | [
852,
0
] | [
902,
58
] | python | en | ['en', 'en', 'en'] | True |
verification_cooldown | (self, rbac, servers=None, node="clickhouse1") | Check verification cooldown parameter functionality.
| Check verification cooldown parameter functionality.
| def verification_cooldown(self, rbac, servers=None, node="clickhouse1"):
"""Check verification cooldown parameter functionality.
"""
for scenario in loads(current_module(), Scenario, filter=has.tag("verification_cooldown")):
scenario(server="openldap1", rbac=rbac) | [
"def",
"verification_cooldown",
"(",
"self",
",",
"rbac",
",",
"servers",
"=",
"None",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"for",
"scenario",
"in",
"loads",
"(",
"current_module",
"(",
")",
",",
"Scenario",
",",
"filter",
"=",
"has",
".",
"tag... | [
905,
0
] | [
909,
47
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, rbac, servers=None, node="clickhouse1") | Check that users can be authenticated using an LDAP server when
users are configured either using an XML configuration file or RBAC.
| Check that users can be authenticated using an LDAP server when
users are configured either using an XML configuration file or RBAC.
| def feature(self, rbac, servers=None, node="clickhouse1"):
"""Check that users can be authenticated using an LDAP server when
users are configured either using an XML configuration file or RBAC.
"""
self.context.node = self.context.cluster.node(node)
if servers is None:
servers = globals()[... | [
"def",
"feature",
"(",
"self",
",",
"rbac",
",",
"servers",
"=",
"None",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"if",
"servers",
... | [
921,
0
] | [
934,
78
] | python | en | ['en', 'en', 'en'] | True |
regression | (self, local, clickhouse_binary_path, stress=None, parallel=None) | RBAC regression.
| RBAC regression.
| def regression(self, local, clickhouse_binary_path, stress=None, parallel=None):
"""RBAC regression.
"""
top().terminating = False
nodes = {
"clickhouse":
("clickhouse1", "clickhouse2", "clickhouse3")
}
if stress is not None:
self.context.stress = stress
if paral... | [
"def",
"regression",
"(",
"self",
",",
"local",
",",
"clickhouse_binary_path",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"top",
"(",
")",
".",
"terminating",
"=",
"False",
"nodes",
"=",
"{",
"\"clickhouse\"",
":",
"(",
"\"clickh... | [
168,
0
] | [
188,
64
] | python | en | ['en', 'mt', 'it'] | False |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SYSTEM SYNC REPLICA` commands if and only if
the privilege has been granted directly.
| Check that a user is able to execute `SYSTEM SYNC 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 SYNC 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 SYNC REPLICA` commands if and only if
the privilege has been granted via role.
| Check that a user is able to execute `SYSTEM SYNC 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 SYNC 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 |
sync_replica | (self, privilege, on, grant_target_name, user_name, node=None) | Check that user is only able to execute `SYSTEM SYNCE REPLICA` when they have privilege.
| Check that user is only able to execute `SYSTEM SYNCE REPLICA` when they have privilege.
| def sync_replica(self, privilege, on, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SYSTEM SYNCE REPLICA` when they have privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
table_name = f"table_name_{getuid()}"
if node is None:
... | [
"def",
"sync_replica",
"(",
"self",
",",
"privilege",
",",
"on",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"t... | [
52,
0
] | [
95,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SYSTEM SYNC REPLICA.
| Check the RBAC functionality of SYSTEM SYNC REPLICA.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SYSTEM SYNC 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_se... | [
"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 |
check_config | (self, entries, valid=True, ldap_server="openldap1", user="user1", password="user1") | Apply LDAP server configuration and check login.
| Apply LDAP server configuration and check login.
| def check_config(self, entries, valid=True, ldap_server="openldap1", user="user1", password="user1"):
"""Apply LDAP server configuration and check login.
"""
if valid:
exitcode = 0
message = "1"
else:
exitcode = 4
message = "DB::Exception: user1: Authentication failed: pa... | [
"def",
"check_config",
"(",
"self",
",",
"entries",
",",
"valid",
"=",
"True",
",",
"ldap_server",
"=",
"\"openldap1\"",
",",
"user",
"=",
"\"user1\"",
",",
"password",
"=",
"\"user1\"",
")",
":",
"if",
"valid",
":",
"exitcode",
"=",
"0",
"message",
"=",... | [
10,
0
] | [
30,
88
] | python | en | ['en', 'en', 'en'] | True |
config_invalid_base_dn | (self) | Check when invalid `base_dn` is specified in the user_dn_detection section.
| Check when invalid `base_dn` is specified in the user_dn_detection section.
| def config_invalid_base_dn(self):
"""Check when invalid `base_dn` is specified in the user_dn_detection section.
"""
with Given("I define LDAP server configuration with invalid base_dn"):
entries = {
"ldap_servers": [
{
"openldap1": {
... | [
"def",
"config_invalid_base_dn",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration with invalid base_dn\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
... | [
37,
0
] | [
59,
46
] | python | en | ['en', 'en', 'en'] | True |
config_empty_base_dn | (self) | Check when empty `base_dn` is specified in the user_dn_detection section.
| Check when empty `base_dn` is specified in the user_dn_detection section.
| def config_empty_base_dn(self):
"""Check when empty `base_dn` is specified in the user_dn_detection section.
"""
with Given("I define LDAP server configuration with invalid base_dn"):
entries = {
"ldap_servers": [
{
"openldap1": {
... | [
"def",
"config_empty_base_dn",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration with invalid base_dn\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
... | [
66,
0
] | [
87,
46
] | python | en | ['en', 'en', 'en'] | True |
config_missing_base_dn | (self) | Check when missing `base_dn` is specified in the user_dn_detection section.
| Check when missing `base_dn` is specified in the user_dn_detection section.
| def config_missing_base_dn(self):
"""Check when missing `base_dn` is specified in the user_dn_detection section.
"""
with Given("I define LDAP server configuration with invalid base_dn"):
entries = {
"ldap_servers": [
{
"openldap1": {
... | [
"def",
"config_missing_base_dn",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration with invalid base_dn\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
... | [
94,
0
] | [
114,
46
] | python | en | ['en', 'en', 'en'] | True |
config_invalid_search_filter | (self) | Check when invalid `search_filter` is specified in the user_dn_detection section.
| Check when invalid `search_filter` is specified in the user_dn_detection section.
| def config_invalid_search_filter(self):
"""Check when invalid `search_filter` is specified in the user_dn_detection section.
"""
with Given("I define LDAP server configuration with invalid search_filter"):
entries = {
"ldap_servers": [
{
"openldap1": {... | [
"def",
"config_invalid_search_filter",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration with invalid search_filter\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"op... | [
121,
0
] | [
142,
46
] | python | en | ['en', 'en', 'en'] | True |
config_missing_search_filter | (self) | Check when missing `search_filter` is specified in the user_dn_detection section.
| Check when missing `search_filter` is specified in the user_dn_detection section.
| def config_missing_search_filter(self):
"""Check when missing `search_filter` is specified in the user_dn_detection section.
"""
with Given("I define LDAP server configuration with invalid search_filter"):
entries = {
"ldap_servers": [
{
"openldap1": {... | [
"def",
"config_missing_search_filter",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration with invalid search_filter\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"op... | [
149,
0
] | [
169,
46
] | python | en | ['en', 'en', 'en'] | True |
config_empty_search_filter | (self) | Check when empty `search_filter` is specified in the user_dn_detection section.
| Check when empty `search_filter` is specified in the user_dn_detection section.
| def config_empty_search_filter(self):
"""Check when empty `search_filter` is specified in the user_dn_detection section.
"""
with Given("I define LDAP server configuration with invalid search_filter"):
entries = {
"ldap_servers": [
{
"openldap1": {
... | [
"def",
"config_empty_search_filter",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration with invalid search_filter\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"open... | [
176,
0
] | [
197,
46
] | python | en | ['en', 'en', 'en'] | True |
config_valid | (self) | Check valid config with valid user_dn_detection section.
| Check valid config with valid user_dn_detection section.
| def config_valid(self):
"""Check valid config with valid user_dn_detection section.
"""
with Given("I define LDAP server configuration"):
entries = {
"ldap_servers": [
{
"openldap1": {
"host": "openldap1",
... | [
"def",
"config_valid",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
"\"openldap1\"",
",",
"\"port\"",
":",
"... | [
205,
0
] | [
226,
45
] | python | en | ['en', 'en', 'en'] | True |
config_valid_tls_connection | (self) | Check valid config with valid user_dn_detection section when
using LDAP that is configured to use TLS connection.
| Check valid config with valid user_dn_detection section when
using LDAP that is configured to use TLS connection.
| def config_valid_tls_connection(self):
"""Check valid config with valid user_dn_detection section when
using LDAP that is configured to use TLS connection.
"""
with Given("I define LDAP server configuration"):
entries = {
"ldap_servers": [
{
"openl... | [
"def",
"config_valid_tls_connection",
"(",
"self",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap2\"",
":",
"{",
"\"host\"",
":",
"\"openldap2\"",
",",
"\"port... | [
234,
0
] | [
257,
102
] | python | en | ['en', 'en', 'en'] | True |
check_valid_scope_values | (self, scope, base_dn) | Check configuration with valid scope values.
| Check configuration with valid scope values.
| def check_valid_scope_values(self, scope, base_dn):
"""Check configuration with valid scope values.
"""
with Given("I define LDAP server configuration"):
entries = {
"ldap_servers": [
{
"openldap1": {
"host": "openldap1",
... | [
"def",
"check_valid_scope_values",
"(",
"self",
",",
"scope",
",",
"base_dn",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
":",
... | [
269,
0
] | [
291,
45
] | python | en | ['en', 'en', 'en'] | True |
mapping | (self) | Run all role mapping tests with both
openldap1 and openldap2 configured to use
user DN detection.
| Run all role mapping tests with both
openldap1 and openldap2 configured to use
user DN detection.
| def mapping(self):
"""Run all role mapping tests with both
openldap1 and openldap2 configured to use
user DN detection.
"""
users = [
{"server": "openldap1", "username": "user1", "password": "user1", "login": True,
"dn": "cn=user1,ou=users,dc=company,dc=com"},
]
entries = {... | [
"def",
"mapping",
"(",
"self",
")",
":",
"users",
"=",
"[",
"{",
"\"server\"",
":",
"\"openldap1\"",
",",
"\"username\"",
":",
"\"user1\"",
",",
"\"password\"",
":",
"\"user1\"",
",",
"\"login\"",
":",
"True",
",",
"\"dn\"",
":",
"\"cn=user1,ou=users,dc=compan... | [
294,
0
] | [
337,
61
] | python | en | ['en', 'en', 'en'] | True |
setup_different_bind_dn_and_user_dn | (self, uid, map_by, user_dn_detection) | Check that roles get mapped properly when bind_dn and user_dn are different
by creating LDAP users that have switched uid parameter values.
| Check that roles get mapped properly when bind_dn and user_dn are different
by creating LDAP users that have switched uid parameter values.
| def setup_different_bind_dn_and_user_dn(self, uid, map_by, user_dn_detection):
"""Check that roles get mapped properly when bind_dn and user_dn are different
by creating LDAP users that have switched uid parameter values.
"""
with Given("I define LDAP server configuration"):
entries = {
... | [
"def",
"setup_different_bind_dn_and_user_dn",
"(",
"self",
",",
"uid",
",",
"map_by",
",",
"user_dn_detection",
")",
":",
"with",
"Given",
"(",
"\"I define LDAP server configuration\"",
")",
":",
"entries",
"=",
"{",
"\"ldap_servers\"",
":",
"[",
"{",
"\"openldap1\"... | [
340,
0
] | [
403,
54
] | python | en | ['en', 'en', 'en'] | True |
map_roles_by_user_dn_when_base_dn_and_user_dn_are_different | (self) | Check the case when we map roles using user_dn then
the first user has uid of second user and second user
has uid of first user and configuring user DN detection to
determine user_dn based on the uid value so that user_dn
for the first user will be bind_dn of the second user and
vice versa.
| Check the case when we map roles using user_dn then
the first user has uid of second user and second user
has uid of first user and configuring user DN detection to
determine user_dn based on the uid value so that user_dn
for the first user will be bind_dn of the second user and
vice versa.
| def map_roles_by_user_dn_when_base_dn_and_user_dn_are_different(self):
"""Check the case when we map roles using user_dn then
the first user has uid of second user and second user
has uid of first user and configuring user DN detection to
determine user_dn based on the uid value so that user_dn
for ... | [
"def",
"map_roles_by_user_dn_when_base_dn_and_user_dn_are_different",
"(",
"self",
")",
":",
"uid",
"=",
"getuid",
"(",
")",
"setup_different_bind_dn_and_user_dn",
"(",
"uid",
"=",
"uid",
",",
"map_by",
"=",
"\"user_dn\"",
",",
"user_dn_detection",
"=",
"True",
")",
... | [
406,
0
] | [
430,
71
] | python | en | ['en', 'en', 'en'] | True |
map_roles_by_bind_dn_when_base_dn_and_user_dn_are_different | (self) | Check the case when we map roles by bind_dn when bind_dn and user_dn
are different.
| Check the case when we map roles by bind_dn when bind_dn and user_dn
are different.
| def map_roles_by_bind_dn_when_base_dn_and_user_dn_are_different(self):
"""Check the case when we map roles by bind_dn when bind_dn and user_dn
are different.
"""
uid = getuid()
setup_different_bind_dn_and_user_dn(uid=uid, map_by="bind_dn", user_dn_detection=True)
with When(f"I login as first L... | [
"def",
"map_roles_by_bind_dn_when_base_dn_and_user_dn_are_different",
"(",
"self",
")",
":",
"uid",
"=",
"getuid",
"(",
")",
"setup_different_bind_dn_and_user_dn",
"(",
"uid",
"=",
"uid",
",",
"map_by",
"=",
"\"bind_dn\"",
",",
"user_dn_detection",
"=",
"True",
")",
... | [
433,
0
] | [
453,
71
] | python | en | ['en', 'en', 'en'] | True |
feature | (self) | Check LDAP user DN detection.
| Check LDAP user DN detection.
| def feature(self):
"""Check LDAP user DN detection.
"""
self.context.node = self.context.cluster.node("clickhouse1")
self.context.ldap_node = self.context.cluster.node("openldap1")
with Given("I fix LDAP access permissions"):
fix_ldap_permissions(node=self.context.cluster.node("openldap1"))... | [
"def",
"feature",
"(",
"self",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"\"clickhouse1\"",
")",
"self",
".",
"context",
".",
"ldap_node",
"=",
"self",
".",
"context",
".",
"cluster",
... | [
460,
0
] | [
473,
22
] | python | da | ['da', 'gl', 'en'] | False |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SHOW ROLES` with privileges are granted directly.
| Check that a user is able to execute `SHOW ROLES` with privileges are granted directly.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `SHOW ROLES` with privileges are granted directly.
"""
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
with user(node, f"{user_name}"):
Suite(run=check_privilege,
... | [
"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,
74
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `SHOW ROLES` with privileges are granted through a role.
| Check that a user is able to execute `SHOW ROLES` with privileges are granted through a role.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `SHOW ROLES` with privileges are granted through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node = self.context.node
with user(node, f"{user_name}"... | [
"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,
74
] | python | en | ['en', 'en', 'en'] | True |
check_privilege | (self, privilege, grant_target_name, user_name, node=None) | Run checks for commands that require SHOW ROLES privilege.
| Run checks for commands that require SHOW ROLES privilege.
| def check_privilege(self, privilege, grant_target_name, user_name, node=None):
"""Run checks for commands that require SHOW ROLES privilege.
"""
if node is None:
node = self.context.node
Suite(test=show_roles)(privilege=privilege, grant_target_name=grant_target_name, user_name=user_name)
S... | [
"def",
"check_privilege",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"Suite",
"(",
"test",
"=",
"show... | [
53,
0
] | [
61,
106
] | python | en | ['en', 'en', 'en'] | True |
show_roles | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `SHOW ROLES` when they have the necessary privilege.
| Check that user is only able to execute `SHOW ROLES` when they have the necessary privilege.
| def show_roles(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SHOW ROLES` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
with Scen... | [
"def",
"show_roles",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"... | [
67,
0
] | [
105,
51
] | python | en | ['en', 'en', 'en'] | True |
show_create | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `SHOW CREATE ROLE` when they have the necessary privilege.
| Check that user is only able to execute `SHOW CREATE ROLE` when they have the necessary privilege.
| def show_create(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SHOW CREATE ROLE` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
wi... | [
"def",
"show_create",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
... | [
111,
0
] | [
158,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SHOW ROLES.
| Check the RBAC functionality of SHOW ROLES.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SHOW ROLES.
"""
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_server_log) | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"privileges_granted_directly",
",",
... | [
167,
0
] | [
173,
82
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None) | Check that clickhouse is able to create a table with extended precision data types.
| Check that clickhouse is able to create a table with extended precision data types.
| def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None):
"""Check that clickhouse is able to create a table with extended precision data types.
"""
node = self.context.cluster.node(node)
table_name = f"table_{getuid()}"
with allow_experimental_bigint(node):
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"mysql_node",
"=",
"\"mysql1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",... | [
12,
0
] | [
34,
64
] | python | en | ['en', 'en', 'en'] | True |
Critic.__init__ | (self,
n_critics,
dim_state,
dim_actions,
dim_goal,
layers,
goal_ids) |
Critic class that can use several critic networks (one for each cost).
Modeling each cost by a critic and using the mixing weights to mix q-values
instead of rewards is an idea from Agent57, Badia et al., 2019.
Parameters
----------
n_critics: int
Number of ... |
Critic class that can use several critic networks (one for each cost).
Modeling each cost by a critic and using the mixing weights to mix q-values
instead of rewards is an idea from Agent57, Badia et al., 2019. | def __init__(self,
n_critics,
dim_state,
dim_actions,
dim_goal,
layers,
goal_ids):
"""
Critic class that can use several critic networks (one for each cost).
Modeling each cost by a critic and u... | [
"def",
"__init__",
"(",
"self",
",",
"n_critics",
",",
"dim_state",
",",
"dim_actions",
",",
"dim_goal",
",",
"layers",
",",
"goal_ids",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"# Initialize Q networks.",
"self",
".",
"qs",
"=",
"[",
"QNe... | [
21,
4
] | [
52,
34
] | python | en | ['en', 'error', 'th'] | False |
Critic.get_model | (self) |
Extract critic state dicts
|
Extract critic state dicts
| def get_model(self):
"""
Extract critic state dicts
"""
return [q.state_dict() for q in self.qs] | [
"def",
"get_model",
"(",
"self",
")",
":",
"return",
"[",
"q",
".",
"state_dict",
"(",
")",
"for",
"q",
"in",
"self",
".",
"qs",
"]"
] | [
54,
4
] | [
58,
48
] | python | en | ['en', 'error', 'th'] | False |
Critic.set_model | (self, model) |
Set critic load dicts
|
Set critic load dicts
| def set_model(self, model):
"""
Set critic load dicts
"""
for q, o in zip(self.qs, model):
q.load_state_dict(o) | [
"def",
"set_model",
"(",
"self",
",",
"model",
")",
":",
"for",
"q",
",",
"o",
"in",
"zip",
"(",
"self",
".",
"qs",
",",
"model",
")",
":",
"q",
".",
"load_state_dict",
"(",
"o",
")"
] | [
60,
4
] | [
65,
32
] | python | en | ['en', 'error', 'th'] | False |
Critic.set_goal_params | (self, params) |
Set the params of the network to the given parameters
|
Set the params of the network to the given parameters
| def set_goal_params(self, params):
"""
Set the params of the network to the given parameters
"""
cpt = 0
for i_q in range(self.n_critics):
for param in self.qs[i_q].parameters():
tmp = np.product(param.size())
param.data.copy_(torch.fro... | [
"def",
"set_goal_params",
"(",
"self",
",",
"params",
")",
":",
"cpt",
"=",
"0",
"for",
"i_q",
"in",
"range",
"(",
"self",
".",
"n_critics",
")",
":",
"for",
"param",
"in",
"self",
".",
"qs",
"[",
"i_q",
"]",
".",
"parameters",
"(",
")",
":",
"tm... | [
67,
4
] | [
77,
26
] | python | en | ['en', 'error', 'th'] | False |
Critic.get_params | (self) |
Returns parameters of the actor as numpy array
|
Returns parameters of the actor as numpy array
| def get_params(self):
"""
Returns parameters of the actor as numpy array
"""
return np.concatenate([np.hstack([v.data.cpu().numpy().flatten() for v in q.parameters()]).copy() for q in self.qs]) | [
"def",
"get_params",
"(",
"self",
")",
":",
"return",
"np",
".",
"concatenate",
"(",
"[",
"np",
".",
"hstack",
"(",
"[",
"v",
".",
"data",
".",
"cpu",
"(",
")",
".",
"numpy",
"(",
")",
".",
"flatten",
"(",
")",
"for",
"v",
"in",
"q",
".",
"pa... | [
79,
4
] | [
83,
124
] | python | en | ['en', 'error', 'th'] | False |
Critic.forward | (self, obs) |
Make a forward pass for each q network.
Parameters
----------
obs: tensor of size (n_batch, dim_state + dim_goal)
Vector of observation, that is the concatenation of the state and goal vectors.
Returns
-------
tuple size n_critics
Q-value... |
Make a forward pass for each q network.
Parameters
----------
obs: tensor of size (n_batch, dim_state + dim_goal)
Vector of observation, that is the concatenation of the state and goal vectors. | def forward(self, obs):
"""
Make a forward pass for each q network.
Parameters
----------
obs: tensor of size (n_batch, dim_state + dim_goal)
Vector of observation, that is the concatenation of the state and goal vectors.
Returns
-------
tuple... | [
"def",
"forward",
"(",
"self",
",",
"obs",
")",
":",
"return",
"tuple",
"(",
"q",
".",
"forward",
"(",
"obs",
")",
"for",
"q",
"in",
"self",
".",
"qs",
")"
] | [
85,
4
] | [
99,
53
] | python | en | ['en', 'error', 'th'] | False |
QNetFC.__init__ | (self,
dim_state,
dim_goal,
dim_actions,
layers,
goal_ids) |
Fully connected Q-Network.
Parameters
----------
dim_state: int
Dimension of the state.
dim_goal: int
Dimension of the goal.
dim_actions: int
Dimension of the actions.
layers: list of ints
Description of the hidden... |
Fully connected Q-Network. | def __init__(self,
dim_state,
dim_goal,
dim_actions,
layers,
goal_ids):
"""
Fully connected Q-Network.
Parameters
----------
dim_state: int
Dimension of the state.
dim_goal: ... | [
"def",
"__init__",
"(",
"self",
",",
"dim_state",
",",
"dim_goal",
",",
"dim_actions",
",",
"layers",
",",
"goal_ids",
")",
":",
"super",
"(",
"QNetFC",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"dim_state",
"=",
"dim_state",
"self",
".... | [
104,
4
] | [
134,
96
] | python | en | ['en', 'error', 'th'] | False |
QNetFC.set_params | (self, params) |
Set the params of the network to the given parameters
|
Set the params of the network to the given parameters
| def set_params(self, params):
"""
Set the params of the network to the given parameters
"""
cpt = 0
for param in self.parameters():
tmp = np.product(param.size())
param.data.copy_(torch.from_numpy(
params[cpt:cpt + tmp]).view(param.size()))... | [
"def",
"set_params",
"(",
"self",
",",
"params",
")",
":",
"cpt",
"=",
"0",
"for",
"param",
"in",
"self",
".",
"parameters",
"(",
")",
":",
"tmp",
"=",
"np",
".",
"product",
"(",
"param",
".",
"size",
"(",
")",
")",
"param",
".",
"data",
".",
"... | [
143,
4
] | [
152,
22
] | python | en | ['en', 'error', 'th'] | False |
QNetFC.get_params | (self) |
Returns parameters of the actor as numpy array
|
Returns parameters of the actor as numpy array
| def get_params(self):
"""
Returns parameters of the actor as numpy array
"""
return np.hstack([v.data.cpu().numpy().flatten() for v in self.parameters()]).copy() | [
"def",
"get_params",
"(",
"self",
")",
":",
"return",
"np",
".",
"hstack",
"(",
"[",
"v",
".",
"data",
".",
"cpu",
"(",
")",
".",
"numpy",
"(",
")",
".",
"flatten",
"(",
")",
"for",
"v",
"in",
"self",
".",
"parameters",
"(",
")",
"]",
")",
".... | [
155,
4
] | [
159,
92
] | python | en | ['en', 'error', 'th'] | False |
subresultants | (p, q, x) |
Return the non-constant subresultants of 'p' and 'q' with respect to the "variable" 'x'.
'p', 'q' and 'x' are Z3 expressions where 'p' and 'q' are arithmetic terms.
Note that, any subterm that cannot be viewed as a polynomial is assumed to be a variable.
Example: f(a) is a considered to be a variable ... |
Return the non-constant subresultants of 'p' and 'q' with respect to the "variable" 'x'. | def subresultants(p, q, x):
"""
Return the non-constant subresultants of 'p' and 'q' with respect to the "variable" 'x'.
'p', 'q' and 'x' are Z3 expressions where 'p' and 'q' are arithmetic terms.
Note that, any subterm that cannot be viewed as a polynomial is assumed to be a variable.
Example: f(a... | [
"def",
"subresultants",
"(",
"p",
",",
"q",
",",
"x",
")",
":",
"return",
"AstVector",
"(",
"Z3_polynomial_subresultants",
"(",
"p",
".",
"ctx_ref",
"(",
")",
",",
"p",
".",
"as_ast",
"(",
")",
",",
"q",
".",
"as_ast",
"(",
")",
",",
"x",
".",
"a... | [
10,
0
] | [
29,
105
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_A | (self, connect, collection) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_A(self, connect, collection):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
vector = gen_single_vector(dim)
status, ids = connect.insert(collection, vector)
assert status.OK()
... | [
"def",
"test_get_vector_A",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vector",
"=",
"gen_single_vector",
"(",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vector",
")",
"assert",
"status",
".",
... | [
28,
4
] | [
41,
46
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_B | (self, connect, collection) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_B(self, connect, collection):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
vectors = gen_vectors(nb, dim)
status, ids = connect.insert(collection, vectors)
assert status.OK()
... | [
"def",
"test_get_vector_B",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
"assert",
"statu... | [
43,
4
] | [
58,
51
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_C_limit | (self, connect, collection, args) |
target: test.get_entity_by_id
method: add vector, and get, limit > 1000
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get, limit > 1000
expected: status ok, vector returned
| def test_get_vector_C_limit(self, connect, collection, args):
'''
target: test.get_entity_by_id
method: add vector, and get, limit > 1000
expected: status ok, vector returned
'''
if args["handler"] == "HTTP":
pytest.skip("skip in http mode")
vectors =... | [
"def",
"test_get_vector_C_limit",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"args",
")",
":",
"if",
"args",
"[",
"\"handler\"",
"]",
"==",
"\"HTTP\"",
":",
"pytest",
".",
"skip",
"(",
"\"skip in http mode\"",
")",
"vectors",
"=",
"gen_vectors",
"(... | [
60,
4
] | [
75,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_partition | (self, connect, collection) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_partition(self, connect, collection):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
vectors = gen_vectors(nb, dim)
status = connect.create_partition(collection, tag)
assert status... | [
"def",
"test_get_vector_partition",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"assert",
"status"... | [
77,
4
] | [
94,
51
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_multi_same_ids | (self, connect, collection) |
target: test.get_entity_by_id
method: add vectors, with the same id, get vector by the given id
expected: status ok, get one vector
|
target: test.get_entity_by_id
method: add vectors, with the same id, get vector by the given id
expected: status ok, get one vector
| def test_get_vector_multi_same_ids(self, connect, collection):
'''
target: test.get_entity_by_id
method: add vectors, with the same id, get vector by the given id
expected: status ok, get one vector
'''
vectors = gen_vectors(nb, dim)
ids = [i for i in range(nb)]
... | [
"def",
"test_get_vector_multi_same_ids",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"ids",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"nb",
")",
"]",
"ids",
"[",
"1",
"]",
... | [
96,
4
] | [
110,
47
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_after_delete | (self, connect, collection, get_id) |
target: test.get_entity_by_id
method: add vectors, and delete, get vector by the given id
expected: status ok, get one vector
|
target: test.get_entity_by_id
method: add vectors, and delete, get vector by the given id
expected: status ok, get one vector
| def test_get_vector_after_delete(self, connect, collection, get_id):
'''
target: test.get_entity_by_id
method: add vectors, and delete, get vector by the given id
expected: status ok, get one vector
'''
vectors = gen_vectors(nb, dim)
status, ids = connect.insert(c... | [
"def",
"test_get_vector_after_delete",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_id",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors... | [
125,
4
] | [
143,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_after_delete_with_partition | (self, connect, collection, get_id) |
target: test.get_entity_by_id
method: add vectors into partition, and delete, get vector by the given id
expected: status ok, get one vector
|
target: test.get_entity_by_id
method: add vectors into partition, and delete, get vector by the given id
expected: status ok, get one vector
| def test_get_vector_after_delete_with_partition(self, connect, collection, get_id):
'''
target: test.get_entity_by_id
method: add vectors into partition, and delete, get vector by the given id
expected: status ok, get one vector
'''
vectors = gen_vectors(nb, dim)
... | [
"def",
"test_get_vector_after_delete_with_partition",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_id",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
... | [
145,
4
] | [
164,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_id_not_exised | (self, connect, collection) |
target: test get vector, params vector_id not existed
method: add vector and get
expected: status ok, empty result
|
target: test get vector, params vector_id not existed
method: add vector and get
expected: status ok, empty result
| def test_get_vector_id_not_exised(self, connect, collection):
'''
target: test get vector, params vector_id not existed
method: add vector and get
expected: status ok, empty result
'''
vector = gen_single_vector(dim)
status, ids = connect.insert(collection, vecto... | [
"def",
"test_get_vector_id_not_exised",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vector",
"=",
"gen_single_vector",
"(",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vector",
")",
"assert",
"stat... | [
166,
4
] | [
179,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetBase.test_get_vector_collection_not_existed | (self, connect, collection) |
target: test get vector, params collection_name not existed
method: add vector and get
expected: status not ok
|
target: test get vector, params collection_name not existed
method: add vector and get
expected: status not ok
| def test_get_vector_collection_not_existed(self, connect, collection):
'''
target: test get vector, params collection_name not existed
method: add vector and get
expected: status not ok
'''
vector = gen_single_vector(dim)
status, ids = connect.insert(collection, v... | [
"def",
"test_get_vector_collection_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vector",
"=",
"gen_single_vector",
"(",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vector",
")",
"assert"... | [
181,
4
] | [
194,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetIndexedVectors.test_get_vectors_after_index_created | (self, connect, collection, get_simple_index, get_id) |
target: test get vector after index created
method: add vector, create index and get vector
expected: status ok
|
target: test get vector after index created
method: add vector, create index and get vector
expected: status ok
| def test_get_vectors_after_index_created(self, connect, collection, get_simple_index, get_id):
'''
target: test get vector after index created
method: add vector, create index and get vector
expected: status ok
'''
index_param = get_simple_index["index_param"]
ind... | [
"def",
"test_get_vectors_after_index_created",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
",",
"get_id",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_t... | [
264,
4
] | [
282,
48
] | python | en | ['en', 'error', 'th'] | False |
TestGetIndexedVectors.test_get_vector_after_delete | (self, connect, collection, get_simple_index, get_id) |
target: test.get_entity_by_id
method: add vectors, and delete, get vector by the given id
expected: status ok, get one vector
|
target: test.get_entity_by_id
method: add vectors, and delete, get vector by the given id
expected: status ok, get one vector
| def test_get_vector_after_delete(self, connect, collection, get_simple_index, get_id):
'''
target: test.get_entity_by_id
method: add vectors, and delete, get vector by the given id
expected: status ok, get one vector
'''
index_param = get_simple_index["index_param"]
... | [
"def",
"test_get_vector_after_delete",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
",",
"get_id",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
... | [
284,
4
] | [
306,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetIndexedVectors.test_get_vector_partition | (self, connect, collection, get_simple_index, get_id) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_partition(self, connect, collection, get_simple_index, get_id):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["... | [
"def",
"test_get_vector_partition",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
",",
"get_id",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"... | [
308,
4
] | [
328,
48
] | python | en | ['en', 'error', 'th'] | False |
TestGetBinary.test_get_vector_A | (self, connect, jac_collection) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_A(self, connect, jac_collection):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.insert(jac_collection, vector)
asser... | [
"def",
"test_get_vector_A",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vector",
"=",
"gen_binary_vectors",
"(",
"1",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"jac_collection",
",",
"vector",... | [
337,
4
] | [
350,
46
] | python | en | ['en', 'error', 'th'] | False |
TestGetBinary.test_get_vector_B | (self, connect, jac_collection) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_B(self, connect, jac_collection):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
tmp, vectors = gen_binary_vectors(nb, dim)
status, ids = connect.insert(jac_collection, vectors)
as... | [
"def",
"test_get_vector_B",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vectors",
"=",
"gen_binary_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"jac_collection",
",",
"vector... | [
352,
4
] | [
365,
47
] | python | en | ['en', 'error', 'th'] | False |
TestGetBinary.test_get_vector_multi_same_ids | (self, connect, jac_collection) |
target: test.get_entity_by_id
method: add vectors, with the same id, get vector by the given id
expected: status ok, get one vector
|
target: test.get_entity_by_id
method: add vectors, with the same id, get vector by the given id
expected: status ok, get one vector
| def test_get_vector_multi_same_ids(self, connect, jac_collection):
'''
target: test.get_entity_by_id
method: add vectors, with the same id, get vector by the given id
expected: status ok, get one vector
'''
tmp, vectors = gen_binary_vectors(nb, dim)
ids = [i for ... | [
"def",
"test_get_vector_multi_same_ids",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vectors",
"=",
"gen_binary_vectors",
"(",
"nb",
",",
"dim",
")",
"ids",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"nb",
")",
"]",
"... | [
367,
4
] | [
381,
47
] | python | en | ['en', 'error', 'th'] | False |
TestGetBinary.test_get_vector_id_not_exised | (self, connect, jac_collection) |
target: test get vector, params vector_id not existed
method: add vector and get
expected: status ok, empty result
|
target: test get vector, params vector_id not existed
method: add vector and get
expected: status ok, empty result
| def test_get_vector_id_not_exised(self, connect, jac_collection):
'''
target: test get vector, params vector_id not existed
method: add vector and get
expected: status ok, empty result
'''
tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.insert(jac_... | [
"def",
"test_get_vector_id_not_exised",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vector",
"=",
"gen_binary_vectors",
"(",
"1",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"jac_collection",
",",... | [
383,
4
] | [
396,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetBinary.test_get_vector_collection_not_existed | (self, connect, jac_collection) |
target: test get vector, params collection_name not existed
method: add vector and get
expected: status not ok
|
target: test get vector, params collection_name not existed
method: add vector and get
expected: status not ok
| def test_get_vector_collection_not_existed(self, connect, jac_collection):
'''
target: test get vector, params collection_name not existed
method: add vector and get
expected: status not ok
'''
tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.insert(... | [
"def",
"test_get_vector_collection_not_existed",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vector",
"=",
"gen_binary_vectors",
"(",
"1",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"jac_collection... | [
398,
4
] | [
411,
30
] | python | en | ['en', 'error', 'th'] | False |
TestGetBinary.test_get_vector_partition | (self, connect, jac_collection) |
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
|
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
| def test_get_vector_partition(self, connect, jac_collection):
'''
target: test.get_entity_by_id
method: add vector, and get
expected: status ok, vector returned
'''
tmp, vectors = gen_binary_vectors(nb, dim)
status = connect.create_partition(jac_collection, tag)
... | [
"def",
"test_get_vector_partition",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vectors",
"=",
"gen_binary_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"jac_collection",
",",
"tag"... | [
413,
4
] | [
427,
47
] | python | en | ['en', 'error', 'th'] | False |
privilege_granted_directly_or_via_role | (self, node=None) | Check that user is only able to execute DETACH DICTIONARY when they have required privilege, either directly or via role.
| Check that user is only able to execute DETACH DICTIONARY when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is only able to execute DETACH DICTIONARY when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
node = self.context.no... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
5,
0
] | [
27,
92
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege"):
dict_name = f"dict_{getuid()}"
try:
... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"with",
"Scenario",
"(",
"\"user without... | [
29,
0
] | [
136,
68
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of DETACH DICTIONARY.
| Check the RBAC functionality of DETACH DICTIONARY.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of DETACH DICTIONARY.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = str... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
145,
0
] | [
156,
48
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check show grants query syntax.
```sql
SHOW GRANTS [FOR user_or_role]
```
| Check show grants query syntax. | def feature(self, node="clickhouse1"):
"""Check show grants query syntax.
```sql
SHOW GRANTS [FOR user_or_role]
```
"""
node = self.context.cluster.node(node)
@contextmanager
def setup(user):
try:
with Given("I have a user"):
node.query(f"CREATE USER... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"setup",
"(",
"user",
")",
":",
"try",
":",
"with",
"Given... | [
8,
0
] | [
36,
37
] | python | en | ['fr', 'en', 'en'] | True |
assemble_dacey_dataset | (df) | Assemble xarray dataset from [1]_ data.
Parameters
----------
df : pd.DataFrame
The Dacey1992_RGC dataframe containing dendritic field diameter, in
arcmin, of parasol and midget RGCs.
Returns
-------
dataset : xarray.Dataset
That data, rearranged to a dataset.
R... | Assemble xarray dataset from [1]_ data. | def assemble_dacey_dataset(df):
"""Assemble xarray dataset from [1]_ data.
Parameters
----------
df : pd.DataFrame
The Dacey1992_RGC dataframe containing dendritic field diameter, in
arcmin, of parasol and midget RGCs.
Returns
-------
dataset : xarray.Dataset
Tha... | [
"def",
"assemble_dacey_dataset",
"(",
"df",
")",
":",
"df",
"[",
"'dendritic_field_diameter_deg'",
"]",
"=",
"df",
"[",
"'dendritic_field_diameter_min'",
"]",
"/",
"60",
"df",
"=",
"df",
".",
"set_index",
"(",
"'cell_type'",
")",
"for",
"n",
"in",
"df",
".",... | [
14,
0
] | [
40,
73
] | python | en | ['en', 'lb', 'en'] | True |
hinged_line | (ecc, slope, hinge_ecc, intercept=0) | Hinged line with an optional intercept.
Parameters
----------
ecc : jnp.ndarray
Eccentricity of RGC cells.
slope : jnp.ndarray
The slope giving the relationship between eccentricity and diameter.
hinge_ecc : jnp.ndarray
Eccentricity at which the line hinges.
intercept : ... | Hinged line with an optional intercept. | def hinged_line(ecc, slope, hinge_ecc, intercept=0):
"""Hinged line with an optional intercept.
Parameters
----------
ecc : jnp.ndarray
Eccentricity of RGC cells.
slope : jnp.ndarray
The slope giving the relationship between eccentricity and diameter.
hinge_ecc : jnp.ndarray
... | [
"def",
"hinged_line",
"(",
"ecc",
",",
"slope",
",",
"hinge_ecc",
",",
"intercept",
"=",
"0",
")",
":",
"diam",
"=",
"intercept",
"+",
"ecc",
"*",
"slope",
"return",
"diam",
".",
"clip",
"(",
"intercept",
"+",
"hinge_ecc",
"*",
"slope",
")"
] | [
43,
0
] | [
64,
51
] | python | en | ['en', 'en', 'en'] | True |
model_physiological_scaling | (eccentricity, observed_diameter=None) | Probabilistic model of dendritic field size, as function of eccentricity.
Fits ``hinged_line`` to eccentricity in order to get the mean diameter at
each location, then uses a normal distribution with the given mean (and
standard deviation equal to a scaling parameter times the mean) to predict
the obse... | Probabilistic model of dendritic field size, as function of eccentricity. | def model_physiological_scaling(eccentricity, observed_diameter=None):
"""Probabilistic model of dendritic field size, as function of eccentricity.
Fits ``hinged_line`` to eccentricity in order to get the mean diameter at
each location, then uses a normal distribution with the given mean (and
standard ... | [
"def",
"model_physiological_scaling",
"(",
"eccentricity",
",",
"observed_diameter",
"=",
"None",
")",
":",
"cell_type_plate",
"=",
"numpyro",
".",
"plate",
"(",
"'cell_type'",
",",
"eccentricity",
".",
"shape",
"[",
"-",
"1",
"]",
",",
"dim",
"=",
"-",
"1",... | [
67,
0
] | [
125,
52
] | python | en | ['en', 'en', 'en'] | True |
run_phys_scaling_inference | (dataset, step_size=.1, num_draws=1000,
num_chains=1, num_warmup=500, seed=0,
target_accept_prob=.8, max_tree_depth=10,
**nuts_kwargs) | Run MCMC inference for physiological scaling, conditioned on data.
Uses NUTS sampler.
For some reason, numpyro has trouble running in parallel, even with the
suggested `numpyro.set_host_device_count(n)` -- I think the solution is to
set the proper environmental variable yourself: `export
XLA_FLAGS... | Run MCMC inference for physiological scaling, conditioned on data. | def run_phys_scaling_inference(dataset, step_size=.1, num_draws=1000,
num_chains=1, num_warmup=500, seed=0,
target_accept_prob=.8, max_tree_depth=10,
**nuts_kwargs):
"""Run MCMC inference for physiological scaling, conditio... | [
"def",
"run_phys_scaling_inference",
"(",
"dataset",
",",
"step_size",
"=",
".1",
",",
"num_draws",
"=",
"1000",
",",
"num_chains",
"=",
"1",
",",
"num_warmup",
"=",
"500",
",",
"seed",
"=",
"0",
",",
"target_accept_prob",
"=",
".8",
",",
"max_tree_depth",
... | [
128,
0
] | [
187,
15
] | python | en | ['en', 'en', 'en'] | True |
assemble_inf_data | (mcmc, dataset, seed=1) | Convert mcmc into properly-formatted inference data object.
Parameters
----------
mcmc : numpyro.infer.MCMC
The MCMC object returned by `run_inference`
dataset: xarray.Dataset
Dataset containing observed_responses data variable and at least the
coordinates trials and scaling (mu... | Convert mcmc into properly-formatted inference data object. | def assemble_inf_data(mcmc, dataset, seed=1):
"""Convert mcmc into properly-formatted inference data object.
Parameters
----------
mcmc : numpyro.infer.MCMC
The MCMC object returned by `run_inference`
dataset: xarray.Dataset
Dataset containing observed_responses data variable and at... | [
"def",
"assemble_inf_data",
"(",
"mcmc",
",",
"dataset",
",",
"seed",
"=",
"1",
")",
":",
"ecc",
"=",
"jnp",
".",
"array",
"(",
"dataset",
".",
"eccentricity_deg",
".",
"values",
",",
"dtype",
"=",
"jnp",
".",
"float32",
")",
"post_pred",
"=",
"numpyro... | [
190,
0
] | [
256,
19
] | python | en | ['en', 'en', 'en'] | True |
inf_data_to_df | (inf_data, kind='predictive', query_str=None, hdi=False) | Convert inf_data to a dataframe, for plotting.
We exponentiate the log_diameter_slope and log_diameter_hinge_ecc
variables.
Parameters
----------
inf_data : arviz.InferenceData
arviz InferenceData object (xarray-like) created by `assemble_inf_data`.
kind : {'predictive', 'parameters'},... | Convert inf_data to a dataframe, for plotting. | def inf_data_to_df(inf_data, kind='predictive', query_str=None, hdi=False):
"""Convert inf_data to a dataframe, for plotting.
We exponentiate the log_diameter_slope and log_diameter_hinge_ecc
variables.
Parameters
----------
inf_data : arviz.InferenceData
arviz InferenceData object (xa... | [
"def",
"inf_data_to_df",
"(",
"inf_data",
",",
"kind",
"=",
"'predictive'",
",",
"query_str",
"=",
"None",
",",
"hdi",
"=",
"False",
")",
":",
"if",
"hdi",
"is",
"True",
":",
"hdi",
"=",
".95",
"if",
"kind",
"==",
"'predictive'",
":",
"dists",
"=",
"... | [
259,
0
] | [
334,
13
] | python | en | ['en', 'no', 'en'] | True |
assert_query_settings | (instance, query, settings, result=None, exception=None, user=None) |
Try and send the query with custom settings via all available methods:
1. TCP Protocol with settings packet
2. HTTP Protocol with settings params
3. TCP Protocol with session level settings
4. TCP Protocol with query level settings
|
Try and send the query with custom settings via all available methods:
1. TCP Protocol with settings packet
2. HTTP Protocol with settings params
3. TCP Protocol with session level settings
4. TCP Protocol with query level settings
| def assert_query_settings(instance, query, settings, result=None, exception=None, user=None):
"""
Try and send the query with custom settings via all available methods:
1. TCP Protocol with settings packet
2. HTTP Protocol with settings params
3. TCP Protocol with session level settings
4. TCP P... | [
"def",
"assert_query_settings",
"(",
"instance",
",",
"query",
",",
"settings",
",",
"result",
"=",
"None",
",",
"exception",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"if",
"not",
"settings",
":",
"settings",
"=",
"{",
"}",
"# tcp level settings",
... | [
91,
0
] | [
138,
67
] | python | en | ['en', 'error', 'th'] | False |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SHOW SETTINGS PROFILES` with privileges are granted directly.
| Check that a user is able to execute `SHOW SETTINGS PROFILES` with privileges are granted directly.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `SHOW SETTINGS PROFILES` with privileges are granted directly.
"""
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
with user(node, f"{user_name}"):
Suite(run=check_p... | [
"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_... | [
20,
0
] | [
34,
74
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `SHOW SETTINGS PROFILES` with privileges are granted through a role.
| Check that a user is able to execute `SHOW SETTINGS PROFILES` with privileges are granted through a role.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `SHOW SETTINGS PROFILES` with privileges are granted through a role.
"""
user_name = f"user_{getuid()}"
role_name = f"role_{getuid()}"
if node is None:
node = self.context.node
with user(node, f"... | [
"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"... | [
37,
0
] | [
55,
74
] | python | en | ['en', 'en', 'en'] | True |
check_privilege | (self, privilege, grant_target_name, user_name, node=None) | Run checks for commands that require SHOW SETTINGS PROFILES privilege.
| Run checks for commands that require SHOW SETTINGS PROFILES privilege.
| def check_privilege(self, privilege, grant_target_name, user_name, node=None):
"""Run checks for commands that require SHOW SETTINGS PROFILES privilege.
"""
if node is None:
node = self.context.node
Suite(test=show_settings_profiles)(privilege=privilege, grant_target_name=grant_target_name, us... | [
"def",
"check_privilege",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"Suite",
"(",
"test",
"=",
"show... | [
67,
0
] | [
75,
106
] | python | en | ['en', 'en', 'en'] | True |
show_settings_profiles | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `SHOW SETTINGS PROFILES` when they have the necessary privilege.
| Check that user is only able to execute `SHOW SETTINGS PROFILES` when they have the necessary privilege.
| def show_settings_profiles(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SHOW SETTINGS PROFILES` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.con... | [
"def",
"show_settings_profiles",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
... | [
81,
0
] | [
119,
51
] | python | en | ['en', 'en', 'en'] | True |
show_create | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `SHOW CREATE SETTINGS PROFILE` when they have the necessary privilege.
| Check that user is only able to execute `SHOW CREATE SETTINGS PROFILE` when they have the necessary privilege.
| def show_create(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SHOW CREATE SETTINGS PROFILE` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.... | [
"def",
"show_create",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
... | [
125,
0
] | [
172,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SHOW SETTINGS PROFILES.
| Check the RBAC functionality of SHOW SETTINGS PROFILES.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SHOW SETTINGS PROFILES.
"""
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",
",",
... | [
181,
0
] | [
187,
82
] | python | en | ['en', 'en', 'en'] | True |
roots | (expr, types=(ops.PhysicalTable,)) | Yield every node of a particular type on which an expression depends.
Parameters
----------
expr : Expr
The expression to analyze
types : tuple(type), optional, default
(:mod:`ibis.expr.operations.PhysicalTable`,)
The node types to traverse
Yields
------
table :... | Yield every node of a particular type on which an expression depends. | def roots(expr, types=(ops.PhysicalTable,)):
"""Yield every node of a particular type on which an expression depends.
Parameters
----------
expr : Expr
The expression to analyze
types : tuple(type), optional, default
(:mod:`ibis.expr.operations.PhysicalTable`,)
The node ... | [
"def",
"roots",
"(",
"expr",
",",
"types",
"=",
"(",
"ops",
".",
"PhysicalTable",
",",
")",
")",
":",
"seen",
"=",
"set",
"(",
")",
"stack",
"=",
"[",
"arg",
"for",
"arg",
"in",
"reversed",
"(",
"expr",
".",
"op",
"(",
")",
".",
"root_tables",
... | [
13,
0
] | [
51,
12
] | python | en | ['en', 'en', 'en'] | True |
_get_args | (op, name) | Hack to get relevant arguments for lineage computation.
We need a better way to determine the relevant arguments of an expression.
| Hack to get relevant arguments for lineage computation. | def _get_args(op, name):
"""Hack to get relevant arguments for lineage computation.
We need a better way to determine the relevant arguments of an expression.
"""
# Could use multipledispatch here to avoid the pasta
if isinstance(op, ops.Selection):
assert name is not None, 'name is None'
... | [
"def",
"_get_args",
"(",
"op",
",",
"name",
")",
":",
"# Could use multipledispatch here to avoid the pasta",
"if",
"isinstance",
"(",
"op",
",",
"ops",
".",
"Selection",
")",
":",
"assert",
"name",
"is",
"not",
"None",
",",
"'name is None'",
"result",
"=",
"o... | [
108,
0
] | [
125,
22
] | python | en | ['en', 'en', 'en'] | True |
lineage | (expr, container=Stack) | Yield the path of the expression tree that comprises a column
expression.
Parameters
----------
expr : Expr
An ibis expression. It must be an instance of
:class:`ibis.expr.types.ColumnExpr`.
container : Container, {Stack, Queue}
Stack for depth-first traversal, and Queue for... | Yield the path of the expression tree that comprises a column
expression. | def lineage(expr, container=Stack):
"""Yield the path of the expression tree that comprises a column
expression.
Parameters
----------
expr : Expr
An ibis expression. It must be an instance of
:class:`ibis.expr.types.ColumnExpr`.
container : Container, {Stack, Queue}
Sta... | [
"def",
"lineage",
"(",
"expr",
",",
"container",
"=",
"Stack",
")",
":",
"if",
"not",
"isinstance",
"(",
"expr",
",",
"ir",
".",
"ColumnExpr",
")",
":",
"raise",
"TypeError",
"(",
"'Input expression must be an instance of ColumnExpr'",
")",
"c",
"=",
"containe... | [
128,
0
] | [
170,
9
] | python | en | ['en', 'en', 'en'] | True |
traverse | (fn, expr, type=ir.Expr, container=Stack) | Utility for generic expression tree traversal
Parameters
----------
fn : Callable[[ir.Expr], Tuple[Union[Boolean, Iterable], Any]]
This function will be applied on each expressions, it must
return a tuple. The first element of the tuple controls the
traversal, and the second is the ... | Utility for generic expression tree traversal | def traverse(fn, expr, type=ir.Expr, container=Stack):
"""Utility for generic expression tree traversal
Parameters
----------
fn : Callable[[ir.Expr], Tuple[Union[Boolean, Iterable], Any]]
This function will be applied on each expressions, it must
return a tuple. The first element of th... | [
"def",
"traverse",
"(",
"fn",
",",
"expr",
",",
"type",
"=",
"ir",
".",
"Expr",
",",
"container",
"=",
"Stack",
")",
":",
"args",
"=",
"expr",
"if",
"isinstance",
"(",
"expr",
",",
"Iterable",
")",
"else",
"[",
"expr",
"]",
"todo",
"=",
"container"... | [
178,
0
] | [
220,
49
] | python | en | ['en', 'en', 'en'] | True |
log_int_inline | (self, func, int_type, min, max, node=None) | Check logical functions with Int128, Int256, and UInt256 using inline tests.
| Check logical functions with Int128, Int256, and UInt256 using inline tests.
| def log_int_inline(self, func, int_type, min, max, node=None):
"""Check logical functions with Int128, Int256, and UInt256 using inline tests.
"""
table_name = f'table_{getuid()}'
if node is None:
node = self.context.node
with When(f"Check {func} with {int_type}"):
node.query(f"SEL... | [
"def",
"log_int_inline",
"(",
"self",
",",
"func",
",",
"int_type",
",",
"min",
",",
"max",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f'table_{getuid()}'",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",... | [
15,
0
] | [
25,
62
] | python | en | ['en', 'en', 'en'] | True |
log_int_table | (self, func, int_type, min, max, node=None) | Check logical functions with Int128, Int256, and UInt256 using table tests.
| Check logical functions with Int128, Int256, and UInt256 using table tests.
| def log_int_table(self, func, int_type, min, max, node=None):
"""Check logical functions with Int128, Int256, and UInt256 using table tests.
"""
if node is None:
node = self.context.node
table_name = f'table_{getuid()}'
with Given(f"I have a table"):
table(name = table_name, data_... | [
"def",
"log_int_table",
"(",
"self",
",",
"func",
",",
"int_type",
",",
"min",
",",
"max",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"table_name",
"=",
"f'table_{getuid()}'",
... | [
29,
0
] | [
45,
65
] | python | en | ['en', 'en', 'en'] | True |
log_dec_inline | (self, func, node=None) | Check logical functions with Decimal256 using inline tests.
| Check logical functions with Decimal256 using inline tests.
| def log_dec_inline(self, func, node=None):
"""Check logical functions with Decimal256 using inline tests.
"""
min = Decimal256_min_max[0]
max = Decimal256_min_max[1]
if node is None:
node = self.context.node
with When(f"Check {func} with Decimal256"):
node.query(f"SELECT {func}... | [
"def",
"log_dec_inline",
"(",
"self",
",",
"func",
",",
"node",
"=",
"None",
")",
":",
"min",
"=",
"Decimal256_min_max",
"[",
"0",
"]",
"max",
"=",
"Decimal256_min_max",
"[",
"1",
"]",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"conte... | [
49,
0
] | [
60,
62
] | python | en | ['en', 'en', 'en'] | True |
log_dec_table | (self, func, node=None) | Check logical functions with Decimal256 using table tests.
| Check logical functions with Decimal256 using table tests.
| def log_dec_table(self, func, node=None):
"""Check logical functions with Decimal256 using table tests.
"""
min = Decimal256_min_max[0]
max = Decimal256_min_max[1]
if node is None:
node = self.context.node
table_name = f'table_{getuid()}'
with Given(f"I have a table"):
tab... | [
"def",
"log_dec_table",
"(",
"self",
",",
"func",
",",
"node",
"=",
"None",
")",
":",
"min",
"=",
"Decimal256_min_max",
"[",
"0",
"]",
"max",
"=",
"Decimal256_min_max",
"[",
"1",
"]",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"contex... | [
64,
0
] | [
82,
66
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None) | Check that comparison functions work with extended precision data types.
| Check that comparison functions work with extended precision data types.
| def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None):
"""Check that comparison functions work with extended precision data types.
"""
self.context.node = self.context.cluster.node(node)
self.context.mysql_node = self.context.cluster.node(mysql_node)
with allow_expe... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"mysql_node",
"=",
"\"mysql1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluste... | [
89,
0
] | [
99,
35
] | python | en | ['en', 'en', 'en'] | True |
file_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `File` source with privileges are granted directly.
| Check that a user is able to create a table from a `File` source with privileges are granted directly.
| def file_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `File` source with privileges are granted directly.
"""
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
with user(node, f"{user_name}"):
Suite(run... | [
"def",
"file_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{... | [
8,
0
] | [
22,
74
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.