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
TestMetricConfig.test_set_port_valid
(self, connect, collection)
target: set port method: call set_config correctly expected: status ok, set successfully
target: set port method: call set_config correctly expected: status ok, set successfully
def test_set_port_valid(self, connect, collection): ''' target: set port method: call set_config correctly expected: status ok, set successfully ''' for valid_port in [1025, 65534, "19530", "9091"]: status, reply = connect.set_config("metric", "port", valid_po...
[ "def", "test_set_port_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "for", "valid_port", "in", "[", "1025", ",", "65534", ",", "\"19530\"", ",", "\"9091\"", "]", ":", "status", ",", "reply", "=", "connect", ".", "set_config", "(", "\"...
[ 1280, 4 ]
[ 1291, 50 ]
python
en
['en', 'error', 'th']
False
TestMetricConfig.test_set_port_invalid
(self, connect, collection)
target: set port method: call set_config with port number out of range(1024, 65535), or same as http.port number expected: status not ok
target: set port method: call set_config with port number out of range(1024, 65535), or same as http.port number expected: status not ok
def test_set_port_invalid(self, connect, collection): ''' target: set port method: call set_config with port number out of range(1024, 65535), or same as http.port number expected: status not ok ''' for invalid_port in [1024, 65535, "0", "True", "19530 ", "100000"]: ...
[ "def", "test_set_port_invalid", "(", "self", ",", "connect", ",", "collection", ")", ":", "for", "invalid_port", "in", "[", "1024", ",", "65535", ",", "\"0\"", ",", "\"True\"", ",", "\"19530 \"", ",", "\"100000\"", "]", ":", "status", ",", "reply", "=", ...
[ 1293, 4 ]
[ 1301, 34 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_enable_invalid_child_key
(self, connect, collection)
target: get invalid child key method: call get_config without child_key: enable expected: status not ok
target: get invalid child key method: call get_config without child_key: enable expected: status not ok
def test_get_enable_invalid_child_key(self, connect, collection): ''' target: get invalid child key method: call get_config without child_key: enable expected: status not ok ''' invalid_configs = ["enabled", "Enable", "enable "] for config in invalid_configs: ...
[ "def", "test_get_enable_invalid_child_key", "(", "self", ",", "connect", ",", "collection", ")", ":", "invalid_configs", "=", "[", "\"enabled\"", ",", "\"Enable\"", ",", "\"enable \"", "]", "for", "config", "in", "invalid_configs", ":", "status", ",", "config_valu...
[ 1379, 4 ]
[ 1388, 34 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_enable_valid
(self, connect, collection)
target: get enable method: call get_config correctly expected: status ok
target: get enable method: call get_config correctly expected: status ok
def test_get_enable_valid(self, connect, collection): ''' target: get enable method: call get_config correctly expected: status ok ''' status, config_value = connect.get_config("wal", "enable") assert status.OK()
[ "def", "test_get_enable_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "status", ",", "config_value", "=", "connect", ".", "get_config", "(", "\"wal\"", ",", "\"enable\"", ")", "assert", "status", ".", "OK", "(", ")" ]
[ 1391, 4 ]
[ 1398, 26 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_recovery_error_ignore_invalid_child_key
(self, connect, collection)
target: get invalid child key method: call get_config without child_key: recovery_error_ignore expected: status not ok
target: get invalid child key method: call get_config without child_key: recovery_error_ignore expected: status not ok
def test_get_recovery_error_ignore_invalid_child_key(self, connect, collection): ''' target: get invalid child key method: call get_config without child_key: recovery_error_ignore expected: status not ok ''' invalid_configs = ["recovery-error-ignore", "Recovery_error_igno...
[ "def", "test_get_recovery_error_ignore_invalid_child_key", "(", "self", ",", "connect", ",", "collection", ")", ":", "invalid_configs", "=", "[", "\"recovery-error-ignore\"", ",", "\"Recovery_error_ignore\"", ",", "\"recovery_error_ignore \"", "]", "for", "config", "in", ...
[ 1401, 4 ]
[ 1410, 34 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_recovery_error_ignore_valid
(self, connect, collection)
target: get recovery_error_ignore method: call get_config correctly expected: status ok
target: get recovery_error_ignore method: call get_config correctly expected: status ok
def test_get_recovery_error_ignore_valid(self, connect, collection): ''' target: get recovery_error_ignore method: call get_config correctly expected: status ok ''' status, config_value = connect.get_config("wal", "recovery_error_ignore") assert status.OK()
[ "def", "test_get_recovery_error_ignore_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "status", ",", "config_value", "=", "connect", ".", "get_config", "(", "\"wal\"", ",", "\"recovery_error_ignore\"", ")", "assert", "status", ".", "OK", "(", ...
[ 1413, 4 ]
[ 1420, 26 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_buffer_size_invalid_child_key
(self, connect, collection)
target: get invalid child key method: call get_config without child_key: buffer_size expected: status not ok
target: get invalid child key method: call get_config without child_key: buffer_size expected: status not ok
def test_get_buffer_size_invalid_child_key(self, connect, collection): ''' target: get invalid child key method: call get_config without child_key: buffer_size expected: status not ok ''' invalid_configs = ["buffersize", "Buffer_size", "buffer_size "] for config i...
[ "def", "test_get_buffer_size_invalid_child_key", "(", "self", ",", "connect", ",", "collection", ")", ":", "invalid_configs", "=", "[", "\"buffersize\"", ",", "\"Buffer_size\"", ",", "\"buffer_size \"", "]", "for", "config", "in", "invalid_configs", ":", "status", "...
[ 1423, 4 ]
[ 1432, 34 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_buffer_size_valid
(self, connect, collection)
target: get buffer_size method: call get_config correctly expected: status ok
target: get buffer_size method: call get_config correctly expected: status ok
def test_get_buffer_size_valid(self, connect, collection): ''' target: get buffer_size method: call get_config correctly expected: status ok ''' status, config_value = connect.get_config("wal", "buffer_size") assert status.OK()
[ "def", "test_get_buffer_size_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "status", ",", "config_value", "=", "connect", ".", "get_config", "(", "\"wal\"", ",", "\"buffer_size\"", ")", "assert", "status", ".", "OK", "(", ")" ]
[ 1435, 4 ]
[ 1442, 26 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_wal_path_invalid_child_key
(self, connect, collection)
target: get invalid child key method: call get_config without child_key: wal_path expected: status not ok
target: get invalid child key method: call get_config without child_key: wal_path expected: status not ok
def test_get_wal_path_invalid_child_key(self, connect, collection): ''' target: get invalid child key method: call get_config without child_key: wal_path expected: status not ok ''' invalid_configs = ["wal", "Wal_path", "wal_path "] for config in invalid_configs: ...
[ "def", "test_get_wal_path_invalid_child_key", "(", "self", ",", "connect", ",", "collection", ")", ":", "invalid_configs", "=", "[", "\"wal\"", ",", "\"Wal_path\"", ",", "\"wal_path \"", "]", "for", "config", "in", "invalid_configs", ":", "status", ",", "config_va...
[ 1445, 4 ]
[ 1454, 34 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_get_wal_path_valid
(self, connect, collection)
target: get wal_path method: call get_config correctly expected: status ok
target: get wal_path method: call get_config correctly expected: status ok
def test_get_wal_path_valid(self, connect, collection): ''' target: get wal_path method: call get_config correctly expected: status ok ''' status, config_value = connect.get_config("wal", "path") assert status.OK()
[ "def", "test_get_wal_path_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "status", ",", "config_value", "=", "connect", ".", "get_config", "(", "\"wal\"", ",", "\"path\"", ")", "assert", "status", ".", "OK", "(", ")" ]
[ 1457, 4 ]
[ 1464, 26 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_set_wal_invalid_child_key
(self, connect, collection)
target: set invalid child key method: call set_config with invalid child_key expected: status not ok
target: set invalid child key method: call set_config with invalid child_key expected: status not ok
def test_set_wal_invalid_child_key(self, connect, collection): ''' target: set invalid child key method: call set_config with invalid child_key expected: status not ok ''' status, reply = connect.set_config("wal", "child_key", 256) assert not status.OK()
[ "def", "test_set_wal_invalid_child_key", "(", "self", ",", "connect", ",", "collection", ")", ":", "status", ",", "reply", "=", "connect", ".", "set_config", "(", "\"wal\"", ",", "\"child_key\"", ",", "256", ")", "assert", "not", "status", ".", "OK", "(", ...
[ 1473, 4 ]
[ 1480, 30 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_set_enable_valid
(self, connect, collection)
target: set enable method: call set_config correctly expected: status ok, set successfully
target: set enable method: call set_config correctly expected: status ok, set successfully
def test_set_enable_valid(self, connect, collection): ''' target: set enable method: call set_config correctly expected: status ok, set successfully ''' for valid_enable in ["Off", "false", 0, "no", "On", "true", "1", "YES"]: status, reply = connect.set_config...
[ "def", "test_set_enable_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "for", "valid_enable", "in", "[", "\"Off\"", ",", "\"false\"", ",", "0", ",", "\"no\"", ",", "\"On\"", ",", "\"true\"", ",", "\"1\"", ",", "\"YES\"", "]", ":", "sta...
[ 1482, 4 ]
[ 1493, 52 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_set_recovery_error_ignore_valid
(self, connect, collection)
target: set recovery_error_ignore method: call set_config correctly expected: status ok, set successfully
target: set recovery_error_ignore method: call set_config correctly expected: status ok, set successfully
def test_set_recovery_error_ignore_valid(self, connect, collection): ''' target: set recovery_error_ignore method: call set_config correctly expected: status ok, set successfully ''' for valid_recovery_error_ignore in ["Off", "false", "0", "no", "On", "true", "1", "YES"]:...
[ "def", "test_set_recovery_error_ignore_valid", "(", "self", ",", "connect", ",", "collection", ")", ":", "for", "valid_recovery_error_ignore", "in", "[", "\"Off\"", ",", "\"false\"", ",", "\"0\"", ",", "\"no\"", ",", "\"On\"", ",", "\"true\"", ",", "\"1\"", ",",...
[ 1495, 4 ]
[ 1506, 62 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_set_buffer_size_valid_A
(self, connect, collection)
target: set buffer_size method: call set_config correctly expected: status ok, set successfully
target: set buffer_size method: call set_config correctly expected: status ok, set successfully
def test_set_buffer_size_valid_A(self, connect, collection): ''' target: set buffer_size method: call set_config correctly expected: status ok, set successfully ''' for valid_buffer_size in ["64MB", "128MB", "4096MB", "1000MB", "256MB"]: status, reply = connec...
[ "def", "test_set_buffer_size_valid_A", "(", "self", ",", "connect", ",", "collection", ")", ":", "for", "valid_buffer_size", "in", "[", "\"64MB\"", ",", "\"128MB\"", ",", "\"4096MB\"", ",", "\"1000MB\"", ",", "\"256MB\"", "]", ":", "status", ",", "reply", "=",...
[ 1508, 4 ]
[ 1519, 57 ]
python
en
['en', 'error', 'th']
False
TestWALConfig.test_set_wal_path_valid
(self, connect, collection, args)
target: set wal_path method: call set_config correctly expected: status ok, set successfully
target: set wal_path method: call set_config correctly expected: status ok, set successfully
def test_set_wal_path_valid(self, connect, collection, args): ''' target: set wal_path method: call set_config correctly expected: status ok, set successfully ''' status, reply = connect.set_config("wal", "path", "/var/lib/milvus/wal") assert status.OK() s...
[ "def", "test_set_wal_path_valid", "(", "self", ",", "connect", ",", "collection", ",", "args", ")", ":", "status", ",", "reply", "=", "connect", ".", "set_config", "(", "\"wal\"", ",", "\"path\"", ",", "\"/var/lib/milvus/wal\"", ")", "assert", "status", ".", ...
[ 1522, 4 ]
[ 1532, 52 ]
python
en
['en', 'error', 'th']
False
feature
(self, node="clickhouse1")
Check drop settings profile query syntax. ```sql DROP [SETTINGS] PROFILE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ```
Check drop settings profile query syntax.
def feature(self, node="clickhouse1"): """Check drop settings profile query syntax. ```sql DROP [SETTINGS] PROFILE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ``` """ node = self.context.cluster.node(node) @contextmanager def cleanup(profile): try: with Given(...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "@", "contextmanager", "def", "cleanup", "(", "profile", ")", ":", "try", ":", "with", "...
[ 9, 0 ]
[ 92, 116 ]
python
en
['fr', 'en', 'en']
True
aes_decrypt_mysql
(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 `aes_decrypt_mysql` function with the specified parameters.
Execute `aes_decrypt_mysql` function with the specified parameters.
def aes_decrypt_mysql(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 `aes_decrypt_mysql` function with the specified parameters. """ params = [] if mode is not None: p...
[ "def", "aes_decrypt_mysql", "(", "self", ",", "ciphertext", "=", "None", ",", "key", "=", "None", ",", "mode", "=", "None", ",", "iv", "=", "None", ",", "aad", "=", "None", ",", "exitcode", "=", "0", ",", "message", "=", "None", ",", "step", "=", ...
[ 13, 0 ]
[ 36, 112 ]
python
en
['en', 'en', 'en']
True
invalid_ciphertext
(self)
Check that `aes_decrypt_mysql` function does not crash when invalid `ciphertext` is passed as the first parameter.
Check that `aes_decrypt_mysql` function does not crash when invalid `ciphertext` is passed as the first parameter.
def invalid_ciphertext(self): """Check that `aes_decrypt_mysql` function does not crash when invalid `ciphertext` is passed as the first parameter. """ key = f"{'1' * 36}" iv = f"{'2' * 16}" invalid_ciphertexts = plaintexts for mode, key_len, iv_len in mysql_modes: with Example(f"""...
[ "def", "invalid_ciphertext", "(", "self", ")", ":", "key", "=", "f\"{'1' * 36}\"", "iv", "=", "f\"{'2' * 16}\"", "invalid_ciphertexts", "=", "plaintexts", "for", "mode", ",", "key_len", ",", "iv_len", "in", "mysql_modes", ":", "with", "Example", "(", "f\"\"\"mod...
[ 42, 0 ]
[ 66, 63 ]
python
en
['en', 'en', 'en']
True
unsupported_modes
(self, mode)
Check that `aes_decrypt_mysql` function returns an error when unsupported modes are specified.
Check that `aes_decrypt_mysql` function returns an error when unsupported modes are specified.
def unsupported_modes(self, mode): """Check that `aes_decrypt_mysql` function returns an error when unsupported modes are specified. """ ciphertext = "unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')" aes_decrypt_mysql(ciphertext=ciphertext, mode=mode, key=f"'{'1'* 32}'", exitcode=36, me...
[ "def", "unsupported_modes", "(", "self", ",", "mode", ")", ":", "ciphertext", "=", "\"unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')\"", "aes_decrypt_mysql", "(", "ciphertext", "=", "ciphertext", ",", "mode", "=", "mode", ",", "key", "=", "f\"'{'1'* 32}...
[ 81, 0 ]
[ 86, 138 ]
python
en
['en', 'en', 'en']
True
invalid_parameters
(self)
Check that `aes_decrypt_mysql` function returns an error when we call it with invalid parameters.
Check that `aes_decrypt_mysql` function returns an error when we call it with invalid parameters.
def invalid_parameters(self): """Check that `aes_decrypt_mysql` function returns an error when we call it with invalid parameters. """ ciphertext = "unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')" with Example("no parameters"): aes_decrypt_mysql(exitcode=42, message="DB::Ex...
[ "def", "invalid_parameters", "(", "self", ")", ":", "ciphertext", "=", "\"unhex('AA1826B5F66A903C888D5DCDA9FB63D1D9CCA10EC55F59D6C00D37')\"", "with", "Example", "(", "\"no parameters\"", ")", ":", "aes_decrypt_mysql", "(", "exitcode", "=", "42", ",", "message", "=", "\"...
[ 92, 0 ]
[ 164, 67 ]
python
en
['en', 'de', 'en']
True
key_or_iv_length_for_mode
(self, mode, key_len, iv_len)
Check that key or iv length for mode.
Check that key or iv length for mode.
def key_or_iv_length_for_mode(self, mode, key_len, iv_len): """Check that key or iv length for mode. """ ciphertext = "unhex('31F4C847CAB873AB34584368E3E85E3A')" if mode == "'aes-128-ecb'": ciphertext = "unhex('31F4C847CAB873AB34584368E3E85E3B')" elif mode == "'aes-192-ecb'": ciphert...
[ "def", "key_or_iv_length_for_mode", "(", "self", ",", "mode", ",", "key_len", ",", "iv_len", ")", ":", "ciphertext", "=", "\"unhex('31F4C847CAB873AB34584368E3E85E3A')\"", "if", "mode", "==", "\"'aes-128-ecb'\"", ":", "ciphertext", "=", "\"unhex('31F4C847CAB873AB34584368E3...
[ 193, 0 ]
[ 229, 107 ]
python
en
['en', 'en', 'en']
True
iv_parameter_types
(self)
Check that `aes_decrypt_mysql` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types.
Check that `aes_decrypt_mysql` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types.
def iv_parameter_types(self): """Check that `aes_decrypt_mysql` 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"): ...
[ "def", "iv_parameter_types", "(", "self", ")", ":", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"iv is specified using String type\"", ")", ":", "aes_decrypt_mysql", "(", "ciphertext...
[ 235, 0 ]
[ 253, 169 ]
python
en
['en', 'en', 'en']
True
key_parameter_types
(self)
Check that `aes_decrypt` function accepts `key` parameter as the second argument of either `String` or `FixedString` types.
Check that `aes_decrypt` function accepts `key` parameter as the second argument of either `String` or `FixedString` types.
def key_parameter_types(self): """Check that `aes_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\"", ")", ":", "aes_decrypt_mysql", "(", "cipherte...
[ 259, 0 ]
[ 277, 161 ]
python
en
['en', 'en', 'en']
True
mode_parameter_types
(self)
Check that `aes_decrypt_mysql` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types.
Check that `aes_decrypt_mysql` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types.
def mode_parameter_types(self): """Check that `aes_decrypt_mysql` 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"): aes_decrypt_mysql(...
[ "def", "mode_parameter_types", "(", "self", ")", ":", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"mode is specified using String type\"", ")", ":", "aes_decrypt_mysql", "(", "ciphertext", "=", "\"unhex('49C9ADB81BA9B58C4...
[ 283, 0 ]
[ 294, 148 ]
python
en
['en', 'en', 'en']
True
return_value
(self)
Check that `aes_decrypt_mysql` functions returns String data type.
Check that `aes_decrypt_mysql` functions returns String data type.
def return_value(self): """Check that `aes_decrypt_mysql` 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 = "...
[ "def", "return_value", "(", "self", ")", ":", "ciphertext", "=", "\"unhex('F024F9372FA0D8B974894D29FFB8A7F7')\"", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"I get type of the return va...
[ 300, 0 ]
[ 316, 98 ]
python
en
['en', 'en', 'en']
True
syntax
(self)
Check that `aes_decrypt_mysql` function supports syntax ```sql aes_decrypt_mysql(ciphertext, key, mode, [iv]) ```
Check that `aes_decrypt_mysql` function supports syntax
def syntax(self): """Check that `aes_decrypt_mysql` function supports syntax ```sql aes_decrypt_mysql(ciphertext, key, mode, [iv]) ``` """ ciphertext = "70FE78410D6EE237C2DE4A" sql = f"SELECT aes_decrypt_mysql('aes-128-ofb', unhex('{ciphertext}'), '0123456789123456', '0123456789123456')" ...
[ "def", "syntax", "(", "self", ")", ":", "ciphertext", "=", "\"70FE78410D6EE237C2DE4A\"", "sql", "=", "f\"SELECT aes_decrypt_mysql('aes-128-ofb', unhex('{ciphertext}'), '0123456789123456', '0123456789123456')\"", "self", ".", "context", ".", "node", ".", "query", "(", "sql", ...
[ 322, 0 ]
[ 331, 66 ]
python
en
['en', 'en', 'en']
True
decryption
(self)
Check that `aes_decrypt_mysql` functions accepts `mode` as the first parameter and `ciphertext` as the second parameter and we can convert the decrypted value into the original value with the original data type.
Check that `aes_decrypt_mysql` functions accepts `mode` as the first parameter and `ciphertext` as the second parameter and we can convert the decrypted value into the original value with the original data type.
def decryption(self): """Check that `aes_decrypt_mysql` functions accepts `mode` as the first parameter and `ciphertext` as the second parameter and we can convert the decrypted value into the original value with the original data type. """ key = f"{'1' * 64}" iv = f"{'2' * 64}" with Given(...
[ "def", "decryption", "(", "self", ")", ":", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", ":", "snapshot_module", "=", "SourceFileLoader", "(", "\"snapshot\"", ",", "os", ".", "path", ".",...
[ 340, 0 ]
[ 373, 77 ]
python
en
['en', 'en', 'en']
True
mismatched_key
(self)
Check that `aes_decrypt_mysql` function returns garbage or an error when key parameter does not match.
Check that `aes_decrypt_mysql` function returns garbage or an error when key parameter does not match.
def mismatched_key(self): """Check that `aes_decrypt_mysql` function returns garbage or an error when key parameter does not match. """ key = f"{'1' * 64}" iv = f"{'2' * 64}" with Given("I load encrypt snapshots"): snapshot_module = SourceFileLoader("snapshot", os.path.join(current_dir(), ...
[ "def", "mismatched_key", "(", "self", ")", ":", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", ":", "snapshot_module", "=", "SourceFileLoader", "(", "\"snapshot\"", ",", "os", ".", "path", ...
[ 379, 0 ]
[ 405, 90 ]
python
en
['en', 'en', 'en']
True
mismatched_iv
(self)
Check that `aes_decrypt_mysql` function returns garbage or an error when iv parameter does not match.
Check that `aes_decrypt_mysql` function returns garbage or an error when iv parameter does not match.
def mismatched_iv(self): """Check that `aes_decrypt_mysql` function returns garbage or an error when iv parameter does not match. """ key = f"{'1' * 64}" iv = f"{'2' * 64}" with Given("I load encrypt snapshots"): snapshot_module = SourceFileLoader("snapshot", os.path.join(current_dir(), ...
[ "def", "mismatched_iv", "(", "self", ")", ":", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "with", "Given", "(", "\"I load encrypt snapshots\"", ")", ":", "snapshot_module", "=", "SourceFileLoader", "(", "\"snapshot\"", ",", "os", ".", "path", "...
[ 411, 0 ]
[ 439, 90 ]
python
en
['en', 'en', 'en']
True
mismatched_mode
(self)
Check that `aes_decrypt_mysql` function returns garbage or an error when mode parameter does not match.
Check that `aes_decrypt_mysql` function returns garbage or an error when mode parameter does not match.
def mismatched_mode(self): """Check that `aes_decrypt_mysql` function returns garbage or an error when mode parameter does not match. """ key = f"{'1' * 64}" iv = f"{'2' * 64}" plaintext = hex('Gãńdåłf_Thê_Gręât'.encode("utf-8")) with Given("I load encrypt snapshots"): snapshot_module =...
[ "def", "mismatched_mode", "(", "self", ")", ":", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "plaintext", "=", "hex", "(", "'Gãńdåłf_Thê_Gręât'.encode", "(", "\"utf-8", "\"", "))", "", "", "with", "Given", "(", "\"I load encrypt snapshots\"", ")...
[ 445, 0 ]
[ 479, 103 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the behavior of the `aes_decrypt_mysql` function.
Check the behavior of the `aes_decrypt_mysql` function.
def feature(self, node="clickhouse1"): """Check the behavior of the `aes_decrypt_mysql` 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", "(",...
[ 486, 0 ]
[ 492, 40 ]
python
en
['en', 'en', 'en']
True
AdminRoute.post
(self, request: Request)
Grant a user administrator privileges.
Grant a user administrator privileges.
async def post(self, request: Request) -> JSONResponse: """Grant a user administrator privileges.""" data = await request.json() admin = AdminModel(**data) if await request.state.db.admins.find_one( {"_id": admin.id} ): return JSONResponse({"error": "alre...
[ "async", "def", "post", "(", "self", ",", "request", ":", "Request", ")", "->", "JSONResponse", ":", "data", "=", "await", "request", ".", "json", "(", ")", "admin", "=", "AdminModel", "(", "*", "*", "data", ")", "if", "await", "request", ".", "state...
[ 29, 4 ]
[ 40, 45 ]
python
en
['ca', 'en', 'en']
True
compile
(expr, params=None)
Compile an ibis expression to the MySQL target. Parameters ---------- expr : ibis.expr.types.Expr The ibis expression to compile params : dict or None ``dict`` mapping :class:`ibis.expr.types.ScalarParameter` objects to values Returns ------- sqlalchemy_expression :...
Compile an ibis expression to the MySQL target.
def compile(expr, params=None): """Compile an ibis expression to the MySQL target. Parameters ---------- expr : ibis.expr.types.Expr The ibis expression to compile params : dict or None ``dict`` mapping :class:`ibis.expr.types.ScalarParameter` objects to values Returns ...
[ "def", "compile", "(", "expr", ",", "params", "=", "None", ")", ":", "return", "to_sqlalchemy", "(", "expr", ",", "dialect", ".", "make_context", "(", "params", "=", "params", ")", ")" ]
[ 6, 0 ]
[ 43, 67 ]
python
en
['en', 'en', 'en']
True
connect
( host='localhost', user=None, password=None, port=3306, database=None, url=None, driver='pymysql' )
Create an Ibis client located at `user`:`password`@`host`:`port` connected to a MySQL database named `database`. Parameters ---------- host : string, default 'localhost' user : string, default None password : string, default None port : string or integer, default 3306 database : string,...
Create an Ibis client located at `user`:`password`@`host`:`port` connected to a MySQL database named `database`.
def connect( host='localhost', user=None, password=None, port=3306, database=None, url=None, driver='pymysql' ): """Create an Ibis client located at `user`:`password`@`host`:`port` connected to a MySQL database named `database`. Parameters ---------- host : string, defa...
[ "def", "connect", "(", "host", "=", "'localhost'", ",", "user", "=", "None", ",", "password", "=", "None", ",", "port", "=", "3306", ",", "database", "=", "None", ",", "url", "=", "None", ",", "driver", "=", "'pymysql'", ")", ":", "return", "MySQLCli...
[ 46, 0 ]
[ 121, 5 ]
python
en
['en', 'en', 'en']
True
scenario
(self, server="openldap1")
Check that LDAP server is up and running by executing ldapsearch, ldapadd, and ldapdelete commands.
Check that LDAP server is up and running by executing ldapsearch, ldapadd, and ldapdelete commands.
def scenario(self, server="openldap1"): """Check that LDAP server is up and running by executing ldapsearch, ldapadd, and ldapdelete commands. """ self.context.ldap_node = self.context.cluster.node(server) with When("I search LDAP database"): r = self.context.ldap_node.command( ...
[ "def", "scenario", "(", "self", ",", "server", "=", "\"openldap1\"", ")", ":", "self", ".", "context", ".", "ldap_node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "server", ")", "with", "When", "(", "\"I search LDAP database\"", ")", ...
[ 7, 0 ]
[ 41, 59 ]
python
en
['en', 'en', 'en']
True
_get_loss_acc
(model, train_loader, valid_loader)
Get losses and validation accuracy of example neural network
Get losses and validation accuracy of example neural network
def _get_loss_acc(model, train_loader, valid_loader): """ Get losses and validation accuracy of example neural network """ n_epochs = 2 learning_rate = 0.001 # Training loss criterion = nn.CrossEntropyLoss() # Optimizer optimizer = optimizer = torch.optim.Adam(model.parameters(...
[ "def", "_get_loss_acc", "(", "model", ",", "train_loader", ",", "valid_loader", ")", ":", "n_epochs", "=", "2", "learning_rate", "=", "0.001", "# Training loss", "criterion", "=", "nn", ".", "CrossEntropyLoss", "(", ")", "# Optimizer", "optimizer", "=", "optimiz...
[ 8, 0 ]
[ 62, 32 ]
python
en
['en', 'error', 'th']
False
compare_init_weights
( model_list, plot_title, train_loader, valid_loader, plot_n_batches=100)
Plot loss and print stats of weights using an example neural network
Plot loss and print stats of weights using an example neural network
def compare_init_weights( model_list, plot_title, train_loader, valid_loader, plot_n_batches=100): """ Plot loss and print stats of weights using an example neural network """ colors = ['r', 'b', 'g', 'c', 'y', 'k'] label_accs = [] label_loss = [] ass...
[ "def", "compare_init_weights", "(", "model_list", ",", "plot_title", ",", "train_loader", ",", "valid_loader", ",", "plot_n_batches", "=", "100", ")", ":", "colors", "=", "[", "'r'", ",", "'b'", ",", "'g'", ",", "'c'", ",", "'y'", ",", "'k'", "]", "label...
[ 65, 0 ]
[ 99, 53 ]
python
en
['en', 'error', 'th']
False
hist_dist
(title, distribution_tensor, hist_range=(-4, 4))
Display histogram of values in a given distribution tensor
Display histogram of values in a given distribution tensor
def hist_dist(title, distribution_tensor, hist_range=(-4, 4)): """ Display histogram of values in a given distribution tensor """ plt.title(title) plt.hist(distribution_tensor, np.linspace(*hist_range, num=len(distribution_tensor)//2)) plt.show()
[ "def", "hist_dist", "(", "title", ",", "distribution_tensor", ",", "hist_range", "=", "(", "-", "4", ",", "4", ")", ")", ":", "plt", ".", "title", "(", "title", ")", "plt", ".", "hist", "(", "distribution_tensor", ",", "np", ".", "linspace", "(", "*"...
[ 102, 0 ]
[ 108, 14 ]
python
en
['en', 'error', 'th']
False
HDFS.chmod
(self, hdfs_path, permissions)
Change permissions of a file of directory Parameters ---------- hdfs_path : string Directory or path permissions : string Octal permissions string
Change permissions of a file of directory
def chmod(self, hdfs_path, permissions): """ Change permissions of a file of directory Parameters ---------- hdfs_path : string Directory or path permissions : string Octal permissions string """ raise NotImplementedError
[ "def", "chmod", "(", "self", ",", "hdfs_path", ",", "permissions", ")", ":", "raise", "NotImplementedError" ]
[ 45, 4 ]
[ 56, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.chown
(self, hdfs_path, owner=None, group=None)
Change owner (and/or group) of a file or directory Parameters ---------- hdfs_path : string Directory or path owner : string, optional Name of owner group : string, optional Name of group
Change owner (and/or group) of a file or directory
def chown(self, hdfs_path, owner=None, group=None): """ Change owner (and/or group) of a file or directory Parameters ---------- hdfs_path : string Directory or path owner : string, optional Name of owner group : string, optional Nam...
[ "def", "chown", "(", "self", ",", "hdfs_path", ",", "owner", "=", "None", ",", "group", "=", "None", ")", ":", "raise", "NotImplementedError" ]
[ 58, 4 ]
[ 71, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.head
(self, hdfs_path, nbytes=1024, offset=0)
Retrieve the requested number of bytes from a file Parameters ---------- hdfs_path : string Absolute HDFS path nbytes : int, default 1024 (1K) Number of bytes to retrieve offset : int, default 0 Number of bytes at beginning of file to skip ...
Retrieve the requested number of bytes from a file
def head(self, hdfs_path, nbytes=1024, offset=0): """ Retrieve the requested number of bytes from a file Parameters ---------- hdfs_path : string Absolute HDFS path nbytes : int, default 1024 (1K) Number of bytes to retrieve offset : int, defa...
[ "def", "head", "(", "self", ",", "hdfs_path", ",", "nbytes", "=", "1024", ",", "offset", "=", "0", ")", ":", "raise", "NotImplementedError" ]
[ 73, 4 ]
[ 90, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.get
(self, hdfs_path, local_path='.', overwrite=False)
Download remote file or directory to the local filesystem Parameters ---------- hdfs_path : string local_path : string, default '.' Further keyword arguments passed down to any internal API used. Returns ------- written_path : string ...
Download remote file or directory to the local filesystem
def get(self, hdfs_path, local_path='.', overwrite=False): """ Download remote file or directory to the local filesystem Parameters ---------- hdfs_path : string local_path : string, default '.' Further keyword arguments passed down to any internal API used. ...
[ "def", "get", "(", "self", ",", "hdfs_path", ",", "local_path", "=", "'.'", ",", "overwrite", "=", "False", ")", ":", "raise", "NotImplementedError" ]
[ 92, 4 ]
[ 108, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.put
(self, hdfs_path, resource, overwrite=False, verbose=None, **kwargs)
Write file or directory to HDFS Parameters ---------- hdfs_path : string Directory or path resource : string or buffer-like Relative or absolute path to local resource, or a file-like object overwrite : boolean, default False verbose : boolea...
Write file or directory to HDFS
def put(self, hdfs_path, resource, overwrite=False, verbose=None, **kwargs): """ Write file or directory to HDFS Parameters ---------- hdfs_path : string Directory or path resource : string or buffer-like Relative or absolute path to local...
[ "def", "put", "(", "self", ",", "hdfs_path", ",", "resource", ",", "overwrite", "=", "False", ",", "verbose", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError" ]
[ 110, 4 ]
[ 131, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.put_tarfile
(self, hdfs_path, local_path, compression='gzip', verbose=None, overwrite=False)
Write contents of tar archive to HDFS directly without having to decompress it locally first Parameters ---------- hdfs_path : string local_path : string compression : {'gzip', 'bz2', None} overwrite : boolean, default False verbose : boolean, de...
Write contents of tar archive to HDFS directly without having to decompress it locally first
def put_tarfile(self, hdfs_path, local_path, compression='gzip', verbose=None, overwrite=False): """ Write contents of tar archive to HDFS directly without having to decompress it locally first Parameters ---------- hdfs_path : string local_pa...
[ "def", "put_tarfile", "(", "self", ",", "hdfs_path", ",", "local_path", ",", "compression", "=", "'gzip'", ",", "verbose", "=", "None", ",", "overwrite", "=", "False", ")", ":", "import", "tarfile", "modes", "=", "{", "None", ":", "'r'", ",", "'gzip'", ...
[ 133, 4 ]
[ 166, 72 ]
python
en
['en', 'error', 'th']
False
HDFS.ls
(self, hdfs_path, status=False)
Return contents of directory Parameters ---------- hdfs_path : string
Return contents of directory
def ls(self, hdfs_path, status=False): """ Return contents of directory Parameters ---------- hdfs_path : string """ raise NotImplementedError
[ "def", "ls", "(", "self", ",", "hdfs_path", ",", "status", "=", "False", ")", ":", "raise", "NotImplementedError" ]
[ 178, 4 ]
[ 186, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.size
(self, hdfs_path)
Return total size of file or directory Parameters ---------- size : int
Return total size of file or directory
def size(self, hdfs_path): """ Return total size of file or directory Parameters ---------- size : int """ raise NotImplementedError
[ "def", "size", "(", "self", ",", "hdfs_path", ")", ":", "raise", "NotImplementedError" ]
[ 188, 4 ]
[ 196, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.mv
(self, hdfs_path_src, hdfs_path_dest, overwrite=True)
Move hdfs_path_src to hdfs_path_dest Parameters ---------- overwrite : boolean, default True Overwrite hdfs_path_dest if it exists.
Move hdfs_path_src to hdfs_path_dest
def mv(self, hdfs_path_src, hdfs_path_dest, overwrite=True): """ Move hdfs_path_src to hdfs_path_dest Parameters ---------- overwrite : boolean, default True Overwrite hdfs_path_dest if it exists. """ raise NotImplementedError
[ "def", "mv", "(", "self", ",", "hdfs_path_src", ",", "hdfs_path_dest", ",", "overwrite", "=", "True", ")", ":", "raise", "NotImplementedError" ]
[ 201, 4 ]
[ 210, 33 ]
python
en
['en', 'error', 'th']
False
HDFS.rm
(self, path)
Delete a single file
Delete a single file
def rm(self, path): """ Delete a single file """ return self.delete(path)
[ "def", "rm", "(", "self", ",", "path", ")", ":", "return", "self", ".", "delete", "(", "path", ")" ]
[ 215, 4 ]
[ 219, 32 ]
python
en
['en', 'error', 'th']
False
HDFS.rmdir
(self, path)
Delete a directory and all its contents
Delete a directory and all its contents
def rmdir(self, path): """ Delete a directory and all its contents """ self.client.delete(path, recursive=True)
[ "def", "rmdir", "(", "self", ",", "path", ")", ":", "self", ".", "client", ".", "delete", "(", "path", ",", "recursive", "=", "True", ")" ]
[ 221, 4 ]
[ 225, 48 ]
python
en
['en', 'error', 'th']
False
WebHDFS.status
(self, path)
Retrieve HDFS metadata for path
Retrieve HDFS metadata for path
def status(self, path): """ Retrieve HDFS metadata for path """ return self.client.status(path)
[ "def", "status", "(", "self", ",", "path", ")", ":", "return", "self", ".", "client", ".", "status", "(", "path", ")" ]
[ 258, 4 ]
[ 262, 39 ]
python
en
['en', 'error', 'th']
False
WebHDFS.delete
(self, hdfs_path, recursive=False)
Delete a file.
Delete a file.
def delete(self, hdfs_path, recursive=False): """ Delete a file. """ return self.client.delete(hdfs_path, recursive=recursive)
[ "def", "delete", "(", "self", ",", "hdfs_path", ",", "recursive", "=", "False", ")", ":", "return", "self", ".", "client", ".", "delete", "(", "hdfs_path", ",", "recursive", "=", "recursive", ")" ]
[ 295, 4 ]
[ 299, 65 ]
python
en
['en', 'error', 'th']
False
table
(name, node, mysql_node, secret_type)
Create a table that can be accessed using MySQL table engine.
Create a table that can be accessed using MySQL table engine.
def table(name, node, mysql_node, secret_type): """Create a table that can be accessed using MySQL table engine. """ try: with Given("table in MySQL"): sql = f""" CREATE TABLE {name}( id INT NOT NULL AUTO_INCREMENT, date DATE, ...
[ "def", "table", "(", "name", ",", "node", ",", "mysql_node", ",", "secret_type", ")", ":", "try", ":", "with", "Given", "(", "\"table in MySQL\"", ")", ":", "sql", "=", "f\"\"\"\n CREATE TABLE {name}(\n id INT NOT NULL AUTO_INCREMENT,\n ...
[ 10, 0 ]
[ 51, 121 ]
python
en
['en', 'en', 'en']
True
decrypt
(self, mysql_datatype)
Check that when using a table with MySQL table engine that contains a column encrypted in MySQL stored using specified data type I can decrypt data in the column using the `decrypt` and `aes_decrypt_mysql` functions in the select query.
Check that when using a table with MySQL table engine that contains a column encrypted in MySQL stored using specified data type I can decrypt data in the column using the `decrypt` and `aes_decrypt_mysql` functions in the select query.
def decrypt(self, mysql_datatype): """Check that when using a table with MySQL table engine that contains a column encrypted in MySQL stored using specified data type I can decrypt data in the column using the `decrypt` and `aes_decrypt_mysql` functions in the select query. """ node = self.conte...
[ "def", "decrypt", "(", "self", ",", "mysql_datatype", ")", ":", "node", "=", "self", ".", "context", ".", "node", "mysql_node", "=", "self", ".", "context", ".", "mysql_node", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "for", "func", "in"...
[ 60, 0 ]
[ 113, 63 ]
python
en
['en', 'en', 'en']
True
encrypt
(self, mysql_datatype)
Check that when using a table with MySQL table engine that we can encrypt data during insert using the `encrypt` and `aes_encrypt_mysql` functions and decrypt it in MySQL.
Check that when using a table with MySQL table engine that we can encrypt data during insert using the `encrypt` and `aes_encrypt_mysql` functions and decrypt it in MySQL.
def encrypt(self, mysql_datatype): """Check that when using a table with MySQL table engine that we can encrypt data during insert using the `encrypt` and `aes_encrypt_mysql` functions and decrypt it in MySQL. """ node = self.context.node mysql_node = self.context.mysql_node key = f"{'1' * 6...
[ "def", "encrypt", "(", "self", ",", "mysql_datatype", ")", ":", "node", "=", "self", ".", "context", ".", "node", "mysql_node", "=", "self", ".", "context", ".", "mysql_node", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "for", "func", "in"...
[ 122, 0 ]
[ 185, 63 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", mysql_node="mysql1")
Check usage of encryption functions with [MySQL table engine]. [MySQL table engine]: https://clickhouse.tech/docs/en/engines/table-engines/integrations/mysql/
Check usage of encryption functions with [MySQL table engine].
def feature(self, node="clickhouse1", mysql_node="mysql1"): """Check usage of encryption functions with [MySQL table engine]. [MySQL table engine]: https://clickhouse.tech/docs/en/engines/table-engines/integrations/mysql/ """ self.context.node = self.context.cluster.node(node) self.context.mysql_no...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "mysql_node", "=", "\"mysql1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "self", ".", "context",...
[ 192, 0 ]
[ 201, 40 ]
python
en
['en', 'en', 'en']
True
create_table
(self, name, create_statement, on_cluster=False)
Create table.
Create table.
def create_table(self, name, create_statement, on_cluster=False): """Create table. """ node = current().context.node try: with Given(f"I have a {name} table"): node.query(create_statement.format(name=name)) yield name finally: with Finally("I drop the table"): ...
[ "def", "create_table", "(", "self", ",", "name", ",", "create_statement", ",", "on_cluster", "=", "False", ")", ":", "node", "=", "current", "(", ")", ".", "context", ".", "node", "try", ":", "with", "Given", "(", "f\"I have a {name} table\"", ")", ":", ...
[ 10, 0 ]
[ 23, 58 ]
python
en
['en', 'ga', 'en']
False
add_ldap_servers_configuration
(self, servers, config=None, config_d_dir="/etc/clickhouse-server/config.d", config_file="ldap_servers.xml", timeout=60, restart=False)
Add LDAP servers configuration to config.xml.
Add LDAP servers configuration to config.xml.
def add_ldap_servers_configuration(self, servers, config=None, config_d_dir="/etc/clickhouse-server/config.d", config_file="ldap_servers.xml", timeout=60, restart=False): """Add LDAP servers configuration to config.xml. """ if config is None: config = create_ldap_servers_config_content(serve...
[ "def", "add_ldap_servers_configuration", "(", "self", ",", "servers", ",", "config", "=", "None", ",", "config_d_dir", "=", "\"/etc/clickhouse-server/config.d\"", ",", "config_file", "=", "\"ldap_servers.xml\"", ",", "timeout", "=", "60", ",", "restart", "=", "False...
[ 26, 0 ]
[ 32, 46 ]
python
en
['en', 'en', 'en']
True
add_ldap_groups
(self, groups, node=None)
Add multiple new groups to the LDAP server.
Add multiple new groups to the LDAP server.
def add_ldap_groups(self, groups, node=None): """Add multiple new groups to the LDAP server. """ try: _groups = [] for group in groups: with By(f"adding group {group['cn']}"): _groups.append(add_group_to_ldap(**group, node=node)) yield _groups finally:...
[ "def", "add_ldap_groups", "(", "self", ",", "groups", ",", "node", "=", "None", ")", ":", "try", ":", "_groups", "=", "[", "]", "for", "group", "in", "groups", ":", "with", "By", "(", "f\"adding group {group['cn']}\"", ")", ":", "_groups", ".", "append",...
[ 35, 0 ]
[ 47, 57 ]
python
en
['en', 'en', 'en']
True
add_ldap_external_user_directory
(self, server, roles=None, role_mappings=None, config_d_dir="/etc/clickhouse-server/config.d", config_file=None, timeout=60, restart=True, config=None)
Add LDAP external user directory.
Add LDAP external user directory.
def add_ldap_external_user_directory(self, server, roles=None, role_mappings=None, config_d_dir="/etc/clickhouse-server/config.d", config_file=None, timeout=60, restart=True, config=None): """Add LDAP external user directory. """ if config_file is None: config_file = f"ldap_external_...
[ "def", "add_ldap_external_user_directory", "(", "self", ",", "server", ",", "roles", "=", "None", ",", "role_mappings", "=", "None", ",", "config_d_dir", "=", "\"/etc/clickhouse-server/config.d\"", ",", "config_file", "=", "None", ",", "timeout", "=", "60", ",", ...
[ 50, 0 ]
[ 62, 46 ]
python
da
['da', 'lb', 'en']
False
add_rbac_roles
(self, roles)
Add RBAC roles.
Add RBAC roles.
def add_rbac_roles(self, roles): """Add RBAC roles. """ with rbac_roles(*roles) as _roles: yield _roles
[ "def", "add_rbac_roles", "(", "self", ",", "roles", ")", ":", "with", "rbac_roles", "(", "*", "roles", ")", "as", "_roles", ":", "yield", "_roles" ]
[ 65, 0 ]
[ 69, 20 ]
python
en
['en', 'bg', 'en']
True
add_rbac_users
(self, users)
Add RBAC users.
Add RBAC users.
def add_rbac_users(self, users): """Add RBAC users. """ with rbac_users(*users) as _users: yield _users
[ "def", "add_rbac_users", "(", "self", ",", "users", ")", ":", "with", "rbac_users", "(", "*", "users", ")", "as", "_users", ":", "yield", "_users" ]
[ 72, 0 ]
[ 76, 20 ]
python
en
['en', 'mt', 'en']
True
add_ldap_users
(self, users, node=None)
Add LDAP users.
Add LDAP users.
def add_ldap_users(self, users, node=None): """Add LDAP users. """ with ldap_users(*users, node=node) as _users: yield _users
[ "def", "add_ldap_users", "(", "self", ",", "users", ",", "node", "=", "None", ")", ":", "with", "ldap_users", "(", "*", "users", ",", "node", "=", "node", ")", "as", "_users", ":", "yield", "_users" ]
[ 79, 0 ]
[ 83, 20 ]
python
en
['en', 'zh', 'en']
True
add_group_to_ldap
(cn, gidnumber=None, node=None, _gidnumber=[600], exitcode=0)
Add new group entry to LDAP.
Add new group entry to LDAP.
def add_group_to_ldap(cn, gidnumber=None, node=None, _gidnumber=[600], exitcode=0): """Add new group entry to LDAP. """ _gidnumber[0] += 1 if node is None: node = current().context.ldap_node if gidnumber is None: gidnumber = _gidnumber[0] group = { "dn": f"cn={cn},ou=g...
[ "def", "add_group_to_ldap", "(", "cn", ",", "gidnumber", "=", "None", ",", "node", "=", "None", ",", "_gidnumber", "=", "[", "600", "]", ",", "exitcode", "=", "0", ")", ":", "_gidnumber", "[", "0", "]", "+=", "1", "if", "node", "is", "None", ":", ...
[ 85, 0 ]
[ 122, 16 ]
python
en
['en', 'en', 'en']
True
delete_group_from_ldap
(group, node=None, exitcode=0)
Delete group entry from LDAP.
Delete group entry from LDAP.
def delete_group_from_ldap(group, node=None, exitcode=0): """Delete group entry from LDAP. """ if node is None: node = current().context.ldap_node with By(f"deleting group {group['dn']}"): r = node.command( f"ldapdelete -x -H ldap://localhost -D \"cn=admin,dc=company,dc=com\...
[ "def", "delete_group_from_ldap", "(", "group", ",", "node", "=", "None", ",", "exitcode", "=", "0", ")", ":", "if", "node", "is", "None", ":", "node", "=", "current", "(", ")", ".", "context", ".", "ldap_node", "with", "By", "(", "f\"deleting group {grou...
[ 124, 0 ]
[ 135, 46 ]
python
en
['en', 'en', 'en']
True
fix_ldap_permissions
(node=None, exitcode=0)
Fix LDAP access permissions.
Fix LDAP access permissions.
def fix_ldap_permissions(node=None, exitcode=0): """Fix LDAP access permissions. """ if node is None: node = current().context.ldap_node ldif = ( "dn: olcDatabase={1}mdb,cn=config\n" "changetype: modify\n" "delete: olcAccess\n" "-\n" "add: olcAccess\n" ...
[ "def", "fix_ldap_permissions", "(", "node", "=", "None", ",", "exitcode", "=", "0", ")", ":", "if", "node", "is", "None", ":", "node", "=", "current", "(", ")", ".", "context", ".", "ldap_node", "ldif", "=", "(", "\"dn: olcDatabase={1}mdb,cn=config\\n\"", ...
[ 137, 0 ]
[ 157, 46 ]
python
en
['en', 'ca', 'en']
True
add_user_to_group_in_ldap
(user, group, node=None, exitcode=0)
Add user to a group in LDAP.
Add user to a group in LDAP.
def add_user_to_group_in_ldap(user, group, node=None, exitcode=0): """Add user to a group in LDAP. """ if node is None: node = current().context.ldap_node ldif = (f"dn: {group['dn']}\n" "changetype: modify\n" "add: uniquemember\n" f"uniquemember: {user['dn']}") with...
[ "def", "add_user_to_group_in_ldap", "(", "user", ",", "group", ",", "node", "=", "None", ",", "exitcode", "=", "0", ")", ":", "if", "node", "is", "None", ":", "node", "=", "current", "(", ")", ".", "context", ".", "ldap_node", "ldif", "=", "(", "f\"d...
[ 159, 0 ]
[ 175, 46 ]
python
en
['en', 'en', 'en']
True
delete_user_from_group_in_ldap
(user, group, node=None, exitcode=0)
Delete user from a group in LDAP.
Delete user from a group in LDAP.
def delete_user_from_group_in_ldap(user, group, node=None, exitcode=0): """Delete user from a group in LDAP. """ if node is None: node = current().context.ldap_node ldif = (f"dn: {group['dn']}\n" "changetype: modify\n" "delete: uniquemember\n" f"uniquemember: {user['dn']...
[ "def", "delete_user_from_group_in_ldap", "(", "user", ",", "group", ",", "node", "=", "None", ",", "exitcode", "=", "0", ")", ":", "if", "node", "is", "None", ":", "node", "=", "current", "(", ")", ".", "context", ".", "ldap_node", "ldif", "=", "(", ...
[ 177, 0 ]
[ 193, 46 ]
python
en
['en', 'en', 'en']
True
create_xml_config_content
(entries, config_d_dir="/etc/clickhouse-server/config.d", config_file="ldap_external_user_directories.xml")
Create XML configuration file from a dictionary.
Create XML configuration file from a dictionary.
def create_xml_config_content(entries, config_d_dir="/etc/clickhouse-server/config.d", config_file="ldap_external_user_directories.xml"): """Create XML configuration file from a dictionary. """ uid = getuid() path = os.path.join(config_d_dir, config_file) name = config_file root = xmltre...
[ "def", "create_xml_config_content", "(", "entries", ",", "config_d_dir", "=", "\"/etc/clickhouse-server/config.d\"", ",", "config_file", "=", "\"ldap_external_user_directories.xml\"", ")", ":", "uid", "=", "getuid", "(", ")", "path", "=", "os", ".", "path", ".", "jo...
[ 195, 0 ]
[ 223, 57 ]
python
en
['en', 'en', 'en']
True
create_ldap_external_user_directory_config_content
(server=None, roles=None, role_mappings=None, **kwargs)
Create LDAP external user directory configuration file content.
Create LDAP external user directory configuration file content.
def create_ldap_external_user_directory_config_content(server=None, roles=None, role_mappings=None, **kwargs): """Create LDAP external user directory configuration file content. """ entries = { "user_directories": { "ldap": { } } } entries["user_directories"]...
[ "def", "create_ldap_external_user_directory_config_content", "(", "server", "=", "None", ",", "roles", "=", "None", ",", "role_mappings", "=", "None", ",", "*", "*", "kwargs", ")", ":", "entries", "=", "{", "\"user_directories\"", ":", "{", "\"ldap\"", ":", "{...
[ 225, 0 ]
[ 247, 55 ]
python
en
['en', 'lb', 'en']
True
create_entries_ldap_external_user_directory_config_content
(entries, **kwargs)
Create LDAP external user directory configuration file content.
Create LDAP external user directory configuration file content.
def create_entries_ldap_external_user_directory_config_content(entries, **kwargs): """Create LDAP external user directory configuration file content. """ return create_xml_config_content(entries, **kwargs)
[ "def", "create_entries_ldap_external_user_directory_config_content", "(", "entries", ",", "*", "*", "kwargs", ")", ":", "return", "create_xml_config_content", "(", "entries", ",", "*", "*", "kwargs", ")" ]
[ 249, 0 ]
[ 252, 55 ]
python
en
['en', 'lb', 'en']
True
TestCalculator.test_add
(self)
Test case: Normal case of addition
Test case: Normal case of addition
def test_add(self): """ Test case: Normal case of addition """ expected_answer = 1 actual_answer = calculator.add(1, 0) self.assertEqual(expected_answer, actual_answer)
[ "def", "test_add", "(", "self", ")", ":", "expected_answer", "=", "1", "actual_answer", "=", "calculator", ".", "add", "(", "1", ",", "0", ")", "self", ".", "assertEqual", "(", "expected_answer", ",", "actual_answer", ")" ]
[ 9, 2 ]
[ 15, 52 ]
python
en
['en', 'ja', 'th']
False
TestCalculator.test_subtract
(self)
Test case: Normal case of subtraction
Test case: Normal case of subtraction
def test_subtract(self): """ Test case: Normal case of subtraction """ expected_answer = 1 actual_answer = calculator.subtract(2, 1) self.assertEqual(expected_answer, actual_answer)
[ "def", "test_subtract", "(", "self", ")", ":", "expected_answer", "=", "1", "actual_answer", "=", "calculator", ".", "subtract", "(", "2", ",", "1", ")", "self", ".", "assertEqual", "(", "expected_answer", ",", "actual_answer", ")" ]
[ 17, 2 ]
[ 23, 52 ]
python
en
['en', 'ja', 'th']
False
TestCalculator.test_multiply
(self)
Test case: Normal case of multiplication
Test case: Normal case of multiplication
def test_multiply(self): """ Test case: Normal case of multiplication """ expected_answer = 1 actual_answer = calculator.multiply(1, 1) self.assertEqual(expected_answer, actual_answer)
[ "def", "test_multiply", "(", "self", ")", ":", "expected_answer", "=", "1", "actual_answer", "=", "calculator", ".", "multiply", "(", "1", ",", "1", ")", "self", ".", "assertEqual", "(", "expected_answer", ",", "actual_answer", ")" ]
[ 25, 2 ]
[ 31, 52 ]
python
en
['en', 'ja', 'th']
False
TestCalculator.test_divide
(self)
Test case: Normal case of division
Test case: Normal case of division
def test_divide(self): """ Test case: Normal case of division """ expected_answer = 1 actual_answer = calculator.divide(2, 2) self.assertEqual(expected_answer, actual_answer) """ Test case: Raise ValueError when y ==0 """ with self.assertRaises(ValueError): ca...
[ "def", "test_divide", "(", "self", ")", ":", "expected_answer", "=", "1", "actual_answer", "=", "calculator", ".", "divide", "(", "2", ",", "2", ")", "self", ".", "assertEqual", "(", "expected_answer", ",", "actual_answer", ")", "\"\"\"\r\n Test case: Raise V...
[ 33, 2 ]
[ 45, 29 ]
python
en
['en', 'ja', 'th']
False
vset
(seq, idfun=None, as_list=True)
order preserving >>> vset([[11,2],1, [10,['9',1]],2, 1, [11,2],[3,3],[10,99],1,[10,['9',1]]],idfun=repr) [[11, 2], 1, [10, ['9', 1]], 2, [3, 3], [10, 99]]
order preserving
def vset(seq, idfun=None, as_list=True): # This functions preserves the order of arguments while removing duplicates. # This function is from https://code.google.com/p/common-python-vu/source/browse/vu_common.py # (Thanhu's personal code). It has been copied here to avoid a dependency on vu_common.py. ...
[ "def", "vset", "(", "seq", ",", "idfun", "=", "None", ",", "as_list", "=", "True", ")", ":", "# This functions preserves the order of arguments while removing duplicates. ", "# This function is from https://code.google.com/p/common-python-vu/source/browse/vu_common.py", "# (Thanhu's ...
[ 15, 0 ]
[ 46, 40 ]
python
en
['en', 'error', 'th']
False
ehash
(v)
Returns a 'stronger' hash value than the default hash() method. The result from hash() is not enough to distinguish between 2 z3 expressions in some cases. Note: the following doctests will fail with Python 2.x as the default formatting doesn't match that of 3.x. >>> x1 = Bool('x'); x2 = ...
Returns a 'stronger' hash value than the default hash() method. The result from hash() is not enough to distinguish between 2 z3 expressions in some cases. Note: the following doctests will fail with Python 2.x as the default formatting doesn't match that of 3.x. >>> x1 = Bool('x'); x2 = ...
def ehash(v): """ Returns a 'stronger' hash value than the default hash() method. The result from hash() is not enough to distinguish between 2 z3 expressions in some cases. Note: the following doctests will fail with Python 2.x as the default formatting doesn't match that of 3.x. >>> ...
[ "def", "ehash", "(", "v", ")", ":", "if", "z3_debug", "(", ")", ":", "assert", "is_expr", "(", "v", ")", "return", "\"{}_{}_{}\"", ".", "format", "(", "str", "(", "v", ")", ",", "v", ".", "hash", "(", ")", ",", "v", ".", "sort_kind", "(", ")", ...
[ 62, 0 ]
[ 80, 59 ]
python
en
['en', 'error', 'th']
False
is_expr_var
(v)
EXAMPLES: >>> is_expr_var(Int('7')) True >>> is_expr_var(IntVal('7')) False >>> is_expr_var(Bool('y')) True >>> is_expr_var(Int('x') + 7 == Int('y')) False >>> LOnOff, (On,Off) = EnumSort("LOnOff",['On','Off']) >>> Block,Reset,SafetyInjection=Consts("Block Reset SafetyInjec...
EXAMPLES:
def is_expr_var(v): """ EXAMPLES: >>> is_expr_var(Int('7')) True >>> is_expr_var(IntVal('7')) False >>> is_expr_var(Bool('y')) True >>> is_expr_var(Int('x') + 7 == Int('y')) False >>> LOnOff, (On,Off) = EnumSort("LOnOff",['On','Off']) >>> Block,Reset,SafetyInjection=Cons...
[ "def", "is_expr_var", "(", "v", ")", ":", "return", "is_const", "(", "v", ")", "and", "v", ".", "decl", "(", ")", ".", "kind", "(", ")", "==", "Z3_OP_UNINTERPRETED" ]
[ 88, 0 ]
[ 112, 63 ]
python
en
['en', 'error', 'th']
False
is_expr_val
(v)
EXAMPLES: >>> is_expr_val(Int('7')) False >>> is_expr_val(IntVal('7')) True >>> is_expr_val(Bool('y')) False >>> is_expr_val(Int('x') + 7 == Int('y')) False >>> LOnOff, (On,Off) = EnumSort("LOnOff",['On','Off']) >>> Block,Reset,SafetyInjection=Consts("Block Reset SafetyInje...
EXAMPLES:
def is_expr_val(v): """ EXAMPLES: >>> is_expr_val(Int('7')) False >>> is_expr_val(IntVal('7')) True >>> is_expr_val(Bool('y')) False >>> is_expr_val(Int('x') + 7 == Int('y')) False >>> LOnOff, (On,Off) = EnumSort("LOnOff",['On','Off']) >>> Block,Reset,SafetyInjection=Con...
[ "def", "is_expr_val", "(", "v", ")", ":", "return", "is_const", "(", "v", ")", "and", "v", ".", "decl", "(", ")", ".", "kind", "(", ")", "!=", "Z3_OP_UNINTERPRETED" ]
[ 114, 0 ]
[ 137, 63 ]
python
en
['en', 'error', 'th']
False
get_vars
(f,rs=[])
>>> x,y = Ints('x y') >>> a,b = Bools('a b') >>> get_vars(Implies(And(x+y==0,x*2==10),Or(a,Implies(a,b==False)))) [x, y, a, b]
>>> x,y = Ints('x y') >>> a,b = Bools('a b') >>> get_vars(Implies(And(x+y==0,x*2==10),Or(a,Implies(a,b==False)))) [x, y, a, b]
def get_vars(f,rs=[]): """ >>> x,y = Ints('x y') >>> a,b = Bools('a b') >>> get_vars(Implies(And(x+y==0,x*2==10),Or(a,Implies(a,b==False)))) [x, y, a, b] """ if z3_debug(): assert is_expr(f) if is_const(f): if is_expr_val(f): return rs else: #variab...
[ "def", "get_vars", "(", "f", ",", "rs", "=", "[", "]", ")", ":", "if", "z3_debug", "(", ")", ":", "assert", "is_expr", "(", "f", ")", "if", "is_const", "(", "f", ")", ":", "if", "is_expr_val", "(", "f", ")", ":", "return", "rs", "else", ":", ...
[ 142, 0 ]
[ 163, 27 ]
python
en
['en', 'error', 'th']
False
prove
(claim,assume=None,verbose=0)
>>> r,m = prove(BoolVal(True),verbose=0); r,model_str(m,as_str=False) (True, None) #infinite counter example when proving contradiction >>> r,m = prove(BoolVal(False)); r,model_str(m,as_str=False) (False, []) >>> x,y,z=Bools('x y z') >>> r,m = prove(And(x,Not(x))); r,model_str(m,as_str=Tr...
>>> r,m = prove(BoolVal(True),verbose=0); r,model_str(m,as_str=False) (True, None)
def prove(claim,assume=None,verbose=0): """ >>> r,m = prove(BoolVal(True),verbose=0); r,model_str(m,as_str=False) (True, None) #infinite counter example when proving contradiction >>> r,m = prove(BoolVal(False)); r,model_str(m,as_str=False) (False, []) >>> x,y,z=Bools('x y z') >>> r,m ...
[ "def", "prove", "(", "claim", ",", "assume", "=", "None", ",", "verbose", "=", "0", ")", ":", "if", "z3_debug", "(", ")", ":", "assert", "not", "assume", "or", "is_expr", "(", "assume", ")", "to_prove", "=", "claim", "if", "assume", ":", "if", "z3_...
[ 185, 0 ]
[ 274, 28 ]
python
en
['en', 'error', 'th']
False
get_models
(f,k)
Returns the first k models satisfiying f. If f is not satisfiable, returns False. If f cannot be solved, returns None If f is satisfiable, returns the first k models Note that if f is a tautology, e.g.\ True, then the result is [] Based on http://stackoverflow.com/questions/11867611/z3py-c...
Returns the first k models satisfiying f. If f is not satisfiable, returns False. If f cannot be solved, returns None If f is satisfiable, returns the first k models Note that if f is a tautology, e.g.\ True, then the result is [] Based on http://stackoverflow.com/questions/11867611/z3py-c...
def get_models(f,k): """ Returns the first k models satisfiying f. If f is not satisfiable, returns False. If f cannot be solved, returns None If f is satisfiable, returns the first k models Note that if f is a tautology, e.g.\ True, then the result is [] Based on http://stackoverflow.c...
[ "def", "get_models", "(", "f", ",", "k", ")", ":", "if", "z3_debug", "(", ")", ":", "assert", "is_expr", "(", "f", ")", "assert", "k", ">=", "1", "s", "=", "Solver", "(", ")", "s", ".", "add", "(", "f", ")", "models", "=", "[", "]", "i", "=...
[ 277, 0 ]
[ 346, 21 ]
python
en
['en', 'error', 'th']
False
is_tautology
(claim,verbose=0)
>>> is_tautology(Implies(Bool('x'),Bool('x'))) True >>> is_tautology(Implies(Bool('x'),Bool('y'))) False >>> is_tautology(BoolVal(True)) True >>> is_tautology(BoolVal(False)) False
>>> is_tautology(Implies(Bool('x'),Bool('x'))) True
def is_tautology(claim,verbose=0): """ >>> is_tautology(Implies(Bool('x'),Bool('x'))) True >>> is_tautology(Implies(Bool('x'),Bool('y'))) False >>> is_tautology(BoolVal(True)) True >>> is_tautology(BoolVal(False)) False """ return prove(claim=claim,assume=None,verbose=ver...
[ "def", "is_tautology", "(", "claim", ",", "verbose", "=", "0", ")", ":", "return", "prove", "(", "claim", "=", "claim", ",", "assume", "=", "None", ",", "verbose", "=", "verbose", ")", "[", "0", "]" ]
[ 348, 0 ]
[ 363, 60 ]
python
en
['en', 'error', 'th']
False
is_contradiction
(claim,verbose=0)
>>> x,y=Bools('x y') >>> is_contradiction(BoolVal(False)) True >>> is_contradiction(BoolVal(True)) False >>> is_contradiction(x) False >>> is_contradiction(Implies(x,y)) False >>> is_contradiction(Implies(x,x)) False >>> is_contradiction(And(x,No...
>>> x,y=Bools('x y') >>> is_contradiction(BoolVal(False)) True >>> is_contradiction(BoolVal(True)) False >>> is_contradiction(x) False >>> is_contradiction(Implies(x,y)) False >>> is_contradiction(Implies(x,x)) False >>> is_contradiction(And(x,No...
def is_contradiction(claim,verbose=0): """ >>> x,y=Bools('x y') >>> is_contradiction(BoolVal(False)) True >>> is_contradiction(BoolVal(True)) False >>> is_contradiction(x) False >>> is_contradiction(Implies(x,y)) False >>> is_contradiction(Implies(x,x)) ...
[ "def", "is_contradiction", "(", "claim", ",", "verbose", "=", "0", ")", ":", "return", "prove", "(", "claim", "=", "Not", "(", "claim", ")", ",", "assume", "=", "None", ",", "verbose", "=", "verbose", ")", "[", "0", "]" ]
[ 366, 0 ]
[ 388, 65 ]
python
en
['en', 'error', 'th']
False
exact_one_model
(f)
return True if f has exactly 1 model, False otherwise. EXAMPLES: >>> x, y = Ints('x y') >>> exact_one_model(And(0<=x**y,x <= 0)) False >>> exact_one_model(And(0<=x,x <= 0)) True >>> exact_one_model(And(0<=x,x <= 1)) False >>> exact_one_model(And(0<=x,x <= -1)) False...
return True if f has exactly 1 model, False otherwise. EXAMPLES:
def exact_one_model(f): """ return True if f has exactly 1 model, False otherwise. EXAMPLES: >>> x, y = Ints('x y') >>> exact_one_model(And(0<=x**y,x <= 0)) False >>> exact_one_model(And(0<=x,x <= 0)) True >>> exact_one_model(And(0<=x,x <= 1)) False >>> exact_one_mod...
[ "def", "exact_one_model", "(", "f", ")", ":", "models", "=", "get_models", "(", "f", ",", "k", "=", "2", ")", "if", "isinstance", "(", "models", ",", "list", ")", ":", "return", "len", "(", "models", ")", "==", "1", "else", ":", "return", "False" ]
[ 391, 0 ]
[ 415, 20 ]
python
en
['en', 'error', 'th']
False
myBinOp
(op,*L)
>>> myAnd(*[Bool('x'),Bool('y')]) And(x, y) >>> myAnd(*[Bool('x'),None]) x >>> myAnd(*[Bool('x')]) x >>> myAnd(*[]) >>> myAnd(Bool('x'),Bool('y')) And(x, y) >>> myAnd(*[Bool('x'),Bool('y')]) And(x, y) >>> myAnd([Bool('x'),Bool('y')]) And(x, ...
>>> myAnd(*[Bool('x'),Bool('y')]) And(x, y) >>> myAnd(*[Bool('x'),None]) x >>> myAnd(*[Bool('x')]) x >>> myAnd(*[]) >>> myAnd(Bool('x'),Bool('y')) And(x, y) >>> myAnd(*[Bool('x'),Bool('y')]) And(x, y)
def myBinOp(op,*L): """ >>> myAnd(*[Bool('x'),Bool('y')]) And(x, y) >>> myAnd(*[Bool('x'),None]) x >>> myAnd(*[Bool('x')]) x >>> myAnd(*[]) >>> myAnd(Bool('x'),Bool('y')) And(x, y) >>> myAnd(*[Bool('x'),Bool('y')]) And(x, y) >>> myAnd([Bool('...
[ "def", "myBinOp", "(", "op", ",", "*", "L", ")", ":", "if", "z3_debug", "(", ")", ":", "assert", "op", "==", "Z3_OP_OR", "or", "op", "==", "Z3_OP_AND", "or", "op", "==", "Z3_OP_IMPLIES", "if", "len", "(", "L", ")", "==", "1", "and", "(", "isinsta...
[ 419, 0 ]
[ 471, 19 ]
python
en
['en', 'error', 'th']
False
model_str
(m,as_str=True)
Returned a 'sorted' model (so that it's easier to see) The model is sorted by its key, e.g. if the model is y = 3 , x = 10, then the result is x = 10, y = 3 EXAMPLES: see doctest exampels from function prove()
Returned a 'sorted' model (so that it's easier to see) The model is sorted by its key, e.g. if the model is y = 3 , x = 10, then the result is x = 10, y = 3
def model_str(m,as_str=True): """ Returned a 'sorted' model (so that it's easier to see) The model is sorted by its key, e.g. if the model is y = 3 , x = 10, then the result is x = 10, y = 3 EXAMPLES: see doctest exampels from function prove() """ if z3_debug(): assert m...
[ "def", "model_str", "(", "m", ",", "as_str", "=", "True", ")", ":", "if", "z3_debug", "(", ")", ":", "assert", "m", "is", "None", "or", "m", "==", "[", "]", "or", "isinstance", "(", "m", ",", "ModelRef", ")", "if", "m", ":", "vs", "=", "[", "...
[ 484, 0 ]
[ 506, 38 ]
python
en
['en', 'error', 'th']
False
validate_hook_url
(url: str)
Validator for discord webhook urls.
Validator for discord webhook urls.
async def validate_hook_url(url: str) -> t.Optional[ValidationError]: """Validator for discord webhook urls.""" async def validate() -> t.Optional[str]: if not isinstance(url, str): raise ValueError("Webhook URL must be a string.") if "discord.com/api/webhooks/" not in url: ...
[ "async", "def", "validate_hook_url", "(", "url", ":", "str", ")", "->", "t", ".", "Optional", "[", "ValidationError", "]", ":", "async", "def", "validate", "(", ")", "->", "t", ".", "Optional", "[", "str", "]", ":", "if", "not", "isinstance", "(", "u...
[ 77, 0 ]
[ 125, 68 ]
python
da
['da', 'sv', 'en']
False
_WebHook.validate_url
(cls, url: str)
Validates URL parameter.
Validates URL parameter.
def validate_url(cls, url: str) -> str: """Validates URL parameter.""" if "discord.com/api/webhooks/" not in url: raise ValueError("URL must be a discord webhook.") return url
[ "def", "validate_url", "(", "cls", ",", "url", ":", "str", ")", "->", "str", ":", "if", "\"discord.com/api/webhooks/\"", "not", "in", "url", ":", "raise", "ValueError", "(", "\"URL must be a discord webhook.\"", ")", "return", "url" ]
[ 18, 4 ]
[ 23, 18 ]
python
en
['en', 'la', 'en']
True
Form.validate_features
(cls, value: list[str])
Validates is all features in allowed list.
Validates is all features in allowed list.
def validate_features(cls, value: list[str]) -> t.Optional[list[str]]: """Validates is all features in allowed list.""" # Uppercase everything to avoid mixed case in DB value = [v.upper() for v in value] allowed_values = [v.value for v in FormFeatures.__members__.values()] if any...
[ "def", "validate_features", "(", "cls", ",", "value", ":", "list", "[", "str", "]", ")", "->", "t", ".", "Optional", "[", "list", "[", "str", "]", "]", ":", "# Uppercase everything to avoid mixed case in DB", "value", "=", "[", "v", ".", "upper", "(", ")...
[ 40, 4 ]
[ 51, 20 ]
python
en
['en', 'en', 'en']
True
Form.dict
(self, admin: bool = True, **kwargs: t.Any)
Wrapper for original function to exclude private data for public access.
Wrapper for original function to exclude private data for public access.
def dict(self, admin: bool = True, **kwargs: t.Any) -> dict[str, t.Any]: """Wrapper for original function to exclude private data for public access.""" data = super().dict(**kwargs) returned_data = {} if not admin: for field in PUBLIC_FIELDS: if field == "id...
[ "def", "dict", "(", "self", ",", "admin", ":", "bool", "=", "True", ",", "*", "*", "kwargs", ":", "t", ".", "Any", ")", "->", "dict", "[", "str", ",", "t", ".", "Any", "]", ":", "data", "=", "super", "(", ")", ".", "dict", "(", "*", "*", ...
[ 53, 4 ]
[ 70, 28 ]
python
en
['en', 'en', 'en']
True
conv_cond_concat
(x, y)
Concatenate conditioning vector on feature map axis.
Concatenate conditioning vector on feature map axis.
def conv_cond_concat(x, y): """Concatenate conditioning vector on feature map axis.""" x_shapes = x.get_shape() y_shapes = y.get_shape() return tf.concat([x , y*tf.ones([x_shapes[0], x_shapes[1], x_shapes[2] , y_shapes[3]])], 3)
[ "def", "conv_cond_concat", "(", "x", ",", "y", ")", ":", "x_shapes", "=", "x", ".", "get_shape", "(", ")", "y_shapes", "=", "y", ".", "get_shape", "(", ")", "return", "tf", ".", "concat", "(", "[", "x", ",", "y", "*", "tf", ".", "ones", "(", "[...
[ 60, 0 ]
[ 65, 95 ]
python
en
['en', 'en', 'en']
True
TestConnect.local_ip
(self, args)
check if ip is localhost or not
check if ip is localhost or not
def local_ip(self, args): ''' check if ip is localhost or not ''' if not args["ip"] or args["ip"] == 'localhost' or args["ip"] == "127.0.0.1": return True else: return False
[ "def", "local_ip", "(", "self", ",", "args", ")", ":", "if", "not", "args", "[", "\"ip\"", "]", "or", "args", "[", "\"ip\"", "]", "==", "'localhost'", "or", "args", "[", "\"ip\"", "]", "==", "\"127.0.0.1\"", ":", "return", "True", "else", ":", "retur...
[ 12, 4 ]
[ 19, 24 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_disconnect
(self, connect)
target: test disconnect method: disconnect a connected client expected: connect failed after disconnected
target: test disconnect method: disconnect a connected client expected: connect failed after disconnected
def test_disconnect(self, connect): ''' target: test disconnect method: disconnect a connected client expected: connect failed after disconnected ''' res = connect.close() with pytest.raises(Exception) as e: res = connect.server_version()
[ "def", "test_disconnect", "(", "self", ",", "connect", ")", ":", "res", "=", "connect", ".", "close", "(", ")", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", "e", ":", "res", "=", "connect", ".", "server_version", "(", ")" ]
[ 21, 4 ]
[ 29, 42 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_disconnect_repeatedly
(self, dis_connect, args)
target: test disconnect repeatedly method: disconnect a connected client, disconnect again expected: raise an error after disconnected
target: test disconnect repeatedly method: disconnect a connected client, disconnect again expected: raise an error after disconnected
def test_disconnect_repeatedly(self, dis_connect, args): ''' target: test disconnect repeatedly method: disconnect a connected client, disconnect again expected: raise an error after disconnected ''' with pytest.raises(Exception) as e: connect.close()
[ "def", "test_disconnect_repeatedly", "(", "self", ",", "dis_connect", ",", "args", ")", ":", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", "e", ":", "connect", ".", "close", "(", ")" ]
[ 31, 4 ]
[ 38, 27 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_connect_correct_ip_port
(self, args)
target: test connect with corrent ip and port value method: set correct ip and port expected: connected is True
target: test connect with corrent ip and port value method: set correct ip and port expected: connected is True
def test_connect_correct_ip_port(self, args): ''' target: test connect with corrent ip and port value method: set correct ip and port expected: connected is True ''' milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
[ "def", "test_connect_correct_ip_port", "(", "self", ",", "args", ")", ":", "milvus", "=", "get_milvus", "(", "args", "[", "\"ip\"", "]", ",", "args", "[", "\"port\"", "]", ",", "handler", "=", "args", "[", "\"handler\"", "]", ")" ]
[ 40, 4 ]
[ 46, 78 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_connect_connected
(self, args)
target: test connect and disconnect with corrent ip and port value, assert connected value method: set correct ip and port expected: connected is False
target: test connect and disconnect with corrent ip and port value, assert connected value method: set correct ip and port expected: connected is False
def test_connect_connected(self, args): ''' target: test connect and disconnect with corrent ip and port value, assert connected value method: set correct ip and port expected: connected is False ''' milvus = get_milvus(args["ip"], args["port"], handler=args["hand...
[ "def", "test_connect_connected", "(", "self", ",", "args", ")", ":", "milvus", "=", "get_milvus", "(", "args", "[", "\"ip\"", "]", ",", "args", "[", "\"port\"", "]", ",", "handler", "=", "args", "[", "\"handler\"", "]", ")", "# milvus.disconnect()", "# ass...
[ 49, 4 ]
[ 58, 21 ]
python
en
['en', 'error', 'th']
False
TestConnect._test_connect_ip_localhost
(self, args)
target: test connect with ip value: localhost method: set host localhost expected: connected is True
target: test connect with ip value: localhost method: set host localhost expected: connected is True
def _test_connect_ip_localhost(self, args): ''' target: test connect with ip value: localhost method: set host localhost expected: connected is True ''' milvus = get_milvus(args["ip"], args["port"], args["handler"])
[ "def", "_test_connect_ip_localhost", "(", "self", ",", "args", ")", ":", "milvus", "=", "get_milvus", "(", "args", "[", "\"ip\"", "]", ",", "args", "[", "\"port\"", "]", ",", "args", "[", "\"handler\"", "]", ")" ]
[ 61, 4 ]
[ 67, 70 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_connect_wrong_ip_null
(self, args)
target: test connect with wrong ip value method: set host null expected: not use default ip, connected is False
target: test connect with wrong ip value method: set host null expected: not use default ip, connected is False
def test_connect_wrong_ip_null(self, args): ''' target: test connect with wrong ip value method: set host null expected: not use default ip, connected is False ''' ip = "" with pytest.raises(Exception) as e: milvus = get_milvus(ip, args["port"], args["...
[ "def", "test_connect_wrong_ip_null", "(", "self", ",", "args", ")", ":", "ip", "=", "\"\"", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", "e", ":", "milvus", "=", "get_milvus", "(", "ip", ",", "args", "[", "\"port\"", "]", ",", "args", ...
[ 72, 4 ]
[ 80, 66 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_connect_uri
(self, args)
target: test connect with correct uri method: uri format and value are both correct expected: connected is True
target: test connect with correct uri method: uri format and value are both correct expected: connected is True
def test_connect_uri(self, args): ''' target: test connect with correct uri method: uri format and value are both correct expected: connected is True ''' uri_value = "tcp://%s:%s" % (args["ip"], args["port"]) milvus = get_milvus(args["ip"], args["port"], u...
[ "def", "test_connect_uri", "(", "self", ",", "args", ")", ":", "uri_value", "=", "\"tcp://%s:%s\"", "%", "(", "args", "[", "\"ip\"", "]", ",", "args", "[", "\"port\"", "]", ")", "milvus", "=", "get_milvus", "(", "args", "[", "\"ip\"", "]", ",", "args",...
[ 83, 4 ]
[ 90, 93 ]
python
en
['en', 'error', 'th']
False
TestConnect.test_connect_uri_null
(self, args)
target: test connect with null uri method: uri set null expected: connected is True
target: test connect with null uri method: uri set null expected: connected is True
def test_connect_uri_null(self, args): ''' target: test connect with null uri method: uri set null expected: connected is True ''' uri_value = "" if self.local_ip(args): milvus = get_milvus(None, None, uri=uri_value, handler=args["handler"]) ...
[ "def", "test_connect_uri_null", "(", "self", ",", "args", ")", ":", "uri_value", "=", "\"\"", "if", "self", ".", "local_ip", "(", "args", ")", ":", "milvus", "=", "get_milvus", "(", "None", ",", "None", ",", "uri", "=", "uri_value", ",", "handler", "="...
[ 93, 4 ]
[ 105, 87 ]
python
en
['en', 'error', 'th']
False