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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
DiscoverableFormsList.get | (self, request: Request) | List all discoverable forms that should be shown on the homepage. | List all discoverable forms that should be shown on the homepage. | async def get(self, request: Request) -> JSONResponse:
"""List all discoverable forms that should be shown on the homepage."""
forms = []
cursor = request.state.db.forms.find({"features": "DISCOVERABLE"}).sort("name")
# Parse it to Form and then back to dictionary
# to replace _... | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
":",
"Request",
")",
"->",
"JSONResponse",
":",
"forms",
"=",
"[",
"]",
"cursor",
"=",
"request",
".",
"state",
".",
"db",
".",
"forms",
".",
"find",
"(",
"{",
"\"features\"",
":",
"\"DISCOVERABLE\"",... | [
21,
4
] | [
35,
9
] | python | en | ['en', 'en', 'en'] | True |
scenario | (self, node="clickhouse1") | Check that an LDAP external user directory can be used to authenticate a user.
| Check that an LDAP external user directory can be used to authenticate a user.
| def scenario(self, node="clickhouse1"):
"""Check that an LDAP external user directory can be used to authenticate a user.
"""
self.context.node = self.context.cluster.node(node)
servers = {
"openldap1": {
"host": "openldap1",
"port": "389",
"enable_tls": "no",... | [
"def",
"scenario",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"servers",
"=",
"{",
"\"openldap1\"",
":",
"{",
"\"host\"",
... | [
7,
0
] | [
23,
39
] | python | en | ['en', 'en', 'en'] | True |
create_image | (image_type, image_size, save_path=None, period=4) | r"""Create a simple image
Parameters
----------
image_type : {'plaid', 'checkerboard'}
What type of image to create
image_size : tuple
2-tuple of ints, specifying the image size
save_path : str or None, optional
If a str, the path to save the padded image at. If None, we
... | r"""Create a simple image | def create_image(image_type, image_size, save_path=None, period=4):
r"""Create a simple image
Parameters
----------
image_type : {'plaid', 'checkerboard'}
What type of image to create
image_size : tuple
2-tuple of ints, specifying the image size
save_path : str or None, optional... | [
"def",
"create_image",
"(",
"image_type",
",",
"image_size",
",",
"save_path",
"=",
"None",
",",
"period",
"=",
"4",
")",
":",
"if",
"image_type",
"in",
"[",
"'plaid'",
",",
"'checkerboard'",
"]",
":",
"image",
"=",
"pt",
".",
"synthetic_images",
".",
"s... | [
18,
0
] | [
51,
16
] | python | en | ['en', 'et', 'en'] | True |
pad_image | (image, pad_mode, save_path=None, constant_values=.5, **pad_kwargs) | r"""Pad an image using ``skimage.util.pad``
Currently, we only support grayscale images
Parameters
----------
image : str or np.array
Either an image array or a string containing the path to an
image. If it's a string, we load it in as a grayscale image. If
an image, we check t... | r"""Pad an image using ``skimage.util.pad`` | def pad_image(image, pad_mode, save_path=None, constant_values=.5, **pad_kwargs):
r"""Pad an image using ``skimage.util.pad``
Currently, we only support grayscale images
Parameters
----------
image : str or np.array
Either an image array or a string containing the path to an
image.... | [
"def",
"pad_image",
"(",
"image",
",",
"pad_mode",
",",
"save_path",
"=",
"None",
",",
"constant_values",
"=",
".5",
",",
"*",
"*",
"pad_kwargs",
")",
":",
"if",
"isinstance",
"(",
"image",
",",
"str",
")",
":",
"image",
"=",
"imageio",
".",
"imread",
... | [
54,
0
] | [
102,
16
] | python | en | ['en', 'lt', 'en'] | True |
collect_images | (image_paths, save_path=None) | r"""Collect images into a single array
We loop through a list of paths, loading in images (as grayscale),
stack them so that the different images are indexed along the first
dimension, and then cast them as ``np.uint8``. We finally optionally
save them and return.
Parameters
----------
ima... | r"""Collect images into a single array | def collect_images(image_paths, save_path=None):
r"""Collect images into a single array
We loop through a list of paths, loading in images (as grayscale),
stack them so that the different images are indexed along the first
dimension, and then cast them as ``np.uint8``. We finally optionally
save th... | [
"def",
"collect_images",
"(",
"image_paths",
",",
"save_path",
"=",
"None",
")",
":",
"images",
"=",
"[",
"]",
"for",
"i",
"in",
"image_paths",
":",
"# then this is the image file",
"if",
"i",
".",
"endswith",
"(",
"'.png'",
")",
":",
"im",
"=",
"imageio",... | [
105,
0
] | [
145,
17
] | python | en | ['en', 'en', 'en'] | True |
create_metamer_df | (image_paths, save_path=None) | r"""Create dataframe summarizing metamer information
We do this by loading in and concatenating the summary.csv files
created as one of the outputs of metamer creation.
Parameters
----------
image_paths : list
A list of strings to image paths
save_path : str or None
If a str, m... | r"""Create dataframe summarizing metamer information | def create_metamer_df(image_paths, save_path=None):
r"""Create dataframe summarizing metamer information
We do this by loading in and concatenating the summary.csv files
created as one of the outputs of metamer creation.
Parameters
----------
image_paths : list
A list of strings to ima... | [
"def",
"create_metamer_df",
"(",
"image_paths",
",",
"save_path",
"=",
"None",
")",
":",
"metamer_info",
"=",
"[",
"]",
"for",
"p",
"in",
"image_paths",
":",
"# images can end in either metamer.png (8 bit), metamer-16.png (16",
"# bit), or metamer.npy (32 bit)",
"csv_path",... | [
148,
0
] | [
189,
13
] | python | de | ['de', 'jv', 'en'] | False |
get_images_for_session | (subject_name, session_number, downsample=False) | Get names of images in specified session for a given subject
This is necessary for two reasons:
1. All subjects see the same 10 images, and then subjects alternate between
two sets (A and B), which determine the remaining 5 images they see.
2. Each session gives a different random subset of 5 of t... | Get names of images in specified session for a given subject | def get_images_for_session(subject_name, session_number, downsample=False):
"""Get names of images in specified session for a given subject
This is necessary for two reasons:
1. All subjects see the same 10 images, and then subjects alternate between
two sets (A and B), which determine the remainin... | [
"def",
"get_images_for_session",
"(",
"subject_name",
",",
"session_number",
",",
"downsample",
"=",
"False",
")",
":",
"with",
"open",
"(",
"op",
".",
"join",
"(",
"op",
".",
"dirname",
"(",
"op",
".",
"realpath",
"(",
"__file__",
")",
")",
",",
"'..'",... | [
192,
0
] | [
251,
44
] | python | en | ['en', 'en', 'en'] | True |
_gen_trial_types | (df) | Generate the trial types arrays
These arrays contains the indices of images that should be compared against
each other: the first contains all metamers synthesized from the same
reference image, for the same model with the same scaling value, and the
second contains reference image they're based on. To... | Generate the trial types arrays | def _gen_trial_types(df):
"""Generate the trial types arrays
These arrays contains the indices of images that should be compared against
each other: the first contains all metamers synthesized from the same
reference image, for the same model with the same scaling value, and the
second contains ref... | [
"def",
"_gen_trial_types",
"(",
"df",
")",
":",
"# The reference images will have a bunch of NaNs in the",
"# metamer-relevant fields. In order to be able to select them, we",
"# replace these with \"None\"",
"df",
"=",
"df",
".",
"fillna",
"(",
"'None'",
")",
"trials_dict",
"=",... | [
255,
0
] | [
299,
57
] | python | en | ['en', 'en', 'en'] | True |
generate_indices_split | (df, seed, comparison='met_v_ref', n_repeats=None) | Generate randomized presentation indices for split-screen task.
We take in the dataframe describing the metamer images combined into our
stimuli array and correctly structure the presentation indices for the
split-screen task (as used in our experiment.py file), randomize them using
the given seed, and... | Generate randomized presentation indices for split-screen task. | def generate_indices_split(df, seed, comparison='met_v_ref', n_repeats=None):
"""Generate randomized presentation indices for split-screen task.
We take in the dataframe describing the metamer images combined into our
stimuli array and correctly structure the presentation indices for the
split-screen t... | [
"def",
"generate_indices_split",
"(",
"df",
",",
"seed",
",",
"comparison",
"=",
"'met_v_ref'",
",",
"n_repeats",
"=",
"None",
")",
":",
"if",
"n_repeats",
"is",
"not",
"None",
":",
"if",
"comparison",
"==",
"'met_v_ref'",
"and",
"n_repeats",
"%",
"4",
"!=... | [
302,
0
] | [
417,
17
] | python | en | ['en', 'sl', 'en'] | True |
create_eccentricity_masks | (img_size=(2048, 2600), max_ecc=26.8) | Create log-eccentricity masks to apply to stimuli.
In order to investigate the accuracy of our linear approximation of
scaling, we want to test whether participants can do the task with the same
accuracy using only information from specific eccentricity bands. This
creates the masks to use for that.
... | Create log-eccentricity masks to apply to stimuli. | def create_eccentricity_masks(img_size=(2048, 2600), max_ecc=26.8):
"""Create log-eccentricity masks to apply to stimuli.
In order to investigate the accuracy of our linear approximation of
scaling, we want to test whether participants can do the task with the same
accuracy using only information from ... | [
"def",
"create_eccentricity_masks",
"(",
"img_size",
"=",
"(",
"2048",
",",
"2600",
")",
",",
"max_ecc",
"=",
"26.8",
")",
":",
"masks",
"=",
"pooling",
".",
"log_eccentricity_windows",
"(",
"img_size",
",",
"4",
",",
"max_ecc",
"=",
"max_ecc",
",",
"windo... | [
420,
0
] | [
473,
25
] | python | en | ['en', 'en', 'en'] | True |
TestMcrouterBasic.test_invalid_key | (self) |
Tests behavior when mcrouter routes keys which have prefixes that are
not in the config.
|
Tests behavior when mcrouter routes keys which have prefixes that are
not in the config.
| def test_invalid_key(self):
"""
Tests behavior when mcrouter routes keys which have prefixes that are
not in the config.
"""
mcr = self.get_mcrouter()
invalid_key = '/blah/bloh/key'
self.assertFalse(mcr.set(invalid_key, 'value'))
self.assertEqual(mcr.get(... | [
"def",
"test_invalid_key",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"invalid_key",
"=",
"'/blah/bloh/key'",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"set",
"(",
"invalid_key",
",",
"'value'",
")",
")",
"self",
".",
"a... | [
50,
4
] | [
59,
74
] | python | en | ['en', 'error', 'th'] | False |
TestBasicAllSync.test_basic_all_sync | (self) |
Tests that the responses are being aggregated and the most awful
(based on the awfulness map) is begin returned
|
Tests that the responses are being aggregated and the most awful
(based on the awfulness map) is begin returned
| def test_basic_all_sync(self):
"""
Tests that the responses are being aggregated and the most awful
(based on the awfulness map) is begin returned
"""
mcr = self.get_mcrouter()
# set key in three cluster
self.mc1.set("key", "value")
self.mc2.set("key", "v... | [
"def",
"test_basic_all_sync",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"# set key in three cluster",
"self",
".",
"mc1",
".",
"set",
"(",
"\"key\"",
",",
"\"value\"",
")",
"self",
".",
"mc2",
".",
"set",
"(",
"\"key\"",
"... | [
375,
4
] | [
405,
43
] | python | en | ['en', 'error', 'th'] | False |
TestBasicAllSyncAppendPrependTouch.test_append_prepend_all_sync | (self) |
Tests that append and prepend work with AllSync. We rely on these
tests to verify correctness of append/prepend since we don't use
these commands in production.
|
Tests that append and prepend work with AllSync. We rely on these
tests to verify correctness of append/prepend since we don't use
these commands in production.
| def test_append_prepend_all_sync(self):
"""
Tests that append and prepend work with AllSync. We rely on these
tests to verify correctness of append/prepend since we don't use
these commands in production.
"""
mcr = self.get_mcrouter()
mcr.set("key", "value")
... | [
"def",
"test_append_prepend_all_sync",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"mcr",
".",
"set",
"(",
"\"key\"",
",",
"\"value\"",
")",
"self",
".",
"assertEqual",
"(",
"self",
".",
"mc1",
".",
"get",
"(",
"\"key\"",
... | [
416,
4
] | [
447,
41
] | python | en | ['en', 'error', 'th'] | False |
TestBasicAllFirst.test_basic_all_first | (self) |
Tests that the first non-tko response is returned
|
Tests that the first non-tko response is returned
| def test_basic_all_first(self):
"""
Tests that the first non-tko response is returned
"""
mcr = self.get_mcrouter()
self.mc1.terminate()
self.assertTrue(mcr.set("key", "value"))
self.assertEqual(mcr.get("key"), "value")
self.assertEqual(mcr.gat(0, "key"),... | [
"def",
"test_basic_all_first",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"self",
".",
"mc1",
".",
"terminate",
"(",
")",
"self",
".",
"assertTrue",
"(",
"mcr",
".",
"set",
"(",
"\"key\"",
",",
"\"value\"",
")",
")",
"s... | [
504,
4
] | [
514,
43
] | python | en | ['en', 'error', 'th'] | False |
TestBasicAllMajority.test_basic_all_majority | (self) |
Tests that the majority response (ties broken by awfulness) is being
returned
|
Tests that the majority response (ties broken by awfulness) is being
returned
| def test_basic_all_majority(self):
"""
Tests that the majority response (ties broken by awfulness) is being
returned
"""
mcr = self.get_mcrouter()
# set key in four cluster
self.mc1.set("key", "value")
self.mc2.set("key", "value")
self.mc3.set("ke... | [
"def",
"test_basic_all_majority",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"# set key in four cluster",
"self",
".",
"mc1",
".",
"set",
"(",
"\"key\"",
",",
"\"value\"",
")",
"self",
".",
"mc2",
".",
"set",
"(",
"\"key\"",
... | [
531,
4
] | [
591,
43
] | python | en | ['en', 'error', 'th'] | False |
TestBasicFailover.test_failover | (self) |
Tests that the failover path works.
|
Tests that the failover path works.
| def test_failover(self):
"""
Tests that the failover path works.
"""
# default path is mctestc01
mcr = self.get_mcrouter()
# Go through the default route and verify a get.
self.assertTrue(self.mc1.set("key", "value"))
self.assertEqual(mcr.get("key"), "va... | [
"def",
"test_failover",
"(",
"self",
")",
":",
"# default path is mctestc01",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"# Go through the default route and verify a get.",
"self",
".",
"assertTrue",
"(",
"self",
".",
"mc1",
".",
"set",
"(",
"\"key\"",
","... | [
606,
4
] | [
629,
49
] | python | en | ['en', 'error', 'th'] | False |
TestBasicFailoverOverride.test_failover_override | (self) |
Tests that the failover overrides work.
|
Tests that the failover overrides work.
| def test_failover_override(self):
"""
Tests that the failover overrides work.
"""
mcr = self.get_mcrouter()
# See that failovers are disabled for cluster1
self.mc1.terminate()
self.assertEqual(mcr.set("key1", "value1"), None)
self.assertEqual(mcr.get("key... | [
"def",
"test_failover_override",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
")",
"# See that failovers are disabled for cluster1",
"self",
".",
"mc1",
".",
"terminate",
"(",
")",
"self",
".",
"assertEqual",
"(",
"mcr",
".",
"set",
"("... | [
670,
4
] | [
685,
51
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2.test_l1_l2_get | (self) |
Tests that get requests using l1/l2 caching and result upgrading is working
|
Tests that get requests using l1/l2 caching and result upgrading is working
| def test_l1_l2_get(self):
"""
Tests that get requests using l1/l2 caching and result upgrading is working
"""
mcr = self.get_mcrouter(self.config)
# get a non-existent key
self.assertFalse(mcr.get("key1"))
# set keys in only l1 pool
self.l1.set("key1", "... | [
"def",
"test_l1_l2_get",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# get a non-existent key",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"get",
"(",
"\"key1\"",
")",
")",
"# set keys in only l1 pool",
... | [
737,
4
] | [
769,
55
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2.test_l1_l2_get_l1_down | (self) |
Tests that gets using l1/l2 caching is working when l1 is down
|
Tests that gets using l1/l2 caching is working when l1 is down
| def test_l1_l2_get_l1_down(self):
"""
Tests that gets using l1/l2 caching is working when l1 is down
"""
mcr = self.get_mcrouter(self.config)
# set key in l1 and l2 pools
self.l1.set("key1", "value1")
self.l2.set("key1", "value1")
self.assertEqual(self.l1... | [
"def",
"test_l1_l2_get_l1_down",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# set key in l1 and l2 pools",
"self",
".",
"l1",
".",
"set",
"(",
"\"key1\"",
",",
"\"value1\"",
")",
"self",
".",
"l2",
"."... | [
771,
4
] | [
788,
44
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2.test_l1_l2_get_l2_down | (self) |
Tests that gets using l1/l2 caching is working when l2 is down
|
Tests that gets using l1/l2 caching is working when l2 is down
| def test_l1_l2_get_l2_down(self):
"""
Tests that gets using l1/l2 caching is working when l2 is down
"""
mcr = self.get_mcrouter(self.config)
# set key in l1 and l2 pools
self.l1.set("key1", "value1")
self.l2.set("key1", "value1")
self.assertEqual(self.l1... | [
"def",
"test_l1_l2_get_l2_down",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# set key in l1 and l2 pools",
"self",
".",
"l1",
".",
"set",
"(",
"\"key1\"",
",",
"\"value1\"",
")",
"self",
".",
"l2",
"."... | [
790,
4
] | [
814,
45
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1MultipleL2SizeSplit.test_l1_multiple_l2_sizesplit_get_after_leaseset | (self) |
Basic functionality tests. Simple Get after Set-lease should work
in a setup with single L1 and multiple L2's.
|
Basic functionality tests. Simple Get after Set-lease should work
in a setup with single L1 and multiple L2's.
| def test_l1_multiple_l2_sizesplit_get_after_leaseset(self):
"""
Basic functionality tests. Simple Get after Set-lease should work
in a setup with single L1 and multiple L2's.
"""
mcr = self.get_mcrouter(self.config_multil2)
# Issue leaseGet with a non-existing key, we sh... | [
"def",
"test_l1_multiple_l2_sizesplit_get_after_leaseset",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config_multil2",
")",
"# Issue leaseGet with a non-existing key, we should get a valid lease token",
"result",
"=",
"mcr",
".",
"lea... | [
875,
4
] | [
897,
53
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1_l2_sizesplit_get | (self) |
Basic functionality tests. Sets go to the right place, gets route properly
|
Basic functionality tests. Sets go to the right place, gets route properly
| def test_l1_l2_sizesplit_get(self):
"""
Basic functionality tests. Sets go to the right place, gets route properly
"""
mcr = self.get_mcrouter(self.config)
# get a non-existent key
self.assertFalse(mcr.get("key1"))
# set small key
mcr.set("key1", "value1... | [
"def",
"test_l1_l2_sizesplit_get",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# get a non-existent key",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"get",
"(",
"\"key1\"",
")",
")",
"# set small key",
... | [
914,
4
] | [
947,
48
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1_l2_sizesplit_bothget | (self) |
Basic functionality. Allow full setst to both pools.
|
Basic functionality. Allow full setst to both pools.
| def test_l1_l2_sizesplit_bothget(self):
"""
Basic functionality. Allow full setst to both pools.
"""
mcr = self.get_mcrouter(self.config_bothset)
self.assertFalse(mcr.get("key1"))
# small key should only exist in L1
mcr.set("key1", "value1")
# small key... | [
"def",
"test_l1_l2_sizesplit_bothget",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config_bothset",
")",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"get",
"(",
"\"key1\"",
")",
")",
"# small key should only exist in L1",
... | [
949,
4
] | [
976,
49
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1_l2_get_l2_down | (self) |
If L2 is down, do we get expected errors.
|
If L2 is down, do we get expected errors.
| def test_l1_l2_get_l2_down(self):
"""
If L2 is down, do we get expected errors.
"""
mcr = self.get_mcrouter(self.config)
value = "foob" * 200
mcr.set("key", value)
self.l2.terminate()
self.assertEqual(self.l1.get("key"), "")
self.assertFalse(mcr.... | [
"def",
"test_l1_l2_get_l2_down",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"value",
"=",
"\"foob\"",
"*",
"200",
"mcr",
".",
"set",
"(",
"\"key\"",
",",
"value",
")",
"self",
".",
"l2",
".",
"ter... | [
978,
4
] | [
989,
40
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1_l2_cas | (self) |
Tests that gets requests using l1/l2 caching and result upgrading is working
|
Tests that gets requests using l1/l2 caching and result upgrading is working
| def test_l1_l2_cas(self):
"""
Tests that gets requests using l1/l2 caching and result upgrading is working
"""
mcr = self.get_mcrouter(self.config)
# get a non-existent key
self.assertFalse(mcr.get("key"))
# set small key which should go to L1
mcr.set("k... | [
"def",
"test_l1_l2_cas",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# get a non-existent key",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"get",
"(",
"\"key\"",
")",
")",
"# set small key which should go... | [
991,
4
] | [
1020,
70
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1_l2_cas_large | (self) |
Tests that large gets requests using l1/l2 caching / result upgrading.
|
Tests that large gets requests using l1/l2 caching / result upgrading.
| def test_l1_l2_cas_large(self):
"""
Tests that large gets requests using l1/l2 caching / result upgrading.
"""
mcr = self.get_mcrouter(self.config)
# get a non-existent key
self.assertFalse(mcr.get("key1"))
# set large key which should go to L2
value = "... | [
"def",
"test_l1_l2_cas_large",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# get a non-existent key",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"get",
"(",
"\"key1\"",
")",
")",
"# set large key which sh... | [
1022,
4
] | [
1052,
58
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1_l2_cas_large_fail | (self) |
Tests that subsequent cas using same token fail in L1/L2 caching fail
|
Tests that subsequent cas using same token fail in L1/L2 caching fail
| def test_l1_l2_cas_large_fail(self):
"""
Tests that subsequent cas using same token fail in L1/L2 caching fail
"""
mcr = self.get_mcrouter(self.config)
# get a non-existent key
self.assertFalse(mcr.get("key1"))
# set large key which should go to L2
value... | [
"def",
"test_l1_l2_cas_large_fail",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# get a non-existent key",
"self",
".",
"assertFalse",
"(",
"mcr",
".",
"get",
"(",
"\"key1\"",
")",
")",
"# set large key whi... | [
1054,
4
] | [
1081,
64
] | python | en | ['en', 'error', 'th'] | False |
TestMcrouterBasicL1L2SizeSplit.test_l1l2_l1_hit_l2_lookup_fail | (self) |
Basic functionality test in L1L2Split
Verify that L1 sentinel is deleted whenever there is a L1 hit but a L2 lookup failure.
|
Basic functionality test in L1L2Split
Verify that L1 sentinel is deleted whenever there is a L1 hit but a L2 lookup failure.
| def test_l1l2_l1_hit_l2_lookup_fail(self):
"""
Basic functionality test in L1L2Split
Verify that L1 sentinel is deleted whenever there is a L1 hit but a L2 lookup failure.
"""
mcr = self.get_mcrouter(self.config)
# Issue leaseGet with a non-existing key, we should get a ... | [
"def",
"test_l1l2_l1_hit_l2_lookup_fail",
"(",
"self",
")",
":",
"mcr",
"=",
"self",
".",
"get_mcrouter",
"(",
"self",
".",
"config",
")",
"# Issue leaseGet with a non-existing key, we should get a valid lease token",
"result",
"=",
"mcr",
".",
"leaseGet",
"(",
"\"key1\... | [
1083,
4
] | [
1125,
70
] | python | en | ['en', 'error', 'th'] | False |
ConanRecipe._abseil_abi_config | (self) | Determine the Abseil ABI for polyfills (absl::any, absl::optional, absl::string_view, and absl::variant) | Determine the Abseil ABI for polyfills (absl::any, absl::optional, absl::string_view, and absl::variant) | def _abseil_abi_config(self):
"""Determine the Abseil ABI for polyfills (absl::any, absl::optional, absl::string_view, and absl::variant)"""
if self.settings.compiler.get_safe("cppstd"):
if self.settings.compiler.get_safe("cppstd") >= "17":
return "1"
return "0"
... | [
"def",
"_abseil_abi_config",
"(",
"self",
")",
":",
"if",
"self",
".",
"settings",
".",
"compiler",
".",
"get_safe",
"(",
"\"cppstd\"",
")",
":",
"if",
"self",
".",
"settings",
".",
"compiler",
".",
"get_safe",
"(",
"\"cppstd\"",
")",
">=",
"\"17\"",
":"... | [
67,
4
] | [
79,
18
] | python | en | ['en', 'en', 'en'] | True |
inline_check | (self, arithmetic_func, expected_result, int_type, min, max, node=None) | Check that arithmetic functions work using inline tests with Int128, UInt128, Int256, and UInt256.
| Check that arithmetic functions work using inline tests with Int128, UInt128, Int256, and UInt256.
| def inline_check(self, arithmetic_func, expected_result, int_type, min, max, node=None):
"""Check that arithmetic functions work using inline tests with Int128, UInt128, Int256, and UInt256.
"""
if node is None:
node = self.context.node
if arithmetic_func in ['negate','abs']:
with Whe... | [
"def",
"inline_check",
"(",
"self",
",",
"arithmetic_func",
",",
"expected_result",
",",
"int_type",
",",
"min",
",",
"max",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"if",
... | [
26,
0
] | [
66,
24
] | python | en | ['en', 'en', 'en'] | True |
table_check | (self, arithmetic_func, expected_result, int_type, min, max, node=None) | Check that arithmetic functions work using tables with Int128, UInt128, Int256, and UInt256.
| Check that arithmetic functions work using tables with Int128, UInt128, Int256, and UInt256.
| def table_check(self, arithmetic_func, expected_result, int_type, min, max, node=None):
"""Check that arithmetic functions work using tables with Int128, UInt128, Int256, and UInt256.
"""
if node is None:
node = self.context.node
table_name = f'table_{getuid()}'
with Given(f"I have a tabl... | [
"def",
"table_check",
"(",
"self",
",",
"arithmetic_func",
",",
"expected_result",
",",
"int_type",
",",
"min",
",",
"max",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"table_na... | [
70,
0
] | [
132,
20
] | python | en | ['en', 'en', 'en'] | True |
inline_check_dec | (self, arithmetic_func, expected_result, node=None) | Check that arithmetic functions work using inline with Decimal256.
| Check that arithmetic functions work using inline with Decimal256.
| def inline_check_dec(self, arithmetic_func, expected_result, node=None):
"""Check that arithmetic functions work using inline with Decimal256.
"""
if node is None:
node = self.context.node
if arithmetic_func in ['negate','abs']:
with When(f"I check {arithmetic_func} with toDecimal256"... | [
"def",
"inline_check_dec",
"(",
"self",
",",
"arithmetic_func",
",",
"expected_result",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"if",
"arithmetic_func",
"in",
"[",
"'negate'",
... | [
136,
0
] | [
159,
53
] | python | en | ['en', 'en', 'en'] | True |
table_check_dec | (self, arithmetic_func, expected_result, node=None) | Check that arithmetic functions work using tables with Decimal256.
| Check that arithmetic functions work using tables with Decimal256.
| def table_check_dec(self, arithmetic_func, expected_result, node=None):
"""Check that arithmetic functions work using tables with Decimal256.
"""
if node is None:
node = self.context.node
table_name = f'table_{getuid()}'
with Given(f"I have a table"):
table(name = table_name, data... | [
"def",
"table_check_dec",
"(",
"self",
",",
"arithmetic_func",
",",
"expected_result",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"table_name",
"=",
"f'table_{getuid()}'",
"with",
... | [
163,
0
] | [
197,
53
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None) | Check that arithmetic functions work with extended precision data types.
| Check that arithmetic functions work with extended precision data types.
| def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None):
"""Check that arithmetic functions work with extended precision data types.
"""
self.context.node = self.context.cluster.node(node)
self.context.mysql_node = self.context.cluster.node(mysql_node)
with allow_expe... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"mysql_node",
"=",
"\"mysql1\"",
",",
"stress",
"=",
"None",
",",
"parallel",
"=",
"None",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluste... | [
206,
0
] | [
216,
39
] | python | en | ['en', 'en', 'en'] | True |
fetchNetwork | (network_dir, model, refList, ref_graph = False,
core_only = False, accessory_only = False, use_gpu = False) | Load the network based on input options
Returns the network as a graph-tool format graph, and sets
the slope parameter of the passed model object.
Args:
network_dir (str)
A network used to define clusters
model (ClusterFit)
A fitted model ob... | Load the network based on input options | def fetchNetwork(network_dir, model, refList, ref_graph = False,
core_only = False, accessory_only = False, use_gpu = False):
"""Load the network based on input options
Returns the network as a graph-tool format graph, and sets
the slope parameter of the passed model object.
... | [
"def",
"fetchNetwork",
"(",
"network_dir",
",",
"model",
",",
"refList",
",",
"ref_graph",
"=",
"False",
",",
"core_only",
"=",
"False",
",",
"accessory_only",
"=",
"False",
",",
"use_gpu",
"=",
"False",
")",
":",
"# If a refined fit, may use just core or accessor... | [
53,
0
] | [
126,
38
] | python | en | ['en', 'en', 'en'] | True |
load_network_file | (fn, use_gpu = False) | Load the network based on input options
Returns the network as a graph-tool format graph, and sets
the slope parameter of the passed model object.
Args:
fn (str)
Network file name
use_gpu (bool)
Use cugraph library to load graph
Retu... | Load the network based on input options | def load_network_file(fn, use_gpu = False):
"""Load the network based on input options
Returns the network as a graph-tool format graph, and sets
the slope parameter of the passed model object.
Args:
fn (str)
Network file name
use_gpu (bool)
... | [
"def",
"load_network_file",
"(",
"fn",
",",
"use_gpu",
"=",
"False",
")",
":",
"# Load the network from the specified file",
"if",
"use_gpu",
":",
"G_df",
"=",
"cudf",
".",
"read_csv",
"(",
"fn",
",",
"compression",
"=",
"'gzip'",
")",
"if",
"'src'",
"in",
"... | [
128,
0
] | [
160,
24
] | python | en | ['en', 'en', 'en'] | True |
checkNetworkVertexCount | (seq_list, G, use_gpu) | Checks the number of network vertices matches the number
of sequence names.
Args:
seq_list (list)
The list of sequence names
G (graph)
The network of sequences
use_gpu (bool)
Whether to use cugraph for graph analyses
| Checks the number of network vertices matches the number
of sequence names. | def checkNetworkVertexCount(seq_list, G, use_gpu):
"""Checks the number of network vertices matches the number
of sequence names.
Args:
seq_list (list)
The list of sequence names
G (graph)
The network of sequences
use_gpu (bool)
Whether to use cug... | [
"def",
"checkNetworkVertexCount",
"(",
"seq_list",
",",
"G",
",",
"use_gpu",
")",
":",
"vertex_list",
"=",
"set",
"(",
"get_vertex_list",
"(",
"G",
",",
"use_gpu",
"=",
"use_gpu",
")",
")",
"networkMissing",
"=",
"set",
"(",
"set",
"(",
"range",
"(",
"le... | [
162,
0
] | [
178,
19
] | python | en | ['en', 'en', 'en'] | True |
getCliqueRefs | (G, reference_indices = set()) | Recursively prune a network of its cliques. Returns one vertex from
a clique at each stage
Args:
G (graph)
The graph to get clique representatives from
reference_indices (set)
The unique list of vertices being kept, to add to
| Recursively prune a network of its cliques. Returns one vertex from
a clique at each stage | def getCliqueRefs(G, reference_indices = set()):
"""Recursively prune a network of its cliques. Returns one vertex from
a clique at each stage
Args:
G (graph)
The graph to get clique representatives from
reference_indices (set)
The unique list of vertices being kept,... | [
"def",
"getCliqueRefs",
"(",
"G",
",",
"reference_indices",
"=",
"set",
"(",
")",
")",
":",
"cliques",
"=",
"gt",
".",
"max_cliques",
"(",
"G",
")",
"try",
":",
"# Get the first clique, and see if it has any members already",
"# contained in the vertex list",
"clique"... | [
180,
0
] | [
206,
28
] | python | en | ['en', 'en', 'en'] | True |
cliquePrune | (component, graph, reference_indices, components_list) | Wrapper function around :func:`~getCliqueRefs` so it can be
called by a multiprocessing pool
| Wrapper function around :func:`~getCliqueRefs` so it can be
called by a multiprocessing pool
| def cliquePrune(component, graph, reference_indices, components_list):
"""Wrapper function around :func:`~getCliqueRefs` so it can be
called by a multiprocessing pool
"""
if gt.openmp_enabled():
gt.openmp_set_num_threads(1)
subgraph = gt.GraphView(graph, vfilt=components_list == component... | [
"def",
"cliquePrune",
"(",
"component",
",",
"graph",
",",
"reference_indices",
",",
"components_list",
")",
":",
"if",
"gt",
".",
"openmp_enabled",
"(",
")",
":",
"gt",
".",
"openmp_set_num_threads",
"(",
"1",
")",
"subgraph",
"=",
"gt",
".",
"GraphView",
... | [
208,
0
] | [
221,
26
] | python | en | ['en', 'en', 'en'] | True |
translate_network_indices | (G_ref_df, reference_indices) | Function for ensuring an updated reference network retains
numbering consistent with sample names
Args:
G_ref_df (cudf data frame)
List of edges in reference network
reference_indices (list)
The ordered list of reference indices in the original network
... | Function for ensuring an updated reference network retains
numbering consistent with sample names | def translate_network_indices(G_ref_df, reference_indices):
"""Function for ensuring an updated reference network retains
numbering consistent with sample names
Args:
G_ref_df (cudf data frame)
List of edges in reference network
reference_indices (list)
... | [
"def",
"translate_network_indices",
"(",
"G_ref_df",
",",
"reference_indices",
")",
":",
"# Translate network indices to match name order",
"G_ref_df",
"[",
"'source'",
"]",
"=",
"[",
"reference_indices",
".",
"index",
"(",
"x",
")",
"for",
"x",
"in",
"G_ref_df",
"[... | [
223,
0
] | [
241,
17
] | python | en | ['en', 'en', 'en'] | True |
extractReferences | (G, dbOrder, outPrefix, outSuffix = '', type_isolate = None,
existingRefs = None, threads = 1, use_gpu = False) | Extract references for each cluster based on cliques
Writes chosen references to file by calling :func:`~writeReferences`
Args:
G (graph)
A network used to define clusters
dbOrder (list)
The order of files in the sketches, so returned references are in... | Extract references for each cluster based on cliques | def extractReferences(G, dbOrder, outPrefix, outSuffix = '', type_isolate = None,
existingRefs = None, threads = 1, use_gpu = False):
"""Extract references for each cluster based on cliques
Writes chosen references to file by calling :func:`~writeReferences`
Args:
... | [
"def",
"extractReferences",
"(",
"G",
",",
"dbOrder",
",",
"outPrefix",
",",
"outSuffix",
"=",
"''",
",",
"type_isolate",
"=",
"None",
",",
"existingRefs",
"=",
"None",
",",
"threads",
"=",
"1",
",",
"use_gpu",
"=",
"False",
")",
":",
"if",
"existingRefs... | [
243,
0
] | [
441,
65
] | python | en | ['en', 'en', 'en'] | True |
writeReferences | (refList, outPrefix, outSuffix = "") | Writes chosen references to file
Args:
refList (list)
Reference names to write
outPrefix (str)
Prefix for output file
outSuffix (str)
Suffix for output file (.refs will be appended)
Returns:
refFileName (str)
The name of the file ... | Writes chosen references to file | def writeReferences(refList, outPrefix, outSuffix = ""):
"""Writes chosen references to file
Args:
refList (list)
Reference names to write
outPrefix (str)
Prefix for output file
outSuffix (str)
Suffix for output file (.refs will be appended)
Retu... | [
"def",
"writeReferences",
"(",
"refList",
",",
"outPrefix",
",",
"outSuffix",
"=",
"\"\"",
")",
":",
"# write references to file",
"refFileName",
"=",
"outPrefix",
"+",
"\"/\"",
"+",
"os",
".",
"path",
".",
"basename",
"(",
"outPrefix",
")",
"+",
"outSuffix",
... | [
443,
0
] | [
463,
22
] | python | en | ['en', 'el-Latn', 'en'] | True |
network_to_edges | (prev_G_fn, rlist, adding_qq_dists = False,
old_ids = None, previous_pkl = None, weights = False,
use_gpu = False) | Load previous network, extract the edges to match the
vertex order specified in rlist, and also return weights if specified.
Args:
prev_G_fn (str or graph object)
Path of file containing existing network, or already-loaded
graph object
adding_qq_dists (bool)
... | Load previous network, extract the edges to match the
vertex order specified in rlist, and also return weights if specified. | def network_to_edges(prev_G_fn, rlist, adding_qq_dists = False,
old_ids = None, previous_pkl = None, weights = False,
use_gpu = False):
"""Load previous network, extract the edges to match the
vertex order specified in rlist, and also return weights if specified.
... | [
"def",
"network_to_edges",
"(",
"prev_G_fn",
",",
"rlist",
",",
"adding_qq_dists",
"=",
"False",
",",
"old_ids",
"=",
"None",
",",
"previous_pkl",
"=",
"None",
",",
"weights",
"=",
"False",
",",
"use_gpu",
"=",
"False",
")",
":",
"# Load graph from file if pas... | [
465,
0
] | [
563,
37
] | python | en | ['en', 'en', 'en'] | True |
print_network_summary | (G, betweenness_sample = betweenness_sample_default, use_gpu = False) | Wrapper function for printing network information
Args:
G (graph)
List of reference sequence labels
betweenness_sample (int)
Number of sequences per component used to estimate betweenness using
a GPU. Smaller numbers are faster but less precise [default = 100]
... | Wrapper function for printing network information | def print_network_summary(G, betweenness_sample = betweenness_sample_default, use_gpu = False):
"""Wrapper function for printing network information
Args:
G (graph)
List of reference sequence labels
betweenness_sample (int)
Number of sequences per component used to estim... | [
"def",
"print_network_summary",
"(",
"G",
",",
"betweenness_sample",
"=",
"betweenness_sample_default",
",",
"use_gpu",
"=",
"False",
")",
":",
"# print some summaries",
"(",
"metrics",
",",
"scores",
")",
"=",
"networkSummary",
"(",
"G",
",",
"betweenness_sample",
... | [
565,
0
] | [
587,
58
] | python | en | ['en', 'en', 'en'] | True |
initial_graph_properties | (rlist, qlist) | Initial processing of sequence names for
network construction.
Args:
rlist (list)
List of reference sequence labels
qlist (list)
List of query sequence labels
Returns:
vertex_labels (list)
Ordered list of sequences in network
self_compari... | Initial processing of sequence names for
network construction. | def initial_graph_properties(rlist, qlist):
"""Initial processing of sequence names for
network construction.
Args:
rlist (list)
List of reference sequence labels
qlist (list)
List of query sequence labels
Returns:
vertex_labels (list)
Ordere... | [
"def",
"initial_graph_properties",
"(",
"rlist",
",",
"qlist",
")",
":",
"if",
"rlist",
"==",
"qlist",
":",
"self_comparison",
"=",
"True",
"vertex_labels",
"=",
"rlist",
"else",
":",
"self_comparison",
"=",
"False",
"vertex_labels",
"=",
"rlist",
"+",
"qlist"... | [
589,
0
] | [
612,
41
] | python | en | ['en', 'en', 'en'] | True |
process_weights | (distMat, weights_type) | Calculate edge weights from the distance matrix
Args:
distMat (2 column ndarray)
Numpy array of pairwise distances
weights_type (str)
Measure to calculate from the distMat to use as edge weights in network
- options are core, accessory or euclidean distance
R... | Calculate edge weights from the distance matrix
Args:
distMat (2 column ndarray)
Numpy array of pairwise distances
weights_type (str)
Measure to calculate from the distMat to use as edge weights in network
- options are core, accessory or euclidean distance | def process_weights(distMat, weights_type):
"""Calculate edge weights from the distance matrix
Args:
distMat (2 column ndarray)
Numpy array of pairwise distances
weights_type (str)
Measure to calculate from the distMat to use as edge weights in network
- optio... | [
"def",
"process_weights",
"(",
"distMat",
",",
"weights_type",
")",
":",
"processed_weights",
"=",
"[",
"]",
"if",
"weights_type",
"is",
"not",
"None",
"and",
"distMat",
"is",
"not",
"None",
":",
"# Check weights type is valid",
"if",
"weights_type",
"not",
"in"... | [
614,
0
] | [
641,
28
] | python | en | ['en', 'en', 'en'] | True |
process_previous_network | (previous_network = None, adding_qq_dists = False, old_ids = None,
previous_pkl = None, vertex_labels = None, weights = False, use_gpu = False) | Extract edge types from an existing network
Args:
previous_network (str or graph object)
Name of file containing a previous network to be integrated into this new
network, or already-loaded graph object
adding_qq_dists (bool)
Boolean specifying whether query-quer... | Extract edge types from an existing network | def process_previous_network(previous_network = None, adding_qq_dists = False, old_ids = None,
previous_pkl = None, vertex_labels = None, weights = False, use_gpu = False):
"""Extract edge types from an existing network
Args:
previous_network (str or graph object)
... | [
"def",
"process_previous_network",
"(",
"previous_network",
"=",
"None",
",",
"adding_qq_dists",
"=",
"False",
",",
"old_ids",
"=",
"None",
",",
"previous_pkl",
"=",
"None",
",",
"vertex_labels",
"=",
"None",
",",
"weights",
"=",
"False",
",",
"use_gpu",
"=",
... | [
643,
0
] | [
699,
54
] | python | en | ['en', 'en', 'en'] | True |
construct_network_from_edge_list | (rlist,
qlist,
edge_list,
weights = None,
distMat = None,
previous_network = None,
... | Construct an undirected network using a data frame of edges. Nodes are samples and
edges where samples are within the same cluster
Will print summary statistics about the network to ``STDERR``
Args:
rlist (list)
List of reference sequence labels
qlist (list)
List of... | Construct an undirected network using a data frame of edges. Nodes are samples and
edges where samples are within the same cluster | def construct_network_from_edge_list(rlist,
qlist,
edge_list,
weights = None,
distMat = None,
previous_network = None,
... | [
"def",
"construct_network_from_edge_list",
"(",
"rlist",
",",
"qlist",
",",
"edge_list",
",",
"weights",
"=",
"None",
",",
"distMat",
"=",
"None",
",",
"previous_network",
"=",
"None",
",",
"adding_qq_dists",
"=",
"False",
",",
"old_ids",
"=",
"None",
",",
"... | [
701,
0
] | [
820,
12
] | python | en | ['en', 'en', 'en'] | True |
construct_network_from_df | (rlist,
qlist,
G_df,
weights = False,
distMat = None,
previous_network = None,
adding_qq_dists = False,
... | Construct an undirected network using a data frame of edges. Nodes are samples and
edges where samples are within the same cluster
Will print summary statistics about the network to ``STDERR``
Args:
rlist (list)
List of reference sequence labels
qlist (list)
List of... | Construct an undirected network using a data frame of edges. Nodes are samples and
edges where samples are within the same cluster | def construct_network_from_df(rlist,
qlist,
G_df,
weights = False,
distMat = None,
previous_network = None,
adding_qq_dists = Fa... | [
"def",
"construct_network_from_df",
"(",
"rlist",
",",
"qlist",
",",
"G_df",
",",
"weights",
"=",
"False",
",",
"distMat",
"=",
"None",
",",
"previous_network",
"=",
"None",
",",
"adding_qq_dists",
"=",
"False",
",",
"old_ids",
"=",
"None",
",",
"previous_pk... | [
822,
0
] | [
933,
12
] | python | en | ['en', 'en', 'en'] | True |
construct_network_from_sparse_matrix | (rlist,
qlist,
sparse_input,
weights = None,
previous_network = None,
previous_pkl = None,
... | Construct an undirected network using a sparse matrix. Nodes are samples and
edges where samples are within the same cluster
Will print summary statistics about the network to ``STDERR``
Args:
rlist (list)
List of reference sequence labels
qlist (list)
List of query... | Construct an undirected network using a sparse matrix. Nodes are samples and
edges where samples are within the same cluster | def construct_network_from_sparse_matrix(rlist,
qlist,
sparse_input,
weights = None,
previous_network = None,
... | [
"def",
"construct_network_from_sparse_matrix",
"(",
"rlist",
",",
"qlist",
",",
"sparse_input",
",",
"weights",
"=",
"None",
",",
"previous_network",
"=",
"None",
",",
"previous_pkl",
"=",
"None",
",",
"betweenness_sample",
"=",
"betweenness_sample_default",
",",
"s... | [
935,
0
] | [
998,
12
] | python | en | ['en', 'en', 'en'] | True |
construct_dense_weighted_network | (rlist, distMat, weights_type = None, use_gpu = False) | Construct an undirected network using sequence lists, assignments of pairwise distances
to clusters, and the identifier of the cluster assigned to within-strain distances.
Nodes are samples and edges where samples are within the same cluster
Will print summary statistics about the network to ``STDERR``
... | Construct an undirected network using sequence lists, assignments of pairwise distances
to clusters, and the identifier of the cluster assigned to within-strain distances.
Nodes are samples and edges where samples are within the same cluster | def construct_dense_weighted_network(rlist, distMat, weights_type = None, use_gpu = False):
"""Construct an undirected network using sequence lists, assignments of pairwise distances
to clusters, and the identifier of the cluster assigned to within-strain distances.
Nodes are samples and edges where samples... | [
"def",
"construct_dense_weighted_network",
"(",
"rlist",
",",
"distMat",
",",
"weights_type",
"=",
"None",
",",
"use_gpu",
"=",
"False",
")",
":",
"# Check GPU library use",
"use_gpu",
"=",
"check_and_set_gpu",
"(",
"use_gpu",
",",
"gpu_lib",
",",
"quit_on_fail",
... | [
1000,
0
] | [
1061,
12
] | python | en | ['en', 'en', 'en'] | True |
construct_network_from_assignments | (rlist, qlist, assignments, within_label = 1, int_offset = 0,
weights = None, distMat = None, weights_type = None, previous_network = None, old_ids = None,
adding_qq_dists = False, previous_pkl = None, betweenness_sample = betweenness_sample_default,
summarise = True, use_gpu = False) | Construct an undirected network using sequence lists, assignments of pairwise distances
to clusters, and the identifier of the cluster assigned to within-strain distances.
Nodes are samples and edges where samples are within the same cluster
Will print summary statistics about the network to ``STDERR``
... | Construct an undirected network using sequence lists, assignments of pairwise distances
to clusters, and the identifier of the cluster assigned to within-strain distances.
Nodes are samples and edges where samples are within the same cluster | def construct_network_from_assignments(rlist, qlist, assignments, within_label = 1, int_offset = 0,
weights = None, distMat = None, weights_type = None, previous_network = None, old_ids = None,
adding_qq_dists = False, previous_pkl = None, betweenness_sample = betweenness_sample_default,
summarise = True, u... | [
"def",
"construct_network_from_assignments",
"(",
"rlist",
",",
"qlist",
",",
"assignments",
",",
"within_label",
"=",
"1",
",",
"int_offset",
"=",
"0",
",",
"weights",
"=",
"None",
",",
"distMat",
"=",
"None",
",",
"weights_type",
"=",
"None",
",",
"previou... | [
1064,
0
] | [
1149,
12
] | python | en | ['en', 'en', 'en'] | True |
get_cugraph_triangles | (G) | Counts the number of triangles in a cugraph
network. Can be removed when the cugraph issue
https://github.com/rapidsai/cugraph/issues/1043 is fixed.
Args:
G (cugraph network)
Network to be analysed
Returns:
triangle_count (int)
Count of triangles in graph
... | Counts the number of triangles in a cugraph
network. Can be removed when the cugraph issue
https://github.com/rapidsai/cugraph/issues/1043 is fixed. | def get_cugraph_triangles(G):
"""Counts the number of triangles in a cugraph
network. Can be removed when the cugraph issue
https://github.com/rapidsai/cugraph/issues/1043 is fixed.
Args:
G (cugraph network)
Network to be analysed
Returns:
triangle_count (int)
... | [
"def",
"get_cugraph_triangles",
"(",
"G",
")",
":",
"nlen",
"=",
"G",
".",
"number_of_vertices",
"(",
")",
"df",
"=",
"G",
".",
"view_edge_list",
"(",
")",
"A",
"=",
"cp",
".",
"full",
"(",
"(",
"nlen",
",",
"nlen",
")",
",",
"0",
",",
"dtype",
"... | [
1151,
0
] | [
1170,
25
] | python | en | ['en', 'en', 'en'] | True |
networkSummary | (G, calc_betweenness=True, betweenness_sample = betweenness_sample_default,
use_gpu = False) | Provides summary values about the network
Args:
G (graph)
The network of strains
calc_betweenness (bool)
Whether to calculate betweenness stats
use_gpu (bool)
Whether to use cugraph for graph analysis
Returns:
metrics (list)
List ... | Provides summary values about the network | def networkSummary(G, calc_betweenness=True, betweenness_sample = betweenness_sample_default,
use_gpu = False):
"""Provides summary values about the network
Args:
G (graph)
The network of strains
calc_betweenness (bool)
Whether to calculate betweennes... | [
"def",
"networkSummary",
"(",
"G",
",",
"calc_betweenness",
"=",
"True",
",",
"betweenness_sample",
"=",
"betweenness_sample_default",
",",
"use_gpu",
"=",
"False",
")",
":",
"if",
"use_gpu",
":",
"use_gpu",
"=",
"check_and_set_gpu",
"(",
"use_gpu",
",",
"gpu_li... | [
1172,
0
] | [
1258,
27
] | python | en | ['en', 'en', 'en'] | True |
addQueryToNetwork | (dbFuncs, rList, qList, G, kmers,
assignments, model, queryDB, distances = None, distance_type = 'euclidean',
queryQuery = False, strand_preserved = False, weights = None, threads = 1,
use_gpu = False) | Finds edges between queries and items in the reference database,
and modifies the network to include them.
Args:
dbFuncs (list)
List of backend functions from :func:`~PopPUNK.utils.setupDBFuncs`
rList (list)
List of reference names
qList (list)
List o... | Finds edges between queries and items in the reference database,
and modifies the network to include them. | def addQueryToNetwork(dbFuncs, rList, qList, G, kmers,
assignments, model, queryDB, distances = None, distance_type = 'euclidean',
queryQuery = False, strand_preserved = False, weights = None, threads = 1,
use_gpu = False):
"""Finds edges between que... | [
"def",
"addQueryToNetwork",
"(",
"dbFuncs",
",",
"rList",
",",
"qList",
",",
"G",
",",
"kmers",
",",
"assignments",
",",
"model",
",",
"queryDB",
",",
"distances",
"=",
"None",
",",
"distance_type",
"=",
"'euclidean'",
",",
"queryQuery",
"=",
"False",
",",... | [
1260,
0
] | [
1431,
23
] | python | en | ['en', 'en', 'en'] | True |
add_self_loop | (G_df, seq_num, weights = False, renumber = True) | Adds self-loop to cugraph graph to ensure all nodes are included in
the graph, even if singletons.
Args:
G_df (cudf)
cudf data frame containing edge list
seq_num (int)
The expected number of nodes in the graph
renumber (bool)
Whether to renumber the v... | Adds self-loop to cugraph graph to ensure all nodes are included in
the graph, even if singletons. | def add_self_loop(G_df, seq_num, weights = False, renumber = True):
"""Adds self-loop to cugraph graph to ensure all nodes are included in
the graph, even if singletons.
Args:
G_df (cudf)
cudf data frame containing edge list
seq_num (int)
The expected number of nodes... | [
"def",
"add_self_loop",
"(",
"G_df",
",",
"seq_num",
",",
"weights",
"=",
"False",
",",
"renumber",
"=",
"True",
")",
":",
"# use self-loop to ensure all nodes are present",
"min_in_df",
"=",
"np",
".",
"amin",
"(",
"[",
"G_df",
"[",
"'source'",
"]",
".",
"m... | [
1433,
0
] | [
1472,
16
] | python | en | ['en', 'en', 'en'] | True |
printClusters | (G, rlist, outPrefix=None, oldClusterFile=None,
externalClusterCSV=None, printRef=True, printCSV=True,
clustering_type='combined', write_unwords=True,
use_gpu = False) | Get cluster assignments
Also writes assignments to a CSV file
Args:
G (graph)
Network used to define clusters
outPrefix (str)
Prefix for output CSV
Default = None
oldClusterFile (str)
CSV with previous cluster assignments.
Pas... | Get cluster assignments | def printClusters(G, rlist, outPrefix=None, oldClusterFile=None,
externalClusterCSV=None, printRef=True, printCSV=True,
clustering_type='combined', write_unwords=True,
use_gpu = False):
"""Get cluster assignments
Also writes assignments to a CSV file
A... | [
"def",
"printClusters",
"(",
"G",
",",
"rlist",
",",
"outPrefix",
"=",
"None",
",",
"oldClusterFile",
"=",
"None",
",",
"externalClusterCSV",
"=",
"None",
",",
"printRef",
"=",
"True",
",",
"printCSV",
"=",
"True",
",",
"clustering_type",
"=",
"'combined'",
... | [
1475,
0
] | [
1652,
22
] | python | en | ['et', 'en', 'en'] | True |
printExternalClusters | (newClusters, extClusterFile, outPrefix,
oldNames, printRef = True) | Prints cluster assignments with respect to previously defined
clusters or labels.
Args:
newClusters (set iterable)
The components from the graph G, defining the PopPUNK clusters
extClusterFile (str)
A CSV file containing definitions of the external clusters for
... | Prints cluster assignments with respect to previously defined
clusters or labels. | def printExternalClusters(newClusters, extClusterFile, outPrefix,
oldNames, printRef = True):
"""Prints cluster assignments with respect to previously defined
clusters or labels.
Args:
newClusters (set iterable)
The components from the graph G, defining the Pop... | [
"def",
"printExternalClusters",
"(",
"newClusters",
",",
"extClusterFile",
",",
"outPrefix",
",",
"oldNames",
",",
"printRef",
"=",
"True",
")",
":",
"# Object to store output csv datatable",
"d",
"=",
"defaultdict",
"(",
"list",
")",
"# Read in external clusters",
"e... | [
1654,
0
] | [
1708,
50
] | python | en | ['en', 'en', 'en'] | True |
generate_minimum_spanning_tree | (G, from_cugraph = False) | Generate a minimum spanning tree from a network
Args:
G (network)
Graph tool network
from_cugraph (bool)
If a pre-calculated MST from cugraph
[default = False]
Returns:
mst_network (str)
Minimum spanning tree (as graph-tool graph)
| Generate a minimum spanning tree from a network | def generate_minimum_spanning_tree(G, from_cugraph = False):
"""Generate a minimum spanning tree from a network
Args:
G (network)
Graph tool network
from_cugraph (bool)
If a pre-calculated MST from cugraph
[default = False]
Returns:
mst_network (str)... | [
"def",
"generate_minimum_spanning_tree",
"(",
"G",
",",
"from_cugraph",
"=",
"False",
")",
":",
"#",
"# Create MST",
"#",
"if",
"from_cugraph",
":",
"mst_network",
"=",
"G",
"else",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"Starting calculation of minimum... | [
1710,
0
] | [
1820,
22
] | python | en | ['en', 'en', 'en'] | True |
get_vertex_list | (G, use_gpu = False) | Generate a list of node indices
Args:
G (network)
Graph tool network
use_gpu (bool)
Whether graph is a cugraph or not
[default = False]
Returns:
vlist (list)
List of integers corresponding to nodes
| Generate a list of node indices | def get_vertex_list(G, use_gpu = False):
"""Generate a list of node indices
Args:
G (network)
Graph tool network
use_gpu (bool)
Whether graph is a cugraph or not
[default = False]
Returns:
vlist (list)
List of integers corresponding to nod... | [
"def",
"get_vertex_list",
"(",
"G",
",",
"use_gpu",
"=",
"False",
")",
":",
"if",
"use_gpu",
":",
"vlist",
"=",
"range",
"(",
"G",
".",
"number_of_vertices",
"(",
")",
")",
"else",
":",
"vlist",
"=",
"list",
"(",
"G",
".",
"vertices",
"(",
")",
")"... | [
1822,
0
] | [
1842,
16
] | python | en | ['en', 'en', 'en'] | True |
save_network | (G, prefix = None, suffix = None, use_graphml = False,
use_gpu = False) | Save a network to disk
Args:
G (network)
Graph tool network
prefix (str)
Prefix for output file
use_graphml (bool)
Whether to output a graph-tool file
in graphml format
use_gpu (bool)
Whether graph is a cugraph or not
[de... | Save a network to disk | def save_network(G, prefix = None, suffix = None, use_graphml = False,
use_gpu = False):
"""Save a network to disk
Args:
G (network)
Graph tool network
prefix (str)
Prefix for output file
use_graphml (bool)
Whether to output a graph-tool fil... | [
"def",
"save_network",
"(",
"G",
",",
"prefix",
"=",
"None",
",",
"suffix",
"=",
"None",
",",
"use_graphml",
"=",
"False",
",",
"use_gpu",
"=",
"False",
")",
":",
"file_name",
"=",
"prefix",
"+",
"\"/\"",
"+",
"os",
".",
"path",
".",
"basename",
"(",... | [
1844,
0
] | [
1873,
31
] | python | en | ['it', 'en', 'en'] | True |
cugraph_to_graph_tool | (G, rlist) | Save a network to disk
Args:
G (cugraph network)
Cugraph network
rlist (list)
List of sequence names
Returns:
G (graph-tool network)
Graph tool network
| Save a network to disk | def cugraph_to_graph_tool(G, rlist):
"""Save a network to disk
Args:
G (cugraph network)
Cugraph network
rlist (list)
List of sequence names
Returns:
G (graph-tool network)
Graph tool network
"""
edge_df = G.view_edge_list()
edge_tuple... | [
"def",
"cugraph_to_graph_tool",
"(",
"G",
",",
"rlist",
")",
":",
"edge_df",
"=",
"G",
".",
"view_edge_list",
"(",
")",
"edge_tuple",
"=",
"edge_df",
"[",
"[",
"'src'",
",",
"'dst'",
"]",
"]",
".",
"values",
".",
"tolist",
"(",
")",
"edge_weights",
"="... | [
1875,
0
] | [
1900,
12
] | python | en | ['it', 'en', 'en'] | True |
sparse_mat_to_network | (sparse_mat, rlist, use_gpu = False) | Generate a network from a lineage rank fit
Args:
sparse_mat (scipy or cupyx sparse matrix)
Sparse matrix of kNN from lineage fit
rlist (list)
List of sequence names
use_gpu (bool)
Whether GPU libraries should be used
Returns:
G (network)
Graph to... | Generate a network from a lineage rank fit | def sparse_mat_to_network(sparse_mat, rlist, use_gpu = False):
"""Generate a network from a lineage rank fit
Args:
sparse_mat (scipy or cupyx sparse matrix)
Sparse matrix of kNN from lineage fit
rlist (list)
List of sequence names
use_gpu (bool)
Whether GPU libra... | [
"def",
"sparse_mat_to_network",
"(",
"sparse_mat",
",",
"rlist",
",",
"use_gpu",
"=",
"False",
")",
":",
"if",
"use_gpu",
":",
"G_df",
"=",
"cudf",
".",
"DataFrame",
"(",
"columns",
"=",
"[",
"'source'",
",",
"'destination'",
",",
"'weights'",
"]",
")",
... | [
1902,
0
] | [
1934,
12
] | python | en | ['en', 'en', 'en'] | True |
Command.invoke | (cls, cmd, stderr=None) | Invoke the given command, and return a tuple of process and raw binary output.
If stderr is defined as None, it will flow to wherever it is currently mapped
for the parent process, generally to the terminal where the user can see the error
(cf. https://docs.python.org/3.7/library/subprocess.htm... | Invoke the given command, and return a tuple of process and raw binary output. | def invoke(cls, cmd, stderr=None):
"""Invoke the given command, and return a tuple of process and raw binary output.
If stderr is defined as None, it will flow to wherever it is currently mapped
for the parent process, generally to the terminal where the user can see the error
(cf. http... | [
"def",
"invoke",
"(",
"cls",
",",
"cmd",
",",
"stderr",
"=",
"None",
")",
":",
"try",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"stderr",
")",
"except",
"OSError",
... | [
11,
4
] | [
31,
32
] | python | en | ['en', 'en', 'en'] | True |
Settings.get | (self, name:str, default:object) | return parameter value by name
| return parameter value by name
| def get(self, name:str, default:object) -> object:
''' return parameter value by name
'''
return self._settings.get(name, default) | [
"def",
"get",
"(",
"self",
",",
"name",
":",
"str",
",",
"default",
":",
"object",
")",
"->",
"object",
":",
"return",
"self",
".",
"_settings",
".",
"get",
"(",
"name",
",",
"default",
")"
] | [
21,
4
] | [
24,
48
] | python | en | ['en', 'en', 'en'] | True |
rate_limited_imap | (f, l) | A threaded imap that does not produce elements faster than they
are consumed | A threaded imap that does not produce elements faster than they
are consumed | def rate_limited_imap(f, l):
"""A threaded imap that does not produce elements faster than they
are consumed"""
pool = ThreadPool(1)
res = None
for i in l:
res_next = pool.apply_async(f, (i, ))
if res:
yield res.get()
res = res_next
yield res.get() | [
"def",
"rate_limited_imap",
"(",
"f",
",",
"l",
")",
":",
"pool",
"=",
"ThreadPool",
"(",
"1",
")",
"res",
"=",
"None",
"for",
"i",
"in",
"l",
":",
"res_next",
"=",
"pool",
".",
"apply_async",
"(",
"f",
",",
"(",
"i",
",",
")",
")",
"if",
"res"... | [
137,
0
] | [
147,
19
] | python | en | ['en', 'en', 'en'] | True |
sanitize | (x) | convert array to a c-contiguous float array | convert array to a c-contiguous float array | def sanitize(x):
""" convert array to a c-contiguous float array """
return np.ascontiguousarray(x.astype('float32')) | [
"def",
"sanitize",
"(",
"x",
")",
":",
"return",
"np",
".",
"ascontiguousarray",
"(",
"x",
".",
"astype",
"(",
"'float32'",
")",
")"
] | [
160,
0
] | [
162,
52
] | python | en | ['en', 'fr', 'en'] | True |
dataset_iterator | (x, preproc, bs) | iterate over the lines of x in blocks of size bs | iterate over the lines of x in blocks of size bs | def dataset_iterator(x, preproc, bs):
""" iterate over the lines of x in blocks of size bs"""
nb = x.shape[0]
block_ranges = [(i0, min(nb, i0 + bs))
for i0 in range(0, nb, bs)]
def prepare_block(i01):
i0, i1 = i01
xb = sanitize(x[i0:i1])
return i0, preproc.a... | [
"def",
"dataset_iterator",
"(",
"x",
",",
"preproc",
",",
"bs",
")",
":",
"nb",
"=",
"x",
".",
"shape",
"[",
"0",
"]",
"block_ranges",
"=",
"[",
"(",
"i0",
",",
"min",
"(",
"nb",
",",
"i0",
"+",
"bs",
")",
")",
"for",
"i0",
"in",
"range",
"("... | [
165,
0
] | [
177,
57
] | python | en | ['en', 'en', 'en'] | True |
eval_intersection_measure | (gt_I, I) | measure intersection measure (used for knngraph) | measure intersection measure (used for knngraph) | def eval_intersection_measure(gt_I, I):
""" measure intersection measure (used for knngraph)"""
inter = 0
rank = I.shape[1]
assert gt_I.shape[1] >= rank
for q in range(nq_gt):
inter += faiss.ranklist_intersection_size(
rank, faiss.swig_ptr(gt_I[q, :]),
rank, faiss.swi... | [
"def",
"eval_intersection_measure",
"(",
"gt_I",
",",
"I",
")",
":",
"inter",
"=",
"0",
"rank",
"=",
"I",
".",
"shape",
"[",
"1",
"]",
"assert",
"gt_I",
".",
"shape",
"[",
"1",
"]",
">=",
"rank",
"for",
"q",
"in",
"range",
"(",
"nq_gt",
")",
":",... | [
180,
0
] | [
189,
38
] | python | en | ['en', 'en', 'en'] | True |
make_vres_vdev | (i0=0, i1=-1) | return vectors of device ids and resources useful for gpu_multiple | return vectors of device ids and resources useful for gpu_multiple | def make_vres_vdev(i0=0, i1=-1):
" return vectors of device ids and resources useful for gpu_multiple"
vres = faiss.GpuResourcesVector()
vdev = faiss.IntVector()
if i1 == -1:
i1 = ngpu
for i in range(i0, i1):
vdev.push_back(i)
vres.push_back(gpu_resources[i])
return vres,... | [
"def",
"make_vres_vdev",
"(",
"i0",
"=",
"0",
",",
"i1",
"=",
"-",
"1",
")",
":",
"vres",
"=",
"faiss",
".",
"GpuResourcesVector",
"(",
")",
"vdev",
"=",
"faiss",
".",
"IntVector",
"(",
")",
"if",
"i1",
"==",
"-",
"1",
":",
"i1",
"=",
"ngpu",
"... | [
313,
0
] | [
322,
21
] | python | en | ['en', 'en', 'en'] | True |
compute_populated_index | (preproc) | Add elements to a sharded index. Return the index and if available
a sharded gpu_index that contains the same data. | Add elements to a sharded index. Return the index and if available
a sharded gpu_index that contains the same data. | def compute_populated_index(preproc):
"""Add elements to a sharded index. Return the index and if available
a sharded gpu_index that contains the same data. """
indexall = prepare_trained_index(preproc)
co = faiss.GpuMultipleClonerOptions()
co.useFloat16 = use_float16
co.useFloat16CoarseQuanti... | [
"def",
"compute_populated_index",
"(",
"preproc",
")",
":",
"indexall",
"=",
"prepare_trained_index",
"(",
"preproc",
")",
"co",
"=",
"faiss",
".",
"GpuMultipleClonerOptions",
"(",
")",
"co",
".",
"useFloat16",
"=",
"use_float16",
"co",
".",
"useFloat16CoarseQuant... | [
500,
0
] | [
561,
30
] | python | en | ['en', 'en', 'en'] | True |
train_kmeans | (x, k, ngpu) | Runs kmeans on one or several GPUs | Runs kmeans on one or several GPUs | def train_kmeans(x, k, ngpu):
"Runs kmeans on one or several GPUs"
d = x.shape[1]
clus = faiss.Clustering(d, k)
clus.verbose = True
clus.niter = 20
# otherwise the kmeans implementation sub-samples the training set
clus.max_points_per_centroid = 10000000
res = [faiss.StandardGpuResourc... | [
"def",
"train_kmeans",
"(",
"x",
",",
"k",
",",
"ngpu",
")",
":",
"d",
"=",
"x",
".",
"shape",
"[",
"1",
"]",
"clus",
"=",
"faiss",
".",
"Clustering",
"(",
"d",
",",
"k",
")",
"clus",
".",
"verbose",
"=",
"True",
"clus",
".",
"niter",
"=",
"2... | [
43,
0
] | [
78,
34
] | python | en | ['en', 'en', 'en'] | True |
execute_cast_datetime_or_timestamp_to_string | (op, data, type, **kwargs) | Cast timestamps to strings | Cast timestamps to strings | def execute_cast_datetime_or_timestamp_to_string(op, data, type, **kwargs):
"""Cast timestamps to strings"""
return str(data) | [
"def",
"execute_cast_datetime_or_timestamp_to_string",
"(",
"op",
",",
"data",
",",
"type",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"str",
"(",
"data",
")"
] | [
256,
0
] | [
258,
20
] | python | en | ['en', 'en', 'en'] | True |
execute_cast_datetime_to_integer | (op, data, type, **kwargs) | Cast datetimes to integers | Cast datetimes to integers | def execute_cast_datetime_to_integer(op, data, type, **kwargs):
"""Cast datetimes to integers"""
return pd.Timestamp(data).value | [
"def",
"execute_cast_datetime_to_integer",
"(",
"op",
",",
"data",
",",
"type",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"pd",
".",
"Timestamp",
"(",
"data",
")",
".",
"value"
] | [
262,
0
] | [
264,
35
] | python | en | ['en', 'en', 'en'] | True |
execute_cast_timestamp_to_integer | (op, data, type, **kwargs) | Cast timestamps to integers | Cast timestamps to integers | def execute_cast_timestamp_to_integer(op, data, type, **kwargs):
"""Cast timestamps to integers"""
return data.value | [
"def",
"execute_cast_timestamp_to_integer",
"(",
"op",
",",
"data",
",",
"type",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"data",
".",
"value"
] | [
268,
0
] | [
270,
21
] | python | en | ['en', 'en', 'bg'] | True |
execute_cast_simple_literal_to_timestamp | (op, data, type, **kwargs) | Cast integer and strings to timestamps | Cast integer and strings to timestamps | def execute_cast_simple_literal_to_timestamp(op, data, type, **kwargs):
"""Cast integer and strings to timestamps"""
return pd.Timestamp(data, tz=type.timezone) | [
"def",
"execute_cast_simple_literal_to_timestamp",
"(",
"op",
",",
"data",
",",
"type",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"pd",
".",
"Timestamp",
"(",
"data",
",",
"tz",
"=",
"type",
".",
"timezone",
")"
] | [
292,
0
] | [
294,
47
] | python | en | ['en', 'en', 'en'] | True |
execute_cast_timestamp_to_timestamp | (op, data, type, **kwargs) | Cast timestamps to other timestamps including timezone if necessary | Cast timestamps to other timestamps including timezone if necessary | def execute_cast_timestamp_to_timestamp(op, data, type, **kwargs):
"""Cast timestamps to other timestamps including timezone if necessary"""
input_timezone = data.tz
target_timezone = type.timezone
if input_timezone == target_timezone:
return data
if input_timezone is None or target_timezo... | [
"def",
"execute_cast_timestamp_to_timestamp",
"(",
"op",
",",
"data",
",",
"type",
",",
"*",
"*",
"kwargs",
")",
":",
"input_timezone",
"=",
"data",
".",
"tz",
"target_timezone",
"=",
"type",
".",
"timezone",
"if",
"input_timezone",
"==",
"target_timezone",
":... | [
298,
0
] | [
309,
43
] | python | en | ['en', 'en', 'en'] | True |
wrap_case_result | (raw, expr) | Wrap a CASE statement result in a Series and handle returning scalars.
Parameters
----------
raw : ndarray[T]
The raw results of executing the ``CASE`` expression
expr : ValueExpr
The expression from the which `raw` was computed
Returns
-------
Union[scalar, Series]
| Wrap a CASE statement result in a Series and handle returning scalars. | def wrap_case_result(raw, expr):
"""Wrap a CASE statement result in a Series and handle returning scalars.
Parameters
----------
raw : ndarray[T]
The raw results of executing the ``CASE`` expression
expr : ValueExpr
The expression from the which `raw` was computed
Returns
-... | [
"def",
"wrap_case_result",
"(",
"raw",
",",
"expr",
")",
":",
"raw_1d",
"=",
"np",
".",
"atleast_1d",
"(",
"raw",
")",
"if",
"np",
".",
"any",
"(",
"pd",
".",
"isnull",
"(",
"raw_1d",
")",
")",
":",
"result",
"=",
"pd",
".",
"Series",
"(",
"raw_1... | [
946,
0
] | [
968,
17
] | python | en | ['en', 'en', 'en'] | True |
vis_square | (visu_path , data , type) | Take an array of shape (n, height, width) or (n, height, width , 3)
and visualize each (height, width) thing in a grid of size approx. sqrt(n) by sqrt(n) | Take an array of shape (n, height, width) or (n, height, width , 3)
and visualize each (height, width) thing in a grid of size approx. sqrt(n) by sqrt(n) | def vis_square(visu_path , data , type):
"""Take an array of shape (n, height, width) or (n, height, width , 3)
and visualize each (height, width) thing in a grid of size approx. sqrt(n) by sqrt(n)"""
# normalize data for display
data = (data - data.min()) / (data.max() - data.min())
# force th... | [
"def",
"vis_square",
"(",
"visu_path",
",",
"data",
",",
"type",
")",
":",
"# normalize data for display",
"data",
"=",
"(",
"data",
"-",
"data",
".",
"min",
"(",
")",
")",
"/",
"(",
"data",
".",
"max",
"(",
")",
"-",
"data",
".",
"min",
"(",
")",
... | [
117,
0
] | [
143,
75
] | python | en | ['en', 'en', 'en'] | True |
calculate_discriminability | (scaling, proportionality_factor, critical_scaling) | r"""Calculate disriminability at given scaling, for specified parameters.
This comes from the Online Methods section of [1]_, equation 17.
Parameters
----------
scaling : torch.Tensor or np.ndarray
Scaling value(s) to calculate discriminability for.
proportionality_factor : torch.Tensor or... | r"""Calculate disriminability at given scaling, for specified parameters. | def calculate_discriminability(scaling, proportionality_factor, critical_scaling):
r"""Calculate disriminability at given scaling, for specified parameters.
This comes from the Online Methods section of [1]_, equation 17.
Parameters
----------
scaling : torch.Tensor or np.ndarray
Scaling v... | [
"def",
"calculate_discriminability",
"(",
"scaling",
",",
"proportionality_factor",
",",
"critical_scaling",
")",
":",
"if",
"not",
"isinstance",
"(",
"scaling",
",",
"torch",
".",
"Tensor",
")",
":",
"scaling",
"=",
"torch",
".",
"tensor",
"(",
"scaling",
")"... | [
16,
0
] | [
50,
28
] | python | en | ['en', 'en', 'en'] | True |
proportion_correct_curve | (scaling, proportionality_factor, critical_scaling) | r"""Compute the proportion correct curve, as function of parameters.
This comes from the Online Methods section of [1]_, equation 18.
Parameters
----------
scaling : torch.Tensor
Scaling value(s) to calculate discriminability for.
proportionality_factor : torch.Tensor or float
The ... | r"""Compute the proportion correct curve, as function of parameters. | def proportion_correct_curve(scaling, proportionality_factor, critical_scaling):
r"""Compute the proportion correct curve, as function of parameters.
This comes from the Online Methods section of [1]_, equation 18.
Parameters
----------
scaling : torch.Tensor
Scaling value(s) to calculate ... | [
"def",
"proportion_correct_curve",
"(",
"scaling",
",",
"proportionality_factor",
",",
"critical_scaling",
")",
":",
"norm",
"=",
"torch",
".",
"distributions",
".",
"Normal",
"(",
"0",
",",
"1",
")",
"discrim",
"=",
"calculate_discriminability",
"(",
"scaling",
... | [
53,
0
] | [
92,
78
] | python | en | ['en', 'en', 'en'] | True |
fit_psychophysical_parameters | (scaling, proportion_correct, lr=.001,
scheduler=True, max_iter=10000, seed=None,
proportionality_factor_init_range=(1, 5),
critical_scaling_init_range=(0, .5)) | r"""Fit the parameters of psychophysical curve for a single set of values.
This has trouble (unsurprisingly) if critical scaling falls too far outside
the range of tested values. Also has issues if critical_scaling's
initialization is too far outside of tested values (it seems less sensitive
to proport... | r"""Fit the parameters of psychophysical curve for a single set of values. | def fit_psychophysical_parameters(scaling, proportion_correct, lr=.001,
scheduler=True, max_iter=10000, seed=None,
proportionality_factor_init_range=(1, 5),
critical_scaling_init_range=(0, .5)):
r"""Fit the paramet... | [
"def",
"fit_psychophysical_parameters",
"(",
"scaling",
",",
"proportion_correct",
",",
"lr",
"=",
".001",
",",
"scheduler",
"=",
"True",
",",
"max_iter",
"=",
"10000",
",",
"seed",
"=",
"None",
",",
"proportionality_factor_init_range",
"=",
"(",
"1",
",",
"5"... | [
95,
0
] | [
187,
17
] | python | en | ['en', 'en', 'en'] | True |
multi_fit_psychophysical_parameters | (kwargs, use_multiproc=True,
n_processes=None, identifiers=[]) | Run fit_psychophysical_parameters multiple times, optionally using multiproc.
Simple helper function to fit the psychophysical parameters multiple times,
using either multiproc or a simple for loop.
Parameters
----------
kwargs : list
List of dictionaries to pass to ``fit_psychophysical_pa... | Run fit_psychophysical_parameters multiple times, optionally using multiproc. | def multi_fit_psychophysical_parameters(kwargs, use_multiproc=True,
n_processes=None, identifiers=[]):
"""Run fit_psychophysical_parameters multiple times, optionally using multiproc.
Simple helper function to fit the psychophysical parameters multiple times,
using e... | [
"def",
"multi_fit_psychophysical_parameters",
"(",
"kwargs",
",",
"use_multiproc",
"=",
"True",
",",
"n_processes",
"=",
"None",
",",
"identifiers",
"=",
"[",
"]",
")",
":",
"if",
"len",
"(",
"identifiers",
")",
">",
"0",
"and",
"len",
"(",
"identifiers",
... | [
190,
0
] | [
248,
18
] | python | en | ['en', 'en', 'en'] | True |
plot_optimization_results | (data, result, hue=None, fig=None, plot_data=True,
plot_mean=False, **plot_kwargs) | r"""Plot results of psychophysical curve fitting.
Creates 5 plot figure:
1. Data and psychophysical curve
2. Loss over iterations
3. History of proportionality_factor values
4. History of critical_scaling values
5. Scatter plot showing initial and final values of the two parameters
(crit... | r"""Plot results of psychophysical curve fitting. | def plot_optimization_results(data, result, hue=None, fig=None, plot_data=True,
plot_mean=False, **plot_kwargs):
r"""Plot results of psychophysical curve fitting.
Creates 5 plot figure:
1. Data and psychophysical curve
2. Loss over iterations
3. History of proportional... | [
"def",
"plot_optimization_results",
"(",
"data",
",",
"result",
",",
"hue",
"=",
"None",
",",
"fig",
"=",
"None",
",",
"plot_data",
"=",
"True",
",",
"plot_mean",
"=",
"False",
",",
"*",
"*",
"plot_kwargs",
")",
":",
"alpha",
"=",
"1",
"if",
"plot_mean... | [
251,
0
] | [
373,
14
] | python | en | ['en', 'en', 'en'] | True |
get_spectrum | (
height: int,
width: int,
height_ignore_edge_size: int = 0,
width_ignore_edge_size: int = 0,
low_center: bool = True,
) | Return generator of specrum matrics of 2D Fourier basis.
Note:
- height_ignore_edge_size and width_ignore_edge_size are used for getting subset of spectrum.
e.g.) In the original paper, Fourier Heat Map was created for a 63x63 low frequency region for ImageNet.
- We generate spectrum one ... | Return generator of specrum matrics of 2D Fourier basis. | def get_spectrum(
height: int,
width: int,
height_ignore_edge_size: int = 0,
width_ignore_edge_size: int = 0,
low_center: bool = True,
) -> Iterator[torch.Tensor]:
"""Return generator of specrum matrics of 2D Fourier basis.
Note:
- height_ignore_edge_size and width_ignore_edge_size ... | [
"def",
"get_spectrum",
"(",
"height",
":",
"int",
",",
"width",
":",
"int",
",",
"height_ignore_edge_size",
":",
"int",
"=",
"0",
",",
"width_ignore_edge_size",
":",
"int",
"=",
"0",
",",
"low_center",
":",
"bool",
"=",
"True",
",",
")",
"->",
"Iterator"... | [
6,
0
] | [
48,
17
] | python | en | ['en', 'la', 'en'] | True |
spectrum_to_basis | (
spectrum: torch.Tensor, l2_normalize: bool = True
) | Convert spectrum matrix to Fourier basis by 2D FFT. Shape of returned basis is (H, W).
Note:
- Currently, only supported the case H==W. If H!=W, returned basis might be wrong.
- In order to apply 2D FFT, dim argument of torch.fft.irfftn should be =(-2,-1).
Args:
spectrum (torch.Tensor)... | Convert spectrum matrix to Fourier basis by 2D FFT. Shape of returned basis is (H, W). | def spectrum_to_basis(
spectrum: torch.Tensor, l2_normalize: bool = True
) -> torch.Tensor:
"""Convert spectrum matrix to Fourier basis by 2D FFT. Shape of returned basis is (H, W).
Note:
- Currently, only supported the case H==W. If H!=W, returned basis might be wrong.
- In order to apply ... | [
"def",
"spectrum_to_basis",
"(",
"spectrum",
":",
"torch",
".",
"Tensor",
",",
"l2_normalize",
":",
"bool",
"=",
"True",
")",
"->",
"torch",
".",
"Tensor",
":",
"assert",
"len",
"(",
"spectrum",
".",
"size",
"(",
")",
")",
"==",
"2",
"H",
"=",
"spect... | [
51,
0
] | [
76,
40
] | python | en | ['en', 'en', 'en'] | True |
generate_files | (api_files,
api_output_dir=None,
z3py_output_dir=None,
dotnet_output_dir=None,
java_output_dir=None,
java_package_name=None,
js_output_dir=None,
ml_output_dir=None,
ml_... |
Scan the api files in ``api_files`` and emit the relevant API files into
the output directories specified. If an output directory is set to ``None``
then the files for that language binding or module are not emitted.
The reason for this function interface is:
* The CMake build system needs to con... |
Scan the api files in ``api_files`` and emit the relevant API files into
the output directories specified. If an output directory is set to ``None``
then the files for that language binding or module are not emitted. | def generate_files(api_files,
api_output_dir=None,
z3py_output_dir=None,
dotnet_output_dir=None,
java_output_dir=None,
java_package_name=None,
js_output_dir=None,
ml_output_dir=None,
... | [
"def",
"generate_files",
"(",
"api_files",
",",
"api_output_dir",
"=",
"None",
",",
"z3py_output_dir",
"=",
"None",
",",
"dotnet_output_dir",
"=",
"None",
",",
"java_output_dir",
"=",
"None",
",",
"java_package_name",
"=",
"None",
",",
"js_output_dir",
"=",
"Non... | [
1887,
0
] | [
1975,
24
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index | (self, connect, collection, get_simple_index) |
target: test create index interface
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index(self, connect, collection, get_simple_index):
'''
target: test create index interface
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
'''
index_param = get_simple_index["index_param"... | [
"def",
"test_create_index",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"logging",
".",
"... | [
61,
4
] | [
72,
26
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_no_vectors | (self, connect, collection, get_simple_index) |
target: test create index interface
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index_no_vectors(self, connect, collection, get_simple_index):
'''
target: test create index interface
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
'''
index_param = get_simple_index["i... | [
"def",
"test_create_index_no_vectors",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"logging",... | [
75,
4
] | [
85,
26
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_partition | (self, connect, collection, get_simple_index) |
target: test create index interface
method: create collection, create partition, and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface
method: create collection, create partition, and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index_partition(self, connect, collection, get_simple_index):
'''
target: test create index interface
method: create collection, create partition, and add vectors in it, create index
expected: return code equals to 0, and search success
'''
index_param = g... | [
"def",
"test_create_index_partition",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"logging",
... | [
88,
4
] | [
100,
26
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_partition_flush | (self, connect, collection, get_simple_index) |
target: test create index interface
method: create collection, create partition, and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface
method: create collection, create partition, and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index_partition_flush(self, connect, collection, get_simple_index):
'''
target: test create index interface
method: create collection, create partition, and add vectors in it, create index
expected: return code equals to 0, and search success
'''
index_par... | [
"def",
"test_create_index_partition_flush",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"logg... | [
103,
4
] | [
116,
26
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_search_with_query_vectors | (self, connect, collection, get_simple_index) |
target: test create index interface, search with more query vectors
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface, search with more query vectors
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index_search_with_query_vectors(self, connect, collection, get_simple_index):
'''
target: test create index interface, search with more query vectors
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
... | [
"def",
"test_create_index_search_with_query_vectors",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]... | [
132,
4
] | [
150,
40
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_multithread | (self, connect, collection, args) |
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index_multithread(self, connect, collection, args):
'''
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
'''
status, ids = connect.inse... | [
"def",
"test_create_index_multithread",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"args",
")",
":",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
"def",
"build",
"(",
"connect",
")",
":",
"status",
... | [
154,
4
] | [
183,
43
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_multithread_multicollection | (self, connect, args) |
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def test_create_index_multithread_multicollection(self, connect, args):
'''
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
'''
threads_num = 8
... | [
"def",
"test_create_index_multithread_multicollection",
"(",
"self",
",",
"connect",
",",
"args",
")",
":",
"threads_num",
"=",
"8",
"loop_num",
"=",
"8",
"threads",
"=",
"[",
"]",
"collection",
"=",
"[",
"]",
"j",
"=",
"0",
"while",
"j",
"<",
"(",
"thre... | [
187,
4
] | [
231,
20
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase._test_create_index_multiprocessing | (self, connect, collection, args) |
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def _test_create_index_multiprocessing(self, connect, collection, args):
'''
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
'''
status, ids = connect... | [
"def",
"_test_create_index_multiprocessing",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"args",
")",
":",
"status",
",",
"ids",
"=",
"connect",
".",
"insert",
"(",
"collection",
",",
"vectors",
")",
"def",
"build",
"(",
"connect",
")",
":",
"stat... | [
264,
4
] | [
293,
43
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase._test_create_index_multiprocessing_multicollection | (self, connect, args) |
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
|
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
| def _test_create_index_multiprocessing_multicollection(self, connect, args):
'''
target: test create index interface with multiprocess
method: create collection and add vectors in it, create index
expected: return code equals to 0, and search success
'''
process_num = 8
... | [
"def",
"_test_create_index_multiprocessing_multicollection",
"(",
"self",
",",
"connect",
",",
"args",
")",
":",
"process_num",
"=",
"8",
"loop_num",
"=",
"8",
"processes",
"=",
"[",
"]",
"collection",
"=",
"[",
"]",
"j",
"=",
"0",
"while",
"j",
"<",
"(",
... | [
297,
4
] | [
344,
20
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_collection_not_existed | (self, connect) |
target: test create index interface when collection name not existed
method: create collection and add vectors in it, create index
, make sure the collection name not in index
expected: return code not equals to 0, create index failed
|
target: test create index interface when collection name not existed
method: create collection and add vectors in it, create index
, make sure the collection name not in index
expected: return code not equals to 0, create index failed
| def test_create_index_collection_not_existed(self, connect):
'''
target: test create index interface when collection name not existed
method: create collection and add vectors in it, create index
, make sure the collection name not in index
expected: return code not equals to... | [
"def",
"test_create_index_collection_not_existed",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"gen_unique_str",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
"nlist",
"=",
"NLIST",
"index_type",
"=",
"IndexType",
".",
"IVF_SQ8",
"index_p... | [
346,
4
] | [
358,
30
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_collection_None | (self, connect) |
target: test create index interface when collection name is None
method: create collection and add vectors in it, create index with an collection_name: None
expected: return code not equals to 0, create index failed
|
target: test create index interface when collection name is None
method: create collection and add vectors in it, create index with an collection_name: None
expected: return code not equals to 0, create index failed
| def test_create_index_collection_None(self, connect):
'''
target: test create index interface when collection name is None
method: create collection and add vectors in it, create index with an collection_name: None
expected: return code not equals to 0, create index failed
'''
... | [
"def",
"test_create_index_collection_None",
"(",
"self",
",",
"connect",
")",
":",
"collection_name",
"=",
"None",
"nlist",
"=",
"NLIST",
"index_type",
"=",
"IndexType",
".",
"IVF_SQ8",
"index_param",
"=",
"{",
"\"nlist\"",
":",
"nlist",
"}",
"with",
"pytest",
... | [
360,
4
] | [
371,
83
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_index_no_vectors_then_insert | (self, connect, collection, get_simple_index) |
target: test create index interface when there is no vectors in collection, and does not affect the subsequent process
method: create collection and add no vectors in it, and then create index, add vectors in it
expected: return code equals to 0
|
target: test create index interface when there is no vectors in collection, and does not affect the subsequent process
method: create collection and add no vectors in it, and then create index, add vectors in it
expected: return code equals to 0
| def test_create_index_no_vectors_then_insert(self, connect, collection, get_simple_index):
'''
target: test create index interface when there is no vectors in collection, and does not affect the subsequent process
method: create collection and add no vectors in it, and then create index, add vec... | [
"def",
"test_create_index_no_vectors_then_insert",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
... | [
374,
4
] | [
384,
26
] | python | en | ['en', 'error', 'th'] | False |
TestIndexBase.test_create_same_index_repeatedly | (self, connect, collection, get_simple_index) |
target: check if index can be created repeatedly, with the same create_index params
method: create index after index have been built
expected: return code success, and search ok
|
target: check if index can be created repeatedly, with the same create_index params
method: create index after index have been built
expected: return code success, and search ok
| def test_create_same_index_repeatedly(self, connect, collection, get_simple_index):
'''
target: check if index can be created repeatedly, with the same create_index params
method: create index after index have been built
expected: return code success, and search ok
'''
in... | [
"def",
"test_create_same_index_repeatedly",
"(",
"self",
",",
"connect",
",",
"collection",
",",
"get_simple_index",
")",
":",
"index_param",
"=",
"get_simple_index",
"[",
"\"index_param\"",
"]",
"index_type",
"=",
"get_simple_index",
"[",
"\"index_type\"",
"]",
"stat... | [
388,
4
] | [
398,
26
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.