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
error_negative_preceding_offset
(self)
Check that non-positive value of preceding offset returns an error.
Check that non-positive value of preceding offset returns an error.
def error_negative_preceding_offset(self): """Check that non-positive value of preceding offset returns an error. """ exitcode = 36 message = "DB::Exception: Frame start offset must be greater than zero, -1 given" sql = ("select max(enroll_date) over (order by salary range between -1 preceding and ...
[ "def", "error_negative_preceding_offset", "(", "self", ")", ":", "exitcode", "=", "36", "message", "=", "\"DB::Exception: Frame start offset must be greater than zero, -1 given\"", "sql", "=", "(", "\"select max(enroll_date) over (order by salary range between -1 preceding and 2 follow...
[ 66, 0 ]
[ 76, 81 ]
python
en
['en', 'gl', 'en']
True
error_negative_following_offset
(self)
Check that non-positive value of following offset returns an error.
Check that non-positive value of following offset returns an error.
def error_negative_following_offset(self): """Check that non-positive value of following offset returns an error. """ exitcode = 36 message = "DB::Exception: Frame end offset must be greater than zero, -2 given" sql = ("select max(enroll_date) over (order by salary range between 1 preceding and -2 ...
[ "def", "error_negative_following_offset", "(", "self", ")", ":", "exitcode", "=", "36", "message", "=", "\"DB::Exception: Frame end offset must be greater than zero, -2 given\"", "sql", "=", "(", "\"select max(enroll_date) over (order by salary range between 1 preceding and -2 followin...
[ 82, 0 ]
[ 92, 81 ]
python
en
['en', 'en', 'en']
True
feature
(self)
Check different error conditions when usign range frame.
Check different error conditions when usign range frame.
def feature(self): """Check different error conditions when usign range frame. """ for scenario in loads(current_module(), Scenario): Scenario(run=scenario, flags=TE)
[ "def", "feature", "(", "self", ")", ":", "for", "scenario", "in", "loads", "(", "current_module", "(", ")", ",", "Scenario", ")", ":", "Scenario", "(", "run", "=", "scenario", ",", "flags", "=", "TE", ")" ]
[ 99, 0 ]
[ 103, 40 ]
python
en
['en', 'en', 'en']
True
UnicornConan._all_supported_archs
(self)
Get all supported architectures of the current version :return: sorted list of strings
Get all supported architectures of the current version :return: sorted list of strings
def _all_supported_archs(self): """ Get all supported architectures of the current version :return: sorted list of strings """ return sorted(["aarch64", "arm", "m68k", "mips", "sparc", "x86"])
[ "def", "_all_supported_archs", "(", "self", ")", ":", "return", "sorted", "(", "[", "\"aarch64\"", ",", "\"arm\"", ",", "\"m68k\"", ",", "\"mips\"", ",", "\"sparc\"", ",", "\"x86\"", "]", ")" ]
[ 37, 4 ]
[ 42, 73 ]
python
en
['en', 'error', 'th']
False
UnicornConan._supported_archs
(self)
Get supported architectures of the current build/package (depends on self.options.supported_archs) :return: sorted list of strings
Get supported architectures of the current build/package (depends on self.options.supported_archs) :return: sorted list of strings
def _supported_archs(self): """ Get supported architectures of the current build/package (depends on self.options.supported_archs) :return: sorted list of strings """ return sorted(set(str(self.options.supported_archs).split(",")))
[ "def", "_supported_archs", "(", "self", ")", ":", "return", "sorted", "(", "set", "(", "str", "(", "self", ".", "options", ".", "supported_archs", ")", ".", "split", "(", "\",\"", ")", ")", ")" ]
[ 45, 4 ]
[ 50, 72 ]
python
en
['en', 'error', 'th']
False
gencon
(gr)
Input a graph as an adjacency list, e.g. {0:[1,2], 1:[2], 2:[1,0]}. Produces solver to check if the given graph has a Hamiltonian cycle. Query the solver using s.check() and if sat, then s.model() spells out the cycle. Two example graphs from http://en.wikipedia.org/wiki/Hamiltonian_path are tested...
Input a graph as an adjacency list, e.g. {0:[1,2], 1:[2], 2:[1,0]}. Produces solver to check if the given graph has a Hamiltonian cycle. Query the solver using s.check() and if sat, then s.model() spells out the cycle. Two example graphs from http://en.wikipedia.org/wiki/Hamiltonian_path are tested...
def gencon(gr): """ Input a graph as an adjacency list, e.g. {0:[1,2], 1:[2], 2:[1,0]}. Produces solver to check if the given graph has a Hamiltonian cycle. Query the solver using s.check() and if sat, then s.model() spells out the cycle. Two example graphs from http://en.wikipedia.org/wiki/Hami...
[ "def", "gencon", "(", "gr", ")", ":", "L", "=", "len", "(", "gr", ")", "cv", "=", "[", "Int", "(", "'cv%s'", "%", "i", ")", "for", "i", "in", "range", "(", "L", ")", "]", "s", "=", "Solver", "(", ")", "s", ".", "add", "(", "cv", "[", "0...
[ 9, 0 ]
[ 33, 12 ]
python
en
['en', 'error', 'th']
False
valid_requests_same_credentials
(self)
ClickHouse should be able to process parallel requests sent under the same credentials.
ClickHouse should be able to process parallel requests sent under the same credentials.
def valid_requests_same_credentials(self): """ClickHouse should be able to process parallel requests sent under the same credentials. """ ch_nodes = self.context.ch_nodes with Given("kinit for clients"): kinit_no_keytab(node=ch_nodes[1]) kinit_no_keytab(node=ch_nodes[2]) with And('...
[ "def", "valid_requests_same_credentials", "(", "self", ")", ":", "ch_nodes", "=", "self", ".", "context", ".", "ch_nodes", "with", "Given", "(", "\"kinit for clients\"", ")", ":", "kinit_no_keytab", "(", "node", "=", "ch_nodes", "[", "1", "]", ")", "kinit_no_k...
[ 14, 0 ]
[ 40, 79 ]
python
en
['en', 'en', 'en']
True
valid_requests_different_credentials
(self)
ClickHouse should be able to process parallel requests by different users.
ClickHouse should be able to process parallel requests by different users.
def valid_requests_different_credentials(self): """ClickHouse should be able to process parallel requests by different users. """ ch_nodes = self.context.ch_nodes with Given("kinit for clients"): kinit_no_keytab(node=ch_nodes[1], principal="krb1") kinit_no_keytab(node=ch_nodes[2], princ...
[ "def", "valid_requests_different_credentials", "(", "self", ")", ":", "ch_nodes", "=", "self", ".", "context", ".", "ch_nodes", "with", "Given", "(", "\"kinit for clients\"", ")", ":", "kinit_no_keytab", "(", "node", "=", "ch_nodes", "[", "1", "]", ",", "princ...
[ 47, 0 ]
[ 82, 63 ]
python
en
['en', 'en', 'en']
True
valid_invalid
(self)
Valid users' Kerberos authentication should not be affected by invalid users' attempts.
Valid users' Kerberos authentication should not be affected by invalid users' attempts.
def valid_invalid(self): """Valid users' Kerberos authentication should not be affected by invalid users' attempts. """ ch_nodes = self.context.ch_nodes with Given("kinit for clients"): kinit_no_keytab(node=ch_nodes[2]) kinit_no_keytab(node=ch_nodes[1], principal="invalid_user") wi...
[ "def", "valid_invalid", "(", "self", ")", ":", "ch_nodes", "=", "self", ".", "context", ".", "ch_nodes", "with", "Given", "(", "\"kinit for clients\"", ")", ":", "kinit_no_keytab", "(", "node", "=", "ch_nodes", "[", "2", "]", ")", "kinit_no_keytab", "(", "...
[ 89, 0 ]
[ 113, 79 ]
python
en
['en', 'en', 'en']
True
deletion
(self)
ClickHouse SHALL NOT crash when 2 Kerberos users are simultaneously deleting one another.
ClickHouse SHALL NOT crash when 2 Kerberos users are simultaneously deleting one another.
def deletion(self): """ClickHouse SHALL NOT crash when 2 Kerberos users are simultaneously deleting one another. """ ch_nodes = self.context.ch_nodes with Given("kinit for clients"): kinit_no_keytab(node=ch_nodes[1], principal="krb1") kinit_no_keytab(node=ch_nodes[2], principal="krb2") ...
[ "def", "deletion", "(", "self", ")", ":", "ch_nodes", "=", "self", ".", "context", ".", "ch_nodes", "with", "Given", "(", "\"kinit for clients\"", ")", ":", "kinit_no_keytab", "(", "node", "=", "ch_nodes", "[", "1", "]", ",", "principal", "=", "\"krb1\"", ...
[ 120, 0 ]
[ 157, 63 ]
python
en
['en', 'en', 'en']
True
kerberos_and_nonkerberos
(self)
ClickHouse SHALL support processing of simultaneous kerberized and non-kerberized requests.
ClickHouse SHALL support processing of simultaneous kerberized and non-kerberized requests.
def kerberos_and_nonkerberos(self): """ClickHouse SHALL support processing of simultaneous kerberized and non-kerberized requests. """ ch_nodes = self.context.ch_nodes with Given("kinit for clients"): kinit_no_keytab(node=ch_nodes[2]) with And('create server principal'): create_ser...
[ "def", "kerberos_and_nonkerberos", "(", "self", ")", ":", "ch_nodes", "=", "self", ".", "context", ".", "ch_nodes", "with", "Given", "(", "\"kinit for clients\"", ")", ":", "kinit_no_keytab", "(", "node", "=", "ch_nodes", "[", "2", "]", ")", "with", "And", ...
[ 164, 0 ]
[ 187, 73 ]
python
en
['en', 'en', 'en']
True
parallel
(self)
Perform ClickHouse Kerberos authentication testing for incorrect configuration files
Perform ClickHouse Kerberos authentication testing for incorrect configuration files
def parallel(self): """Perform ClickHouse Kerberos authentication testing for incorrect configuration files """ self.context.ch_nodes = [self.context.cluster.node(f"clickhouse{i}") for i in range(1, 4)] self.context.krb_server = self.context.cluster.node("kerberos") self.context.clients = [self.con...
[ "def", "parallel", "(", "self", ")", ":", "self", ".", "context", ".", "ch_nodes", "=", "[", "self", ".", "context", ".", "cluster", ".", "node", "(", "f\"clickhouse{i}\"", ")", "for", "i", "in", "range", "(", "1", ",", "4", ")", "]", "self", ".", ...
[ 194, 0 ]
[ 203, 40 ]
python
en
['la', 'en', 'en']
True
permutations
()
Returns list of all permutations to run. Currently includes NONE, ADD, DROP, both, and ALTER CONSTRAINT
Returns list of all permutations to run. Currently includes NONE, ADD, DROP, both, and ALTER CONSTRAINT
def permutations(): """Returns list of all permutations to run. Currently includes NONE, ADD, DROP, both, and ALTER CONSTRAINT """ return [*range(permutation_count + len(aliases["ALTER CONSTRAINT"]))]
[ "def", "permutations", "(", ")", ":", "return", "[", "*", "range", "(", "permutation_count", "+", "len", "(", "aliases", "[", "\"ALTER CONSTRAINT\"", "]", ")", ")", "]" ]
[ 25, 0 ]
[ 29, 73 ]
python
en
['en', 'en', 'en']
True
alter_constraint_privileges
(grants: int)
Takes in an integer, and returns the corresponding set of tests to grant and not grant using the binary string. Each integer corresponds to a unique permutation of grants.
Takes in an integer, and returns the corresponding set of tests to grant and not grant using the binary string. Each integer corresponds to a unique permutation of grants.
def alter_constraint_privileges(grants: int): """Takes in an integer, and returns the corresponding set of tests to grant and not grant using the binary string. Each integer corresponds to a unique permutation of grants. """ note(grants) privileges = [] # Extra iteration for ALTER CONSTRAIN...
[ "def", "alter_constraint_privileges", "(", "grants", ":", "int", ")", ":", "note", "(", "grants", ")", "privileges", "=", "[", "]", "# Extra iteration for ALTER CONSTRAINT", "if", "grants", ">=", "permutation_count", ":", "privileges", ".", "append", "(", "aliases...
[ 31, 0 ]
[ 51, 32 ]
python
en
['en', 'en', 'en']
True
alter_constraint_privilege_handler
(grants, table, user, node)
For all 2 subprivileges, if the privilege is granted: run test to ensure correct behavior, and if the privilege is not granted, run test to ensure correct behavior there as well
For all 2 subprivileges, if the privilege is granted: run test to ensure correct behavior, and if the privilege is not granted, run test to ensure correct behavior there as well
def alter_constraint_privilege_handler(grants, table, user, node): """For all 2 subprivileges, if the privilege is granted: run test to ensure correct behavior, and if the privilege is not granted, run test to ensure correct behavior there as well """ # Testing ALTER CONSTRAINT and CONSTRAINT is the sam...
[ "def", "alter_constraint_privilege_handler", "(", "grants", ",", "table", ",", "user", ",", "node", ")", ":", "# Testing ALTER CONSTRAINT and CONSTRAINT is the same as testing all subprivileges", "if", "grants", ">", "permutation_count", "-", "1", ":", "grants", "=", "per...
[ 53, 0 ]
[ 72, 82 ]
python
en
['en', 'en', 'en']
True
check_add_constraint_when_privilege_is_granted
(table, user, node)
Ensures ADD CONSTRAINT runs as expected when the privilege is granted to the specified user
Ensures ADD CONSTRAINT runs as expected when the privilege is granted to the specified user
def check_add_constraint_when_privilege_is_granted(table, user, node): """Ensures ADD CONSTRAINT runs as expected when the privilege is granted to the specified user """ constraint = "add" with Given(f"I add constraint '{constraint}'"): node.query(f"ALTER TABLE {table} ADD CONSTRAINT {constrain...
[ "def", "check_add_constraint_when_privilege_is_granted", "(", "table", ",", "user", ",", "node", ")", ":", "constraint", "=", "\"add\"", "with", "Given", "(", "f\"I add constraint '{constraint}'\"", ")", ":", "node", ".", "query", "(", "f\"ALTER TABLE {table} ADD CONSTR...
[ 74, 0 ]
[ 88, 71 ]
python
en
['en', 'en', 'en']
True
check_drop_constraint_when_privilege_is_granted
(table, user, node)
Ensures DROP CONSTRAINT runs as expected when the privilege is granted to the specified user
Ensures DROP CONSTRAINT runs as expected when the privilege is granted to the specified user
def check_drop_constraint_when_privilege_is_granted(table, user, node): """Ensures DROP CONSTRAINT runs as expected when the privilege is granted to the specified user """ with But("I try to drop nonexistent constraint, throws exception"): exitcode, message = errors.wrong_constraint_name("fake_const...
[ "def", "check_drop_constraint_when_privilege_is_granted", "(", "table", ",", "user", ",", "node", ")", ":", "with", "But", "(", "\"I try to drop nonexistent constraint, throws exception\"", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "wrong_constraint_name",...
[ 90, 0 ]
[ 109, 89 ]
python
en
['en', 'en', 'en']
True
check_add_constraint_when_privilege_is_not_granted
(table, user, node)
Ensures ADD CONSTRAINT errors as expected without the required privilege for the specified user
Ensures ADD CONSTRAINT errors as expected without the required privilege for the specified user
def check_add_constraint_when_privilege_is_not_granted(table, user, node): """Ensures ADD CONSTRAINT errors as expected without the required privilege for the specified user """ constraint = "add" with When("I try to use privilege that has not been granted"): exitcode, message = errors.not_enou...
[ "def", "check_add_constraint_when_privilege_is_not_granted", "(", "table", ",", "user", ",", "node", ")", ":", "constraint", "=", "\"add\"", "with", "When", "(", "\"I try to use privilege that has not been granted\"", ")", ":", "exitcode", ",", "message", "=", "errors",...
[ 111, 0 ]
[ 119, 76 ]
python
en
['en', 'en', 'en']
True
check_drop_constraint_when_privilege_is_not_granted
(table, user, node)
Ensures DROP CONSTRAINT errors as expected without the required privilege for the specified user
Ensures DROP CONSTRAINT errors as expected without the required privilege for the specified user
def check_drop_constraint_when_privilege_is_not_granted(table, user, node): """Ensures DROP CONSTRAINT errors as expected without the required privilege for the specified user """ constraint = "drop" with When("I try to use privilege that has not been granted"): exitcode, message = errors.not_e...
[ "def", "check_drop_constraint_when_privilege_is_not_granted", "(", "table", ",", "user", ",", "node", ")", ":", "constraint", "=", "\"drop\"", "with", "When", "(", "\"I try to use privilege that has not been granted\"", ")", ":", "exitcode", ",", "message", "=", "errors...
[ 121, 0 ]
[ 129, 76 ]
python
en
['en', 'en', 'en']
True
user_with_some_privileges
(self, table_type, node=None)
Check that user with any permutation of ALTER CONSTRAINT subprivileges is able to alter the table for privileges granted, and not for privileges not granted.
Check that user with any permutation of ALTER CONSTRAINT subprivileges is able to alter the table for privileges granted, and not for privileges not granted.
def user_with_some_privileges(self, table_type, node=None): """Check that user with any permutation of ALTER CONSTRAINT subprivileges is able to alter the table for privileges granted, and not for privileges not granted. """ if node is None: node = self.context.node table_name = f"merge_tre...
[ "def", "user_with_some_privileges", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "table_name", "=", "f\"merge_tree_{getuid()}\"", "user_name", "=", "f\"...
[ 132, 0 ]
[ 151, 96 ]
python
en
['en', 'en', 'en']
True
user_with_revoked_privileges
(self, table_type, node=None)
Check that user is unable to ALTER CONSTRAINTs on table after ALTER CONSTRAINT privilege on that table has been revoked from the user.
Check that user is unable to ALTER CONSTRAINTs on table after ALTER CONSTRAINT privilege on that table has been revoked from the user.
def user_with_revoked_privileges(self, table_type, node=None): """Check that user is unable to ALTER CONSTRAINTs on table after ALTER CONSTRAINT privilege on that table has been revoked from the user. """ if node is None: node = self.context.node table_name = f"merge_tree_{getuid()}" us...
[ "def", "user_with_revoked_privileges", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "table_name", "=", "f\"merge_tree_{getuid()}\"", "user_name", "=", "...
[ 157, 0 ]
[ 180, 86 ]
python
en
['en', 'en', 'en']
True
role_with_some_privileges
(self, table_type, node=None)
Check that user can ALTER CONSTRAINT on a table after it is granted a role that has the ALTER CONSTRAINT privilege for that table.
Check that user can ALTER CONSTRAINT on a table after it is granted a role that has the ALTER CONSTRAINT privilege for that table.
def role_with_some_privileges(self, table_type, node=None): """Check that user can ALTER CONSTRAINT on a table after it is granted a role that has the ALTER CONSTRAINT privilege for that table. """ if node is None: node = self.context.node table_name = f"merge_tree_{getuid()}" user_name...
[ "def", "role_with_some_privileges", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "table_name", "=", "f\"merge_tree_{getuid()}\"", "user_name", "=", "f\"...
[ 186, 0 ]
[ 209, 96 ]
python
en
['en', 'en', 'en']
True
user_with_revoked_role
(self, table_type, node=None)
Check that user with a role that has ALTER CONSTRAINT privilege on a table is unable to ALTER CONSTRAINT from that table after the role with privilege has been revoked from the user.
Check that user with a role that has ALTER CONSTRAINT privilege on a table is unable to ALTER CONSTRAINT from that table after the role with privilege has been revoked from the user.
def user_with_revoked_role(self, table_type, node=None): """Check that user with a role that has ALTER CONSTRAINT privilege on a table is unable to ALTER CONSTRAINT from that table after the role with privilege has been revoked from the user. """ if node is None: node = self.context.node ta...
[ "def", "user_with_revoked_role", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "table_name", "=", "f\"merge_tree_{getuid()}\"", "user_name", "=", "f\"use...
[ 212, 0 ]
[ 239, 86 ]
python
en
['en', 'en', 'en']
True
user_with_privileges_on_cluster
(self, table_type, node=None)
Check that user is able to ALTER CONSTRAINT on a table with privilege granted on a cluster.
Check that user is able to ALTER CONSTRAINT on a table with privilege granted on a cluster.
def user_with_privileges_on_cluster(self, table_type, node=None): """Check that user is able to ALTER CONSTRAINT on a table with privilege granted on a cluster. """ if node is None: node = self.context.node table_name = f"merge_tree_{getuid()}" user_name = f"user_{getuid()}" for pe...
[ "def", "user_with_privileges_on_cluster", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "table_name", "=", "f\"merge_tree_{getuid()}\"", "user_name", "=", ...
[ 245, 0 ]
[ 271, 87 ]
python
en
['en', 'en', 'en']
True
AdminApiEndpointTestCase.test_api_add_book
(self)
Tests is admin can add a book
Tests is admin can add a book
def test_api_add_book(self): """Tests is admin can add a book""" book = self.book.books_list[0] ISBN = book["ISBN"] response = self.client.get('/api/v1/books', content_type='application/json') print(response.data) self.assertEquals(response...
[ "def", "test_api_add_book", "(", "self", ")", ":", "book", "=", "self", ".", "book", ".", "books_list", "[", "0", "]", "ISBN", "=", "book", "[", "\"ISBN\"", "]", "response", "=", "self", ".", "client", ".", "get", "(", "'/api/v1/books'", ",", "content_...
[ 67, 8 ]
[ 86, 56 ]
python
en
['en', 'en', 'en']
True
AdminApiEndpointTestCase.test_api_delete
(self)
Tests book deletion
Tests book deletion
def test_api_delete(self): """Tests book deletion""" new_book = { "title": "Bruh", "ISBN": "0001" } response = self.client.delete('/api/v1/books/ISBN', data=json.dumps(new_book), content_type='application/jso...
[ "def", "test_api_delete", "(", "self", ")", ":", "new_book", "=", "{", "\"title\"", ":", "\"Bruh\"", ",", "\"ISBN\"", ":", "\"0001\"", "}", "response", "=", "self", ".", "client", ".", "delete", "(", "'/api/v1/books/ISBN'", ",", "data", "=", "json", ".", ...
[ 88, 8 ]
[ 96, 56 ]
python
ca
['ca', 'da', 'en']
False
AdminApiEndpointTestCase.test_api_retrieve_one_book
(self)
Test retrieveing a book
Test retrieveing a book
def test_api_retrieve_one_book(self): """Test retrieveing a book""" response = self.client.get('/api/v1/books/ISBN', content_type='application/json') self.assertIn("Please login", str(response.data))
[ "def", "test_api_retrieve_one_book", "(", "self", ")", ":", "response", "=", "self", ".", "client", ".", "get", "(", "'/api/v1/books/ISBN'", ",", "content_type", "=", "'application/json'", ")", "self", ".", "assertIn", "(", "\"Please login\"", ",", "str", "(", ...
[ 98, 8 ]
[ 101, 61 ]
python
en
['en', 'lb', 'en']
True
heterogeneity
(im, kernel_size=16, kernel_type='gaussian', pyramid_height=4)
Compute heterogeneity statistic. 1. Convolve image with Laplacian pyramid of specified height. 2. Rectify pyramid outputs. 3. Compute local mean and variance of rectified pyramid outputs using a filter of specified type and size. 4. Heterogeneity equals the local variance divided by the local me...
Compute heterogeneity statistic.
def heterogeneity(im, kernel_size=16, kernel_type='gaussian', pyramid_height=4): """Compute heterogeneity statistic. 1. Convolve image with Laplacian pyramid of specified height. 2. Rectify pyramid outputs. 3. Compute local mean and variance of rectified pyramid outputs using a filter of specifi...
[ "def", "heterogeneity", "(", "im", ",", "kernel_size", "=", "16", ",", "kernel_type", "=", "'gaussian'", ",", "pyramid_height", "=", "4", ")", ":", "pyr", "=", "pt", ".", "pyramids", ".", "LaplacianPyramid", "(", "im", ",", "pyramid_height", ")", "# rectif...
[ 13, 0 ]
[ 73, 28 ]
python
en
['en', 'sn', 'en']
True
amplitude_spectra
(image)
Compute amplitude spectra of an image. We compute the 2d Fourier transform of an image, take its magnitude, and then radially average it. This averages across orientations and also discretizes the frequency. We also drop a disk in frequency space to exclude the highest frequencies (that is, those where...
Compute amplitude spectra of an image.
def amplitude_spectra(image): """Compute amplitude spectra of an image. We compute the 2d Fourier transform of an image, take its magnitude, and then radially average it. This averages across orientations and also discretizes the frequency. We also drop a disk in frequency space to exclude the high...
[ "def", "amplitude_spectra", "(", "image", ")", ":", "frq", "=", "sp_fft", ".", "fftshift", "(", "sp_fft", ".", "fft2", "(", "image", ")", ")", "# following", "# https://scipy-lectures.org/advanced/image_processing/auto_examples/plot_radial_mean.html.", "# Note the tutorial ...
[ 76, 0 ]
[ 119, 18 ]
python
en
['en', 'en', 'en']
True
amplitude_orientation
(image, n_angle_slices=32, metadata=OrderedDict())
Compute orientation energy of an image. We compute the 2d Fourier transform of an image, take its magnitude, and compile the amplitudes in angular slices. Note that, unlike amplitude_spectra(), we do not average within these slices to get a single number. That's because the distributions here can have ...
Compute orientation energy of an image.
def amplitude_orientation(image, n_angle_slices=32, metadata=OrderedDict()): """Compute orientation energy of an image. We compute the 2d Fourier transform of an image, take its magnitude, and compile the amplitudes in angular slices. Note that, unlike amplitude_spectra(), we do not average within thes...
[ "def", "amplitude_orientation", "(", "image", ",", "n_angle_slices", "=", "32", ",", "metadata", "=", "OrderedDict", "(", ")", ")", ":", "frq", "=", "sp_fft", ".", "fftshift", "(", "sp_fft", ".", "fft2", "(", "image", ")", ")", "theta", "=", "pt", ".",...
[ 122, 0 ]
[ 212, 26 ]
python
en
['en', 'en', 'en']
True
image_set_amplitude_spectra
(images, names, metadata=OrderedDict(), name_dim='image_name')
Compute amplitude spectra of a set of images. All images must be same size. Parameters ---------- images : list This should be a list of 2d image arrays (all the same size) or of strings giving the paths to such images. names : list List of strings, same length as images, g...
Compute amplitude spectra of a set of images.
def image_set_amplitude_spectra(images, names, metadata=OrderedDict(), name_dim='image_name'): """Compute amplitude spectra of a set of images. All images must be same size. Parameters ---------- images : list This should be a list of 2d image arrays (all th...
[ "def", "image_set_amplitude_spectra", "(", "images", ",", "names", ",", "metadata", "=", "OrderedDict", "(", ")", ",", "name_dim", "=", "'image_name'", ")", ":", "spectra", "=", "[", "]", "ori", "=", "[", "]", "ori_metadata", "=", "metadata", ".", "copy", ...
[ 215, 0 ]
[ 261, 36 ]
python
en
['en', 'en', 'en']
True
serve
(learner_script, port=16118, debug=True, image_dir='~/.heartex/images', num_iter=10, **fit_kwargs)
:param learner_script: function that takes (DataBunch, str) as input and returns Learner object :param port: specify localhost port where the model will be served :param debug: whether to start at debug mode :return:
:param learner_script: function that takes (DataBunch, str) as input and returns Learner object :param port: specify localhost port where the model will be served :param debug: whether to start at debug mode :return:
def serve(learner_script, port=16118, debug=True, image_dir='~/.heartex/images', num_iter=10, **fit_kwargs): """ :param learner_script: function that takes (DataBunch, str) as input and returns Learner object :param port: specify localhost port where the model will be served :param debug: whether to sta...
[ "def", "serve", "(", "learner_script", ",", "port", "=", "16118", ",", "debug", "=", "True", ",", "image_dir", "=", "'~/.heartex/images'", ",", "num_iter", "=", "10", ",", "*", "*", "fit_kwargs", ")", ":", "init_model_server", "(", "create_model_func", "=", ...
[ 50, 0 ]
[ 69, 51 ]
python
en
['en', 'error', 'th']
False
get_stat_func
(line='mean', err='std')
Wrapper around statistics measures: central tendencies (mean, median), and errors (std, sem, percentiles, etc) Parameters ---------- line: str Central tendencies (mean or median). err: str Error (std, sem, range or interquartile) Returns ------- line_f, err_min, err_ma...
Wrapper around statistics measures: central tendencies (mean, median), and errors (std, sem, percentiles, etc)
def get_stat_func(line='mean', err='std'): """ Wrapper around statistics measures: central tendencies (mean, median), and errors (std, sem, percentiles, etc) Parameters ---------- line: str Central tendencies (mean or median). err: str Error (std, sem, range or interquartile) ...
[ "def", "get_stat_func", "(", "line", "=", "'mean'", ",", "err", "=", "'std'", ")", ":", "if", "line", "==", "'mean'", ":", "def", "line_f", "(", "a", ")", ":", "return", "np", ".", "nanmean", "(", "a", ",", "axis", "=", "0", ")", "elif", "line", ...
[ 74, 0 ]
[ 131, 38 ]
python
en
['en', 'error', 'th']
False
get_logdir
(params)
Create logging directory. Parameters ---------- params: dict Params of the experiment required to create the logging directory. Returns -------
Create logging directory.
def get_logdir(params): """ Create logging directory. Parameters ---------- params: dict Params of the experiment required to create the logging directory. Returns ------- """ repo_path = get_repo_path() logdir = repo_path + 'data/results/' + params['env_id'] + '/' + p...
[ "def", "get_logdir", "(", "params", ")", ":", "repo_path", "=", "get_repo_path", "(", ")", "logdir", "=", "repo_path", "+", "'data/results/'", "+", "params", "[", "'env_id'", "]", "+", "'/'", "+", "params", "[", "'algo_id'", "]", "+", "'/'", "+", "params...
[ 338, 0 ]
[ 369, 17 ]
python
en
['en', 'error', 'th']
False
set_seeds
(seed)
Set all seeds. Parameters ---------- seed: int Random seed. env: Gym Env Gym environment that should be seeded.
Set all seeds.
def set_seeds(seed): """ Set all seeds. Parameters ---------- seed: int Random seed. env: Gym Env Gym environment that should be seeded. """ if seed is None: seed = np.random.randint(1e6) random.seed(seed) torch.manual_seed(seed) np.random.seed(seed)
[ "def", "set_seeds", "(", "seed", ")", ":", "if", "seed", "is", "None", ":", "seed", "=", "np", ".", "random", ".", "randint", "(", "1e6", ")", "random", ".", "seed", "(", "seed", ")", "torch", ".", "manual_seed", "(", "seed", ")", "np", ".", "ran...
[ 372, 0 ]
[ 387, 24 ]
python
en
['en', 'error', 'th']
False
mv2musig
(m, v)
Convert mean and variance of log-normal distribution into mean and stdev of underlying normal distribution Parameters ---------- m: float Mean of log-normal distribution. v: float Variance of log-normal distribution. Returns ------- mu: float Mean of underlying no...
Convert mean and variance of log-normal distribution into mean and stdev of underlying normal distribution Parameters ---------- m: float Mean of log-normal distribution. v: float Variance of log-normal distribution.
def mv2musig(m, v): """ Convert mean and variance of log-normal distribution into mean and stdev of underlying normal distribution Parameters ---------- m: float Mean of log-normal distribution. v: float Variance of log-normal distribution. Returns ------- mu: float ...
[ "def", "mv2musig", "(", "m", ",", "v", ")", ":", "sig", "=", "np", ".", "sqrt", "(", "np", ".", "log", "(", "v", "/", "np", ".", "exp", "(", "2", "*", "np", ".", "log", "(", "m", ")", ")", "+", "1", ")", ")", "mu", "=", "np", ".", "lo...
[ 390, 0 ]
[ 409, 18 ]
python
en
['en', 'error', 'th']
False
musig2mv
(mu, sig)
Converts mean and stdev of normal distribution into mean and variance of log-normal distribution. Parameters ---------- mu: float Mean of normal distribution. sig: float Stdev of normal distribution. Returns ------- m: float Mean of log-normal distribution. ...
Converts mean and stdev of normal distribution into mean and variance of log-normal distribution.
def musig2mv(mu, sig): """ Converts mean and stdev of normal distribution into mean and variance of log-normal distribution. Parameters ---------- mu: float Mean of normal distribution. sig: float Stdev of normal distribution. Returns ------- m: float Mean o...
[ "def", "musig2mv", "(", "mu", ",", "sig", ")", ":", "m", "=", "np", ".", "exp", "(", "mu", "+", "sig", "**", "2", "/", "2", ")", "v", "=", "(", "np", ".", "exp", "(", "sig", "**", "2", ")", "-", "1", ")", "*", "np", ".", "exp", "(", "...
[ 412, 0 ]
[ 432, 15 ]
python
en
['en', 'error', 'th']
False
compute_pareto_front
(costs: list)
Find rows of entries in the Pareto front. Parameters ---------- costs: list of arrays List of arrays of costs. Returns ------- front_ids: list of ints List of row indices of elements from the pareto front.
Find rows of entries in the Pareto front. Parameters ---------- costs: list of arrays List of arrays of costs.
def compute_pareto_front(costs: list): """ Find rows of entries in the Pareto front. Parameters ---------- costs: list of arrays List of arrays of costs. Returns ------- front_ids: list of ints List of row indices of elements from the pareto front. """ front_ids ...
[ "def", "compute_pareto_front", "(", "costs", ":", "list", ")", ":", "front_ids", "=", "[", "]", "n_points", "=", "len", "(", "costs", ")", "for", "ind1", "in", "range", "(", "n_points", ")", ":", "pareto", "=", "True", "for", "ind2", "in", "range", "...
[ 435, 0 ]
[ 462, 20 ]
python
en
['en', 'error', 'th']
False
BaseDist.__init__
(self, params, stochastic)
Base distribution class. Parameters ---------- params: Parameters of the distribution. stochastic: bool Whether the sampling is stochastic.
Base distribution class.
def __init__(self, params, stochastic): """ Base distribution class. Parameters ---------- params: Parameters of the distribution. stochastic: bool Whether the sampling is stochastic. """ self.params = params self.stochasti...
[ "def", "__init__", "(", "self", ",", "params", ",", "stochastic", ")", ":", "self", ".", "params", "=", "params", "self", ".", "stochastic", "=", "stochastic" ]
[ 139, 4 ]
[ 151, 36 ]
python
en
['en', 'error', 'th']
False
BaseDist.sample
(self, n=1)
Sample from the distribution. Parameters ---------- n: int Number of samples. Returns ------- a: Sampled values (nd.array if n>1).
Sample from the distribution.
def sample(self, n=1): """ Sample from the distribution. Parameters ---------- n: int Number of samples. Returns ------- a: Sampled values (nd.array if n>1). """ pass
[ "def", "sample", "(", "self", ",", "n", "=", "1", ")", ":", "pass" ]
[ 154, 4 ]
[ 168, 12 ]
python
en
['en', 'error', 'th']
False
DiscreteDist.__init__
(self, params, stochastic)
Discrete distribution. Parameters ---------- params: list of size 3 First element is the list of values, second the list of probabilities, third the value in the deterministic case. stochastic: bool Whether the sampling is stochastic.
Discrete distribution.
def __init__(self, params, stochastic): """ Discrete distribution. Parameters ---------- params: list of size 3 First element is the list of values, second the list of probabilities, third the value in the deterministic case. stochastic: bool Whet...
[ "def", "__init__", "(", "self", ",", "params", ",", "stochastic", ")", ":", "super", "(", "DiscreteDist", ",", "self", ")", ".", "__init__", "(", "params", ",", "stochastic", ")", "assert", "isinstance", "(", "params", ",", "list", ")", ",", "\"params sh...
[ 296, 4 ]
[ 313, 56 ]
python
en
['en', 'error', 'th']
False
Logger.__init__
(self, keys, logdir)
Logging class Parameters ---------- keys: list of str Keys that should be logged after every evaluation (in order of appearance in prints). logdir: str Path where the logs should be saved Attributes: ---------- data: dict of list...
Logging class
def __init__(self, keys, logdir): """ Logging class Parameters ---------- keys: list of str Keys that should be logged after every evaluation (in order of appearance in prints). logdir: str Path where the logs should be saved Attributes: ...
[ "def", "__init__", "(", "self", ",", "keys", ",", "logdir", ")", ":", "self", ".", "keys", "=", "keys", "self", ".", "data", "=", "dict", "(", "zip", "(", "keys", ",", "[", "[", "]", "for", "_", "in", "range", "(", "len", "(", "keys", ")", ")...
[ 465, 4 ]
[ 483, 28 ]
python
en
['en', 'error', 'th']
False
Logger.add
(self, new_data)
Adds new entries to the logs. Parameters ---------- new_data: dict New data should contain one metric for each key
Adds new entries to the logs.
def add(self, new_data): """ Adds new entries to the logs. Parameters ---------- new_data: dict New data should contain one metric for each key """ assert sorted(list(new_data.keys())) == sorted(self.keys) for k in new_data.keys(): ...
[ "def", "add", "(", "self", ",", "new_data", ")", ":", "assert", "sorted", "(", "list", "(", "new_data", ".", "keys", "(", ")", ")", ")", "==", "sorted", "(", "self", ".", "keys", ")", "for", "k", "in", "new_data", ".", "keys", "(", ")", ":", "s...
[ 485, 4 ]
[ 497, 44 ]
python
en
['en', 'error', 'th']
False
sketchAssign
()
Recieve sketch and respond with clustering information
Recieve sketch and respond with clustering information
def sketchAssign(): """Recieve sketch and respond with clustering information""" if not request.json: return "not a json post" if request.json: sketch_dict = request.json # determine database to use if sketch_dict["species"] == "S.pneumoniae": species = 'Streptoco...
[ "def", "sketchAssign", "(", ")", ":", "if", "not", "request", ".", "json", ":", "return", "\"not a json post\"", "if", "request", ".", "json", ":", "sketch_dict", "=", "request", ".", "json", "# determine database to use", "if", "sketch_dict", "[", "\"species\""...
[ 44, 0 ]
[ 148, 32 ]
python
en
['en', 'en', 'en']
True
default_options
(species_db)
Default options for WebAPI
Default options for WebAPI
def default_options(species_db): """Default options for WebAPI""" with open(os.path.join(species_db, "args.txt")) as a: args_json = a.read() args = json.loads(args_json, object_hook=lambda d: SimpleNamespace(**d)) args.assign.ref_db = species_db args.assign.previous_clustering = species_db ...
[ "def", "default_options", "(", "species_db", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "species_db", ",", "\"args.txt\"", ")", ")", "as", "a", ":", "args_json", "=", "a", ".", "read", "(", ")", "args", "=", "json", ".", "l...
[ 150, 0 ]
[ 160, 17 ]
python
en
['en', 'pt', 'en']
True
get_colours
(query, clusters)
Colour array for Plotly.js
Colour array for Plotly.js
def get_colours(query, clusters): """Colour array for Plotly.js""" colours = [] for clus in clusters: if str(clus) == str(query): colours.append('rgb(255,128,128)') else: colours.append('blue') return colours
[ "def", "get_colours", "(", "query", ",", "clusters", ")", ":", "colours", "=", "[", "]", "for", "clus", "in", "clusters", ":", "if", "str", "(", "clus", ")", "==", "str", "(", "query", ")", ":", "colours", ".", "append", "(", "'rgb(255,128,128)'", ")...
[ 162, 0 ]
[ 170, 18 ]
python
en
['en', 'en', 'en']
True
sketch_to_hdf5
(sketch, output)
Convert JSON sketch to query hdf5 database
Convert JSON sketch to query hdf5 database
def sketch_to_hdf5(sketch, output): """Convert JSON sketch to query hdf5 database""" kmers = [] dists = [] sketch_dict = json.loads(sketch) qNames = ["query"] queryDB = h5py.File(os.path.join(output, os.path.basename(output) + '.h5'), 'w') sketches = queryDB.create_group("sketches") ske...
[ "def", "sketch_to_hdf5", "(", "sketch", ",", "output", ")", ":", "kmers", "=", "[", "]", "dists", "=", "[", "]", "sketch_dict", "=", "json", ".", "loads", "(", "sketch", ")", "qNames", "=", "[", "\"query\"", "]", "queryDB", "=", "h5py", ".", "File", ...
[ 172, 0 ]
[ 214, 17 ]
python
en
['en', 'en', 'en']
True
graphml_to_json
(network_dir)
Converts full GraphML file to JSON subgraph
Converts full GraphML file to JSON subgraph
def graphml_to_json(network_dir): """Converts full GraphML file to JSON subgraph""" labels = [] nodes_list = [] edges_list = [] full_graph = gt.load_graph(os.path.join(network_dir, os.path.basename(network_dir) + "_cytoscape.graphml")) components = gt.label_components(full_graph)[0].a subgra...
[ "def", "graphml_to_json", "(", "network_dir", ")", ":", "labels", "=", "[", "]", "nodes_list", "=", "[", "]", "edges_list", "=", "[", "]", "full_graph", "=", "gt", ".", "load_graph", "(", "os", ".", "path", ".", "join", "(", "network_dir", ",", "os", ...
[ 216, 0 ]
[ 245, 23 ]
python
en
['en', 'en', 'en']
True
highlight_cluster
(query, cluster)
Colour assigned cluster in Microreact output
Colour assigned cluster in Microreact output
def highlight_cluster(query, cluster): """Colour assigned cluster in Microreact output""" if str(cluster) == str(query): colour = "red" else: colour = "blue" return colour
[ "def", "highlight_cluster", "(", "query", ",", "cluster", ")", ":", "if", "str", "(", "cluster", ")", "==", "str", "(", "query", ")", ":", "colour", "=", "\"red\"", "else", ":", "colour", "=", "\"blue\"", "return", "colour" ]
[ 247, 0 ]
[ 253, 17 ]
python
en
['en', 'en', 'en']
True
api
(query, ref_db)
Post cluster and tree information to microreact
Post cluster and tree information to microreact
def api(query, ref_db): """Post cluster and tree information to microreact""" url = "https://microreact.org/api/project/" microreactDF = pd.read_csv(os.path.join(ref_db, os.path.basename(ref_db) + "_microreact_clusters.csv")) microreactDF["Cluster__autocolour"] = microreactDF['Cluster_Cluster__autocolou...
[ "def", "api", "(", "query", ",", "ref_db", ")", ":", "url", "=", "\"https://microreact.org/api/project/\"", "microreactDF", "=", "pd", ".", "read_csv", "(", "os", ".", "path", ".", "join", "(", "ref_db", ",", "os", ".", "path", ".", "basename", "(", "ref...
[ 255, 0 ]
[ 274, 14 ]
python
en
['en', 'en', 'en']
True
calc_prevalence
(cluster, cluster_list, num_samples)
Cluster prevalences for Plotly.js
Cluster prevalences for Plotly.js
def calc_prevalence(cluster, cluster_list, num_samples): """Cluster prevalences for Plotly.js""" clusterCount = cluster_list.count(cluster) prevalence = round(clusterCount / num_samples * 100, 2) return prevalence
[ "def", "calc_prevalence", "(", "cluster", ",", "cluster_list", ",", "num_samples", ")", ":", "clusterCount", "=", "cluster_list", ".", "count", "(", "cluster", ")", "prevalence", "=", "round", "(", "clusterCount", "/", "num_samples", "*", "100", ",", "2", ")...
[ 276, 0 ]
[ 280, 21 ]
python
en
['en', 'da', 'en']
True
summarise_clusters
(output, species, species_db)
Retreieve assigned query and all cluster prevalences. Write list of all isolates in cluster for tree subsetting
Retreieve assigned query and all cluster prevalences. Write list of all isolates in cluster for tree subsetting
def summarise_clusters(output, species, species_db): """Retreieve assigned query and all cluster prevalences. Write list of all isolates in cluster for tree subsetting""" totalDF = pd.read_csv(os.path.join(output, os.path.basename(output) + "_clusters.csv")) queryDF = totalDF.loc[totalDF['Taxon'] == "qu...
[ "def", "summarise_clusters", "(", "output", ",", "species", ",", "species_db", ")", ":", "totalDF", "=", "pd", ".", "read_csv", "(", "os", ".", "path", ".", "join", "(", "output", ",", "os", ".", "path", ".", "basename", "(", "output", ")", "+", "\"_...
[ 292, 0 ]
[ 321, 81 ]
python
en
['en', 'pt', 'en']
True
image_from_string
(img_str)
Parse a string into an image map
Parse a string into an image map
def image_from_string(img_str): """Parse a string into an image map""" tag = "" digest = "" if ":" not in img_str: img_str = img_str + ":latest" if "@" in img_str: name, digest = img_str.rsplit("@", 1) else: name, tag = img_str.rsplit(":", 1) img = {"name": name, ...
[ "def", "image_from_string", "(", "img_str", ")", ":", "tag", "=", "\"\"", "digest", "=", "\"\"", "if", "\":\"", "not", "in", "img_str", ":", "img_str", "=", "img_str", "+", "\":latest\"", "if", "\"@\"", "in", "img_str", ":", "name", ",", "digest", "=", ...
[ 21, 0 ]
[ 36, 14 ]
python
en
['en', 'en', 'en']
True
scan_kustomization_for_images
(kust_dir)
Scan kustomization folder and produce a list of images Args: kust_dir (str): Path where the kustomize application resides.
Scan kustomization folder and produce a list of images
def scan_kustomization_for_images(kust_dir): """Scan kustomization folder and produce a list of images Args: kust_dir (str): Path where the kustomize application resides. """ yaml = YAML() yaml.block_seq_indent = 0 # Load kustomization with open(path.join(kust_dir, "kustomization.ya...
[ "def", "scan_kustomization_for_images", "(", "kust_dir", ")", ":", "yaml", "=", "YAML", "(", ")", "yaml", ".", "block_seq_indent", "=", "0", "# Load kustomization", "with", "open", "(", "path", ".", "join", "(", "kust_dir", ",", "\"kustomization.yaml\"", ")", ...
[ 57, 0 ]
[ 108, 39 ]
python
en
['en', 'en', 'en']
True
test_gate_unitary_correct
(op, op_name)
Test if lightning.qubit correctly applies gates by reconstructing the unitary matrix and comparing to the expected version
Test if lightning.qubit correctly applies gates by reconstructing the unitary matrix and comparing to the expected version
def test_gate_unitary_correct(op, op_name): """Test if lightning.qubit correctly applies gates by reconstructing the unitary matrix and comparing to the expected version""" if op_name in ("BasisState", "QubitStateVector"): pytest.skip("Skipping operation because it is a state preparation") wir...
[ "def", "test_gate_unitary_correct", "(", "op", ",", "op_name", ")", ":", "if", "op_name", "in", "(", "\"BasisState\"", ",", "\"QubitStateVector\"", ")", ":", "pytest", ".", "skip", "(", "\"Skipping operation because it is a state preparation\"", ")", "wires", "=", "...
[ 31, 0 ]
[ 57, 49 ]
python
en
['en', 'en', 'en']
True
test_inverse_unitary_correct
(op, op_name)
Test if lightning.qubit correctly applies inverse gates by reconstructing the unitary matrix and comparing to the expected version
Test if lightning.qubit correctly applies inverse gates by reconstructing the unitary matrix and comparing to the expected version
def test_inverse_unitary_correct(op, op_name): """Test if lightning.qubit correctly applies inverse gates by reconstructing the unitary matrix and comparing to the expected version""" if op_name in ("BasisState", "QubitStateVector"): pytest.skip("Skipping operation because it is a state preparation...
[ "def", "test_inverse_unitary_correct", "(", "op", ",", "op_name", ")", ":", "if", "op_name", "in", "(", "\"BasisState\"", ",", "\"QubitStateVector\"", ")", ":", "pytest", ".", "skip", "(", "\"Skipping operation because it is a state preparation\"", ")", "wires", "=", ...
[ 61, 0 ]
[ 87, 49 ]
python
en
['en', 'en', 'en']
True
test_arbitrary_unitary_correct
()
Test if lightning.qubit correctly applies an arbitrary unitary by reconstructing its matrix
Test if lightning.qubit correctly applies an arbitrary unitary by reconstructing its matrix
def test_arbitrary_unitary_correct(): """Test if lightning.qubit correctly applies an arbitrary unitary by reconstructing its matrix""" wires = 2 dev = qml.device("lightning.qubit", wires=wires) @qml.qnode(dev) def output(input): qml.BasisState(input, wires=range(wires)) qml.Qub...
[ "def", "test_arbitrary_unitary_correct", "(", ")", ":", "wires", "=", "2", "dev", "=", "qml", ".", "device", "(", "\"lightning.qubit\"", ",", "wires", "=", "wires", ")", "@", "qml", ".", "qnode", "(", "dev", ")", "def", "output", "(", "input", ")", ":"...
[ 121, 0 ]
[ 139, 47 ]
python
en
['en', 'en', 'en']
True
test_arbitrary_inv_unitary_correct
()
Test if lightning.qubit correctly applies the inverse of an arbitrary unitary by reconstructing its matrix
Test if lightning.qubit correctly applies the inverse of an arbitrary unitary by reconstructing its matrix
def test_arbitrary_inv_unitary_correct(): """Test if lightning.qubit correctly applies the inverse of an arbitrary unitary by reconstructing its matrix""" wires = 2 dev = qml.device("lightning.qubit", wires=wires) @qml.qnode(dev) def output(input): qml.BasisState(input, wires=range(wire...
[ "def", "test_arbitrary_inv_unitary_correct", "(", ")", ":", "wires", "=", "2", "dev", "=", "qml", ".", "device", "(", "\"lightning.qubit\"", ",", "wires", "=", "wires", ")", "@", "qml", ".", "qnode", "(", "dev", ")", "def", "output", "(", "input", ")", ...
[ 143, 0 ]
[ 162, 51 ]
python
en
['en', 'en', 'en']
True
showPage
(request)
Show the page when the URL is called.
Show the page when the URL is called.
def showPage(request): """Show the page when the URL is called. """ # Supply names of all datasets available for user to chooose from datasetNames = [item['name'] for item in datasets.datasetAttributes(request)] # Fetch BPDataset instance based on request parameter selectedDatasetName = request.params.get("datas...
[ "def", "showPage", "(", "request", ")", ":", "# Supply names of all datasets available for user to chooose from", "datasetNames", "=", "[", "item", "[", "'name'", "]", "for", "item", "in", "datasets", ".", "datasetAttributes", "(", "request", ")", "]", "# Fetch BPData...
[ 10, 0 ]
[ 45, 49 ]
python
en
['en', 'en', 'en']
True
insert_line_breaks
(s, width)
Break s in lines of size width (approx)
Break s in lines of size width (approx)
def insert_line_breaks(s, width): """Break s in lines of size width (approx)""" sz = len(s) if sz <= width: return s new_str = io.StringIO() w = 0 for i in range(sz): if w > width and s[i] == ' ': new_str.write(u('<br />')) w = 0 else: ...
[ "def", "insert_line_breaks", "(", "s", ",", "width", ")", ":", "sz", "=", "len", "(", "s", ")", "if", "sz", "<=", "width", ":", "return", "s", "new_str", "=", "io", ".", "StringIO", "(", ")", "w", "=", "0", "for", "i", "in", "range", "(", "sz",...
[ 1293, 0 ]
[ 1307, 29 ]
python
en
['en', 'fy', 'en']
True
decrypt
(self, ciphertext=None, key=None, mode=None, iv=None, aad=None, exitcode=0, message=None, step=When, cast=None, endcast=None, compare=None, no_checks=False)
Execute `decrypt` function with the specified parameters.
Execute `decrypt` function with the specified parameters.
def decrypt(self, ciphertext=None, key=None, mode=None, iv=None, aad=None, exitcode=0, message=None, step=When, cast=None, endcast=None, compare=None, no_checks=False): """Execute `decrypt` function with the specified parameters. """ params = [] if mode is not None: params.append(mode) if ci...
[ "def", "decrypt", "(", "self", ",", "ciphertext", "=", "None", ",", "key", "=", "None", ",", "mode", "=", "None", ",", "iv", "=", "None", ",", "aad", "=", "None", ",", "exitcode", "=", "0", ",", "message", "=", "None", ",", "step", "=", "When", ...
[ 13, 0 ]
[ 35, 112 ]
python
en
['en', 'en', 'en']
True
invalid_ciphertext
(self)
Check that `decrypt` function does not crash when invalid `ciphertext` is passed as the first parameter.
Check that `decrypt` function does not crash when invalid `ciphertext` is passed as the first parameter.
def invalid_ciphertext(self): """Check that `decrypt` function does not crash when invalid `ciphertext` is passed as the first parameter. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" invalid_ciphertexts = plaintexts for mode, key_len, iv_len, aad_len in modes: ...
[ "def", "invalid_ciphertext", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "invalid_ciphertexts", "=", "plaintexts", "for", "mode", ",", "key_len", ",", "iv_len", ",", "aad_len", "in", "mod...
[ 41, 0 ]
[ 67, 63 ]
python
en
['en', 'en', 'en']
True
invalid_parameters
(self)
Check that `decrypt` function returns an error when we call it with invalid parameters.
Check that `decrypt` function returns an error when we call it with invalid parameters.
def invalid_parameters(self): """Check that `decrypt` function returns an error when we call it with invalid parameters. """ ciphertext = "unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')" with Example("no parameters"): decrypt(exitcode=42, message="DB::Exception: Incorrect n...
[ "def", "invalid_parameters", "(", "self", ")", ":", "ciphertext", "=", "\"unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')\"", "with", "Example", "(", "\"no parameters\"", ")", ":", "decrypt", "(", "exitcode", "=", "42", ",", "message", "=", "\"DB::Except...
[ 73, 0 ]
[ 153, 67 ]
python
en
['en', 'de', 'en']
True
invalid_key_or_iv_length_for_mode_non_gcm
(self, mode, key_len, iv_len, aad)
Check that an error is returned when key or iv length does not match the expected value for the mode.
Check that an error is returned when key or iv length does not match the expected value for the mode.
def invalid_key_or_iv_length_for_mode_non_gcm(self, mode, key_len, iv_len, aad): """Check that an error is returned when key or iv length does not match the expected value for the mode. """ ciphertext = "unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')" key = "0123456789" * 4 iv =...
[ "def", "invalid_key_or_iv_length_for_mode_non_gcm", "(", "self", ",", "mode", ",", "key_len", ",", "iv_len", ",", "aad", ")", ":", "ciphertext", "=", "\"unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')\"", "key", "=", "\"0123456789\"", "*", "4", "iv", "="...
[ 184, 0 ]
[ 211, 179 ]
python
en
['en', 'en', 'en']
True
invalid_key_or_iv_length_for_gcm
(self, mode, key_len, iv_len, aad)
Check that an error is returned when key or iv length does not match the expected value for the GCM mode.
Check that an error is returned when key or iv length does not match the expected value for the GCM mode.
def invalid_key_or_iv_length_for_gcm(self, mode, key_len, iv_len, aad): """Check that an error is returned when key or iv length does not match the expected value for the GCM mode. """ ciphertext = "'hello there'" plaintext = "hello there" key = "0123456789" * 4 iv = "0123456789" * 4 wi...
[ "def", "invalid_key_or_iv_length_for_gcm", "(", "self", ",", "mode", ",", "key_len", ",", "iv_len", ",", "aad", ")", ":", "ciphertext", "=", "\"'hello there'\"", "plaintext", "=", "\"hello there\"", "key", "=", "\"0123456789\"", "*", "4", "iv", "=", "\"012345678...
[ 229, 0 ]
[ 253, 156 ]
python
en
['en', 'en', 'en']
True
aad_parameter_types_and_length
(self)
Check that `decrypt` function accepts `aad` parameter as the fifth argument of either `String` or `FixedString` types and that the length is not limited.
Check that `decrypt` function accepts `aad` parameter as the fifth argument of either `String` or `FixedString` types and that the length is not limited.
def aad_parameter_types_and_length(self): """Check that `decrypt` function accepts `aad` parameter as the fifth argument of either `String` or `FixedString` types and that the length is not limited. """ plaintext = "hello there" iv = "'012345678912'" mode = "'aes-128-gcm'" key = "'0123456789...
[ "def", "aad_parameter_types_and_length", "(", "self", ")", ":", "plaintext", "=", "\"hello there\"", "iv", "=", "\"'012345678912'\"", "mode", "=", "\"'aes-128-gcm'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"aad is specified using String type\"", ")"...
[ 260, 0 ]
[ 295, 106 ]
python
en
['en', 'en', 'en']
True
iv_parameter_types
(self)
Check that `decrypt` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types.
Check that `decrypt` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types.
def iv_parameter_types(self): """Check that `decrypt` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types. """ iv = "'0123456789123456'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("iv is specified using String type"): dec...
[ "def", "iv_parameter_types", "(", "self", ")", ":", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"iv is specified using String type\"", ")", ":", "decrypt", "(", "ciphertext", "=", ...
[ 301, 0 ]
[ 319, 159 ]
python
en
['en', 'en', 'en']
True
key_parameter_types
(self)
Check that `decrypt` function accepts `key` parameter as the second argument of either `String` or `FixedString` types.
Check that `decrypt` function accepts `key` parameter as the second argument of either `String` or `FixedString` types.
def key_parameter_types(self): """Check that `decrypt` function accepts `key` parameter as the second argument of either `String` or `FixedString` types. """ iv = "'0123456789123456'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("key is specified using String type"): ...
[ "def", "key_parameter_types", "(", "self", ")", ":", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"key is specified using String type\"", ")", ":", "decrypt", "(", "ciphertext", "="...
[ 325, 0 ]
[ 343, 151 ]
python
en
['en', 'en', 'en']
True
mode_parameter_types
(self)
Check that `decrypt` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types.
Check that `decrypt` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types.
def mode_parameter_types(self): """Check that `decrypt` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types. """ mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("mode is specified using String type"): decrypt(ciphertext="unhex('4...
[ "def", "mode_parameter_types", "(", "self", ")", ":", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"mode is specified using String type\"", ")", ":", "decrypt", "(", "ciphertext", "=", "\"unhex('49C9ADB81BA9B58C485E7ADB90E...
[ 349, 0 ]
[ 360, 138 ]
python
en
['en', 'en', 'en']
True
return_value
(self)
Check that `decrypt` functions returns String data type.
Check that `decrypt` functions returns String data type.
def return_value(self): """Check that `decrypt` functions returns String data type. """ ciphertext = "unhex('F024F9372FA0D8B974894D29FFB8A7F7')" iv = "'0123456789123456'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("I get type of the return value"): sql = "SELECT toT...
[ "def", "return_value", "(", "self", ")", ":", "ciphertext", "=", "\"unhex('F024F9372FA0D8B974894D29FFB8A7F7')\"", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"I get type of the return va...
[ 366, 0 ]
[ 382, 88 ]
python
en
['en', 'en', 'en']
True
syntax
(self)
Check that `decrypt` function supports syntax ```sql decrypt(ciphertext, key, mode, [iv, aad]) ```
Check that `decrypt` function supports syntax
def syntax(self): """Check that `decrypt` function supports syntax ```sql decrypt(ciphertext, key, mode, [iv, aad]) ``` """ ciphertext = "19A1183335B374C626B242A6F6E8712E2B64DCDC6A468B2F654614" sql = f"SELECT decrypt('aes-128-gcm', unhex('{ciphertext}'), '0123456789123456', '012345678912', ...
[ "def", "syntax", "(", "self", ")", ":", "ciphertext", "=", "\"19A1183335B374C626B242A6F6E8712E2B64DCDC6A468B2F654614\"", "sql", "=", "f\"SELECT decrypt('aes-128-gcm', unhex('{ciphertext}'), '0123456789123456', '012345678912', 'AAD')\"", "self", ".", "context", ".", "node", ".", "...
[ 388, 0 ]
[ 397, 66 ]
python
en
['en', 'en', 'en']
True
decryption
(self)
Check that `decrypt` functions accepts `ciphertext` as the second parameter and `mode` as the first parameter and we can convert the decrypted value into the original value with the original data type.
Check that `decrypt` functions accepts `ciphertext` as the second parameter and `mode` as the first parameter and we can convert the decrypted value into the original value with the original data type.
def decryption(self): """Check that `decrypt` functions accepts `ciphertext` as the second parameter and `mode` as the first parameter and we can convert the decrypted value into the original value with the original data type. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad...
[ "def", "decryption", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", ":", "snapshot_module", "=", "SourceFileLoader", "(", "\"snapshot\"...
[ 406, 0 ]
[ 441, 77 ]
python
en
['en', 'en', 'en']
True
mismatched_key
(self)
Check that `decrypt` function returns garbage or an error when key parameter does not match.
Check that `decrypt` function returns garbage or an error when key parameter does not match.
def mismatched_key(self): """Check that `decrypt` function returns garbage or an error when key parameter does not match. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" datatype = "String" plaintext = "'1'" with Given("I load encrypt snapshots"): snapshot_mod...
[ "def", "mismatched_key", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "datatype", "=", "\"String\"", "plaintext", "=", "\"'1'\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", "...
[ 447, 0 ]
[ 476, 90 ]
python
en
['en', 'en', 'en']
True
mismatched_iv
(self)
Check that `decrypt` function returns garbage or an error when iv parameter does not match.
Check that `decrypt` function returns garbage or an error when iv parameter does not match.
def mismatched_iv(self): """Check that `decrypt` function returns garbage or an error when iv parameter does not match. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" datatype = "String" plaintext = "'1'" with Given("I load encrypt snapshots"): snapshot_modul...
[ "def", "mismatched_iv", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "datatype", "=", "\"String\"", "plaintext", "=", "\"'1'\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", ":...
[ 482, 0 ]
[ 512, 90 ]
python
en
['en', 'en', 'en']
True
mismatched_aad
(self)
Check that `decrypt` function returns garbage or an error when aad parameter does not match.
Check that `decrypt` function returns garbage or an error when aad parameter does not match.
def mismatched_aad(self): """Check that `decrypt` function returns garbage or an error when aad parameter does not match. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" datatype = "String" plaintext = "'1'" with Given("I load encrypt snapshots"): snapshot_mod...
[ "def", "mismatched_aad", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "datatype", "=", "\"String\"", "plaintext", "=", "\"'1'\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", "...
[ 518, 0 ]
[ 548, 90 ]
python
en
['en', 'en', 'en']
True
mismatched_mode
(self)
Check that `decrypt` function returns garbage or an error when mode parameter does not match.
Check that `decrypt` function returns garbage or an error when mode parameter does not match.
def mismatched_mode(self): """Check that `decrypt` function returns garbage or an error when mode parameter does not match. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" plaintext = hex('Gãńdåłf_Thê_Gręât'.encode("utf-8")) with Given("I load encrypt snapshots"): ...
[ "def", "mismatched_mode", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "plaintext", "=", "hex", "(", "'Gãńdåłf_Thê_Gręât'.encode", "(", "\"utf-8", "\"", "))", "", "", "with", "Given", "(...
[ 554, 0 ]
[ 588, 49 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the behavior of the `decrypt` function.
Check the behavior of the `decrypt` function.
def feature(self, node="clickhouse1"): """Check the behavior of the `decrypt` function. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): Scenario(run=scenario, flags=TE)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 595, 0 ]
[ 601, 40 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check alter quota query syntax. ```sql ALTER QUOTA [IF EXISTS] name [ON CLUSTER cluster_name] [RENAME TO new_name] [KEYED BY {'none' | 'user name' | 'ip address' | 'client key' | 'client key or user name' | 'client key or ip address'}] [FOR [RANDOMIZED] INTERVAL number {SECOND | MINUTE | HOUR | DAY...
Check alter quota query syntax.
def feature(self, node="clickhouse1"): """Check alter quota query syntax. ```sql ALTER QUOTA [IF EXISTS] name [ON CLUSTER cluster_name] [RENAME TO new_name] [KEYED BY {'none' | 'user name' | 'ip address' | 'client key' | 'client key or user name' | 'client key or ip address'}] [FOR [RANDOMIZED]...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "def", "cleanup_quota", "(", "quota", ")", ":", "with", "Given", "(", "f\"I ensure that quot...
[ 10, 0 ]
[ 205, 52 ]
python
en
['es', 'en', 'it']
False
encrypt_using_materialized_view
(self)
Check that we can use `encrypt` function when inserting data into a table using a materialized view for input data transformation.
Check that we can use `encrypt` function when inserting data into a table using a materialized view for input data transformation.
def encrypt_using_materialized_view(self): """Check that we can use `encrypt` function when inserting data into a table using a materialized view for input data transformation. """ node = self.context.node key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" for mode, key_...
[ "def", "encrypt_using_materialized_view", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "for", "mode", ",", "key_len", ",", "iv_len", ","...
[ 73, 0 ]
[ 108, 145 ]
python
en
['en', 'en', 'en']
True
aes_encrypt_mysql_using_materialized_view
(self)
Check that we can use `aes_encrypt_mysql` function when inserting data into a table using a materialized view for input data transformation.
Check that we can use `aes_encrypt_mysql` function when inserting data into a table using a materialized view for input data transformation.
def aes_encrypt_mysql_using_materialized_view(self): """Check that we can use `aes_encrypt_mysql` function when inserting data into a table using a materialized view for input data transformation. """ node = self.context.node key = f"{'1' * 64}" iv = f"{'2' * 64}" aad = "some random aad"...
[ "def", "aes_encrypt_mysql_using_materialized_view", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "aad", "=", "\"some random aad\"", "for", "mode", ",", "key_len", ",", "iv_l...
[ 111, 0 ]
[ 145, 155 ]
python
en
['en', 'en', 'en']
True
encrypt_using_input_table_function
(self)
Check that we can use `encrypt` function when inserting data into a table using insert select and `input()` table function.
Check that we can use `encrypt` function when inserting data into a table using insert select and `input()` table function.
def encrypt_using_input_table_function(self): """Check that we can use `encrypt` function when inserting data into a table using insert select and `input()` table function. """ node = self.context.node key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" for mode, key_len,...
[ "def", "encrypt_using_input_table_function", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "for", "mode", ",", "key_len", ",", "iv_len", ...
[ 148, 0 ]
[ 183, 147 ]
python
en
['en', 'en', 'en']
True
aes_encrypt_mysql_using_input_table_function
(self)
Check that we can use `aes_encrypt_mysql` function when inserting data into a table using insert select and `input()` table function.
Check that we can use `aes_encrypt_mysql` function when inserting data into a table using insert select and `input()` table function.
def aes_encrypt_mysql_using_input_table_function(self): """Check that we can use `aes_encrypt_mysql` function when inserting data into a table using insert select and `input()` table function. """ node = self.context.node key = f"{'1' * 64}" iv = f"{'2' * 64}" aad = "some random aad" ...
[ "def", "aes_encrypt_mysql_using_input_table_function", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "aad", "=", "\"some random aad\"", "for", "mode", ",", "key_len", ",", "i...
[ 186, 0 ]
[ 220, 157 ]
python
en
['en', 'en', 'en']
True
decrypt_using_materialized_view
(self)
Check that we can use `decrypt` function when inserting data into a table using a materialized view for input data transformation.
Check that we can use `decrypt` function when inserting data into a table using a materialized view for input data transformation.
def decrypt_using_materialized_view(self): """Check that we can use `decrypt` function when inserting data into a table using a materialized view for input data transformation. """ node = self.context.node key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" with Given("I ...
[ "def", "decrypt_using_materialized_view", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ...
[ 223, 0 ]
[ 266, 60 ]
python
en
['en', 'en', 'en']
True
aes_decrypt_mysql_using_materialized_view
(self)
Check that we can use `aes_decrypt_mysql` function when inserting data into a table using a materialized view for input data transformation.
Check that we can use `aes_decrypt_mysql` function when inserting data into a table using a materialized view for input data transformation.
def aes_decrypt_mysql_using_materialized_view(self): """Check that we can use `aes_decrypt_mysql` function when inserting data into a table using a materialized view for input data transformation. """ node = self.context.node key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad"...
[ "def", "aes_decrypt_mysql_using_materialized_view", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "with", "Given", "(", "\"I load encrypt snaps...
[ 269, 0 ]
[ 312, 60 ]
python
en
['en', 'en', 'en']
True
decrypt_using_input_table_function
(self)
Check that we can use `decrypt` function when inserting data into a table using insert select and `input()` table function.
Check that we can use `decrypt` function when inserting data into a table using insert select and `input()` table function.
def decrypt_using_input_table_function(self): """Check that we can use `decrypt` function when inserting data into a table using insert select and `input()` table function. """ node = self.context.node key = f"{'1' * 36}" iv = f"{'2' * 16}" aad = "some random aad" with Given("I load...
[ "def", "decrypt_using_input_table_function", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "aad", "=", "\"some random aad\"", "with", "Given", "(", "\"I load encrypt snapshots\""...
[ 315, 0 ]
[ 358, 56 ]
python
en
['en', 'en', 'en']
True
aes_decrypt_mysql_using_input_table_function
(self)
Check that we can use `aes_decrypt_mysql` function when inserting data into a table using insert select and `input()` table function.
Check that we can use `aes_decrypt_mysql` function when inserting data into a table using insert select and `input()` table function.
def aes_decrypt_mysql_using_input_table_function(self): """Check that we can use `aes_decrypt_mysql` function when inserting data into a table using insert select and `input()` table function. """ node = self.context.node key = f"{'1' * 64}" iv = f"{'2' * 64}" aad = "some random aad" ...
[ "def", "aes_decrypt_mysql_using_input_table_function", "(", "self", ")", ":", "node", "=", "self", ".", "context", ".", "node", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "aad", "=", "\"some random aad\"", "with", "Given", "(", "\"I load encrypt sn...
[ 361, 0 ]
[ 403, 56 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check encryption functions when used during data insertion into a table.
Check encryption functions when used during data insertion into a table.
def feature(self, node="clickhouse1"): """Check encryption functions when used during data insertion into a table. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): Scenario(run=scenario, flags=TE)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 407, 0 ]
[ 413, 40 ]
python
en
['en', 'en', 'en']
True
PostgreSQLClient.database
(self, name=None)
Connect to a database called `name`. Parameters ---------- name : str, optional The name of the database to connect to. If ``None``, return the database named ``self.current_database``. Returns ------- db : PostgreSQLDatabase An :clas...
Connect to a database called `name`.
def database(self, name=None): """Connect to a database called `name`. Parameters ---------- name : str, optional The name of the database to connect to. If ``None``, return the database named ``self.current_database``. Returns ------- db...
[ "def", "database", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "==", "self", ".", "current_database", "or", "(", "name", "is", "None", "and", "name", "!=", "self", ".", "current_database", ")", ":", "return", "self", ".", "database_c...
[ 76, 4 ]
[ 109, 56 ]
python
en
['en', 'en', 'en']
True
PostgreSQLClient.schema
(self, name)
Get a schema object from the current database for the schema named `name`. Parameters ---------- name : str Returns ------- schema : PostgreSQLSchema An :class:`ibis.sql.postgres.client.PostgreSQLSchema` instance.
Get a schema object from the current database for the schema named `name`.
def schema(self, name): """Get a schema object from the current database for the schema named `name`. Parameters ---------- name : str Returns ------- schema : PostgreSQLSchema An :class:`ibis.sql.postgres.client.PostgreSQLSchema` instance. ...
[ "def", "schema", "(", "self", ",", "name", ")", ":", "return", "self", ".", "database", "(", ")", ".", "schema", "(", "name", ")" ]
[ 111, 4 ]
[ 124, 43 ]
python
en
['en', 'en', 'en']
True
PostgreSQLClient.current_database
(self)
The name of the current database this client is connected to.
The name of the current database this client is connected to.
def current_database(self): """The name of the current database this client is connected to.""" return self.database_name
[ "def", "current_database", "(", "self", ")", ":", "return", "self", ".", "database_name" ]
[ 127, 4 ]
[ 129, 33 ]
python
en
['en', 'en', 'en']
True
PostgreSQLClient.list_schemas
(self)
List all the schemas in the current database.
List all the schemas in the current database.
def list_schemas(self): """List all the schemas in the current database.""" return self.inspector.get_schema_names()
[ "def", "list_schemas", "(", "self", ")", ":", "return", "self", ".", "inspector", ".", "get_schema_names", "(", ")" ]
[ 139, 4 ]
[ 141, 48 ]
python
en
['en', 'en', 'en']
True
PostgreSQLClient.table
(self, name, database=None, schema=None)
Create a table expression that references a particular a table called `name` in a PostgreSQL database called `database`. Parameters ---------- name : str The name of the table to retrieve. database : str, optional The database in which the table referred ...
Create a table expression that references a particular a table called `name` in a PostgreSQL database called `database`.
def table(self, name, database=None, schema=None): """Create a table expression that references a particular a table called `name` in a PostgreSQL database called `database`. Parameters ---------- name : str The name of the table to retrieve. database : str, ...
[ "def", "table", "(", "self", ",", "name", ",", "database", "=", "None", ",", "schema", "=", "None", ")", ":", "if", "database", "is", "not", "None", "and", "database", "!=", "self", ".", "current_database", ":", "return", "(", "self", ".", "database", ...
[ 153, 4 ]
[ 181, 46 ]
python
en
['en', 'en', 'en']
True
comp_int_inline
(self, func, int_type, min, max, node=None)
Check comparison functions with Int128, UInt128, Int256, and UInt256 using inline tests.
Check comparison functions with Int128, UInt128, Int256, and UInt256 using inline tests.
def comp_int_inline(self, func, int_type, min, max, node=None): """Check comparison functions with Int128, UInt128, Int256, and UInt256 using inline tests. """ if node is None: node = self.context.node with When(f"I check {func} with {int_type}"): execute_query(f""" SELECT ...
[ "def", "comp_int_inline", "(", "self", ",", "func", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "When", "(", "f\"I check {func...
[ 17, 0 ]
[ 27, 16 ]
python
en
['en', 'en', 'en']
True
comp_int_table
(self, func, int_type, min, max, node=None)
Check comparison functions with Int128, UInt128, Int256, and UInt256 using table tests.
Check comparison functions with Int128, UInt128, Int256, and UInt256 using table tests.
def comp_int_table(self, func, int_type, min, max, node=None): """Check comparison functions with Int128, UInt128, Int256, and UInt256 using table tests. """ if node is None: node = self.context.node table_name = f'table_{getuid()}' with Given(f"I have a table"): table(name = tabl...
[ "def", "comp_int_table", "(", "self", ",", "func", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "table_name", "=", "f'table_{getuid()}'",...
[ 31, 0 ]
[ 51, 16 ]
python
en
['en', 'en', 'en']
True
comp_dec_inline
(self, func, node=None)
Check comparison functions with Decimal256 using inline tests.
Check comparison functions with Decimal256 using inline tests.
def comp_dec_inline(self, func, node=None): """Check comparison functions with Decimal256 using inline tests. """ min = Decimal256_min_max[0] max = Decimal256_min_max[1] if node is None: node = self.context.node with When(f"I check {func} with Decimal256"): execute_query(f""" ...
[ "def", "comp_dec_inline", "(", "self", ",", "func", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "if", "node", "is", "None", ":", "node", "=", "self", ".", "cont...
[ 55, 0 ]
[ 67, 16 ]
python
en
['en', 'en', 'en']
True
comp_dec_table
(self, func, node=None)
Check comparison functions with Decimal256 using table tests.
Check comparison functions with Decimal256 using table tests.
def comp_dec_table(self, func, node=None): """Check comparison functions with Decimal256 using table tests. """ min = Decimal256_min_max[0] max = Decimal256_min_max[1] if node is None: node = self.context.node table_name = f'table_{getuid()}' with Given(f"I have a table"): ...
[ "def", "comp_dec_table", "(", "self", ",", "func", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "if", "node", "is", "None", ":", "node", "=", "self", ".", "conte...
[ 71, 0 ]
[ 93, 16 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None)
Check that comparison functions work with extended precision data types.
Check that comparison functions work with extended precision data types.
def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None): """Check that comparison functions work with extended precision data types. """ self.context.node = self.context.cluster.node(node) self.context.mysql_node = self.context.cluster.node(mysql_node) with allow_expe...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "mysql_node", "=", "\"mysql1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluste...
[ 100, 0 ]
[ 110, 36 ]
python
en
['en', 'en', 'en']
True
repository
(urls = urls, log = EmptyLogger())
Downloads and parse mingw-build repository files and parses them
Downloads and parse mingw-build repository files and parses them
def repository(urls = urls, log = EmptyLogger()): ''' Downloads and parse mingw-build repository files and parses them ''' log.info('getting mingw-builds repository') versions = {} re_sourceforge = re.compile(r'http://sourceforge.net/projects/([^/]+)/files') re_sub = r'http://downloads.sourc...
[ "def", "repository", "(", "urls", "=", "urls", ",", "log", "=", "EmptyLogger", "(", ")", ")", ":", "log", ".", "info", "(", "'getting mingw-builds repository'", ")", "versions", "=", "{", "}", "re_sourceforge", "=", "re", ".", "compile", "(", "r'http://sou...
[ 54, 0 ]
[ 83, 19 ]
python
en
['en', 'error', 'th']
False
find_in_path
(file, path=None)
Attempts to find an executable in the path
Attempts to find an executable in the path
def find_in_path(file, path=None): ''' Attempts to find an executable in the path ''' if platform.system() == 'Windows': file += '.exe' if path is None: path = os.environ.get('PATH', '') if type(path) is type(''): path = path.split(os.pathsep) return list(filter(os.pa...
[ "def", "find_in_path", "(", "file", ",", "path", "=", "None", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Windows'", ":", "file", "+=", "'.exe'", "if", "path", "is", "None", ":", "path", "=", "os", ".", "environ", ".", "get", "(", ...
[ 85, 0 ]
[ 96, 67 ]
python
en
['en', 'error', 'th']
False
find_7zip
(log = EmptyLogger())
Attempts to find 7zip for unpacking the mingw-build archives
Attempts to find 7zip for unpacking the mingw-build archives
def find_7zip(log = EmptyLogger()): ''' Attempts to find 7zip for unpacking the mingw-build archives ''' log.info('finding 7zip') path = find_in_path('7z') if not path: key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\7-Zip') path, _ = winreg.QueryValueEx(key, 'Path') ...
[ "def", "find_7zip", "(", "log", "=", "EmptyLogger", "(", ")", ")", ":", "log", ".", "info", "(", "'finding 7zip'", ")", "path", "=", "find_in_path", "(", "'7z'", ")", "if", "not", "path", ":", "key", "=", "winreg", ".", "OpenKey", "(", "winreg", ".",...
[ 98, 0 ]
[ 109, 18 ]
python
en
['en', 'error', 'th']
False