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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
file_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `File` source with privileges are granted through a role.
| Check that a user is able to create a table from a `File` source with privileges are granted through a role.
| def file_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `File` source 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(... | [
"def",
"file_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,
74
] | python | en | ['en', 'en', 'en'] | True |
file | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `File` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `File` source when they have the necessary privilege.
| def file(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `File` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"file",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
... | [
54,
0
] | [
97,
51
] | python | en | ['en', 'en', 'en'] | True |
url_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `URL` source with privileges are granted directly.
| Check that a user is able to create a table from a `URL` source with privileges are granted directly.
| def url_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `URL` 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=u... | [
"def",
"url_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{u... | [
100,
0
] | [
114,
74
] | python | en | ['en', 'en', 'en'] | True |
url_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `URL` source with privileges are granted through a role.
| Check that a user is able to create a table from a `URL` source with privileges are granted through a role.
| def url_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `URL` source 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(no... | [
"def",
"url_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",
"w... | [
117,
0
] | [
135,
74
] | python | en | ['en', 'en', 'en'] | True |
url | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `URL` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `URL` source when they have the necessary privilege.
| def url(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `URL` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"url",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
... | [
146,
0
] | [
189,
51
] | python | en | ['en', 'en', 'en'] | True |
remote_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a Remote source with privileges are granted directly.
| Check that a user is able to create a table from a Remote source with privileges are granted directly.
| def remote_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a Remote 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(r... | [
"def",
"remote_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\... | [
192,
0
] | [
206,
74
] | python | en | ['en', 'en', 'en'] | True |
remote_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a Remote source with privileges are granted through a role.
| Check that a user is able to create a table from a Remote source with privileges are granted through a role.
| def remote_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a Remote source 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 use... | [
"def",
"remote_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",
... | [
209,
0
] | [
227,
74
] | python | en | ['en', 'en', 'en'] | True |
remote | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a remote source when they have the necessary privilege.
| Check that user is only able to to create a table from a remote source when they have the necessary privilege.
| def remote(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a remote source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"remote",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",... | [
238,
0
] | [
281,
51
] | python | en | ['en', 'en', 'en'] | True |
MySQL_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `MySQL` source with privileges are granted directly.
| Check that a user is able to create a table from a `MySQL` source with privileges are granted directly.
| def MySQL_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `MySQL` 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(r... | [
"def",
"MySQL_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"... | [
284,
0
] | [
298,
74
] | python | en | ['en', 'en', 'en'] | True |
MySQL_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `MySQL` source with privileges are granted through a role.
| Check that a user is able to create a table from a `MySQL` source with privileges are granted through a role.
| def MySQL_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `MySQL` source 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 use... | [
"def",
"MySQL_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",
... | [
301,
0
] | [
319,
74
] | python | en | ['en', 'en', 'en'] | True |
MySQL | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `MySQL` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `MySQL` source when they have the necessary privilege.
| def MySQL(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `MySQL` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"MySQL",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
... | [
330,
0
] | [
373,
51
] | python | en | ['en', 'en', 'en'] | True |
ODBC_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `ODBC` source with privileges are granted directly.
| Check that a user is able to create a table from a `ODBC` source with privileges are granted directly.
| def ODBC_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `ODBC` 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",
"ODBC_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{... | [
376,
0
] | [
390,
74
] | python | en | ['en', 'en', 'en'] | True |
ODBC_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `ODBC` source with privileges are granted through a role.
| Check that a user is able to create a table from a `ODBC` source with privileges are granted through a role.
| def ODBC_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `ODBC` source 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(... | [
"def",
"ODBC_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",
"... | [
393,
0
] | [
411,
74
] | python | en | ['en', 'en', 'en'] | True |
ODBC | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `ODBC` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `ODBC` source when they have the necessary privilege.
| def ODBC(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `ODBC` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"ODBC",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
... | [
422,
0
] | [
465,
51
] | python | en | ['en', 'en', 'en'] | True |
JDBC_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `JDBC` source with privileges are granted directly.
| Check that a user is able to create a table from a `JDBC` source with privileges are granted directly.
| def JDBC_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `JDBC` 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",
"JDBC_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{... | [
468,
0
] | [
482,
74
] | python | en | ['en', 'en', 'en'] | True |
JDBC_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `JDBC` source with privileges are granted through a role.
| Check that a user is able to create a table from a `JDBC` source with privileges are granted through a role.
| def JDBC_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `JDBC` source 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(... | [
"def",
"JDBC_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",
"... | [
485,
0
] | [
503,
74
] | python | en | ['en', 'en', 'en'] | True |
JDBC | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `JDBC` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `JDBC` source when they have the necessary privilege.
| def JDBC(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `JDBC` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"JDBC",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
... | [
514,
0
] | [
557,
51
] | python | en | ['en', 'en', 'en'] | True |
HDFS_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `HDFS` source with privileges are granted directly.
| Check that a user is able to create a table from a `HDFS` source with privileges are granted directly.
| def HDFS_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `HDFS` 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",
"HDFS_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{... | [
560,
0
] | [
574,
74
] | python | en | ['en', 'en', 'en'] | True |
HDFS_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `HDFS` source with privileges are granted through a role.
| Check that a user is able to create a table from a `HDFS` source with privileges are granted through a role.
| def HDFS_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `HDFS` source 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(... | [
"def",
"HDFS_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",
"... | [
577,
0
] | [
595,
74
] | python | en | ['en', 'en', 'en'] | True |
HDFS | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `HDFS` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `HDFS` source when they have the necessary privilege.
| def HDFS(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `HDFS` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"HDFS",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
... | [
606,
0
] | [
649,
51
] | python | en | ['en', 'en', 'en'] | True |
S3_privileges_granted_directly | (self, node=None) | Check that a user is able to create a table from a `S3` source with privileges are granted directly.
| Check that a user is able to create a table from a `S3` source with privileges are granted directly.
| def S3_privileges_granted_directly(self, node=None):
"""Check that a user is able to create a table from a `S3` 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=S3,... | [
"def",
"S3_privileges_granted_directly",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"user",
"(",
"node",
",",
"f\"{us... | [
652,
0
] | [
666,
74
] | python | en | ['en', 'en', 'en'] | True |
S3_privileges_granted_via_role | (self, node=None) | Check that a user is able to create a table from a `S3` source with privileges are granted through a role.
| Check that a user is able to create a table from a `S3` source with privileges are granted through a role.
| def S3_privileges_granted_via_role(self, node=None):
"""Check that a user is able to create a table from a `S3` source 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... | [
"def",
"S3_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",
"wi... | [
669,
0
] | [
687,
74
] | python | en | ['en', 'en', 'en'] | True |
S3 | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to to create a table from a `S3` source when they have the necessary privilege.
| Check that user is only able to to create a table from a `S3` source when they have the necessary privilege.
| def S3(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to to create a table from a `S3` source when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
w... | [
"def",
"S3",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
"... | [
698,
0
] | [
741,
51
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SOURCES.
| Check the RBAC functionality of SOURCES.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SOURCES.
"""
self.context.node = self.context.cluster.node(node)
Suite(run=file_privileges_granted_directly, setup=instrument_clickhouse_server_log)
Suite(run=file_privileges_granted_via_role, setup=instrument_clickhouse_serv... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"file_privileges_granted_directly",
"... | [
750,
0
] | [
770,
85
] | python | en | ['en', 'en', 'en'] | True |
TestDeleteBase.test_delete_vector_search | (self, connect, collection, get_simple_index) |
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
|
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
| def test_delete_vector_search(self, connect, collection, get_simple_index):
'''
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type... | [
"def",
"test_delete_vector_search",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vector",
"... | [
41,
4
] | [
63,
31
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_vector_multi_same_ids | (self, connect, collection, get_simple_index) |
target: test delete vector, with some same ids
method: add vector and delete
expected: status ok, vector deleted
|
target: test delete vector, with some same ids
method: add vector and delete
expected: status ok, vector deleted
| def test_delete_vector_multi_same_ids(self, connect, collection, get_simple_index):
'''
target: test delete vector, with some same ids
method: add vector and delete
expected: status ok, vector deleted
'''
index_param = get_simple_index["index_param"]
index_type = ... | [
"def",
"test_delete_vector_multi_same_ids",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vect... | [
65,
4
] | [
85,
31
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_vector_collection_count | (self, connect, collection) |
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
|
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
| def test_delete_vector_collection_count(self, connect, collection):
'''
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
'''
vector = gen_single_vector(dim)
status, ids = connect.insert(collection, vector)
assert... | [
"def",
"test_delete_vector_collection_count",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vector",
"=",
"gen_single_vector",
"(",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vector",
")",
"assert",
... | [
87,
4
] | [
103,
23
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_vector_collection_count_no_flush | (self, connect, collection) |
target: test delete vector
method: add vector and delete, no flush(using auto flush)
expected: status ok, vector deleted
|
target: test delete vector
method: add vector and delete, no flush(using auto flush)
expected: status ok, vector deleted
| def test_delete_vector_collection_count_no_flush(self, connect, collection):
'''
target: test delete vector
method: add vector and delete, no flush(using auto flush)
expected: status ok, vector deleted
'''
vector = gen_single_vector(dim)
status, ids = connect.inse... | [
"def",
"test_delete_vector_collection_count_no_flush",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vector",
"=",
"gen_single_vector",
"(",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vector",
")",
"a... | [
105,
4
] | [
123,
23
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_vector_id_not_exised | (self, connect, collection, get_simple_index) |
target: test delete vector, params vector_id not existed
method: add vector and delete
expected: status ok, search with vector have result
|
target: test delete vector, params vector_id not existed
method: add vector and delete
expected: status ok, search with vector have result
| def test_delete_vector_id_not_exised(self, connect, collection, get_simple_index):
'''
target: test delete vector, params vector_id not existed
method: add vector and delete
expected: status ok, search with vector have result
'''
index_param = get_simple_index["index_para... | [
"def",
"test_delete_vector_id_not_exised",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vecto... | [
125,
4
] | [
144,
37
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_vector_collection_not_existed | (self, connect, collection) |
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
|
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
| def test_delete_vector_collection_not_existed(self, connect, collection):
'''
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
'''
vector = gen_single_vector(dim)
status, ids = connect.insert(coll... | [
"def",
"test_delete_vector_collection_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vector",
"=",
"gen_single_vector",
"(",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vector",
")",
"asse... | [
146,
4
] | [
159,
30
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_insert_delete_vector | (self, connect, collection, get_simple_index) |
method: add vectors and delete
expected: status ok, vectors deleted
|
method: add vectors and delete
expected: status ok, vectors deleted
| def test_insert_delete_vector(self, connect, collection, get_simple_index):
'''
method: add vectors and delete
expected: status ok, vectors deleted
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
vectors = gen_vector(n... | [
"def",
"test_insert_delete_vector",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vectors",
... | [
161,
4
] | [
185,
43
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_create_index_after_delete | (self, connect, collection, get_simple_index) |
method: add vectors and delete, then create index
expected: status ok, vectors deleted, index created
|
method: add vectors and delete, then create index
expected: status ok, vectors deleted, index created
| def test_create_index_after_delete(self, connect, collection, get_simple_index):
'''
method: add vectors and delete, then create index
expected: status ok, vectors deleted, index created
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["inde... | [
"def",
"test_create_index_after_delete",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vectors... | [
187,
4
] | [
215,
38
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_add_vector_after_delete | (self, connect, collection, get_simple_index) |
method: add vectors and delete, then add vector
expected: status ok, vectors deleted, vector added
|
method: add vectors and delete, then add vector
expected: status ok, vectors deleted, vector added
| def test_add_vector_after_delete(self, connect, collection, get_simple_index):
'''
method: add vectors and delete, then add vector
expected: status ok, vectors deleted, vector added
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_typ... | [
"def",
"test_add_vector_after_delete",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vectors",... | [
217,
4
] | [
247,
43
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_multiable_times | (self, connect, collection) |
method: add vectors and delete id serveral times
expected: status ok, vectors deleted, and status ok for next delete operation
|
method: add vectors and delete id serveral times
expected: status ok, vectors deleted, and status ok for next delete operation
| def test_delete_multiable_times(self, connect, collection):
'''
method: add vectors and delete id serveral times
expected: status ok, vectors deleted, and status ok for next delete operation
'''
vectors = gen_vector(nb, dim)
status, ids = connect.insert(collection, vector... | [
"def",
"test_delete_multiable_times",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vector",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
"assert",... | [
249,
4
] | [
266,
30
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBase.test_delete_no_flush_multiable_times | (self, connect, collection) |
method: add vectors and delete id serveral times
expected: status ok, vectors deleted, and status ok for next delete operation
|
method: add vectors and delete id serveral times
expected: status ok, vectors deleted, and status ok for next delete operation
| def test_delete_no_flush_multiable_times(self, connect, collection):
'''
method: add vectors and delete id serveral times
expected: status ok, vectors deleted, and status ok for next delete operation
'''
vectors = gen_vector(nb, dim)
status, ids = connect.insert(collectio... | [
"def",
"test_delete_no_flush_multiable_times",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vector",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
... | [
268,
4
] | [
285,
30
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteIndexedVectors.test_delete_vectors_after_index_created_search | (self, connect, collection, get_simple_index) |
target: test delete vector after index created
method: add vector, create index and delete vector
expected: status ok, vector deleted
|
target: test delete vector after index created
method: add vector, create index and delete vector
expected: status ok, vector deleted
| def test_delete_vectors_after_index_created_search(self, connect, collection, get_simple_index):
'''
target: test delete vector after index created
method: add vector, create index and delete vector
expected: status ok, vector deleted
'''
index_param = get_simple_index["i... | [
"def",
"test_delete_vectors_after_index_created_search",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
... | [
307,
4
] | [
329,
31
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteIndexedVectors.test_insert_delete_vector | (self, connect, collection, get_simple_index) |
method: add vectors and delete
expected: status ok, vectors deleted
|
method: add vectors and delete
expected: status ok, vectors deleted
| def test_insert_delete_vector(self, connect, collection, get_simple_index):
'''
method: add vectors and delete
expected: status ok, vectors deleted
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
vectors = gen_vector(n... | [
"def",
"test_insert_delete_vector",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"vectors",
... | [
331,
4
] | [
361,
38
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBinary.test_delete_vector_search | (self, connect, jac_collection, get_simple_index) |
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
|
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
| def test_delete_vector_search(self, connect, jac_collection, get_simple_index):
'''
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_... | [
"def",
"test_delete_vector_search",
"(",
"self",
",",
"connect",
",",
"jac_collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"tmp",
... | [
381,
4
] | [
401,
31
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBinary.test_delete_vector_collection_count | (self, connect, jac_collection) |
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
|
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
| def test_delete_vector_collection_count(self, connect, jac_collection):
'''
target: test delete vector
method: add vector and delete
expected: status ok, vector deleted
'''
tmp, vector = gen_binary_vectors(1, dim)
status, ids = connect.insert(jac_collection, vecto... | [
"def",
"test_delete_vector_collection_count",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vector",
"=",
"gen_binary_vectors",
"(",
"1",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"jac_collection",
... | [
404,
4
] | [
420,
23
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBinary.test_delete_vector_id_not_exised | (self, connect, jac_collection, get_simple_index) |
target: test delete vector, params vector_id not existed
method: add vector and delete
expected: status ok, search with vector have result
|
target: test delete vector, params vector_id not existed
method: add vector and delete
expected: status ok, search with vector have result
| def test_delete_vector_id_not_exised(self, connect, jac_collection, get_simple_index):
'''
target: test delete vector, params vector_id not existed
method: add vector and delete
expected: status ok, search with vector have result
'''
index_param = get_simple_index["index_... | [
"def",
"test_delete_vector_id_not_exised",
"(",
"self",
",",
"connect",
",",
"jac_collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"t... | [
422,
4
] | [
442,
37
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBinary.test_delete_vector_collection_not_existed | (self, connect, jac_collection) |
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
|
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
| def test_delete_vector_collection_not_existed(self, connect, jac_collection):
'''
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
'''
tmp, vector = gen_binary_vectors(1, dim)
status, ids = connec... | [
"def",
"test_delete_vector_collection_not_existed",
"(",
"self",
",",
"connect",
",",
"jac_collection",
")",
":",
"tmp",
",",
"vector",
"=",
"gen_binary_vectors",
"(",
"1",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"jac_collect... | [
444,
4
] | [
459,
30
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBinary.test_insert_delete_vector | (self, connect, jac_collection, get_simple_index) |
method: add vectors and delete
expected: status ok, vectors deleted
|
method: add vectors and delete
expected: status ok, vectors deleted
| def test_insert_delete_vector(self, connect, jac_collection, get_simple_index):
'''
method: add vectors and delete
expected: status ok, vectors deleted
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
tmp, vectors = gen... | [
"def",
"test_insert_delete_vector",
"(",
"self",
",",
"connect",
",",
"jac_collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"tmp",
... | [
461,
4
] | [
484,
38
] | python | en | ['en', 'error', 'th'] | False |
TestDeleteBinary.test_add_after_delete_vector | (self, connect, jac_collection, get_simple_index) |
method: add vectors and delete, add
expected: status ok, vectors added
|
method: add vectors and delete, add
expected: status ok, vectors added
| def test_add_after_delete_vector(self, connect, jac_collection, get_simple_index):
'''
method: add vectors and delete, add
expected: status ok, vectors added
'''
index_param = get_simple_index["index_param"]
index_type = get_simple_index["index_type"]
tmp, vectors... | [
"def",
"test_add_after_delete_vector",
"(",
"self",
",",
"connect",
",",
"jac_collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"tmp",... | [
486,
4
] | [
513,
42
] | python | en | ['en', 'error', 'th'] | False |
highest_precedence_dtype | (exprs) | Return the highest precedence type from the passed expressions
Also verifies that there are valid implicit casts between any of the types
and the selected highest precedence type.
This is a thin wrapper around datatypes highest precedence check.
Parameters
----------
exprs : Iterable[ir.ValueE... | Return the highest precedence type from the passed expressions | def highest_precedence_dtype(exprs):
"""Return the highest precedence type from the passed expressions
Also verifies that there are valid implicit casts between any of the types
and the selected highest precedence type.
This is a thin wrapper around datatypes highest precedence check.
Parameters
... | [
"def",
"highest_precedence_dtype",
"(",
"exprs",
")",
":",
"if",
"not",
"exprs",
":",
"raise",
"ValueError",
"(",
"'Must pass at least one expression'",
")",
"return",
"dt",
".",
"highest_precedence",
"(",
"expr",
".",
"type",
"(",
")",
"for",
"expr",
"in",
"e... | [
20,
0
] | [
40,
63
] | python | en | ['en', 'en', 'en'] | True |
castable | (source, target) | Return whether source ir type is implicitly castable to target
Based on the underlying datatypes and the value in case of Literals
| Return whether source ir type is implicitly castable to target | def castable(source, target):
"""Return whether source ir type is implicitly castable to target
Based on the underlying datatypes and the value in case of Literals
"""
op = source.op()
value = getattr(op, 'value', None)
return dt.castable(source.type(), target.type(), value=value) | [
"def",
"castable",
"(",
"source",
",",
"target",
")",
":",
"op",
"=",
"source",
".",
"op",
"(",
")",
"value",
"=",
"getattr",
"(",
"op",
",",
"'value'",
",",
"None",
")",
"return",
"dt",
".",
"castable",
"(",
"source",
".",
"type",
"(",
")",
",",... | [
43,
0
] | [
50,
65
] | python | en | ['en', 'en', 'en'] | True |
cast | (source, target) | Currently Literal to *Scalar implicit casts are allowed | Currently Literal to *Scalar implicit casts are allowed | def cast(source, target):
"""Currently Literal to *Scalar implicit casts are allowed"""
import ibis.expr.operations as ops # TODO: don't use ops here
if not castable(source, target):
raise com.IbisTypeError('Source is not castable to target type!')
# currently it prevents column -> scalar imp... | [
"def",
"cast",
"(",
"source",
",",
"target",
")",
":",
"import",
"ibis",
".",
"expr",
".",
"operations",
"as",
"ops",
"# TODO: don't use ops here",
"if",
"not",
"castable",
"(",
"source",
",",
"target",
")",
":",
"raise",
"com",
".",
"IbisTypeError",
"(",
... | [
57,
0
] | [
71,
23
] | python | en | ['en', 'en', 'en'] | True |
one_of | (inners, arg) | At least one of the inner validators must pass | At least one of the inner validators must pass | def one_of(inners, arg):
"""At least one of the inner validators must pass"""
for inner in inners:
with suppress(com.IbisTypeError, ValueError):
return inner(arg)
rules_formatted = ', '.join(map(repr, inners))
raise com.IbisTypeError(
'Arg passes neither of the following rul... | [
"def",
"one_of",
"(",
"inners",
",",
"arg",
")",
":",
"for",
"inner",
"in",
"inners",
":",
"with",
"suppress",
"(",
"com",
".",
"IbisTypeError",
",",
"ValueError",
")",
":",
"return",
"inner",
"(",
"arg",
")",
"rules_formatted",
"=",
"', '",
".",
"join... | [
92,
0
] | [
101,
5
] | python | en | ['en', 'en', 'en'] | True |
all_of | (inners, arg) | All of the inner valudators must pass.
The order of inner validators matters.
Parameters
----------
inners : List[validator]
Functions are applied from right to left so allof([rule1, rule2], arg) is
the same as rule1(rule2(arg)).
arg : Any
Value to be validated.
Returns
... | All of the inner valudators must pass. | def all_of(inners, arg):
"""All of the inner valudators must pass.
The order of inner validators matters.
Parameters
----------
inners : List[validator]
Functions are applied from right to left so allof([rule1, rule2], arg) is
the same as rule1(rule2(arg)).
arg : Any
Value to... | [
"def",
"all_of",
"(",
"inners",
",",
"arg",
")",
":",
"return",
"compose",
"(",
"*",
"inners",
")",
"(",
"arg",
")"
] | [
105,
0
] | [
123,
32
] | python | en | ['en', 'en', 'en'] | True |
instance_of | (klass, arg) | Require that a value has a particular Python type. | Require that a value has a particular Python type. | def instance_of(klass, arg):
"""Require that a value has a particular Python type."""
if not isinstance(arg, klass):
raise com.IbisTypeError(
'Given argument with type {} is not an instance of {}'.format(
type(arg), klass
)
)
return arg | [
"def",
"instance_of",
"(",
"klass",
",",
"arg",
")",
":",
"if",
"not",
"isinstance",
"(",
"arg",
",",
"klass",
")",
":",
"raise",
"com",
".",
"IbisTypeError",
"(",
"'Given argument with type {} is not an instance of {}'",
".",
"format",
"(",
"type",
"(",
"arg"... | [
171,
0
] | [
179,
14
] | python | en | ['en', 'en', 'en'] | True |
value | (dtype, arg) | Validates that the given argument is a Value with a particular datatype
Parameters
----------
dtype : DataType subclass or DataType instance
arg : python literal or an ibis expression
If a python literal is given the validator tries to coerce it to an ibis
literal.
Returns
-------
... | Validates that the given argument is a Value with a particular datatype | def value(dtype, arg):
"""Validates that the given argument is a Value with a particular datatype
Parameters
----------
dtype : DataType subclass or DataType instance
arg : python literal or an ibis expression
If a python literal is given the validator tries to coerce it to an ibis
lite... | [
"def",
"value",
"(",
"dtype",
",",
"arg",
")",
":",
"if",
"not",
"isinstance",
"(",
"arg",
",",
"ir",
".",
"Expr",
")",
":",
"# coerce python literal to ibis literal",
"arg",
"=",
"ir",
".",
"literal",
"(",
"arg",
")",
"if",
"not",
"isinstance",
"(",
"... | [
183,
0
] | [
219,
63
] | python | en | ['en', 'en', 'en'] | True |
table | (schema, arg) | A table argument.
Parameters
----------
schema : Union[sch.Schema, List[Tuple[str, dt.DataType]]
A validator for the table's columns. Only column subset validators are
currently supported. Accepts any arguments that `sch.schema` accepts.
See the example for usage.
arg : The vali... | A table argument. | def table(schema, arg):
"""A table argument.
Parameters
----------
schema : Union[sch.Schema, List[Tuple[str, dt.DataType]]
A validator for the table's columns. Only column subset validators are
currently supported. Accepts any arguments that `sch.schema` accepts.
See the exampl... | [
"def",
"table",
"(",
"schema",
",",
"arg",
")",
":",
"assert",
"isinstance",
"(",
"arg",
",",
"ir",
".",
"TableExpr",
")",
"if",
"arg",
".",
"schema",
"(",
")",
">=",
"sch",
".",
"schema",
"(",
"schema",
")",
":",
"return",
"arg",
"raise",
"com",
... | [
334,
0
] | [
361,
5
] | python | en | ['en', 'fr', 'en'] | True |
unitsize | (indexkey) | size of one vector in the index | size of one vector in the index | def unitsize(indexkey):
""" size of one vector in the index """
mo = re.match('.*,PQ(\\d+)', indexkey)
if mo:
return int(mo.group(1))
if indexkey.endswith('SQ8'):
bits_per_d = 8
elif indexkey.endswith('SQ4'):
bits_per_d = 4
elif indexkey.endswith('SQfp16'):
bits_p... | [
"def",
"unitsize",
"(",
"indexkey",
")",
":",
"mo",
"=",
"re",
".",
"match",
"(",
"'.*,PQ(\\\\d+)'",
",",
"indexkey",
")",
"if",
"mo",
":",
"return",
"int",
"(",
"mo",
".",
"group",
"(",
"1",
")",
")",
"if",
"indexkey",
".",
"endswith",
"(",
"'SQ8'... | [
27,
0
] | [
49,
16
] | python | en | ['en', 'en', 'en'] | True |
seirah_model | (y: tuple,
t: int,
De: float,
Dh: float,
Di: float,
Dq: float,
N: int,
alpha: float,
b: float,
r: float) |
SEIRAH epidemiological model from Population modeling of early COVID-19 epidemic dynamics in French
regions and estimation of the lockdown impact on infection rate, Prague et al., 2020.
Parameters
----------
y: tuple
Current states SEIRAH.
y = [S, E, I, R, A, H]
S: # susceptibl... |
SEIRAH epidemiological model from Population modeling of early COVID-19 epidemic dynamics in French
regions and estimation of the lockdown impact on infection rate, Prague et al., 2020.
Parameters
----------
y: tuple
Current states SEIRAH.
y = [S, E, I, R, A, H]
S: # susceptibl... | def seirah_model(y: tuple,
t: int,
De: float,
Dh: float,
Di: float,
Dq: float,
N: int,
alpha: float,
b: float,
r: float):
"""
SEIRAH epidemiological model from... | [
"def",
"seirah_model",
"(",
"y",
":",
"tuple",
",",
"t",
":",
"int",
",",
"De",
":",
"float",
",",
"Dh",
":",
"float",
",",
"Di",
":",
"float",
",",
"Dq",
":",
"float",
",",
"N",
":",
"int",
",",
"alpha",
":",
"float",
",",
"b",
":",
"float",... | [
14,
0
] | [
77,
15
] | python | en | ['en', 'error', 'th'] | False |
PragueOdeSeirahModel.__init__ | (self,
region='IDF',
stochastic=False,
noise_params=0.1,
range_delay=(0, 21)
) |
Implementation of the SEIRAH model from Prague et al., 2020:
Population modeling of early COVID-19 epidemic dynamics in French regions and estimation of the lockdown impact on infection rate.
Parameters
----------
region: str
Region identifier.
stochasti... |
Implementation of the SEIRAH model from Prague et al., 2020:
Population modeling of early COVID-19 epidemic dynamics in French regions and estimation of the lockdown impact on infection rate. | def __init__(self,
region='IDF',
stochastic=False,
noise_params=0.1,
range_delay=(0, 21)
):
"""
Implementation of the SEIRAH model from Prague et al., 2020:
Population modeling of early COVID-19 epidemic dynamic... | [
"def",
"__init__",
"(",
"self",
",",
"region",
"=",
"'IDF'",
",",
"stochastic",
"=",
"False",
",",
"noise_params",
"=",
"0.1",
",",
"range_delay",
"=",
"(",
"0",
",",
"21",
")",
")",
":",
"self",
".",
"fitted_params",
"=",
"pd",
".",
"read_csv",
"(",... | [
81,
4
] | [
136,
49
] | python | en | ['en', 'error', 'th'] | False |
PragueOdeSeirahModel.define_params_and_initial_state_distributions | (self) |
Extract and define distributions of parameters for all French regions
|
Extract and define distributions of parameters for all French regions
| def define_params_and_initial_state_distributions(self):
"""
Extract and define distributions of parameters for all French regions
"""
label2ind = dict(zip(list(self.fitted_cov.columns), np.arange(len(self.fitted_cov.columns))))
for i in self.fitted_params.index:
r =... | [
"def",
"define_params_and_initial_state_distributions",
"(",
"self",
")",
":",
"label2ind",
"=",
"dict",
"(",
"zip",
"(",
"list",
"(",
"self",
".",
"fitted_cov",
".",
"columns",
")",
",",
"np",
".",
"arange",
"(",
"len",
"(",
"self",
".",
"fitted_cov",
"."... | [
140,
4
] | [
181,
56
] | python | en | ['en', 'error', 'th'] | False |
PragueOdeSeirahModel._sample_initial_state | (self) |
Samples an initial model state from its distribution (Dirac distributions if self.stochastic is False).
|
Samples an initial model state from its distribution (Dirac distributions if self.stochastic is False). | def _sample_initial_state(self):
"""
Samples an initial model state from its distribution (Dirac distributions if self.stochastic is False).
"""
self.initial_state = dict()
for k in self._all_initial_state_distribs[self.region].keys():
self.initial_state[k] = self._... | [
"def",
"_sample_initial_state",
"(",
"self",
")",
":",
"self",
".",
"initial_state",
"=",
"dict",
"(",
")",
"for",
"k",
"in",
"self",
".",
"_all_initial_state_distribs",
"[",
"self",
".",
"region",
"]",
".",
"keys",
"(",
")",
":",
"self",
".",
"initial_s... | [
183,
4
] | [
199,
157
] | python | en | ['en', 'error', 'th'] | False |
PragueOdeSeirahModel._sample_model_params | (self) |
Samples parameters of the model from their distribution (Dirac distributions if self.stochastic is False).
|
Samples parameters of the model from their distribution (Dirac distributions if self.stochastic is False). | def _sample_model_params(self):
"""
Samples parameters of the model from their distribution (Dirac distributions if self.stochastic is False).
"""
self.initial_internal_params = dict()
for k in self._all_internal_params_distribs[self.region].keys():
self.initial_inte... | [
"def",
"_sample_model_params",
"(",
"self",
")",
":",
"self",
".",
"initial_internal_params",
"=",
"dict",
"(",
")",
"for",
"k",
"in",
"self",
".",
"_all_internal_params_distribs",
"[",
"self",
".",
"region",
"]",
".",
"keys",
"(",
")",
":",
"self",
".",
... | [
201,
4
] | [
209,
34
] | python | en | ['en', 'error', 'th'] | False |
PragueOdeSeirahModel.run_n_steps | (self, current_state=None, n=1, labelled_states=False) |
Runs the model for n steps
Parameters
----------
current_state: 1D nd.array
Current model state.
n: int
Number of steps the model should be run for.
labelled_states: bool
Whether the result should be a dict wit... |
Runs the model for n steps | def run_n_steps(self, current_state=None, n=1, labelled_states=False):
"""
Runs the model for n steps
Parameters
----------
current_state: 1D nd.array
Current model state.
n: int
Number of steps the model should be run for.
labe... | [
"def",
"run_n_steps",
"(",
"self",
",",
"current_state",
"=",
"None",
",",
"n",
"=",
"1",
",",
"labelled_states",
"=",
"False",
")",
":",
"if",
"current_state",
"is",
"None",
":",
"current_state",
"=",
"self",
".",
"_get_current_state",
"(",
")",
"# Use th... | [
211,
4
] | [
243,
39
] | python | en | ['en', 'error', 'th'] | False |
is_compiler | (given, expected) |
Return True if the 'given' compiler is the expected one.
>>> is_compiler('g++', 'g++')
True
>>> is_compiler('/home/g++', 'g++')
True
>>> is_compiler(os.path.join('home', 'g++'), 'g++')
True
>>> is_compiler('clang++', 'g++')
False
>>> is_compiler(os.path.join('home', 'clang++'), ... |
Return True if the 'given' compiler is the expected one.
>>> is_compiler('g++', 'g++')
True
>>> is_compiler('/home/g++', 'g++')
True
>>> is_compiler(os.path.join('home', 'g++'), 'g++')
True
>>> is_compiler('clang++', 'g++')
False
>>> is_compiler(os.path.join('home', 'clang++'), ... | def is_compiler(given, expected):
"""
Return True if the 'given' compiler is the expected one.
>>> is_compiler('g++', 'g++')
True
>>> is_compiler('/home/g++', 'g++')
True
>>> is_compiler(os.path.join('home', 'g++'), 'g++')
True
>>> is_compiler('clang++', 'g++')
False
>>> is_c... | [
"def",
"is_compiler",
"(",
"given",
",",
"expected",
")",
":",
"if",
"given",
"==",
"expected",
":",
"return",
"True",
"if",
"len",
"(",
"expected",
")",
"<",
"len",
"(",
"given",
")",
":",
"return",
"given",
"[",
"len",
"(",
"given",
")",
"-",
"le... | [
886,
0
] | [
904,
16
] | python | en | ['en', 'error', 'th'] | False |
DLLComponent.dll_file | (self) |
Return file name of component suitable for use in a Makefile
|
Return file name of component suitable for use in a Makefile
| def dll_file(self):
"""
Return file name of component suitable for use in a Makefile
"""
return '%s$(SO_EXT)' % self.dll_name | [
"def",
"dll_file",
"(",
"self",
")",
":",
"return",
"'%s$(SO_EXT)'",
"%",
"self",
".",
"dll_name"
] | [
1295,
4
] | [
1299,
44
] | python | en | ['en', 'error', 'th'] | False |
DLLComponent.install_path | (self) |
Return install location of component (relative to prefix)
suitable for use in a Makefile
|
Return install location of component (relative to prefix)
suitable for use in a Makefile
| def install_path(self):
"""
Return install location of component (relative to prefix)
suitable for use in a Makefile
"""
return os.path.join(INSTALL_LIB_DIR, self.dll_file()) | [
"def",
"install_path",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"INSTALL_LIB_DIR",
",",
"self",
".",
"dll_file",
"(",
")",
")"
] | [
1301,
4
] | [
1306,
61
] | python | en | ['en', 'error', 'th'] | False |
MLComponent._init_ocamlfind_paths | (self) |
Initialises self.destdir and self.ldconf
Do not call this from the MLComponent constructor because OCAMLFIND
has not been checked at that point
|
Initialises self.destdir and self.ldconf
Do not call this from the MLComponent constructor because OCAMLFIND
has not been checked at that point
| def _init_ocamlfind_paths(self):
"""
Initialises self.destdir and self.ldconf
Do not call this from the MLComponent constructor because OCAMLFIND
has not been checked at that point
"""
if self.destdir != "" and self.ldconf != "":
# Initialisation a... | [
"def",
"_init_ocamlfind_paths",
"(",
"self",
")",
":",
"if",
"self",
".",
"destdir",
"!=",
"\"\"",
"and",
"self",
".",
"ldconf",
"!=",
"\"\"",
":",
"# Initialisation already done",
"return",
"# Use Ocamlfind to get the default destdir and ldconf path",
"self",
".",
"d... | [
1874,
4
] | [
1893,
64
] | python | en | ['en', 'error', 'th'] | False |
get_settings_from_env | (controller_port=None,
visualization_server_image=None, frontend_image=None,
visualization_server_tag=None, frontend_tag=None, disable_istio_sidecar=None,
minio_access_key=None, minio_secret_key=None, kfp_default_pipeline_root=None) |
Returns a dict of settings from environment variables relevant to the controller
Environment settings can be overridden by passing them here as arguments.
Settings are pulled from the all-caps version of the setting name. The
following defaults are used if those environment variables are not set
... |
Returns a dict of settings from environment variables relevant to the controller | def get_settings_from_env(controller_port=None,
visualization_server_image=None, frontend_image=None,
visualization_server_tag=None, frontend_tag=None, disable_istio_sidecar=None,
minio_access_key=None, minio_secret_key=None, kfp_default_pipe... | [
"def",
"get_settings_from_env",
"(",
"controller_port",
"=",
"None",
",",
"visualization_server_image",
"=",
"None",
",",
"frontend_image",
"=",
"None",
",",
"visualization_server_tag",
"=",
"None",
",",
"frontend_tag",
"=",
"None",
",",
"disable_istio_sidecar",
"=",
... | [
26,
0
] | [
89,
19
] | python | en | ['en', 'error', 'th'] | False |
server_factory | (visualization_server_image,
visualization_server_tag, frontend_image, frontend_tag,
disable_istio_sidecar, minio_access_key,
minio_secret_key, kfp_default_pipeline_root=None,
url="", controller_port=8080) |
Returns an HTTPServer populated with Handler with customized settings
|
Returns an HTTPServer populated with Handler with customized settings
| def server_factory(visualization_server_image,
visualization_server_tag, frontend_image, frontend_tag,
disable_istio_sidecar, minio_access_key,
minio_secret_key, kfp_default_pipeline_root=None,
url="", controller_port=8080):
"""
Return... | [
"def",
"server_factory",
"(",
"visualization_server_image",
",",
"visualization_server_tag",
",",
"frontend_image",
",",
"frontend_tag",
",",
"disable_istio_sidecar",
",",
"minio_access_key",
",",
"minio_secret_key",
",",
"kfp_default_pipeline_root",
"=",
"None",
",",
"url"... | [
92,
0
] | [
371,
62
] | python | en | ['en', 'error', 'th'] | False |
simple_get | (url) |
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, return the
text content, otherwise return None.
|
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, return the
text content, otherwise return None.
| def simple_get(url):
"""
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, return the
text content, otherwise return None.
"""
try:
with closing(get(url, stream=True)) as resp:
if is_good_response(res... | [
"def",
"simple_get",
"(",
"url",
")",
":",
"try",
":",
"with",
"closing",
"(",
"get",
"(",
"url",
",",
"stream",
"=",
"True",
")",
")",
"as",
"resp",
":",
"if",
"is_good_response",
"(",
"resp",
")",
":",
"return",
"resp",
".",
"content",
"else",
":... | [
24,
0
] | [
39,
19
] | python | en | ['en', 'error', 'th'] | False |
is_good_response | (resp) |
Returns True if the response seems to be HTML, False otherwise.
|
Returns True if the response seems to be HTML, False otherwise.
| def is_good_response(resp):
"""
Returns True if the response seems to be HTML, False otherwise.
"""
content_type = resp.headers['Content-Type'].lower()
return (resp.status_code == 200
and content_type is not None
and content_type.find('html') > -1) | [
"def",
"is_good_response",
"(",
"resp",
")",
":",
"content_type",
"=",
"resp",
".",
"headers",
"[",
"'Content-Type'",
"]",
".",
"lower",
"(",
")",
"return",
"(",
"resp",
".",
"status_code",
"==",
"200",
"and",
"content_type",
"is",
"not",
"None",
"and",
... | [
42,
0
] | [
49,
47
] | python | en | ['en', 'error', 'th'] | False |
feature | (self, node="clickhouse1") | Check create role query syntax.
```sql
CREATE ROLE [IF NOT EXISTS | OR REPLACE] name
[SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
```
| Check create role query syntax. | def feature(self, node="clickhouse1"):
"""Check create role query syntax.
```sql
CREATE ROLE [IF NOT EXISTS | OR REPLACE] name
[SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY|WRITABLE] | PROFILE 'profile_name'] [,...]
```
"""
node = self.context.cluster.node(n... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"cleanup",
"(",
"role",
")",
":",
"try",
":",
"with",
"Giv... | [
10,
0
] | [
123,
91
] | python | en | ['fr', 'en', 'en'] | True |
TestFlushBase.test_flush_collection_not_existed | (self, connect, collection) |
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
|
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
| def test_flush_collection_not_existed(self, connect, collection):
'''
target: test delete vector, params collection_name not existed
method: add vector and delete
expected: status not ok
'''
collection_new = gen_unique_str()
status = connect.flush([collection_new]... | [
"def",
"test_flush_collection_not_existed",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"collection_new",
"=",
"gen_unique_str",
"(",
")",
"status",
"=",
"connect",
".",
"flush",
"(",
"[",
"collection_new",
"]",
")",
"assert",
"not",
"status",
".... | [
38,
4
] | [
46,
30
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_flush_empty_collection | (self, connect, collection) |
method: flush collection with no vectors
expected: status ok
|
method: flush collection with no vectors
expected: status ok
| def test_flush_empty_collection(self, connect, collection):
'''
method: flush collection with no vectors
expected: status ok
'''
status = connect.flush([collection])
assert status.OK() | [
"def",
"test_flush_empty_collection",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"status",
"=",
"connect",
".",
"flush",
"(",
"[",
"collection",
"]",
")",
"assert",
"status",
".",
"OK",
"(",
")"
] | [
48,
4
] | [
54,
26
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_add_partition_flush | (self, connect, collection) |
method: add vectors into partition in collection, flush serveral times
expected: status ok
|
method: add vectors into partition in collection, flush serveral times
expected: status ok
| def test_add_partition_flush(self, connect, collection):
'''
method: add vectors into partition in collection, flush serveral times
expected: status ok
'''
vectors = gen_vector(nb, dim)
status = connect.create_partition(collection, tag)
vectors = gen_vectors(nb, d... | [
"def",
"test_add_partition_flush",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vector",
"(",
"nb",
",",
"dim",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"collection",
",",
"tag",
")",
"vectors",
"=",
"g... | [
56,
4
] | [
74,
28
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_add_partitions_flush | (self, connect, collection) |
method: add vectors into partitions in collection, flush one
expected: status ok
|
method: add vectors into partitions in collection, flush one
expected: status ok
| def test_add_partitions_flush(self, connect, collection):
'''
method: add vectors into partitions in collection, flush one
expected: status ok
'''
vectors = gen_vectors(nb, dim)
tag_new = gen_unique_str()
status = connect.create_partition(collection, tag)
... | [
"def",
"test_add_partitions_flush",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"tag_new",
"=",
"gen_unique_str",
"(",
")",
"status",
"=",
"connect",
".",
"create_partition",
"(",
"coll... | [
76,
4
] | [
94,
28
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_add_collections_flush | (self, connect, collection) |
method: add vectors into collections, flush one
expected: status ok
|
method: add vectors into collections, flush one
expected: status ok
| def test_add_collections_flush(self, connect, collection):
'''
method: add vectors into collections, flush one
expected: status ok
'''
vectors = gen_vectors(nb, dim)
collection_new = gen_unique_str()
param = {'collection_name': collection_new,
'dimensi... | [
"def",
"test_add_collections_flush",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"collection_new",
"=",
"gen_unique_str",
"(",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collectio... | [
96,
4
] | [
121,
24
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_add_flush_multiable_times | (self, connect, collection) |
method: add vectors, flush serveral times
expected: status ok
|
method: add vectors, flush serveral times
expected: status ok
| def test_add_flush_multiable_times(self, connect, collection):
'''
method: add vectors, flush serveral times
expected: status ok
'''
vectors = gen_vectors(nb, dim)
status, ids = connect.insert(collection, vectors)
assert status.OK()
for i in range(10):
... | [
"def",
"test_add_flush_multiable_times",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
"asse... | [
123,
4
] | [
136,
26
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_add_flush_auto | (self, connect, collection) |
method: add vectors
expected: status ok
|
method: add vectors
expected: status ok
| def test_add_flush_auto(self, connect, collection):
'''
method: add vectors
expected: status ok
'''
vectors = gen_vectors(nb, dim)
ids = [i for i in range(nb)]
status, ids = connect.insert(collection, vectors, ids)
assert status.OK()
timeout = 10
... | [
"def",
"test_add_flush_auto",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"ids",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"nb",
")",
"]",
"status",
",",
"ids",
"=",
"con... | [
139,
4
] | [
157,
24
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_add_flush_same_ids | (self, connect, collection, same_ids) |
method: add vectors, with same ids, count(same ids) < 15, > 15
expected: status ok
|
method: add vectors, with same ids, count(same ids) < 15, > 15
expected: status ok
| def test_add_flush_same_ids(self, connect, collection, same_ids):
'''
method: add vectors, with same ids, count(same ids) < 15, > 15
expected: status ok
'''
vectors = gen_vectors(nb, dim)
ids = [i for i in range(nb)]
for i, item in enumerate(ids):
if i... | [
"def",
"test_add_flush_same_ids",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"same_ids",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"ids",
"=",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"nb",
")",
"]",
"for",
"i",
... | [
169,
4
] | [
184,
24
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase.test_delete_flush_multiable_times | (self, connect, collection) |
method: delete vectors, flush serveral times
expected: status ok
|
method: delete vectors, flush serveral times
expected: status ok
| def test_delete_flush_multiable_times(self, connect, collection):
'''
method: delete vectors, flush serveral times
expected: status ok
'''
vectors = gen_vectors(nb, dim)
status, ids = connect.insert(collection, vectors)
assert status.OK()
status = connect.... | [
"def",
"test_delete_flush_multiable_times",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"vectors",
"=",
"gen_vectors",
"(",
"nb",
",",
"dim",
")",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
"a... | [
186,
4
] | [
201,
26
] | python | en | ['en', 'error', 'th'] | False |
TestFlushBase._test_collection_count_during_flush | (self, connect, args) |
method: flush collection at background, call `count_entities`
expected: status ok
|
method: flush collection at background, call `count_entities`
expected: status ok
| def _test_collection_count_during_flush(self, connect, args):
'''
method: flush collection at background, call `count_entities`
expected: status ok
'''
collection = gen_unique_str()
param = {'collection_name': collection,
'dimension': dim,
... | [
"def",
"_test_collection_count_during_flush",
"(",
"self",
",",
"connect",
",",
"args",
")",
":",
"collection",
"=",
"gen_unique_str",
"(",
")",
"param",
"=",
"{",
"'collection_name'",
":",
"collection",
",",
"'dimension'",
":",
"dim",
",",
"'index_file_size'",
... | [
204,
4
] | [
232,
23
] | python | en | ['en', 'error', 'th'] | False |
TestFlushAsync.test_flush_empty_collection | (self, connect, collection) |
method: flush collection with no vectors
expected: status ok
|
method: flush collection with no vectors
expected: status ok
| def test_flush_empty_collection(self, connect, collection):
'''
method: flush collection with no vectors
expected: status ok
'''
future = connect.flush([collection], _async=True)
status = future.result()
assert status.OK() | [
"def",
"test_flush_empty_collection",
"(",
"self",
",",
"connect",
",",
"collection",
")",
":",
"future",
"=",
"connect",
".",
"flush",
"(",
"[",
"collection",
"]",
",",
"_async",
"=",
"True",
")",
"status",
"=",
"future",
".",
"result",
"(",
")",
"asser... | [
250,
4
] | [
257,
26
] | python | en | ['en', 'error', 'th'] | False |
regression | (self, local, clickhouse_binary_path, parallel=None, stress=None) | ClickHouse LDAP integration regression module.
| ClickHouse LDAP integration regression module.
| def regression(self, local, clickhouse_binary_path, parallel=None, stress=None):
"""ClickHouse LDAP integration regression module.
"""
top().terminating = False
args = {"local": local, "clickhouse_binary_path": clickhouse_binary_path}
if stress is not None:
self.context.stress = stress
... | [
"def",
"regression",
"(",
"self",
",",
"local",
",",
"clickhouse_binary_path",
",",
"parallel",
"=",
"None",
",",
"stress",
"=",
"None",
")",
":",
"top",
"(",
")",
".",
"terminating",
"=",
"False",
"args",
"=",
"{",
"\"local\"",
":",
"local",
",",
"\"c... | [
12,
0
] | [
30,
23
] | python | en | ['en', 'ca', 'en'] | True |
main | () | Manage test data for Ibis | Manage test data for Ibis | def main():
"""Manage test data for Ibis"""
pass | [
"def",
"main",
"(",
")",
":",
"pass"
] | [
211,
0
] | [
213,
8
] | python | en | ['en', 'en', 'en'] | True |
load | (data, udf, data_dir, overwrite) | Load Ibis test data and build/upload UDFs | Load Ibis test data and build/upload UDFs | def load(data, udf, data_dir, overwrite):
"""Load Ibis test data and build/upload UDFs"""
con = make_ibis_client(ENV)
# validate our environment before performing possibly expensive operations
if not can_write_to_hdfs(con):
raise IbisError('Failed to write to HDFS; check your settings')
if ... | [
"def",
"load",
"(",
"data",
",",
"udf",
",",
"data_dir",
",",
"overwrite",
")",
":",
"con",
"=",
"make_ibis_client",
"(",
"ENV",
")",
"# validate our environment before performing possibly expensive operations",
"if",
"not",
"can_write_to_hdfs",
"(",
"con",
")",
":"... | [
234,
0
] | [
264,
57
] | python | en | ['en', 'en', 'en'] | True |
cleanup | (test_data, udfs, tmp_data, tmp_db) | Cleanup Ibis test data and UDFs | Cleanup Ibis test data and UDFs | def cleanup(test_data, udfs, tmp_data, tmp_db):
"""Cleanup Ibis test data and UDFs"""
con = make_ibis_client(ENV)
if udfs:
# this comes before test_data bc the latter clobbers this too
con.hdfs.rmdir(os.path.join(ENV.test_data_dir, 'udf'))
if test_data:
con.drop_database(ENV.te... | [
"def",
"cleanup",
"(",
"test_data",
",",
"udfs",
",",
"tmp_data",
",",
"tmp_db",
")",
":",
"con",
"=",
"make_ibis_client",
"(",
"ENV",
")",
"if",
"udfs",
":",
"# this comes before test_data bc the latter clobbers this too",
"con",
".",
"hdfs",
".",
"rmdir",
"(",... | [
307,
0
] | [
323,
49
] | python | en | ['en', 'en', 'en'] | True |
privilege_granted_directly_or_via_role | (self, node=None) | Check that user is only able to execute DROP TABLE when they have required privilege, either directly or via role.
| Check that user is only able to execute DROP TABLE when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, node=None):
"""Check that user is only able to execute DROP TABLE when they have required privilege, either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
node = self.context.node
... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node... | [
5,
0
] | [
27,
92
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, node=None) | Run scenarios to check the user's access with different privileges.
| Run scenarios to check the user's access with different privileges.
| def privilege_check(grant_target_name, user_name, node=None):
"""Run scenarios to check the user's access with different privileges.
"""
exitcode, message = errors.not_enough_privileges(name=f"{user_name}")
with Scenario("user without privilege"):
table_name = f"table_{getuid()}"
try:
... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"with",
"Scenario",
"(",
"\"user without... | [
29,
0
] | [
127,
64
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of DROP TABLE.
| Check the RBAC functionality of DROP TABLE.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of DROP TABLE.
"""
self.context.node = self.context.cluster.node(node)
if parallel is not None:
self.context.parallel = parallel
if stress is not None:
self.context.stress = stress
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
... | [
136,
0
] | [
147,
48
] | python | en | ['en', 'en', 'en'] | True |
find_immediate_parent_tables | (expr) | Find every first occurrence of a :class:`ibis.expr.types.TableExpr`
object in `expr`.
Parameters
----------
expr : ir.Expr
Yields
------
e : ir.Expr
Notes
-----
This function does not traverse into TableExpr objects. This means that the
underlying PhysicalTable of a Select... | Find every first occurrence of a :class:`ibis.expr.types.TableExpr`
object in `expr`. | def find_immediate_parent_tables(expr):
"""Find every first occurrence of a :class:`ibis.expr.types.TableExpr`
object in `expr`.
Parameters
----------
expr : ir.Expr
Yields
------
e : ir.Expr
Notes
-----
This function does not traverse into TableExpr objects. This means th... | [
"def",
"find_immediate_parent_tables",
"(",
"expr",
")",
":",
"def",
"finder",
"(",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"ir",
".",
"TableExpr",
")",
":",
"return",
"lin",
".",
"halt",
",",
"expr",
"else",
":",
"return",
"lin",
".",
... | [
179,
0
] | [
229,
37
] | python | en | ['en', 'en', 'en'] | True |
has_reduction | (expr) | Does `expr` contain a reduction?
Parameters
----------
expr : ibis.expr.types.Expr
An ibis expression
Returns
-------
truth_value : bool
Whether or not there's at least one reduction in `expr`
Notes
-----
The ``isinstance(op, ops.TableNode)`` check in this function... | Does `expr` contain a reduction? | def has_reduction(expr):
"""Does `expr` contain a reduction?
Parameters
----------
expr : ibis.expr.types.Expr
An ibis expression
Returns
-------
truth_value : bool
Whether or not there's at least one reduction in `expr`
Notes
-----
The ``isinstance(op, ops.Tab... | [
"def",
"has_reduction",
"(",
"expr",
")",
":",
"def",
"fn",
"(",
"expr",
")",
":",
"op",
"=",
"expr",
".",
"op",
"(",
")",
"if",
"isinstance",
"(",
"op",
",",
"ops",
".",
"TableNode",
")",
":",
"# don't go below any table nodes",
"return",
"lin",
".",
... | [
478,
0
] | [
505,
32
] | python | en | ['en', 'en', 'en'] | True |
find_source_table | (expr) | Find the first table expression observed for each argument that the
expression depends on
Parameters
----------
expr : ir.Expr
Returns
-------
table_expr : ir.TableExpr
Examples
--------
>>> import ibis
>>> t = ibis.table([('a', 'double'), ('b', 'string')], name='t')
>... | Find the first table expression observed for each argument that the
expression depends on | def find_source_table(expr):
"""Find the first table expression observed for each argument that the
expression depends on
Parameters
----------
expr : ir.Expr
Returns
-------
table_expr : ir.TableExpr
Examples
--------
>>> import ibis
>>> t = ibis.table([('a', 'double'... | [
"def",
"find_source_table",
"(",
"expr",
")",
":",
"def",
"finder",
"(",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"ir",
".",
"TableExpr",
")",
":",
"return",
"lin",
".",
"halt",
",",
"expr",
"else",
":",
"return",
"lin",
".",
"proceed"... | [
948,
0
] | [
1010,
21
] | python | en | ['en', 'en', 'en'] | True |
flatten_predicate | (expr) | Yield the expressions corresponding to the `And` nodes of a predicate.
Parameters
----------
expr : ir.BooleanColumn
Returns
-------
exprs : List[ir.BooleanColumn]
Examples
--------
>>> import ibis
>>> t = ibis.table([('a', 'int64'), ('b', 'string')], name='t')
>>> filt = ... | Yield the expressions corresponding to the `And` nodes of a predicate. | def flatten_predicate(expr):
"""Yield the expressions corresponding to the `And` nodes of a predicate.
Parameters
----------
expr : ir.BooleanColumn
Returns
-------
exprs : List[ir.BooleanColumn]
Examples
--------
>>> import ibis
>>> t = ibis.table([('a', 'int64'), ('b', '... | [
"def",
"flatten_predicate",
"(",
"expr",
")",
":",
"def",
"predicate",
"(",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
".",
"op",
"(",
")",
",",
"ops",
".",
"And",
")",
":",
"return",
"lin",
".",
"proceed",
",",
"None",
"else",
":",
"return... | [
1013,
0
] | [
1067,
69
] | python | en | ['en', 'en', 'en'] | True |
is_reduction | (expr) | Check whether an expression is a reduction or not
Aggregations yield typed scalar expressions, since the result of an
aggregation is a single value. When creating an table expression
containing a GROUP BY equivalent, we need to be able to easily check
that we are looking at the result of an aggregation... | Check whether an expression is a reduction or not | def is_reduction(expr):
"""Check whether an expression is a reduction or not
Aggregations yield typed scalar expressions, since the result of an
aggregation is a single value. When creating an table expression
containing a GROUP BY equivalent, we need to be able to easily check
that we are looking ... | [
"def",
"is_reduction",
"(",
"expr",
")",
":",
"def",
"has_reduction",
"(",
"op",
")",
":",
"if",
"getattr",
"(",
"op",
",",
"'_reduction'",
",",
"False",
")",
":",
"return",
"True",
"for",
"arg",
"in",
"op",
".",
"args",
":",
"if",
"isinstance",
"(",... | [
1086,
0
] | [
1123,
74
] | python | en | ['en', 'en', 'en'] | True |
Substitutor._substitute | (self, expr, mapping) | Substitute expressions with other expressions.
Parameters
----------
expr : ibis.expr.types.Expr
mapping : Dict, OrderedDict
Returns
-------
new_expr : ibis.expr.types.Expr
| Substitute expressions with other expressions. | def _substitute(self, expr, mapping):
"""Substitute expressions with other expressions.
Parameters
----------
expr : ibis.expr.types.Expr
mapping : Dict, OrderedDict
Returns
-------
new_expr : ibis.expr.types.Expr
"""
node = expr.op()
... | [
"def",
"_substitute",
"(",
"self",
",",
"expr",
",",
"mapping",
")",
":",
"node",
"=",
"expr",
".",
"op",
"(",
")",
"key",
"=",
"repr",
"(",
"node",
")",
"if",
"key",
"in",
"mapping",
":",
"return",
"mapping",
"[",
"key",
"]",
"if",
"node",
".",
... | [
57,
4
] | [
94,
49
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `SHOW QUOTAS` with privileges are granted directly.
| Check that a user is able to execute `SHOW QUOTAS` with privileges are granted directly.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `SHOW QUOTAS` 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_... | [
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 QUOTAS` with privileges are granted through a role.
| Check that a user is able to execute `SHOW QUOTAS` with privileges are granted through a role.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `SHOW QUOTAS` 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"... | [
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 QUOTAS privilege.
| Run checks for commands that require SHOW QUOTAS privilege.
| def check_privilege(self, privilege, grant_target_name, user_name, node=None):
"""Run checks for commands that require SHOW QUOTAS privilege.
"""
if node is None:
node = self.context.node
Suite(test=show_quotas)(privilege=privilege, grant_target_name=grant_target_name, user_name=user_name)
... | [
"def",
"check_privilege",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"Suite",
"(",
"test",
"=",
"show... | [
65,
0
] | [
73,
106
] | python | en | ['en', 'en', 'en'] | True |
show_quotas | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `SHOW QUOTAS` when they have the necessary privilege.
| Check that user is only able to execute `SHOW QUOTAS` when they have the necessary privilege.
| def show_quotas(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `SHOW QUOTAS` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
with Sc... | [
"def",
"show_quotas",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
... | [
79,
0
] | [
117,
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 QUOTA` when they have the necessary privilege.
| Check that user is only able to execute `SHOW CREATE QUOTA` 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 QUOTA` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
w... | [
"def",
"show_create",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
... | [
123,
0
] | [
170,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of SHOW QUOTAS.
| Check the RBAC functionality of SHOW QUOTAS.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of SHOW QUOTAS.
"""
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",
",",
... | [
179,
0
] | [
185,
82
] | python | en | ['en', 'en', 'en'] | True |
IndexRoute.get | (self, request: Request) |
Return a hello from Python Discord forms!
|
Return a hello from Python Discord forms!
| def get(self, request: Request) -> JSONResponse:
"""
Return a hello from Python Discord forms!
"""
response_data = {
"message": "Hello, world!",
"client": request.client.host,
"user": {
"authenticated": False
},
... | [
"def",
"get",
"(",
"self",
",",
"request",
":",
"Request",
")",
"->",
"JSONResponse",
":",
"response_data",
"=",
"{",
"\"message\"",
":",
"\"Hello, world!\"",
",",
"\"client\"",
":",
"request",
".",
"client",
".",
"host",
",",
"\"user\"",
":",
"{",
"\"auth... | [
43,
4
] | [
64,
42
] | python | en | ['en', 'error', 'th'] | False |
get_params | (config_id, expe_name=None) |
Get experiment parameters.
Parameters
----------
config_id: str
Name of the config.
expe_name: str
Name of the experiment, optional.
Returns
-------
params: dict
Dictionary of experiment parameters.
|
Get experiment parameters. | def get_params(config_id, expe_name=None):
"""
Get experiment parameters.
Parameters
----------
config_id: str
Name of the config.
expe_name: str
Name of the experiment, optional.
Returns
-------
params: dict
Dictionary of experiment parameters.
"""
... | [
"def",
"get_params",
"(",
"config_id",
",",
"expe_name",
"=",
"None",
")",
":",
"if",
"config_id",
"==",
"'dqn'",
":",
"from",
"epidemioptim",
".",
"configs",
".",
"dqn",
"import",
"params",
"elif",
"config_id",
"==",
"'goal_dqn'",
":",
"from",
"epidemioptim... | [
1,
0
] | [
30,
17
] | python | en | ['en', 'error', 'th'] | False |
_sign | (translator, expr) | Workaround for missing sign function | Workaround for missing sign function | def _sign(translator, expr):
"""Workaround for missing sign function"""
op = expr.op()
arg, = op.args
arg_ = translator.translate(arg)
return 'intDivOrZero({0}, abs({0}))'.format(arg_) | [
"def",
"_sign",
"(",
"translator",
",",
"expr",
")",
":",
"op",
"=",
"expr",
".",
"op",
"(",
")",
"arg",
",",
"=",
"op",
".",
"args",
"arg_",
"=",
"translator",
".",
"translate",
"(",
"arg",
")",
"return",
"'intDivOrZero({0}, abs({0}))'",
".",
"format"... | [
208,
0
] | [
213,
53
] | 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.