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
TestAddBase.test_collection_add_rows_count_multi_threading
(self, args, collection)
target: test collection rows_count is correct or not with multi threading method: create collection and add vectors in it(idmap), assert the value returned by count_entities method is equal to length of vectors expected: the count is equal to the length of vectors
target: test collection rows_count is correct or not with multi threading method: create collection and add vectors in it(idmap), assert the value returned by count_entities method is equal to length of vectors expected: the count is equal to the length of vectors
def test_collection_add_rows_count_multi_threading(self, args, collection): ''' target: test collection rows_count is correct or not with multi threading method: create collection and add vectors in it(idmap), assert the value returned by count_entities method is equal to length of v...
[ "def", "test_collection_add_rows_count_multi_threading", "(", "self", ",", "args", ",", "collection", ")", ":", "if", "args", "[", "\"handler\"", "]", "==", "\"HTTP\"", ":", "pytest", ".", "skip", "(", "\"Skip test in http mode\"", ")", "thread_num", "=", "8", "...
[ 584, 4 ]
[ 612, 37 ]
python
en
['en', 'error', 'th']
False
TestAddBase.test_add_vector_multi_collections
(self, connect)
target: test add vectors is correct or not with multiple collections of L2 method: create 50 collections and add vectors into them in turn expected: status ok
target: test add vectors is correct or not with multiple collections of L2 method: create 50 collections and add vectors into them in turn expected: status ok
def test_add_vector_multi_collections(self, connect): ''' target: test add vectors is correct or not with multiple collections of L2 method: create 50 collections and add vectors into them in turn expected: status ok ''' nq = 100 vectors = gen_vectors(nq, dim) ...
[ "def", "test_add_vector_multi_collections", "(", "self", ",", "connect", ")", ":", "nq", "=", "100", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "collection_list", "=", "[", "]", "for", "i", "in", "range", "(", "20", ")", ":", "collection_...
[ 614, 4 ]
[ 634, 34 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async
(self, connect, collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async(self, connect, collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count insert_...
[ "def", "test_insert_async", "(", "self", ",", "connect", ",", "collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "future", "=", "connect", ".", "insert", "(", "collection...
[ 661, 4 ]
[ 673, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async_false
(self, connect, collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async_false(self, connect, collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count i...
[ "def", "test_insert_async_false", "(", "self", ",", "connect", ",", "collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert"...
[ 676, 4 ]
[ 687, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async_callback
(self, connect, collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async_callback(self, connect, collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count ...
[ "def", "test_insert_async_callback", "(", "self", ",", "connect", ",", "collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "future", "=", "connect", ".", "insert", "(", "c...
[ 689, 4 ]
[ 698, 21 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async_long
(self, connect, collection)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async_long(self, connect, collection): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = 50000 insert_vec_list = gen_v...
[ "def", "test_insert_async_long", "(", "self", ",", "connect", ",", "collection", ")", ":", "nb", "=", "50000", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "future", "=", "connect", ".", "insert", "(", "collection", ",", "insert_vec_lis...
[ 701, 4 ]
[ 718, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async_callback_timeout
(self, connect, collection)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async_callback_timeout(self, connect, collection): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = 100000 insert_vec...
[ "def", "test_insert_async_callback_timeout", "(", "self", ",", "connect", ",", "collection", ")", ":", "nb", "=", "100000", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "future", "=", "connect", ".", "insert", "(", "collection", ",", "i...
[ 720, 4 ]
[ 729, 21 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async_invalid_params
(self, connect, collection)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async_invalid_params(self, connect, collection): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' insert_vec_list = gen_vectors(nb...
[ "def", "test_insert_async_invalid_params", "(", "self", ",", "connect", ",", "collection", ")", ":", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "collection_new", "=", "gen_unique_str", "(", ")", "future", "=", "connect", ".", "insert", ...
[ 731, 4 ]
[ 741, 30 ]
python
en
['en', 'error', 'th']
False
TestAddAsync.test_insert_async_invalid_params_raise_exception
(self, connect, collection)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_async_invalid_params_raise_exception(self, connect, collection): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' insert_vec_list ...
[ "def", "test_insert_async_invalid_params_raise_exception", "(", "self", ",", "connect", ",", "collection", ")", ":", "insert_vec_list", "=", "[", "]", "collection_new", "=", "gen_unique_str", "(", ")", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", ...
[ 744, 4 ]
[ 753, 81 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_create_collection
(self, connect, ip_collection)
target: test add vector, then create collection again method: add vector and create collection expected: status not ok
target: test add vector, then create collection again method: add vector and create collection expected: status not ok
def test_add_vector_create_collection(self, connect, ip_collection): ''' target: test add vector, then create collection again method: add vector and create collection expected: status not ok ''' vector = gen_single_vector(dim) status, ids = connect.insert(ip_coll...
[ "def", "test_add_vector_create_collection", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector", ")", "param"...
[ 774, 4 ]
[ 787, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_has_collection
(self, connect, ip_collection)
target: test add vector, then check collection existence method: add vector and call Hascollection expected: collection exists, status ok
target: test add vector, then check collection existence method: add vector and call Hascollection expected: collection exists, status ok
def test_add_vector_has_collection(self, connect, ip_collection): ''' target: test add vector, then check collection existence method: add vector and call Hascollection expected: collection exists, status ok ''' vector = gen_single_vector(dim) status, ids = connec...
[ "def", "test_add_vector_has_collection", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector", ")", "assert", ...
[ 789, 4 ]
[ 797, 60 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_drop_collection_add_vector
(self, connect, ip_collection)
target: test add vector after collection deleted method: delete collection and add vector expected: status not ok
target: test add vector after collection deleted method: delete collection and add vector expected: status not ok
def test_drop_collection_add_vector(self, connect, ip_collection): ''' target: test add vector after collection deleted method: delete collection and add vector expected: status not ok ''' status = connect.drop_collection(ip_collection) vector = gen_single_vector(...
[ "def", "test_drop_collection_add_vector", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "status", "=", "connect", ".", "drop_collection", "(", "ip_collection", ")", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", ...
[ 800, 4 ]
[ 809, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_drop_collection_add_vector_another
(self, connect, ip_collection)
target: test add vector to collection_1 after collection_2 deleted method: delete collection_2 and add vector to collection_1 expected: status ok
target: test add vector to collection_1 after collection_2 deleted method: delete collection_2 and add vector to collection_1 expected: status ok
def test_drop_collection_add_vector_another(self, connect, ip_collection): ''' target: test add vector to collection_1 after collection_2 deleted method: delete collection_2 and add vector to collection_1 expected: status ok ''' param = {'collection_name': gen_unique_str(...
[ "def", "test_drop_collection_add_vector_another", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "param", "=", "{", "'collection_name'", ":", "gen_unique_str", "(", ")", ",", "'dimension'", ":", "dim", ",", "'index_file_size'", ":", "index_file_size", ...
[ 812, 4 ]
[ 826, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_drop_collection
(self, connect, ip_collection)
target: test delete collection after add vector method: add vector and delete collection expected: status ok
target: test delete collection after add vector method: add vector and delete collection expected: status ok
def test_add_vector_drop_collection(self, connect, ip_collection): ''' target: test delete collection after add vector method: add vector and delete collection expected: status ok ''' vector = gen_single_vector(dim) status, ids = connect.insert(ip_collection, vect...
[ "def", "test_add_vector_drop_collection", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector", ")", "status",...
[ 829, 4 ]
[ 838, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_delete_another_collection
(self, connect, ip_collection)
target: test delete collection_1 collection after add vector to collection_2 method: add vector and delete collection expected: status ok
target: test delete collection_1 collection after add vector to collection_2 method: add vector and delete collection expected: status ok
def test_add_vector_delete_another_collection(self, connect, ip_collection): ''' target: test delete collection_1 collection after add vector to collection_2 method: add vector and delete collection expected: status ok ''' param = {'collection_name': 'test_add_vector_dele...
[ "def", "test_add_vector_delete_another_collection", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "param", "=", "{", "'collection_name'", ":", "'test_add_vector_delete_another_collection'", ",", "'dimension'", ":", "dim", ",", "'index_file_size'", ":", "i...
[ 841, 4 ]
[ 855, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_sleep_drop_collection
(self, connect, ip_collection)
target: test delete collection after add vector for a while method: add vector, sleep, and delete collection expected: status ok
target: test delete collection after add vector for a while method: add vector, sleep, and delete collection expected: status ok
def test_add_vector_sleep_drop_collection(self, connect, ip_collection): ''' target: test delete collection after add vector for a while method: add vector, sleep, and delete collection expected: status ok ''' vector = gen_single_vector(dim) status, ids = connect....
[ "def", "test_add_vector_sleep_drop_collection", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector", ")", "co...
[ 858, 4 ]
[ 868, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_sleep_delete_another_collection
(self, connect, ip_collection)
target: test delete collection_1 collection after add vector to collection_2 for a while method: add vector , sleep, and delete collection expected: status ok
target: test delete collection_1 collection after add vector to collection_2 for a while method: add vector , sleep, and delete collection expected: status ok
def test_add_vector_sleep_delete_another_collection(self, connect, ip_collection): ''' target: test delete collection_1 collection after add vector to collection_2 for a while method: add vector , sleep, and delete collection expected: status ok ''' param = {'collection_n...
[ "def", "test_add_vector_sleep_delete_another_collection", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "param", "=", "{", "'collection_name'", ":", "gen_unique_str", "(", ")", ",", "'dimension'", ":", "dim", ",", "'index_file_size'", ":", "index_file...
[ 871, 4 ]
[ 886, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_create_index_add_vector
(self, connect, ip_collection, get_simple_index)
target: test add vector after build index method: build index and add vector expected: status ok
target: test add vector after build index method: build index and add vector expected: status ok
def test_create_index_add_vector(self, connect, ip_collection, get_simple_index): ''' target: test add vector after build index method: build index and add vector expected: status ok ''' index_param = get_simple_index["index_param"] index_type = get_simple_index["...
[ "def", "test_create_index_add_vector", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", "status...
[ 889, 4 ]
[ 900, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_create_index_add_vector_another
(self, connect, ip_collection, get_simple_index)
target: test add vector to collection_2 after build index for collection_1 method: build index and add vector expected: status ok
target: test add vector to collection_2 after build index for collection_1 method: build index and add vector expected: status ok
def test_create_index_add_vector_another(self, connect, ip_collection, get_simple_index): ''' target: test add vector to collection_2 after build index for collection_1 method: build index and add vector expected: status ok ''' index_param = get_simple_index["index_param"...
[ "def", "test_create_index_add_vector_another", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", ...
[ 903, 4 ]
[ 919, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_create_index
(self, connect, ip_collection, get_simple_index)
target: test build index add after vector method: add vector and build index expected: status ok
target: test build index add after vector method: add vector and build index expected: status ok
def test_add_vector_create_index(self, connect, ip_collection, get_simple_index): ''' target: test build index add after vector method: add vector and build index expected: status ok ''' index_param = get_simple_index["index_param"] index_type = get_simple_index["...
[ "def", "test_add_vector_create_index", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", "vector...
[ 922, 4 ]
[ 938, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_create_index_another
(self, connect, ip_collection, get_simple_index)
target: test add vector to collection_2 after build index for collection_1 method: build index and add vector expected: status ok
target: test add vector to collection_2 after build index for collection_1 method: build index and add vector expected: status ok
def test_add_vector_create_index_another(self, connect, ip_collection, get_simple_index): ''' target: test add vector to collection_2 after build index for collection_1 method: build index and add vector expected: status ok ''' index_param = get_simple_index["index_param"...
[ "def", "test_add_vector_create_index_another", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", ...
[ 941, 4 ]
[ 957, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_sleep_create_index
(self, connect, ip_collection, get_simple_index)
target: test build index add after vector for a while method: add vector and build index expected: status ok
target: test build index add after vector for a while method: add vector and build index expected: status ok
def test_add_vector_sleep_create_index(self, connect, ip_collection, get_simple_index): ''' target: test build index add after vector for a while method: add vector and build index expected: status ok ''' index_param = get_simple_index["index_param"] index_type = ...
[ "def", "test_add_vector_sleep_create_index", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", "...
[ 960, 4 ]
[ 975, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_sleep_create_index_another
(self, connect, ip_collection, get_simple_index)
target: test add vector to collection_2 after build index for collection_1 for a while method: build index and add vector expected: status ok
target: test add vector to collection_2 after build index for collection_1 for a while method: build index and add vector expected: status ok
def test_add_vector_sleep_create_index_another(self, connect, ip_collection, get_simple_index): ''' target: test add vector to collection_2 after build index for collection_1 for a while method: build index and add vector expected: status ok ''' index_param = get_simple_i...
[ "def", "test_add_vector_sleep_create_index_another", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", ...
[ 978, 4 ]
[ 995, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_search_vector_add_vector
(self, connect, ip_collection)
target: test add vector after search collection method: search collection and add vector expected: status ok
target: test add vector after search collection method: search collection and add vector expected: status ok
def test_search_vector_add_vector(self, connect, ip_collection): ''' target: test add vector after search collection method: search collection and add vector expected: status ok ''' vector = gen_single_vector(dim) status, result = connect.search(ip_collection, 1, ...
[ "def", "test_search_vector_add_vector", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "result", "=", "connect", ".", "search", "(", "ip_collection", ",", "1", ",", "vector", "...
[ 998, 4 ]
[ 1007, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_search_vector_add_vector_another
(self, connect, ip_collection)
target: test add vector to collection_1 after search collection_2 method: search collection and add vector expected: status ok
target: test add vector to collection_1 after search collection_2 method: search collection and add vector expected: status ok
def test_search_vector_add_vector_another(self, connect, ip_collection): ''' target: test add vector to collection_1 after search collection_2 method: search collection and add vector expected: status ok ''' param = {'collection_name': gen_unique_str(), '...
[ "def", "test_search_vector_add_vector_another", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "param", "=", "{", "'collection_name'", ":", "gen_unique_str", "(", ")", ",", "'dimension'", ":", "dim", ",", "'index_file_size'", ":", "index_file_size", ...
[ 1010, 4 ]
[ 1024, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_search_vector
(self, connect, ip_collection)
target: test search vector after add vector method: add vector and search collection expected: status ok
target: test search vector after add vector method: add vector and search collection expected: status ok
def test_add_vector_search_vector(self, connect, ip_collection): ''' target: test search vector after add vector method: add vector and search collection expected: status ok ''' vector = gen_single_vector(dim) status, ids = connect.insert(ip_collection, vector) ...
[ "def", "test_add_vector_search_vector", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector", ")", "assert", ...
[ 1027, 4 ]
[ 1038, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_search_vector_another
(self, connect, ip_collection)
target: test add vector to collection_1 after search collection_2 method: search collection and add vector expected: status ok
target: test add vector to collection_1 after search collection_2 method: search collection and add vector expected: status ok
def test_add_vector_search_vector_another(self, connect, ip_collection): ''' target: test add vector to collection_1 after search collection_2 method: search collection and add vector expected: status ok ''' param = {'collection_name': gen_unique_str(), '...
[ "def", "test_add_vector_search_vector_another", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "param", "=", "{", "'collection_name'", ":", "gen_unique_str", "(", ")", ",", "'dimension'", ":", "dim", ",", "'index_file_size'", ":", "index_file_size", ...
[ 1041, 4 ]
[ 1056, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_sleep_search_vector
(self, connect, ip_collection)
target: test search vector after add vector after a while method: add vector, sleep, and search collection expected: status ok
target: test search vector after add vector after a while method: add vector, sleep, and search collection expected: status ok
def test_add_vector_sleep_search_vector(self, connect, ip_collection): ''' target: test search vector after add vector after a while method: add vector, sleep, and search collection expected: status ok ''' vector = gen_single_vector(dim) status, ids = connect.inse...
[ "def", "test_add_vector_sleep_search_vector", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector", ")", "time...
[ 1059, 4 ]
[ 1069, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_sleep_search_vector_another
(self, connect, ip_collection)
target: test add vector to collection_1 after search collection_2 a while method: search collection , sleep, and add vector expected: status ok
target: test add vector to collection_1 after search collection_2 a while method: search collection , sleep, and add vector expected: status ok
def test_add_vector_sleep_search_vector_another(self, connect, ip_collection): ''' target: test add vector to collection_1 after search collection_2 a while method: search collection , sleep, and add vector expected: status ok ''' param = {'collection_name': gen_unique_st...
[ "def", "test_add_vector_sleep_search_vector_another", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "param", "=", "{", "'collection_name'", ":", "gen_unique_str", "(", ")", ",", "'dimension'", ":", "dim", ",", "'index_file_size'", ":", "index_file_siz...
[ 1072, 4 ]
[ 1088, 26 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert_ids
(self, connect, ip_collection)
target: test add vectors in collection, use customize ids method: create collection and add vectors in it, check the ids returned and the collection length after vectors added expected: the length of ids and the collection row count
target: test add vectors in collection, use customize ids method: create collection and add vectors in it, check the ids returned and the collection length after vectors added expected: the length of ids and the collection row count
def test_insert_ids(self, connect, ip_collection): ''' target: test add vectors in collection, use customize ids method: create collection and add vectors in it, check the ids returned and the collection length after vectors added expected: the length of ids and the collection row count ...
[ "def", "test_insert_ids", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "top_k", "=", "1", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "ids", "=", "[", "i", "for", "i", "in", "range", "(", "nq", ")", ...
[ 1097, 4 ]
[ 1115, 39 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert_twice_ids_no_ids
(self, connect, ip_collection)
target: check the result of insert, with params ids and no ids method: test add vectors twice, use customize ids first, and then use no ids expected: status not OK
target: check the result of insert, with params ids and no ids method: test add vectors twice, use customize ids first, and then use no ids expected: status not OK
def test_insert_twice_ids_no_ids(self, connect, ip_collection): ''' target: check the result of insert, with params ids and no ids method: test add vectors twice, use customize ids first, and then use no ids expected: status not OK ''' nq = 5; top_k = 1 vectors =...
[ "def", "test_insert_twice_ids_no_ids", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "top_k", "=", "1", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "ids", "=", "[", "i", "for", "i", "in", "range", "(", "n...
[ 1118, 4 ]
[ 1132, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert_twice_not_ids_ids
(self, connect, ip_collection)
target: check the result of insert, with params ids and no ids method: test add vectors twice, use not ids first, and then use customize ids expected: status not OK
target: check the result of insert, with params ids and no ids method: test add vectors twice, use not ids first, and then use customize ids expected: status not OK
def test_insert_twice_not_ids_ids(self, connect, ip_collection): ''' target: check the result of insert, with params ids and no ids method: test add vectors twice, use not ids first, and then use customize ids expected: status not OK ''' nq = 5; top_k = 1 vectors...
[ "def", "test_insert_twice_not_ids_ids", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "top_k", "=", "1", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "ids", "=", "[", "i", "for", "i", "in", "range", "(", "...
[ 1135, 4 ]
[ 1149, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert_ids_length_not_match
(self, connect, ip_collection)
target: test add vectors in collection, use customize ids, len(ids) != len(vectors) method: create collection and add vectors in it expected: raise an exception
target: test add vectors in collection, use customize ids, len(ids) != len(vectors) method: create collection and add vectors in it expected: raise an exception
def test_insert_ids_length_not_match(self, connect, ip_collection): ''' target: test add vectors in collection, use customize ids, len(ids) != len(vectors) method: create collection and add vectors in it expected: raise an exception ''' nq = 5 vectors = gen_vector...
[ "def", "test_insert_ids_length_not_match", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "ids", "=", "[", "i", "for", "i", "in", "range", "(", "1", ",", "nq", "...
[ 1152, 4 ]
[ 1162, 69 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert_ids_invalid
(self, connect, ip_collection, get_vector_id)
target: test add vectors in collection, use customize ids, which are not int64 method: create collection and add vectors in it expected: raise an exception
target: test add vectors in collection, use customize ids, which are not int64 method: create collection and add vectors in it expected: raise an exception
def test_insert_ids_invalid(self, connect, ip_collection, get_vector_id): ''' target: test add vectors in collection, use customize ids, which are not int64 method: create collection and add vectors in it expected: raise an exception ''' nq = 5 vectors = gen_vecto...
[ "def", "test_insert_ids_invalid", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_vector_id", ")", ":", "nq", "=", "5", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "vector_id", "=", "get_vector_id", "ids", "=", "[", "vector_id", ...
[ 1172, 4 ]
[ 1183, 69 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert
(self, connect, ip_collection)
target: test add vectors in collection created before method: create collection and add vectors in it, check the ids returned and the collection length after vectors added expected: the length of ids and the collection row count
target: test add vectors in collection created before method: create collection and add vectors in it, check the ids returned and the collection length after vectors added expected: the length of ids and the collection row count
def test_insert(self, connect, ip_collection): ''' target: test add vectors in collection created before method: create collection and add vectors in it, check the ids returned and the collection length after vectors added expected: the length of ids and the collection row count ...
[ "def", "test_insert", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vectors", ")"...
[ 1186, 4 ]
[ 1196, 29 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_dim_not_matched
(self, connect, ip_collection)
target: test add vector, the vector dimension is not equal to the collection dimension method: the vector dimension is half of the collection dimension, check the status expected: status not ok
target: test add vector, the vector dimension is not equal to the collection dimension method: the vector dimension is half of the collection dimension, check the status expected: status not ok
def test_add_vector_dim_not_matched(self, connect, ip_collection): ''' target: test add vector, the vector dimension is not equal to the collection dimension method: the vector dimension is half of the collection dimension, check the status expected: status not ok ''' vec...
[ "def", "test_add_vector_dim_not_matched", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vector", "=", "gen_single_vector", "(", "int", "(", "dim", ")", "//", "2", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection",...
[ 1210, 4 ]
[ 1218, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_insert_dim_not_matched
(self, connect, ip_collection)
target: test add vectors, the vector dimension is not equal to the collection dimension method: the vectors dimension is half of the collection dimension, check the status expected: status not ok
target: test add vectors, the vector dimension is not equal to the collection dimension method: the vectors dimension is half of the collection dimension, check the status expected: status not ok
def test_insert_dim_not_matched(self, connect, ip_collection): ''' target: test add vectors, the vector dimension is not equal to the collection dimension method: the vectors dimension is half of the collection dimension, check the status expected: status not ok ''' nq = ...
[ "def", "test_insert_dim_not_matched", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "vectors", "=", "gen_vectors", "(", "nq", ",", "int", "(", "dim", ")", "//", "2", ")", "status", ",", "ids", "=", "connect", ".", "insert...
[ 1220, 4 ]
[ 1229, 30 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_query_after_sleep
(self, connect, ip_collection)
target: test add vectors, and search it after sleep method: set vector[0][1] as query vectors expected: status ok and result length is 1
target: test add vectors, and search it after sleep method: set vector[0][1] as query vectors expected: status ok and result length is 1
def test_add_vector_query_after_sleep(self, connect, ip_collection): ''' target: test add vectors, and search it after sleep method: set vector[0][1] as query vectors expected: status ok and result length is 1 ''' nq = 5 vectors = gen_vectors(nq, dim) stat...
[ "def", "test_add_vector_query_after_sleep", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "nq", "=", "5", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", "...
[ 1231, 4 ]
[ 1243, 31 ]
python
en
['en', 'error', 'th']
False
TestAddIP.test_add_vector_multi_collections
(self, connect)
target: test add vectors is correct or not with multiple collections of IP method: create 50 collections and add vectors into them in turn expected: status ok
target: test add vectors is correct or not with multiple collections of IP method: create 50 collections and add vectors into them in turn expected: status ok
def test_add_vector_multi_collections(self, connect): ''' target: test add vectors is correct or not with multiple collections of IP method: create 50 collections and add vectors into them in turn expected: status ok ''' nq = 100 vectors = gen_vectors(nq, dim) ...
[ "def", "test_add_vector_multi_collections", "(", "self", ",", "connect", ")", ":", "nq", "=", "100", "vectors", "=", "gen_vectors", "(", "nq", ",", "dim", ")", "collection_list", "=", "[", "]", "for", "i", "in", "range", "(", "20", ")", ":", "collection_...
[ 1245, 4 ]
[ 1265, 34 ]
python
en
['en', 'error', 'th']
False
TestAddAdvance.test_insert_much
(self, connect, collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_much(self, connect, collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count insert_v...
[ "def", "test_insert_much", "(", "self", ",", "connect", ",", "collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "("...
[ 1279, 4 ]
[ 1289, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAdvance.test_insert_much_ip
(self, connect, ip_collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_much_ip(self, connect, ip_collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count in...
[ "def", "test_insert_much_ip", "(", "self", ",", "connect", ",", "ip_collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "insert_vec_list", "=", "gen_vectors", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert",...
[ 1291, 4 ]
[ 1301, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAdvance.test_insert_much_jaccard
(self, connect, jac_collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_much_jaccard(self, connect, jac_collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count ...
[ "def", "test_insert_much_jaccard", "(", "self", ",", "connect", ",", "jac_collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "tmp", ",", "insert_vec_list", "=", "gen_binary_vectors", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", ...
[ 1303, 4 ]
[ 1313, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAdvance.test_insert_much_hamming
(self, connect, ham_collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_much_hamming(self, connect, ham_collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_count ...
[ "def", "test_insert_much_hamming", "(", "self", ",", "connect", ",", "ham_collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "tmp", ",", "insert_vec_list", "=", "gen_binary_vectors", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", ...
[ 1315, 4 ]
[ 1325, 26 ]
python
en
['en', 'error', 'th']
False
TestAddAdvance.test_insert_much_tanimoto
(self, connect, tanimoto_collection, insert_count)
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors
def test_insert_much_tanimoto(self, connect, tanimoto_collection, insert_count): ''' target: test add vectors with different length of vectors method: set different vectors as add method params expected: length of ids is equal to the length of vectors ''' nb = insert_coun...
[ "def", "test_insert_much_tanimoto", "(", "self", ",", "connect", ",", "tanimoto_collection", ",", "insert_count", ")", ":", "nb", "=", "insert_count", "tmp", ",", "insert_vec_list", "=", "gen_binary_vectors", "(", "nb", ",", "dim", ")", "status", ",", "ids", "...
[ 1327, 4 ]
[ 1337, 26 ]
python
en
['en', 'error', 'th']
False
_create_xlf
(target_lang)
Creates a <target_lang>.xlf file for Soy. Args: target_lang: The ISO 639 language code for the target language. This is used in the name of the file and in the metadata. Returns: A pointer to a file to which the metadata has been written. Raises: IOError: An error occu...
Creates a <target_lang>.xlf file for Soy.
def _create_xlf(target_lang): """Creates a <target_lang>.xlf file for Soy. Args: target_lang: The ISO 639 language code for the target language. This is used in the name of the file and in the metadata. Returns: A pointer to a file to which the metadata has been written. R...
[ "def", "_create_xlf", "(", "target_lang", ")", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "os", ".", "curdir", ",", "args", ".", "output_dir", ",", "target_lang", "+", "'.xlf'", ")", "out_file", "=", "codecs", ".", "open", "(", "filenam...
[ 33, 0 ]
[ 56, 19 ]
python
en
['en', 'en', 'en']
True
_close_xlf
(xlf_file)
Closes a <target_lang>.xlf file created with create_xlf(). This includes writing the terminating XML. Args: xlf_file: A pointer to a file created by _create_xlf(). Raises: IOError: An error occurred while writing to or closing the file.
Closes a <target_lang>.xlf file created with create_xlf().
def _close_xlf(xlf_file): """Closes a <target_lang>.xlf file created with create_xlf(). This includes writing the terminating XML. Args: xlf_file: A pointer to a file created by _create_xlf(). Raises: IOError: An error occurred while writing to or closing the file. """ xlf_fil...
[ "def", "_close_xlf", "(", "xlf_file", ")", ":", "xlf_file", ".", "write", "(", "\"\"\"\n </body>\n </file>\n</xliff>\n\"\"\"", ")", "xlf_file", ".", "close", "(", ")" ]
[ 59, 0 ]
[ 75, 20 ]
python
en
['en', 'en', 'en']
True
_process_file
(path_to_json, target_lang, key_dict)
Creates an .xlf file corresponding to the specified .json input file. The name of the input file must be target_lang followed by '.json'. The name of the output file will be target_lang followed by '.js'. Args: path_to_json: Path to the directory of xx.json files. target_lang: A IETF langu...
Creates an .xlf file corresponding to the specified .json input file.
def _process_file(path_to_json, target_lang, key_dict): """Creates an .xlf file corresponding to the specified .json input file. The name of the input file must be target_lang followed by '.json'. The name of the output file will be target_lang followed by '.js'. Args: path_to_json: Path to th...
[ "def", "_process_file", "(", "path_to_json", ",", "target_lang", ",", "key_dict", ")", ":", "keyfile", "=", "os", ".", "path", ".", "join", "(", "path_to_json", ",", "target_lang", "+", "'.json'", ")", "j", "=", "read_json_file", "(", "keyfile", ")", "out_...
[ 78, 0 ]
[ 111, 24 ]
python
en
['en', 'en', 'en']
True
main
()
Parses arguments and iterates over files.
Parses arguments and iterates over files.
def main(): """Parses arguments and iterates over files.""" # Set up argument parser. parser = argparse.ArgumentParser(description='Convert JSON files to JS.') parser.add_argument('--source_lang', default='en', help='ISO 639-1 source language code') parser.add_argument('--ou...
[ "def", "main", "(", ")", ":", "# Set up argument parser.", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Convert JSON files to JS.'", ")", "parser", ".", "add_argument", "(", "'--source_lang'", ",", "default", "=", "'en'", ",", "help...
[ 114, 0 ]
[ 180, 34 ]
python
en
['en', 'en', 'en']
True
regression
(self, local, clickhouse_binary_path, parallel=False, stress=False)
ClickHouse DateTime64 Extended Range regression module.
ClickHouse DateTime64 Extended Range regression module.
def regression(self, local, clickhouse_binary_path, parallel=False, stress=False): """ClickHouse DateTime64 Extended Range regression module. """ top().terminating = False nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), } if stress is not None: self.contex...
[ "def", "regression", "(", "self", ",", "local", ",", "clickhouse_binary_path", ",", "parallel", "=", "False", ",", "stress", "=", "False", ")", ":", "top", "(", ")", ".", "terminating", "=", "False", "nodes", "=", "{", "\"clickhouse\"", ":", "(", "\"clic...
[ 63, 0 ]
[ 89, 27 ]
python
en
['en', 'fr', 'en']
True
ClickHouseClusterWithDDLHelpers.insert_reliable
(instance, query_insert)
Make retries in case of UNKNOWN_STATUS_OF_INSERT or zkutil::KeeperException errors
Make retries in case of UNKNOWN_STATUS_OF_INSERT or zkutil::KeeperException errors
def insert_reliable(instance, query_insert): """ Make retries in case of UNKNOWN_STATUS_OF_INSERT or zkutil::KeeperException errors """ for i in range(100): try: instance.query(query_insert) return except Exception as e: ...
[ "def", "insert_reliable", "(", "instance", ",", "query_insert", ")", ":", "for", "i", "in", "range", "(", "100", ")", ":", "try", ":", "instance", ".", "query", "(", "query_insert", ")", "return", "except", "Exception", "as", "e", ":", "last_exception", ...
[ 109, 4 ]
[ 124, 28 ]
python
en
['en', 'error', 'th']
False
MagnumConan.package_info
(self)
# If there is only one application, here it is an alias self.cpp_info.components["application"].names["cmake_find_package"] = "Application" self.cpp_info.components["application"].names["cmake_find_package_multi"] = "Application" self.cpp_info.components["application"].r...
# If there is only one application, here it is an alias self.cpp_info.components["application"].names["cmake_find_package"] = "Application" self.cpp_info.components["application"].names["cmake_find_package_multi"] = "Application" self.cpp_info.components["application"].r...
def package_info(self): self.cpp_info.names["cmake_find_package"] = "Magnum" self.cpp_info.names["cmake_find_package_multi"] = "Magnum" magnum_plugin_libdir = "magnum-d" if self.settings.build_type == "Debug" and self.options.shared_plugins else "magnum" plugin_lib_suffix = "-d" if self...
[ "def", "package_info", "(", "self", ")", ":", "self", ".", "cpp_info", ".", "names", "[", "\"cmake_find_package\"", "]", "=", "\"Magnum\"", "self", ".", "cpp_info", ".", "names", "[", "\"cmake_find_package_multi\"", "]", "=", "\"Magnum\"", "magnum_plugin_libdir", ...
[ 439, 4 ]
[ 657, 142 ]
python
en
['en', 'error', 'th']
False
null_int_inline
(self, func, expected_result, int_type, min, max, node=None)
Check null function with Int128, UInt128, Int256, and UInt256 using inline tests.
Check null function with Int128, UInt128, Int256, and UInt256 using inline tests.
def null_int_inline(self, func, expected_result, int_type, min, max, node=None): """Check null function with Int128, UInt128, Int256, and UInt256 using inline tests. """ if node is None: node = self.context.node with When(f"I check {func} with {int_type}"): output = node.query(f"SELECT...
[ "def", "null_int_inline", "(", "self", ",", "func", ",", "expected_result", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "When"...
[ 18, 0 ]
[ 32, 16 ]
python
en
['en', 'en', 'en']
True
null_int_table
(self, func, expected_result, int_type, min, max, node=None)
Check null function with Int128, UInt128, Int256, and UInt256 using table tests.
Check null function with Int128, UInt128, Int256, and UInt256 using table tests.
def null_int_table(self, func, expected_result, int_type, min, max, node=None): """Check null function with Int128, UInt128, Int256, and UInt256 using table tests. """ table_name = f"table_{getuid()}" if node is None: node = self.context.node with Given("I have a table"): table(na...
[ "def", "null_int_table", "(", "self", ",", "func", ",", "expected_result", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".",...
[ 36, 0 ]
[ 56, 16 ]
python
en
['en', 'en', 'en']
True
null_dec_inline
(self, func, expected_result, node=None)
Check null function with Decimal256 using inline tests.
Check null function with Decimal256 using inline tests.
def null_dec_inline(self, func, expected_result, node=None): """Check null function 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"I check {func} with Decimal256"): output = n...
[ "def", "null_dec_inline", "(", "self", ",", "func", ",", "expected_result", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "if", "node", "is", "None", ":", "node", "...
[ 60, 0 ]
[ 76, 16 ]
python
en
['en', 'en', 'en']
True
null_dec_table
(self, func, expected_result, node=None)
Check null function with Decimal256 using table tests.
Check null function with Decimal256 using table tests.
def null_dec_table(self, func, expected_result, node=None): """Check null function with Decimal256 using table tests. """ min = Decimal256_min_max[0] max = Decimal256_min_max[1] table_name = f"table_{getuid()}" if node is None: node = self.context.node with Given("I have a table")...
[ "def", "null_dec_table", "(", "self", ",", "func", ",", "expected_result", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "table_name", "=", "f\"table_{getuid()}\"", "if",...
[ 80, 0 ]
[ 102, 16 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None)
Check that null functions work with extended precision data types.
Check that null functions work with extended precision data types.
def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None): """Check that null 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_experiment...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "mysql_node", "=", "\"mysql1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluste...
[ 109, 0 ]
[ 119, 36 ]
python
en
['en', 'en', 'en']
True
is_good_response
(resp)
Returns True if the response seems to be HTML, False otherwise.
Returns True if the response seems to be HTML, False otherwise.
def is_good_response(resp): """ Returns True if the response seems to be HTML, False otherwise. """ content_type = resp.headers['Content-Type'].lower() return (resp.status_code == 200 and content_type is not None and content_type.find('html') > -1)
[ "def", "is_good_response", "(", "resp", ")", ":", "content_type", "=", "resp", ".", "headers", "[", "'Content-Type'", "]", ".", "lower", "(", ")", "return", "(", "resp", ".", "status_code", "==", "200", "and", "content_type", "is", "not", "None", "and", ...
[ 41, 0 ]
[ 48, 47 ]
python
en
['en', 'error', 'th']
False
pause_ordering
()
Pause multipledispatch ordering.
Pause multipledispatch ordering.
def pause_ordering(): """Pause multipledispatch ordering.""" halt_ordering() try: yield finally: restart_ordering()
[ "def", "pause_ordering", "(", ")", ":", "halt_ordering", "(", ")", "try", ":", "yield", "finally", ":", "restart_ordering", "(", ")" ]
[ 88, 0 ]
[ 94, 26 ]
python
en
['de', 'en', 'en']
True
alter_quota_granted_directly
(self, node=None)
Check that a user is able to execute `ALTER QUOTA` with privileges are granted directly.
Check that a user is able to execute `ALTER QUOTA` with privileges are granted directly.
def alter_quota_granted_directly(self, node=None): """Check that a user is able to execute `ALTER QUOTA` 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=alter_quota, ...
[ "def", "alter_quota_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\"{user...
[ 22, 0 ]
[ 36, 80 ]
python
en
['en', 'en', 'en']
True
alter_quota_granted_via_role
(self, node=None)
Check that a user is able to execute `ALTER QUOTA` with privileges are granted through a role.
Check that a user is able to execute `ALTER QUOTA` with privileges are granted through a role.
def alter_quota_granted_via_role(self, node=None): """Check that a user is able to execute `ALTER QUOTA` 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", "alter_quota_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...
[ 39, 0 ]
[ 57, 80 ]
python
en
['en', 'en', 'en']
True
alter_quota
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `ALTER QUOTA` when they have the necessary privilege.
Check that user is only able to execute `ALTER QUOTA` when they have the necessary privilege.
def alter_quota(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `ALTER QUOTA` 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", "alter_quota", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", ...
[ 65, 0 ]
[ 130, 55 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of ALTER QUOTA.
Check the RBAC functionality of ALTER QUOTA.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of ALTER QUOTA. """ self.context.node = self.context.cluster.node(node) Suite(run=alter_quota_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=alter_quota_granted_via_role, setup=instrument_clickhouse_server_l...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "alter_quota_granted_directly", ",", ...
[ 139, 0 ]
[ 145, 83 ]
python
en
['en', 'en', 'en']
True
parse_json
(fname)
Parse the input profile @param fname: input profile path @return data: a dictionary with user-defined data for training
Parse the input profile
def parse_json(fname): """Parse the input profile @param fname: input profile path @return data: a dictionary with user-defined data for training """ with open(fname) as data_file: data = json.load(data_file) return data
[ "def", "parse_json", "(", "fname", ")", ":", "with", "open", "(", "fname", ")", "as", "data_file", ":", "data", "=", "json", ".", "load", "(", "data_file", ")", "return", "data" ]
[ 49, 0 ]
[ 59, 15 ]
python
en
['en', 'en', 'en']
True
write_json
(data, fname='./output.json')
Write data to json @param data: object to be written Keyword arguments: fname -- output filename (default './output.json')
Write data to json
def write_json(data, fname='./output.json'): """Write data to json @param data: object to be written Keyword arguments: fname -- output filename (default './output.json') """ with open(fname, 'w') as fp: json.dump(data, fp, cls=NumpyAwareJSONEncoder)
[ "def", "write_json", "(", "data", ",", "fname", "=", "'./output.json'", ")", ":", "with", "open", "(", "fname", ",", "'w'", ")", "as", "fp", ":", "json", ".", "dump", "(", "data", ",", "fp", ",", "cls", "=", "NumpyAwareJSONEncoder", ")" ]
[ 67, 0 ]
[ 77, 54 ]
python
en
['en', 'el-Latn', 'en']
True
print_time
(t0, s)
Print how much time has been spent @param t0: previous timestamp @param s: description of this step
Print how much time has been spent
def print_time(t0, s): """Print how much time has been spent @param t0: previous timestamp @param s: description of this step """ print("%.5f seconds to %s" % ((time.time() - t0), s)) return time.time()
[ "def", "print_time", "(", "t0", ",", "s", ")", ":", "print", "(", "\"%.5f seconds to %s\"", "%", "(", "(", "time", ".", "time", "(", ")", "-", "t0", ")", ",", "s", ")", ")", "return", "time", ".", "time", "(", ")" ]
[ 80, 0 ]
[ 89, 22 ]
python
en
['en', 'en', 'en']
True
search
(request)
Works as a "buffer" for when we are obtaining data
Works as a "buffer" for when we are obtaining data
def search(request): '''Works as a "buffer" for when we are obtaining data''' if request.method == 'GET': search = request.GET.get('find') course_name = search.upper() # make search query uppercase print(f"*Searching database for {course_name}") return redirect('coursetracker:co...
[ "def", "search", "(", "request", ")", ":", "if", "request", ".", "method", "==", "'GET'", ":", "search", "=", "request", ".", "GET", ".", "get", "(", "'find'", ")", "course_name", "=", "search", ".", "upper", "(", ")", "# make search query uppercase", "p...
[ 5, 0 ]
[ 11, 60 ]
python
en
['en', 'en', 'en']
True
course
(request, course_name)
Finds the Course object from its course name, returning that course's page if it exists. Inputs: - course_name (str): must be in the format '<subject> <number><detail>', all caps - Not all course names have details - Examples: MATH 100, APSC 496D
Finds the Course object from its course name, returning that course's page if it exists.
def course(request, course_name): '''Finds the Course object from its course name, returning that course's page if it exists. Inputs: - course_name (str): must be in the format '<subject> <number><detail>', all caps - Not all course names have details - Examples: MATH 100, APSC ...
[ "def", "course", "(", "request", ",", "course_name", ")", ":", "try", ":", "c", "=", "Course", ".", "objects", ".", "get", "(", "course_name__exact", "=", "course_name", ")", "print", "(", "f\"*{course_name} found in database\"", ")", "except", "Course", ".", ...
[ 14, 0 ]
[ 29, 70 ]
python
en
['en', 'en', 'en']
True
privilege_granted_directly_or_via_role
(self, node=None)
Check that user is only able to execute ATTACH DICTIONARY when they have required privilege, either directly or via role.
Check that user is only able to execute ATTACH 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 ATTACH 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 ]
[ 116, 68 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of ATTACH DICTIONARY.
Check the RBAC functionality of ATTACH DICTIONARY.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of ATTACH 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", ")", ...
[ 125, 0 ]
[ 136, 48 ]
python
en
['en', 'en', 'en']
True
showPage
(request)
Show the page when the URL is called.
Show the page when the URL is called.
def showPage(request): """Show the page when the URL is called. """ if 'geneset' in request.session: # restore previous list of genes gs = request.session['geneset'] genes = [] for item in gs.dataframe().reset_index().to_dict(orient="records"): # won't return TranscriptLengths genes.append(dict([(key,val) ...
[ "def", "showPage", "(", "request", ")", ":", "if", "'geneset'", "in", "request", ".", "session", ":", "# restore previous list of genes", "gs", "=", "request", ".", "session", "[", "'geneset'", "]", "genes", "=", "[", "]", "for", "item", "in", "gs", ".", ...
[ 9, 0 ]
[ 21, 36 ]
python
en
['en', 'en', 'en']
True
geneSearch
(request)
Return a list of gene attributes given a search string.
Return a list of gene attributes given a search string.
def geneSearch(request): """Return a list of gene attributes given a search string. """ searchString = request.params.get('searchTerm') gs = geneset.Geneset().subset([searchString]) if gs.size()>0: gs.name = searchString request.session['geneset'] = gs return gs.to_json()
[ "def", "geneSearch", "(", "request", ")", ":", "searchString", "=", "request", ".", "params", ".", "get", "(", "'searchTerm'", ")", "gs", "=", "geneset", ".", "Geneset", "(", ")", ".", "subset", "(", "[", "searchString", "]", ")", "if", "gs", ".", "s...
[ 24, 0 ]
[ 32, 20 ]
python
en
['en', 'en', 'en']
True
_MatchFirstFunction
(script)
Match the first function seen in the script.
Match the first function seen in the script.
def _MatchFirstFunction(script): """Match the first function seen in the script.""" return _FUNCTION_REGEX.search(script)
[ "def", "_MatchFirstFunction", "(", "script", ")", ":", "return", "_FUNCTION_REGEX", ".", "search", "(", "script", ")" ]
[ 57, 0 ]
[ 59, 39 ]
python
en
['en', 'en', 'en']
True
_ParseArgString
(arg_string)
Parse an argument string (inside parens) into parameter names.
Parse an argument string (inside parens) into parameter names.
def _ParseArgString(arg_string): """Parse an argument string (inside parens) into parameter names.""" for arg in arg_string.split(','): arg = arg.strip() if arg: yield arg
[ "def", "_ParseArgString", "(", "arg_string", ")", ":", "for", "arg", "in", "arg_string", ".", "split", "(", "','", ")", ":", "arg", "=", "arg", ".", "strip", "(", ")", "if", "arg", ":", "yield", "arg" ]
[ 62, 0 ]
[ 67, 15 ]
python
en
['en', 'en', 'en']
True
_ExtractFunctionBody
(script, indentation=0)
Attempt to return the function body.
Attempt to return the function body.
def _ExtractFunctionBody(script, indentation=0): """Attempt to return the function body.""" # Real extraction would require a token parser and state machines. # We look for first bracket at the same level of indentation. regex_str = r'{(.*?)^[ ]{%d}}' % indentation function_regex = re.compile(regex_str, re....
[ "def", "_ExtractFunctionBody", "(", "script", ",", "indentation", "=", "0", ")", ":", "# Real extraction would require a token parser and state machines.", "# We look for first bracket at the same level of indentation.", "regex_str", "=", "r'{(.*?)^[ ]{%d}}'", "%", "indentation", "...
[ 70, 0 ]
[ 80, 25 ]
python
en
['en', 'en', 'en']
True
_ContainsReturnValue
(function_body)
Attempt to determine if the function body returns a value.
Attempt to determine if the function body returns a value.
def _ContainsReturnValue(function_body): """Attempt to determine if the function body returns a value.""" return_regex = re.compile(r'\breturn\b[^;]') # If this matches, we assume they're returning something. return bool(return_regex.search(function_body))
[ "def", "_ContainsReturnValue", "(", "function_body", ")", ":", "return_regex", "=", "re", ".", "compile", "(", "r'\\breturn\\b[^;]'", ")", "# If this matches, we assume they're returning something.", "return", "bool", "(", "return_regex", ".", "search", "(", "function_bod...
[ 83, 0 ]
[ 88, 49 ]
python
en
['en', 'en', 'en']
True
_InsertString
(original_string, inserted_string, index)
Insert a string into another string at a given index.
Insert a string into another string at a given index.
def _InsertString(original_string, inserted_string, index): """Insert a string into another string at a given index.""" return original_string[0:index] + inserted_string + original_string[index:]
[ "def", "_InsertString", "(", "original_string", ",", "inserted_string", ",", "index", ")", ":", "return", "original_string", "[", "0", ":", "index", "]", "+", "inserted_string", "+", "original_string", "[", "index", ":", "]" ]
[ 91, 0 ]
[ 93, 77 ]
python
en
['en', 'en', 'en']
True
_GenerateJsDoc
(args, return_val=False)
Generate JSDoc for a function. Args: args: A list of names of the argument. return_val: Whether the function has a return value. Returns: The JSDoc as a string.
Generate JSDoc for a function.
def _GenerateJsDoc(args, return_val=False): """Generate JSDoc for a function. Args: args: A list of names of the argument. return_val: Whether the function has a return value. Returns: The JSDoc as a string. """ lines = [] lines.append('/**') lines += [' * @param {} %s' % arg for arg in ar...
[ "def", "_GenerateJsDoc", "(", "args", ",", "return_val", "=", "False", ")", ":", "lines", "=", "[", "]", "lines", ".", "append", "(", "'/**'", ")", "lines", "+=", "[", "' * @param {} %s'", "%", "arg", "for", "arg", "in", "args", "]", "if", "return_val"...
[ 96, 0 ]
[ 117, 32 ]
python
en
['en', 'en', 'en']
True
_IndentString
(source_string, indentation)
Indent string some number of characters.
Indent string some number of characters.
def _IndentString(source_string, indentation): """Indent string some number of characters.""" lines = [(indentation * ' ') + line for line in source_string.splitlines(True)] return ''.join(lines)
[ "def", "_IndentString", "(", "source_string", ",", "indentation", ")", ":", "lines", "=", "[", "(", "indentation", "*", "' '", ")", "+", "line", "for", "line", "in", "source_string", ".", "splitlines", "(", "True", ")", "]", "return", "''", ".", "join", ...
[ 120, 0 ]
[ 124, 23 ]
python
en
['en', 'en', 'en']
True
InsertJsDoc
(script)
Attempt to insert JSDoc for the first seen function in the script. Args: script: The script, as a string. Returns: Returns the new string if function was found and JSDoc inserted. Otherwise returns None.
Attempt to insert JSDoc for the first seen function in the script.
def InsertJsDoc(script): """Attempt to insert JSDoc for the first seen function in the script. Args: script: The script, as a string. Returns: Returns the new string if function was found and JSDoc inserted. Otherwise returns None. """ match = _MatchFirstFunction(script) if not match: r...
[ "def", "InsertJsDoc", "(", "script", ")", ":", "match", "=", "_MatchFirstFunction", "(", "script", ")", "if", "not", "match", ":", "return", "# Add argument flags.", "args_string", "=", "match", ".", "group", "(", "'arguments'", ")", "args", "=", "_ParseArgStr...
[ 127, 0 ]
[ 160, 50 ]
python
en
['en', 'en', 'en']
True
load_data
(path)
Load Dataset from File
Load Dataset from File
def load_data(path): """ Load Dataset from File """ input_file = os.path.join(path) with open(input_file, "r") as f: data = f.read() return data
[ "def", "load_data", "(", "path", ")", ":", "input_file", "=", "os", ".", "path", ".", "join", "(", "path", ")", "with", "open", "(", "input_file", ",", "\"r\"", ")", "as", "f", ":", "data", "=", "f", ".", "read", "(", ")", "return", "data" ]
[ 8, 0 ]
[ 16, 15 ]
python
en
['en', 'error', 'th']
False
preprocess_and_save_data
(dataset_path, token_lookup, create_lookup_tables)
Preprocess Text Data
Preprocess Text Data
def preprocess_and_save_data(dataset_path, token_lookup, create_lookup_tables): """ Preprocess Text Data """ text = load_data(dataset_path) # Ignore notice, since we don't use it for analysing the data text = text[81:] token_dict = token_lookup() for key, token in token_dict.items(...
[ "def", "preprocess_and_save_data", "(", "dataset_path", ",", "token_lookup", ",", "create_lookup_tables", ")", ":", "text", "=", "load_data", "(", "dataset_path", ")", "# Ignore notice, since we don't use it for analysing the data", "text", "=", "text", "[", "81", ":", ...
[ 19, 0 ]
[ 37, 95 ]
python
en
['en', 'error', 'th']
False
load_preprocess
()
Load the Preprocessed Training data and return them in batches of <batch_size> or less
Load the Preprocessed Training data and return them in batches of <batch_size> or less
def load_preprocess(): """ Load the Preprocessed Training data and return them in batches of <batch_size> or less """ return pickle.load(open('preprocess.p', mode='rb'))
[ "def", "load_preprocess", "(", ")", ":", "return", "pickle", ".", "load", "(", "open", "(", "'preprocess.p'", ",", "mode", "=", "'rb'", ")", ")" ]
[ 40, 0 ]
[ 44, 55 ]
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", ...
[ 40, 0 ]
[ 47, 47 ]
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", ...
[ 41, 0 ]
[ 48, 47 ]
python
en
['en', 'error', 'th']
False
compile
(expr, params=None)
Force compilation of expression as though it were an expression depending on Clickhouse. Note you can also call expr.compile() Returns ------- compiled : string
Force compilation of expression as though it were an expression depending on Clickhouse. Note you can also call expr.compile()
def compile(expr, params=None): """ Force compilation of expression as though it were an expression depending on Clickhouse. Note you can also call expr.compile() Returns ------- compiled : string """ from ibis.clickhouse.compiler import to_sql return to_sql(expr, dialect.make_conte...
[ "def", "compile", "(", "expr", ",", "params", "=", "None", ")", ":", "from", "ibis", ".", "clickhouse", ".", "compiler", "import", "to_sql", "return", "to_sql", "(", "expr", ",", "dialect", ".", "make_context", "(", "params", "=", "params", ")", ")" ]
[ 17, 0 ]
[ 27, 60 ]
python
en
['en', 'error', 'th']
False
verify
(expr, params=None)
Determine if expression can be successfully translated to execute on Clickhouse
Determine if expression can be successfully translated to execute on Clickhouse
def verify(expr, params=None): """ Determine if expression can be successfully translated to execute on Clickhouse """ try: compile(expr, params=params) return True except com.TranslationError: return False
[ "def", "verify", "(", "expr", ",", "params", "=", "None", ")", ":", "try", ":", "compile", "(", "expr", ",", "params", "=", "params", ")", "return", "True", "except", "com", ".", "TranslationError", ":", "return", "False" ]
[ 30, 0 ]
[ 39, 20 ]
python
en
['en', 'error', 'th']
False
connect
(host='localhost', port=9000, database='default', user='default', password='', client_name='ibis', compression=_default_compression)
Create an ClickhouseClient for use with Ibis. Parameters ---------- host : str, optional Host name of the clickhouse server port : int, optional Clickhouse server's port database : str, optional Default database when executing queries user : str, optional User t...
Create an ClickhouseClient for use with Ibis.
def connect(host='localhost', port=9000, database='default', user='default', password='', client_name='ibis', compression=_default_compression): """Create an ClickhouseClient for use with Ibis. Parameters ---------- host : str, optional Host name of the clickhouse server port : ...
[ "def", "connect", "(", "host", "=", "'localhost'", ",", "port", "=", "9000", ",", "database", "=", "'default'", ",", "user", "=", "'default'", ",", "password", "=", "''", ",", "client_name", "=", "'ibis'", ",", "compression", "=", "_default_compression", "...
[ 42, 0 ]
[ 91, 17 ]
python
en
['en', 'en', 'en']
True
run_rollout
(policy, env, eval, n=1, additional_keys=(), goal=None, reset_same_model=False)
Rollout function. Executes 'n' trajectories in 'env' using 'policy' with given 'goal'. Parameters ---------- policy: BaseAlgorithm The algorithm whose policy is used as the agent. env: BaseEnv The learning environment. eval: bool Whether this is an evaluation episode (n...
Rollout function. Executes 'n' trajectories in 'env' using 'policy' with given 'goal'.
def run_rollout(policy, env, eval, n=1, additional_keys=(), goal=None, reset_same_model=False): """ Rollout function. Executes 'n' trajectories in 'env' using 'policy' with given 'goal'. Parameters ---------- policy: BaseAlgorithm The algorithm whose policy is used as the agent. env: Ba...
[ "def", "run_rollout", "(", "policy", ",", "env", ",", "eval", ",", "n", "=", "1", ",", "additional_keys", "=", "(", ")", ",", "goal", "=", "None", ",", "reset_same_model", "=", "False", ")", ":", "if", "goal", "is", "not", "None", ":", "goal", "=",...
[ 3, 0 ]
[ 86, 19 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_compact_collection_name_None
(self, connect, collection)
target: compact collection where collection name is None method: compact with the collection_name: None expected: exception raised
target: compact collection where collection name is None method: compact with the collection_name: None expected: exception raised
def test_compact_collection_name_None(self, connect, collection): ''' target: compact collection where collection name is None method: compact with the collection_name: None expected: exception raised ''' collection_name = None with pytest.raises(Exception) as e: ...
[ "def", "test_compact_collection_name_None", "(", "self", ",", "connect", ",", "collection", ")", ":", "collection_name", "=", "None", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", "e", ":", "status", "=", "connect", ".", "compact", "(", "coll...
[ 25, 4 ]
[ 33, 53 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_compact_collection_name_not_existed
(self, connect, collection)
target: compact collection not existed method: compact with a random collection_name, which is not in db expected: status not ok
target: compact collection not existed method: compact with a random collection_name, which is not in db expected: status not ok
def test_compact_collection_name_not_existed(self, connect, collection): ''' target: compact collection not existed method: compact with a random collection_name, which is not in db expected: status not ok ''' collection_name = gen_unique_str("not_existed_collection") ...
[ "def", "test_compact_collection_name_not_existed", "(", "self", ",", "connect", ",", "collection", ")", ":", "collection_name", "=", "gen_unique_str", "(", "\"not_existed_collection\"", ")", "status", "=", "connect", ".", "compact", "(", "collection_name", ")", "asser...
[ 36, 4 ]
[ 44, 30 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_compact_collection_name_invalid
(self, connect, get_collection_name)
target: compact collection with invalid name method: compact with invalid collection_name expected: status not ok
target: compact collection with invalid name method: compact with invalid collection_name expected: status not ok
def test_compact_collection_name_invalid(self, connect, get_collection_name): ''' target: compact collection with invalid name method: compact with invalid collection_name expected: status not ok ''' collection_name = get_collection_name status = connect.compact(c...
[ "def", "test_compact_collection_name_invalid", "(", "self", ",", "connect", ",", "get_collection_name", ")", ":", "collection_name", "=", "get_collection_name", "status", "=", "connect", ".", "compact", "(", "collection_name", ")", "assert", "not", "status", ".", "O...
[ 54, 4 ]
[ 62, 30 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_add_vector_and_compact
(self, connect, collection)
target: test add vector and compact method: add vector and compact collection expected: status ok, vector added
target: test add vector and compact method: add vector and compact collection expected: status ok, vector added
def test_add_vector_and_compact(self, connect, collection): ''' target: test add vector and compact method: add vector and compact collection expected: status ok, vector added ''' vector = gen_single_vector(dim) status, ids = connect.insert(collection, vector) ...
[ "def", "test_add_vector_and_compact", "(", "self", ",", "connect", ",", "collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vector", ")", "assert", "status...
[ 65, 4 ]
[ 87, 41 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_insert_and_compact
(self, connect, collection)
target: test add vectors and compact method: add vectors and compact collection expected: status ok, vectors added
target: test add vectors and compact method: add vectors and compact collection expected: status ok, vectors added
def test_insert_and_compact(self, connect, collection): ''' target: test add vectors and compact method: add vectors and compact collection expected: status ok, vectors added ''' vectors = gen_vector(nb, dim) status, ids = connect.insert(collection, vectors) ...
[ "def", "test_insert_and_compact", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vectors", ")", "assert", "...
[ 90, 4 ]
[ 111, 41 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_insert_delete_part_and_compact
(self, connect, collection)
target: test add vectors, delete part of them and compact method: add vectors, delete a few and compact collection expected: status ok, data size is smaller after compact
target: test add vectors, delete part of them and compact method: add vectors, delete a few and compact collection expected: status ok, data size is smaller after compact
def test_insert_delete_part_and_compact(self, connect, collection): ''' target: test add vectors, delete part of them and compact method: add vectors, delete a few and compact collection expected: status ok, data size is smaller after compact ''' vectors = gen_vector(nb,...
[ "def", "test_insert_delete_part_and_compact", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vectors", ")", "...
[ 114, 4 ]
[ 144, 41 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_insert_delete_all_and_compact
(self, connect, collection)
target: test add vectors, delete them and compact method: add vectors, delete all and compact collection expected: status ok, no data size in collection info because collection is empty
target: test add vectors, delete them and compact method: add vectors, delete all and compact collection expected: status ok, no data size in collection info because collection is empty
def test_insert_delete_all_and_compact(self, connect, collection): ''' target: test add vectors, delete them and compact method: add vectors, delete all and compact collection expected: status ok, no data size in collection info because collection is empty ''' vectors = ...
[ "def", "test_insert_delete_all_and_compact", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vectors", ")", "a...
[ 147, 4 ]
[ 171, 52 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_insert_partition_delete_half_and_compact
(self, connect, collection)
target: test add vectors into partition, delete them and compact method: add vectors, delete half of vectors in partition and compact collection expected: status ok, data_size less than the older version
target: test add vectors into partition, delete them and compact method: add vectors, delete half of vectors in partition and compact collection expected: status ok, data_size less than the older version
def test_insert_partition_delete_half_and_compact(self, connect, collection): ''' target: test add vectors into partition, delete them and compact method: add vectors, delete half of vectors in partition and compact collection expected: status ok, data_size less than the older version ...
[ "def", "test_insert_partition_delete_half_and_compact", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "nb", ",", "dim", ")", "status", "=", "connect", ".", "create_partition", "(", "collection", ",", "tag", ")", "...
[ 174, 4 ]
[ 206, 122 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_compact_after_index_created
(self, connect, collection, get_simple_index)
target: test compact collection after index created method: add vectors, create index, delete part of vectors and compact expected: status ok, index description no change, data size smaller after compact
target: test compact collection after index created method: add vectors, create index, delete part of vectors and compact expected: status ok, index description no change, data size smaller after compact
def test_compact_after_index_created(self, connect, collection, get_simple_index): ''' target: test compact collection after index created method: add vectors, create index, delete part of vectors and compact expected: status ok, index description no change, data size smaller after compa...
[ "def", "test_compact_after_index_created", "(", "self", ",", "connect", ",", "collection", ",", "get_simple_index", ")", ":", "count", "=", "10", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"inde...
[ 220, 4 ]
[ 255, 40 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_add_vector_and_compact_twice
(self, connect, collection)
target: test add vector and compact twice method: add vector and compact collection twice expected: status ok, data size no change
target: test add vector and compact twice method: add vector and compact collection twice expected: status ok, data size no change
def test_add_vector_and_compact_twice(self, connect, collection): ''' target: test add vector and compact twice method: add vector and compact collection twice expected: status ok, data size no change ''' vector = gen_single_vector(dim) status, ids = connect.inser...
[ "def", "test_add_vector_and_compact_twice", "(", "self", ",", "connect", ",", "collection", ")", ":", "vector", "=", "gen_single_vector", "(", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vector", ")", "assert", "...
[ 258, 4 ]
[ 288, 46 ]
python
en
['en', 'error', 'th']
False
TestCompactBase.test_insert_delete_part_and_compact_twice
(self, connect, collection)
target: test add vectors, delete part of them and compact twice method: add vectors, delete part and compact collection twice expected: status ok, data size smaller after first compact, no change after second
target: test add vectors, delete part of them and compact twice method: add vectors, delete part and compact collection twice expected: status ok, data size smaller after first compact, no change after second
def test_insert_delete_part_and_compact_twice(self, connect, collection): ''' target: test add vectors, delete part of them and compact twice method: add vectors, delete part and compact collection twice expected: status ok, data size smaller after first compact, no change after second ...
[ "def", "test_insert_delete_part_and_compact_twice", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "nb", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vectors", ")...
[ 291, 4 ]
[ 324, 46 ]
python
en
['en', 'error', 'th']
False