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
feature
(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None)
Check the conversion of extended precision data types.
Check the conversion of extended precision data types.
def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None): """Check the conversion of extended precision data types. """ self.context.node = self.context.cluster.node(node) self.context.mysql_node = self.context.cluster.node(mysql_node) for scenario in loads(current_mod...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "mysql_node", "=", "\"mysql1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluste...
[ 278, 0 ]
[ 286, 34 ]
python
en
['en', 'en', 'en']
True
has_flag
(compiler, flagname)
Return a boolean indicating whether a flag name is supported on the specified compiler.
Return a boolean indicating whether a flag name is supported on the specified compiler.
def has_flag(compiler, flagname): """Return a boolean indicating whether a flag name is supported on the specified compiler. """ import tempfile import os with tempfile.NamedTemporaryFile("w", suffix=".cpp", delete=False) as f: f.write("int main (int argc, char **argv) { return 0; }") ...
[ "def", "has_flag", "(", "compiler", ",", "flagname", ")", ":", "import", "tempfile", "import", "os", "with", "tempfile", ".", "NamedTemporaryFile", "(", "\"w\"", ",", "suffix", "=", "\".cpp\"", ",", "delete", "=", "False", ")", "as", "f", ":", "f", ".", ...
[ 36, 0 ]
[ 57, 15 ]
python
en
['en', 'en', 'en']
True
cpp_flag
(compiler)
Return the -std=c++[11/14/17] compiler flag. The newer version is prefered over c++11 (when it is available).
Return the -std=c++[11/14/17] compiler flag. The newer version is prefered over c++11 (when it is available).
def cpp_flag(compiler): """Return the -std=c++[11/14/17] compiler flag. The newer version is prefered over c++11 (when it is available). """ flags = ["-std=c++17", "-std=c++14", "-std=c++11"] for flag in flags: if has_flag(compiler, flag): return flag raise RuntimeError("Un...
[ "def", "cpp_flag", "(", "compiler", ")", ":", "flags", "=", "[", "\"-std=c++17\"", ",", "\"-std=c++14\"", ",", "\"-std=c++11\"", "]", "for", "flag", "in", "flags", ":", "if", "has_flag", "(", "compiler", ",", "flag", ")", ":", "return", "flag", "raise", ...
[ 60, 0 ]
[ 70, 83 ]
python
en
['en', 'da', 'en']
True
plain_text
(self)
Check that we can perform LDAP user authentication using `plain text` connection protocol.
Check that we can perform LDAP user authentication using `plain text` connection protocol.
def plain_text(self): """Check that we can perform LDAP user authentication using `plain text` connection protocol. """ servers = { "openldap1": { "host": "openldap1", "enable_tls": "no", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company...
[ "def", "plain_text", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth_dn_suffix\"", ":", "\",ou=users,dc=company,d...
[ 13, 0 ]
[ 27, 39 ]
python
en
['en', 'en', 'en']
True
plain_text_with_custom_port
(self)
Check that we can perform LDAP user authentication using `plain text` connection protocol with the server that uses custom port.
Check that we can perform LDAP user authentication using `plain text` connection protocol with the server that uses custom port.
def plain_text_with_custom_port(self): """Check that we can perform LDAP user authentication using `plain text` connection protocol with the server that uses custom port. """ servers = { "openldap3": { "host": "openldap3", "port": "3089", "enable_tls": "no", ...
[ "def", "plain_text_with_custom_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap3\"", ":", "{", "\"host\"", ":", "\"openldap3\"", ",", "\"port\"", ":", "\"3089\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",",...
[ 34, 0 ]
[ 50, 39 ]
python
en
['en', 'en', 'en']
True
tls_with_custom_port
(self)
Check that we can perform LDAP user authentication using `TLS` connection protocol with the server that uses custom port.
Check that we can perform LDAP user authentication using `TLS` connection protocol with the server that uses custom port.
def tls_with_custom_port(self): """Check that we can perform LDAP user authentication using `TLS` connection protocol with the server that uses custom port. """ servers = { "openldap4": { "host": "openldap4", "port": "6036", "tls_require_cert": "never", ...
[ "def", "tls_with_custom_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"6036\"", ",", "\"tls_require_cert\"", ":", "\"never\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",...
[ 57, 0 ]
[ 73, 39 ]
python
en
['en', 'en', 'en']
True
starttls_with_custom_port
(self)
Check that we can perform LDAP user authentication using `StartTLS` connection protocol with the server that uses custom port.
Check that we can perform LDAP user authentication using `StartTLS` connection protocol with the server that uses custom port.
def starttls_with_custom_port(self): """Check that we can perform LDAP user authentication using `StartTLS` connection protocol with the server that uses custom port. """ servers = { "openldap4": { "host": "openldap4", "port": "3089", "enable_tls": "starttls",...
[ "def", "starttls_with_custom_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"3089\"", ",", "\"enable_tls\"", ":", "\"starttls\"", ",", "\"tls_require_cert\"", ":", "\"never\""...
[ 80, 0 ]
[ 97, 39 ]
python
en
['en', 'en', 'en']
True
tls_connection
(enable_tls, tls_require_cert)
Try to login using LDAP user authentication over a TLS connection.
Try to login using LDAP user authentication over a TLS connection.
def tls_connection(enable_tls, tls_require_cert): """Try to login using LDAP user authentication over a TLS connection.""" servers = { "openldap2": { "host": "openldap2", "enable_tls": enable_tls, "tls_require_cert": tls_require_cert, "auth_dn_prefix": "cn...
[ "def", "tls_connection", "(", "enable_tls", ",", "tls_require_cert", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"enable_tls\"", ":", "enable_tls", ",", "\"tls_require_cert\"", ":", "tls_require_cert", ",", "\...
[ 99, 0 ]
[ 126, 43 ]
python
en
['en', 'en', 'en']
True
tls
(self)
Check that we can perform LDAP user authentication using `TLS` connection protocol.
Check that we can perform LDAP user authentication using `TLS` connection protocol.
def tls(self): """Check that we can perform LDAP user authentication using `TLS` connection protocol. """ for example in self.examples: tls_connection(*example)
[ "def", "tls", "(", "self", ")", ":", "for", "example", "in", "self", ".", "examples", ":", "tls_connection", "(", "*", "example", ")" ]
[ 143, 0 ]
[ 147, 32 ]
python
en
['en', 'en', 'en']
True
tls_enable_tls_default_yes
(self)
Check that the default value for the `enable_tls` is set to `yes`.
Check that the default value for the `enable_tls` is set to `yes`.
def tls_enable_tls_default_yes(self): """Check that the default value for the `enable_tls` is set to `yes`.""" servers = { "openldap2": { "host": "openldap2", "tls_require_cert": "never", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=...
[ "def", "tls_enable_tls_default_yes", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"tls_require_cert\"", ":", "\"never\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth_dn_suffix\"", ":", ...
[ 153, 0 ]
[ 166, 39 ]
python
en
['en', 'en', 'en']
True
tls_require_cert_default_demand
(self)
Check that the default value for the `tls_require_cert` is set to `demand`.
Check that the default value for the `tls_require_cert` is set to `demand`.
def tls_require_cert_default_demand(self): """Check that the default value for the `tls_require_cert` is set to `demand`.""" servers = { "openldap2": { "host": "openldap2", "enable_tls": "yes", "port": "636", "auth_dn_prefix": "cn=", "auth_dn_s...
[ "def", "tls_require_cert_default_demand", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"enable_tls\"", ":", "\"yes\"", ",", "\"port\"", ":", "\"636\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ...
[ 172, 0 ]
[ 186, 39 ]
python
en
['en', 'en', 'en']
True
starttls
(self)
Check that we can perform LDAP user authentication using legacy `StartTLS` connection protocol.
Check that we can perform LDAP user authentication using legacy `StartTLS` connection protocol.
def starttls(self): """Check that we can perform LDAP user authentication using legacy `StartTLS` connection protocol. """ for example in self.examples: tls_connection(*example)
[ "def", "starttls", "(", "self", ")", ":", "for", "example", "in", "self", ".", "examples", ":", "tls_connection", "(", "*", "example", ")" ]
[ 201, 0 ]
[ 205, 32 ]
python
en
['en', 'en', 'en']
True
tls_cipher_suite
(self)
Check that `tls_cipher_suite` parameter can be used specify allowed cipher suites.
Check that `tls_cipher_suite` parameter can be used specify allowed cipher suites.
def tls_cipher_suite(self): """Check that `tls_cipher_suite` parameter can be used specify allowed cipher suites.""" servers = { "openldap4": { "host": "openldap4", "port": "6036", "tls_require_cert": "never", "tls_cipher_suite": "SECURE256:+SECURE128:-VER...
[ "def", "tls_cipher_suite", "(", "self", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"6036\"", ",", "\"tls_require_cert\"", ":", "\"never\"", ",", "\"tls_cipher_suite\"", ":", "\"SECURE256:+SEC...
[ 211, 0 ]
[ 227, 39 ]
python
en
['en', 'en', 'en']
True
tls_minimum_protocol_version
(self, version, exitcode, message)
Check that `tls_minimum_protocol_version` parameter can be used specify to specify the minimum protocol version of SSL/TLS.
Check that `tls_minimum_protocol_version` parameter can be used specify to specify the minimum protocol version of SSL/TLS.
def tls_minimum_protocol_version(self, version, exitcode, message): """Check that `tls_minimum_protocol_version` parameter can be used specify to specify the minimum protocol version of SSL/TLS.""" servers = { "openldap4": { "host": "openldap4", "port": "6036", "...
[ "def", "tls_minimum_protocol_version", "(", "self", ",", "version", ",", "exitcode", ",", "message", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"6036\"", ",", "\"tls_require_cert\"", ":", ...
[ 241, 0 ]
[ 261, 38 ]
python
en
['en', 'en', 'en']
True
createDatasetFile
(destDir, **kwargs)
This function extends genedataset.dataset.createDatasetFile() by adding more objects to the .h5 file created, as these objects are used by BioPyramid. Parameters ---------- The same parameters as genedataset.dataset.createDatasetFile() are needed. In addition we need: sampleGroupsDisplayed: (list) a subset list...
This function extends genedataset.dataset.createDatasetFile() by adding more objects to the .h5 file created, as these objects are used by BioPyramid.
def createDatasetFile(destDir, **kwargs): """ This function extends genedataset.dataset.createDatasetFile() by adding more objects to the .h5 file created, as these objects are used by BioPyramid. Parameters ---------- The same parameters as genedataset.dataset.createDatasetFile() are needed. In addition we need...
[ "def", "createDatasetFile", "(", "destDir", ",", "*", "*", "kwargs", ")", ":", "sampleGroupsDisplayed", "=", "kwargs", ".", "get", "(", "'sampleGroupsDisplayed'", ",", "[", "]", ")", "sampleGroupOrdering", "=", "kwargs", ".", "get", "(", "'sampleGroupOrdering'",...
[ 15, 0 ]
[ 43, 30 ]
python
en
['en', 'error', 'th']
False
instantiateDatasetFile
(ds, sampleGroupsDisplayed, sampleGroupOrdering, sampleGroupColours, pca)
This function is used to
This function is used to
def instantiateDatasetFile(ds, sampleGroupsDisplayed, sampleGroupOrdering, sampleGroupColours, pca): """This function is used to """ store = ds.hdfStore() store['/series/sampleGroupsDisplayed'] = pandas.Series(sampleGroupsDisplayed) store['/series/sampleGroupOrdering'] = pandas.Series(sampleGroupOrdering) store[...
[ "def", "instantiateDatasetFile", "(", "ds", ",", "sampleGroupsDisplayed", ",", "sampleGroupOrdering", ",", "sampleGroupColours", ",", "pca", ")", ":", "store", "=", "ds", ".", "hdfStore", "(", ")", "store", "[", "'/series/sampleGroupsDisplayed'", "]", "=", "pandas...
[ 47, 0 ]
[ 55, 14 ]
python
en
['en', 'en', 'en']
True
datasetAttributes
(filepath, includeFilepath=False)
Return a dictionary of dataset attributes from hdf5 file: (name, fullname, species, version, description, pubmed_id, parent) This is the same as attributes() method on the BPDataset instant, but should be faster since it only extracts the attributes rather than all other values. If includeFilepath is true, fil...
Return a dictionary of dataset attributes from hdf5 file: (name, fullname, species, version, description, pubmed_id, parent) This is the same as attributes() method on the BPDataset instant, but should be faster since it only extracts the attributes rather than all other values. If includeFilepath is true, fil...
def datasetAttributes(filepath, includeFilepath=False): """ Return a dictionary of dataset attributes from hdf5 file: (name, fullname, species, version, description, pubmed_id, parent) This is the same as attributes() method on the BPDataset instant, but should be faster since it only extracts the attributes rath...
[ "def", "datasetAttributes", "(", "filepath", ",", "includeFilepath", "=", "False", ")", ":", "import", "os", "if", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "attributes", "=", "mutex", ".", "hdf_attr_to_dict", "(", "filepath", ",", "'/se...
[ 58, 0 ]
[ 78, 11 ]
python
en
['en', 'error', 'th']
False
BPDataset.__init__
(self, pathToHDF)
Instantiate the object by reading the hdf file given by pathToHDF
Instantiate the object by reading the hdf file given by pathToHDF
def __init__(self, pathToHDF): """Instantiate the object by reading the hdf file given by pathToHDF """ super(BPDataset, self).__init__(pathToHDF) self._sampleGroupColours = pandas.read_hdf(self.filepath, '/series/sampleGroupColours') self._sampleGroupOrdering = pandas.read_hdf(self.filepath, '/series/samp...
[ "def", "__init__", "(", "self", ",", "pathToHDF", ")", ":", "super", "(", "BPDataset", ",", "self", ")", ".", "__init__", "(", "pathToHDF", ")", "self", ".", "_sampleGroupColours", "=", "pandas", ".", "read_hdf", "(", "self", ".", "filepath", ",", "'/ser...
[ 101, 1 ]
[ 109, 61 ]
python
en
['en', 'en', 'en']
True
BPDataset.sampleGroups
(self, returnType=None)
Return a list of sample group names eg: ["celltype","tissue"]. Override base class method in order to ensure correct ordering and filtering. Parameters ---------- returnType: {None, "display"}. If display, it returns only sample groups defined as for display. This is useful when not all sample groups are ...
Return a list of sample group names eg: ["celltype","tissue"]. Override base class method in order to ensure correct ordering and filtering.
def sampleGroups(self, returnType=None): """ Return a list of sample group names eg: ["celltype","tissue"]. Override base class method in order to ensure correct ordering and filtering. Parameters ---------- returnType: {None, "display"}. If display, it returns only sample groups defined as for display. ...
[ "def", "sampleGroups", "(", "self", ",", "returnType", "=", "None", ")", ":", "if", "returnType", "==", "\"display\"", ":", "return", "self", ".", "_sampleGroupsDisplayed", ".", "tolist", "(", ")", "else", ":", "return", "super", "(", "BPDataset", ",", "se...
[ 111, 1 ]
[ 128, 47 ]
python
en
['en', 'error', 'th']
False
BPDataset.sampleGroupItems
(self, sampleGroup=None, groupBy=None, duplicates=False)
Return sample group items belonging to sampleGroup, eg: ["B1","B2"]. Override base class method to enforce correct ordering. Parameters ---------- sampleGroup: name of sample group, eg: 'celltype' groupBy: name of another sample group for grouping, eg: 'cell_lineage' duplicates: boolean to return a li...
Return sample group items belonging to sampleGroup, eg: ["B1","B2"]. Override base class method to enforce correct ordering. Parameters ---------- sampleGroup: name of sample group, eg: 'celltype' groupBy: name of another sample group for grouping, eg: 'cell_lineage' duplicates: boolean to return a li...
def sampleGroupItems(self, sampleGroup=None, groupBy=None, duplicates=False): """ Return sample group items belonging to sampleGroup, eg: ["B1","B2"]. Override base class method to enforce correct ordering. Parameters ---------- sampleGroup: name of sample group, eg: 'celltype' groupBy: name of another...
[ "def", "sampleGroupItems", "(", "self", ",", "sampleGroup", "=", "None", ",", "groupBy", "=", "None", ",", "duplicates", "=", "False", ")", ":", "df", "=", "self", ".", "samples", "sgo", "=", "self", ".", "_sampleGroupOrdering", "if", "sampleGroup", "in", ...
[ 130, 1 ]
[ 191, 12 ]
python
en
['en', 'error', 'th']
False
BPDataset.sampleGroupColours
(self, sampleGroup=None)
Return colour dictionary given sampleGroup, eg: {'Stem Cell':'#cccccc', ...} If sampleGroup==None, returns the dictionary with enclosing sample groups as keys, eg: {'cell_lineage': {'Stem Cell':'#cccccc', ...}, ...} Parameters: sampleGroup: string, a member of self.sampleGroups()
Return colour dictionary given sampleGroup, eg: {'Stem Cell':'#cccccc', ...} If sampleGroup==None, returns the dictionary with enclosing sample groups as keys, eg: {'cell_lineage': {'Stem Cell':'#cccccc', ...}, ...} Parameters: sampleGroup: string, a member of self.sampleGroups()
def sampleGroupColours(self, sampleGroup=None): """Return colour dictionary given sampleGroup, eg: {'Stem Cell':'#cccccc', ...} If sampleGroup==None, returns the dictionary with enclosing sample groups as keys, eg: {'cell_lineage': {'Stem Cell':'#cccccc', ...}, ...} Parameters: sampleGroup: string, a mem...
[ "def", "sampleGroupColours", "(", "self", ",", "sampleGroup", "=", "None", ")", ":", "series", "=", "self", ".", "_sampleGroupColours", "if", "sampleGroup", ":", "return", "series", "[", "sampleGroup", "]", "if", "sampleGroup", "in", "series", "else", "{", "...
[ 193, 1 ]
[ 207, 26 ]
python
en
['en', 'en', 'en']
True
BPDataset.sampleGroupOrdering
(self, sampleGroup=None)
Return list of ordered sample group items given sampleGroup, eg: ['LSK','MPP', ...] If sampleGroup==None, returns the dictionary with enclosing sample groups as keys, eg: {'celltype': ['LSK','MPP', ...], ...} Parameters: sampleGroup: string, a member of self.sampleGroups()
Return list of ordered sample group items given sampleGroup, eg: ['LSK','MPP', ...] If sampleGroup==None, returns the dictionary with enclosing sample groups as keys, eg: {'celltype': ['LSK','MPP', ...], ...} Parameters: sampleGroup: string, a member of self.sampleGroups()
def sampleGroupOrdering(self, sampleGroup=None): """Return list of ordered sample group items given sampleGroup, eg: ['LSK','MPP', ...] If sampleGroup==None, returns the dictionary with enclosing sample groups as keys, eg: {'celltype': ['LSK','MPP', ...], ...} Parameters: sampleGroup: string, a member of...
[ "def", "sampleGroupOrdering", "(", "self", ",", "sampleGroup", "=", "None", ")", ":", "series", "=", "self", ".", "_sampleGroupOrdering", "if", "sampleGroup", ":", "return", "series", "[", "sampleGroup", "]", "if", "sampleGroup", "in", "series", "else", "{", ...
[ 209, 1 ]
[ 222, 26 ]
python
en
['en', 'no', 'en']
True
BPDataset.sampleTable
(self)
Ensure that 'sampleId' is always the name of the index, just in case it was left out.
Ensure that 'sampleId' is always the name of the index, just in case it was left out.
def sampleTable(self): """Ensure that 'sampleId' is always the name of the index, just in case it was left out. """ df = self.samples df.index.name = 'sampleId' return df
[ "def", "sampleTable", "(", "self", ")", ":", "df", "=", "self", ".", "samples", "df", ".", "index", ".", "name", "=", "'sampleId'", "return", "df" ]
[ 224, 1 ]
[ 229, 11 ]
python
en
['en', 'en', 'en']
True
dict_setup
(node, table_name, dict_name)
Setup and teardown of table and dictionary needed for the tests.
Setup and teardown of table and dictionary needed for the tests.
def dict_setup(node, table_name, dict_name): """Setup and teardown of table and dictionary needed for the tests. """ try: with Given("I have a table"): node.query(f"CREATE TABLE {table_name} (key UInt64, val UInt64) Engine=Memory()") with And("I have a dictionary"): ...
[ "def", "dict_setup", "(", "node", ",", "table_name", ",", "dict_name", ")", ":", "try", ":", "with", "Given", "(", "\"I have a table\"", ")", ":", "node", ".", "query", "(", "f\"CREATE TABLE {table_name} (key UInt64, val UInt64) Engine=Memory()\"", ")", "with", "And...
[ 8, 0 ]
[ 26, 72 ]
python
en
['en', 'en', 'en']
True
config_privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD CONFIG` if and only if they have `SYSTEM RELOAD CONFIG` privilege granted directly.
Check that a user is able to execute `SYSTEM RELOAD CONFIG` if and only if they have `SYSTEM RELOAD CONFIG` privilege granted directly.
def config_privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD CONFIG` if and only if they have `SYSTEM RELOAD CONFIG` privilege granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(nod...
[ "def", "config_privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\...
[ 29, 0 ]
[ 43, 80 ]
python
en
['en', 'en', 'en']
True
config_privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD CONFIG` if and only if they have `SYSTEM RELOAD CONFIG` privilege granted via role.
Check that a user is able to execute `SYSTEM RELOAD CONFIG` if and only if they have `SYSTEM RELOAD CONFIG` privilege granted via role.
def config_privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD CONFIG` if and only if they have `SYSTEM RELOAD CONFIG` privilege granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = s...
[ "def", "config_privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", ...
[ 46, 0 ]
[ 64, 80 ]
python
en
['en', 'en', 'en']
True
config
(self, privilege, grant_target_name, user_name, node=None)
Run checks for `SYSTEM RELOAD CONFIG` privilege.
Run checks for `SYSTEM RELOAD CONFIG` privilege.
def config(self, privilege, grant_target_name, user_name, node=None): """Run checks for `SYSTEM RELOAD CONFIG` privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenario("SYSTEM RELOAD CONFIG without privilege"): ...
[ "def", "config", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "is",...
[ 77, 0 ]
[ 115, 51 ]
python
it
['it', 'it', 'en']
True
dictionary_privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD DICTIONARY` if and only if they have `SYSTEM RELOAD DICTIONARY` privilege granted directly.
Check that a user is able to execute `SYSTEM RELOAD DICTIONARY` if and only if they have `SYSTEM RELOAD DICTIONARY` privilege granted directly.
def dictionary_privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD DICTIONARY` if and only if they have `SYSTEM RELOAD DICTIONARY` privilege granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node w...
[ "def", "dictionary_privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", ...
[ 118, 0 ]
[ 132, 80 ]
python
en
['en', 'en', 'en']
True
dictionary_privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD DICTIONARY` if and only if they have `SYSTEM RELOAD DICTIONARY` privilege granted via role.
Check that a user is able to execute `SYSTEM RELOAD DICTIONARY` if and only if they have `SYSTEM RELOAD DICTIONARY` privilege granted via role.
def dictionary_privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD DICTIONARY` if and only if they have `SYSTEM RELOAD DICTIONARY` privilege granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: ...
[ "def", "dictionary_privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node...
[ 135, 0 ]
[ 153, 80 ]
python
en
['en', 'en', 'en']
True
dictionary
(self, privilege, grant_target_name, user_name, node=None)
Run checks for `SYSTEM RELOAD DICTIONARY` privilege.
Run checks for `SYSTEM RELOAD DICTIONARY` privilege.
def dictionary(self, privilege, grant_target_name, user_name, node=None): """Run checks for `SYSTEM RELOAD DICTIONARY` privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenario("SYSTEM RELOAD DICTIONARY without p...
[ "def", "dictionary", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "...
[ 167, 0 ]
[ 220, 55 ]
python
en
['it', 'en', 'en']
True
dictionaries_privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD DICTIONARIES` if and only if they have `SYSTEM RELOAD DICTIONARIES` privilege granted directly.
Check that a user is able to execute `SYSTEM RELOAD DICTIONARIES` if and only if they have `SYSTEM RELOAD DICTIONARIES` privilege granted directly.
def dictionaries_privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD DICTIONARIES` if and only if they have `SYSTEM RELOAD DICTIONARIES` privilege granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node ...
[ "def", "dictionaries_privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",",...
[ 223, 0 ]
[ 237, 80 ]
python
en
['en', 'en', 'en']
True
dictionaries_privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD DICTIONARIES` if and only if they have `SYSTEM RELOAD DICTIONARIES` privilege granted via role.
Check that a user is able to execute `SYSTEM RELOAD DICTIONARIES` if and only if they have `SYSTEM RELOAD DICTIONARIES` privilege granted via role.
def dictionaries_privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD DICTIONARIES` if and only if they have `SYSTEM RELOAD DICTIONARIES` privilege granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None...
[ "def", "dictionaries_privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "no...
[ 240, 0 ]
[ 258, 80 ]
python
en
['en', 'en', 'en']
True
dictionaries
(self, privilege, grant_target_name, user_name, node=None)
Run checks for `SYSTEM RELOAD DICTIONARIES` privilege.
Run checks for `SYSTEM RELOAD DICTIONARIES` privilege.
def dictionaries(self, privilege, grant_target_name, user_name, node=None): """Run checks for `SYSTEM RELOAD DICTIONARIES` privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenario("SYSTEM RELOAD DICTIONARIES wit...
[ "def", "dictionaries", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", ...
[ 272, 0 ]
[ 310, 51 ]
python
en
['it', 'en', 'en']
True
embedded_dictionaries_privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD EMBEDDED DICTIONARIES` if and only if they have `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege granted directly.
Check that a user is able to execute `SYSTEM RELOAD EMBEDDED DICTIONARIES` if and only if they have `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege granted directly.
def embedded_dictionaries_privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD EMBEDDED DICTIONARIES` if and only if they have `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege granted directly. """ user_name = f"user_{getuid()}" if node is None: ...
[ "def", "embedded_dictionaries_privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node...
[ 313, 0 ]
[ 327, 80 ]
python
en
['en', 'en', 'en']
True
embedded_dictionaries_privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM RELOAD EMBEDDED DICTIONARIES` if and only if they have `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege granted via role.
Check that a user is able to execute `SYSTEM RELOAD EMBEDDED DICTIONARIES` if and only if they have `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege granted via role.
def embedded_dictionaries_privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM RELOAD EMBEDDED DICTIONARIES` if and only if they have `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getu...
[ "def", "embedded_dictionaries_privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", "...
[ 330, 0 ]
[ 348, 80 ]
python
en
['en', 'en', 'en']
True
embedded_dictionaries
(self, privilege, grant_target_name, user_name, node=None)
Run checks for `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege.
Run checks for `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege.
def embedded_dictionaries(self, privilege, grant_target_name, user_name, node=None): """Run checks for `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenario("SYSTEM RELOA...
[ "def", "embedded_dictionaries", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", ...
[ 361, 0 ]
[ 399, 51 ]
python
en
['it', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of SYSTEM RELOAD.
Check the RBAC functionality of SYSTEM RELOAD.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of SYSTEM RELOAD. """ self.context.node = self.context.cluster.node(node) Suite(run=config_privileges_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=config_privileges_granted_via_role, setup=instrument_click...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "config_privileges_granted_directly", ...
[ 408, 0 ]
[ 420, 104 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check encryption functions usage compatibility with MySQL.
Check encryption functions usage compatibility with MySQL.
def feature(self, node="clickhouse1"): """Check encryption functions usage compatibility with MySQL. """ self.context.node = self.context.cluster.node(node) Feature(run=load("aes_encryption.tests.compatibility.mysql.table_engine", "feature"), flags=TE) Feature(run=load("aes_encryption.tests.compati...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Feature", "(", "run", "=", "load", "(", "\"aes_encryption.te...
[ 9, 0 ]
[ 17, 97 ]
python
en
['en', 'en', 'en']
True
alter_user_granted_directly
(self, node=None)
Check that a user is able to execute `ALTER USER` with privileges are granted directly.
Check that a user is able to execute `ALTER USER` with privileges are granted directly.
def alter_user_granted_directly(self, node=None): """Check that a user is able to execute `ALTER USER` with privileges are granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite(run=alter_user, ...
[ "def", "alter_user_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\"{user_...
[ 8, 0 ]
[ 22, 80 ]
python
en
['en', 'en', 'en']
True
alter_user_granted_via_role
(self, node=None)
Check that a user is able to execute `ALTER USER` with privileges are granted through a role.
Check that a user is able to execute `ALTER USER` with privileges are granted through a role.
def alter_user_granted_via_role(self, node=None): """Check that a user is able to execute `ALTER USER` with privileges are granted through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"...
[ "def", "alter_user_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with"...
[ 25, 0 ]
[ 43, 80 ]
python
en
['en', 'en', 'en']
True
alter_user
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `ALTER USER` when they have the necessary privilege.
Check that user is only able to execute `ALTER USER` when they have the necessary privilege.
def alter_user(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `ALTER USER` when they have the necessary privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scen...
[ "def", "alter_user", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "...
[ 51, 0 ]
[ 111, 55 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of ALTER USER.
Check the RBAC functionality of ALTER USER.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of ALTER USER. """ self.context.node = self.context.cluster.node(node) Suite(run=alter_user_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=alter_user_granted_via_role, setup=instrument_clickhouse_server_log)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "alter_user_granted_directly", ",", ...
[ 120, 0 ]
[ 126, 82 ]
python
en
['en', 'en', 'en']
True
MultiCostDeathGdpControllable.__init__
(self, N_region, N_country, ratio_death_to_R=0.005, use_constraints=False, beta_default=0.5 )
Multi-objective cost functions with two costs: death toll and gdp recess. It is controllable by three parameters: the mixing parameter beta, and one constraints of maximum cumulative cost for each of them. Parameters ---------- N_region: int Population size of the r...
Multi-objective cost functions with two costs: death toll and gdp recess. It is controllable by three parameters: the mixing parameter beta, and one constraints of maximum cumulative cost for each of them.
def __init__(self, N_region, N_country, ratio_death_to_R=0.005, use_constraints=False, beta_default=0.5 ): """ Multi-objective cost functions with two costs: death toll and gdp recess. It is controllabl...
[ "def", "__init__", "(", "self", ",", "N_region", ",", "N_country", ",", "ratio_death_to_R", "=", "0.005", ",", "use_constraints", "=", "False", ",", "beta_default", "=", "0.5", ")", ":", "super", "(", ")", ".", "__init__", "(", "use_constraints", "=", "use...
[ 10, 4 ]
[ 54, 37 ]
python
en
['en', 'error', 'th']
False
MultiCostDeathGdpControllable.sample_goal_params
(self)
Sample goal parameters. Returns ------- goal: 1D nd.array Made of three params in [0, 1]: beta is the mixing parameter, the following are normalized constraints on the maximal values of cumulative costs.
Sample goal parameters.
def sample_goal_params(self): """ Sample goal parameters. Returns ------- goal: 1D nd.array Made of three params in [0, 1]: beta is the mixing parameter, the following are normalized constraints on the maximal values of cumulative costs. """ ...
[ "def", "sample_goal_params", "(", "self", ")", ":", "beta", "=", "np", ".", "random", ".", "rand", "(", ")", "if", "self", ".", "use_constraints", ":", "r", "=", "np", ".", "random", ".", "rand", "(", ")", "if", "r", "<", "0.25", ":", "constraints"...
[ 56, 4 ]
[ 79, 29 ]
python
en
['en', 'error', 'th']
False
MultiCostDeathGdpControllable.set_goal_params
(self, goal)
Set a goal. Parameters ---------- goal: 1D nd.array Should be of size 3: mixing parameter beta and normalized constraints, all in [0, 1].
Set a goal.
def set_goal_params(self, goal): """ Set a goal. Parameters ---------- goal: 1D nd.array Should be of size 3: mixing parameter beta and normalized constraints, all in [0, 1]. """ self.beta = goal[0] if self.use_constraints: if len...
[ "def", "set_goal_params", "(", "self", ",", "goal", ")", ":", "self", ".", "beta", "=", "goal", "[", "0", "]", "if", "self", ".", "use_constraints", ":", "if", "len", "(", "goal", "[", "1", ":", "]", ")", "==", "self", ".", "nb_costs", ":", "for"...
[ 112, 4 ]
[ 129, 40 ]
python
en
['en', 'error', 'th']
False
MultiCostDeathGdpControllable.compute_cost
(self, previous_state, state, label_to_id, action, others={})
Compute each cost and an aggregated measure of costs as well as constraints. Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimension # of states). state: 2D nd.array Current model states (either 1D or...
Compute each cost and an aggregated measure of costs as well as constraints.
def compute_cost(self, previous_state, state, label_to_id, action, others={}): """ Compute each cost and an aggregated measure of costs as well as constraints. Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimensi...
[ "def", "compute_cost", "(", "self", ",", "previous_state", ",", "state", ",", "label_to_id", ",", "action", ",", "others", "=", "{", "}", ")", ":", "previous_state", "=", "np", ".", "atleast_2d", "(", "previous_state", ")", "state", "=", "np", ".", "atle...
[ 132, 4 ]
[ 173, 55 ]
python
en
['en', 'error', 'th']
False
MultiCostDeathGdpControllable.compute_deaths
(self, previous_state, state, label_to_id, action, others={})
Compute death toll Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimension # of states). state: 2D nd.array Current model states (either 1D or 2D with first dimension # of states). label_to_id:...
Compute death toll
def compute_deaths(self, previous_state, state, label_to_id, action, others={}): """ Compute death toll Parameters ---------- previous_state: 2D nd.array Previous model states (either 1D or 2D with first dimension # of states). state: 2D nd.array C...
[ "def", "compute_deaths", "(", "self", ",", "previous_state", ",", "state", ",", "label_to_id", ",", "action", ",", "others", "=", "{", "}", ")", ":", "return", "self", ".", "costs", "[", "0", "]", ".", "compute_cost", "(", "previous_state", ",", "state",...
[ 175, 4 ]
[ 196, 93 ]
python
en
['en', 'error', 'th']
False
MultiCostDeathGdpControllable.compute_aggregated_cost
(self, costs, beta=None, constraints=None)
Compute aggregated measure of cost with mixing beta and optional constraints. Parameters ---------- costs: 2D nd.array Array of costs (n_points, n_costs). beta: float Mixing parameters for the two costs. constraints: nd.array of bools, optional ...
Compute aggregated measure of cost with mixing beta and optional constraints. Parameters ---------- costs: 2D nd.array Array of costs (n_points, n_costs). beta: float Mixing parameters for the two costs. constraints: nd.array of bools, optional ...
def compute_aggregated_cost(self, costs, beta=None, constraints=None): """ Compute aggregated measure of cost with mixing beta and optional constraints. Parameters ---------- costs: 2D nd.array Array of costs (n_points, n_costs). beta: float Mixing...
[ "def", "compute_aggregated_cost", "(", "self", ",", "costs", ",", "beta", "=", "None", ",", "constraints", "=", "None", ")", ":", "if", "beta", "is", "None", ":", "beta", "=", "self", ".", "beta", "factors", "=", "np", ".", "array", "(", "[", "1", ...
[ 198, 4 ]
[ 224, 30 ]
python
en
['en', 'error', 'th']
False
lovasz_grad
(gt_sorted)
Computes gradient of the Lovasz extension w.r.t sorted errors See Alg. 1 in paper
Computes gradient of the Lovasz extension w.r.t sorted errors See Alg. 1 in paper
def lovasz_grad(gt_sorted): """ Computes gradient of the Lovasz extension w.r.t sorted errors See Alg. 1 in paper """ p = len(gt_sorted) gts = gt_sorted.sum() intersection = gts - gt_sorted.float().cumsum(0) union = gts + (1 - gt_sorted).float().cumsum(0) jaccard = 1. - intersection ...
[ "def", "lovasz_grad", "(", "gt_sorted", ")", ":", "p", "=", "len", "(", "gt_sorted", ")", "gts", "=", "gt_sorted", ".", "sum", "(", ")", "intersection", "=", "gts", "-", "gt_sorted", ".", "float", "(", ")", ".", "cumsum", "(", "0", ")", "union", "=...
[ 39, 0 ]
[ 51, 18 ]
python
en
['en', 'error', 'th']
False
iou_binary
(preds, labels, EMPTY=1., ignore=None, per_image=True)
IoU for foreground class binary: 1 foreground, 0 background
IoU for foreground class binary: 1 foreground, 0 background
def iou_binary(preds, labels, EMPTY=1., ignore=None, per_image=True): """ IoU for foreground class binary: 1 foreground, 0 background """ if not per_image: preds, labels = (preds,), (labels,) ious = [] for pred, label in zip(preds, labels): intersection = ((label == 1) & (pre...
[ "def", "iou_binary", "(", "preds", ",", "labels", ",", "EMPTY", "=", "1.", ",", "ignore", "=", "None", ",", "per_image", "=", "True", ")", ":", "if", "not", "per_image", ":", "preds", ",", "labels", "=", "(", "preds", ",", ")", ",", "(", "labels", ...
[ 54, 0 ]
[ 71, 20 ]
python
en
['en', 'error', 'th']
False
iou
(preds, labels, C, EMPTY=1., ignore=None, per_image=False)
Array of IoU for each (non ignored) class
Array of IoU for each (non ignored) class
def iou(preds, labels, C, EMPTY=1., ignore=None, per_image=False): """ Array of IoU for each (non ignored) class """ if not per_image: preds, labels = (preds,), (labels,) ious = [] for pred, label in zip(preds, labels): iou = [] for i in range(C): if i != igno...
[ "def", "iou", "(", "preds", ",", "labels", ",", "C", ",", "EMPTY", "=", "1.", ",", "ignore", "=", "None", ",", "per_image", "=", "False", ")", ":", "if", "not", "per_image", ":", "preds", ",", "labels", "=", "(", "preds", ",", ")", ",", "(", "l...
[ 74, 0 ]
[ 93, 31 ]
python
en
['en', 'error', 'th']
False
mean
(l, ignore_nan=False, empty=0)
nanmean compatible with generators.
nanmean compatible with generators.
def mean(l, ignore_nan=False, empty=0): """ nanmean compatible with generators. """ l = iter(l) if ignore_nan: l = ifilterfalse(isnan, l) try: n = 1 acc = next(l) except StopIteration: if empty == 'raise': raise ValueError('Empty mean') ret...
[ "def", "mean", "(", "l", ",", "ignore_nan", "=", "False", ",", "empty", "=", "0", ")", ":", "l", "=", "iter", "(", "l", ")", "if", "ignore_nan", ":", "l", "=", "ifilterfalse", "(", "isnan", ",", "l", ")", "try", ":", "n", "=", "1", "acc", "="...
[ 101, 0 ]
[ 119, 18 ]
python
en
['en', 'error', 'th']
False
lovasz_hinge
(logits, labels, per_image=True, ignore=None)
Binary Lovasz hinge loss logits: [B, H, W] Variable, logits at each pixel (between -\infty and +\infty) labels: [B, H, W] Tensor, binary ground truth masks (0 or 1) per_image: compute the loss per image instead of per batch ignore: void class id
Binary Lovasz hinge loss logits: [B, H, W] Variable, logits at each pixel (between -\infty and +\infty) labels: [B, H, W] Tensor, binary ground truth masks (0 or 1) per_image: compute the loss per image instead of per batch ignore: void class id
def lovasz_hinge(logits, labels, per_image=True, ignore=None): """ Binary Lovasz hinge loss logits: [B, H, W] Variable, logits at each pixel (between -\infty and +\infty) labels: [B, H, W] Tensor, binary ground truth masks (0 or 1) per_image: compute the loss per image instead of per batch ...
[ "def", "lovasz_hinge", "(", "logits", ",", "labels", ",", "per_image", "=", "True", ",", "ignore", "=", "None", ")", ":", "if", "per_image", ":", "loss", "=", "mean", "(", "lovasz_hinge_flat", "(", "*", "flatten_binary_scores", "(", "log", ".", "unsqueeze"...
[ 121, 0 ]
[ 134, 15 ]
python
en
['en', 'error', 'th']
False
lovasz_hinge_flat
(logits, labels)
Binary Lovasz hinge loss logits: [P] Variable, logits at each prediction (between -\infty and +\infty) labels: [P] Tensor, binary ground truth labels (0 or 1) ignore: label to ignore
Binary Lovasz hinge loss logits: [P] Variable, logits at each prediction (between -\infty and +\infty) labels: [P] Tensor, binary ground truth labels (0 or 1) ignore: label to ignore
def lovasz_hinge_flat(logits, labels): """ Binary Lovasz hinge loss logits: [P] Variable, logits at each prediction (between -\infty and +\infty) labels: [P] Tensor, binary ground truth labels (0 or 1) ignore: label to ignore """ if len(labels) == 0: # only void pixels, the gra...
[ "def", "lovasz_hinge_flat", "(", "logits", ",", "labels", ")", ":", "if", "len", "(", "labels", ")", "==", "0", ":", "# only void pixels, the gradients should be 0", "return", "logits", ".", "sum", "(", ")", "*", "0.", "signs", "=", "2.", "*", "labels", "....
[ 137, 0 ]
[ 154, 15 ]
python
en
['en', 'error', 'th']
False
flatten_binary_scores
(scores, labels, ignore=None)
Flattens predictions in the batch (binary case) Remove labels equal to 'ignore'
Flattens predictions in the batch (binary case) Remove labels equal to 'ignore'
def flatten_binary_scores(scores, labels, ignore=None): """ Flattens predictions in the batch (binary case) Remove labels equal to 'ignore' """ scores = scores.view(-1) labels = labels.view(-1) if ignore is None: return scores, labels valid = (labels != ignore) vscores = scor...
[ "def", "flatten_binary_scores", "(", "scores", ",", "labels", ",", "ignore", "=", "None", ")", ":", "scores", "=", "scores", ".", "view", "(", "-", "1", ")", "labels", "=", "labels", ".", "view", "(", "-", "1", ")", "if", "ignore", "is", "None", ":...
[ 157, 0 ]
[ 169, 27 ]
python
en
['en', 'error', 'th']
False
lovasz_softmax
(probas, labels, classes='present', per_image=False, ignore=None)
Multi-class Lovasz-Softmax loss probas: [B, C, H, W] Variable, class probabilities at each prediction (between 0 and 1). Interpreted as binary (sigmoid) output with outputs of size [B, H, W]. labels: [B, H, W] Tensor, ground truth labels (between 0 and C - 1) classes: 'all' for all,...
Multi-class Lovasz-Softmax loss probas: [B, C, H, W] Variable, class probabilities at each prediction (between 0 and 1). Interpreted as binary (sigmoid) output with outputs of size [B, H, W]. labels: [B, H, W] Tensor, ground truth labels (between 0 and C - 1) classes: 'all' for all,...
def lovasz_softmax(probas, labels, classes='present', per_image=False, ignore=None): """ Multi-class Lovasz-Softmax loss probas: [B, C, H, W] Variable, class probabilities at each prediction (between 0 and 1). Interpreted as binary (sigmoid) output with outputs of size [B, H, W]. label...
[ "def", "lovasz_softmax", "(", "probas", ",", "labels", ",", "classes", "=", "'present'", ",", "per_image", "=", "False", ",", "ignore", "=", "None", ")", ":", "if", "per_image", ":", "loss", "=", "mean", "(", "lovasz_softmax_flat", "(", "*", "flatten_proba...
[ 171, 0 ]
[ 186, 15 ]
python
en
['en', 'error', 'th']
False
lovasz_softmax_flat
(probas, labels, classes='present')
Multi-class Lovasz-Softmax loss probas: [P, C] Variable, class probabilities at each prediction (between 0 and 1) labels: [P] Tensor, ground truth labels (between 0 and C - 1) classes: 'all' for all, 'present' for classes present in labels, or a list of classes to average.
Multi-class Lovasz-Softmax loss probas: [P, C] Variable, class probabilities at each prediction (between 0 and 1) labels: [P] Tensor, ground truth labels (between 0 and C - 1) classes: 'all' for all, 'present' for classes present in labels, or a list of classes to average.
def lovasz_softmax_flat(probas, labels, classes='present'): """ Multi-class Lovasz-Softmax loss probas: [P, C] Variable, class probabilities at each prediction (between 0 and 1) labels: [P] Tensor, ground truth labels (between 0 and C - 1) classes: 'all' for all, 'present' for classes present ...
[ "def", "lovasz_softmax_flat", "(", "probas", ",", "labels", ",", "classes", "=", "'present'", ")", ":", "if", "probas", ".", "numel", "(", ")", "==", "0", ":", "# only void pixels, the gradients should be 0", "return", "probas", "*", "0.", "C", "=", "probas", ...
[ 189, 0 ]
[ 217, 23 ]
python
en
['en', 'error', 'th']
False
flatten_probas
(probas, labels, ignore=None)
Flattens predictions in the batch
Flattens predictions in the batch
def flatten_probas(probas, labels, ignore=None): """ Flattens predictions in the batch """ if probas.dim() == 3: # assumes output of a sigmoid layer B, H, W = probas.size() probas = probas.view(B, 1, H, W) B, C, H, W = probas.size() probas = probas.permute(0, 2, 3, 1).con...
[ "def", "flatten_probas", "(", "probas", ",", "labels", ",", "ignore", "=", "None", ")", ":", "if", "probas", ".", "dim", "(", ")", "==", "3", ":", "# assumes output of a sigmoid layer", "B", ",", "H", ",", "W", "=", "probas", ".", "size", "(", ")", "...
[ 220, 0 ]
[ 236, 27 ]
python
en
['en', 'error', 'th']
False
xloss
(logits, labels, ignore=None)
Cross entropy loss
Cross entropy loss
def xloss(logits, labels, ignore=None): """ Cross entropy loss """ return F.cross_entropy(logits, Variable(labels), ignore_index=255)
[ "def", "xloss", "(", "logits", ",", "labels", ",", "ignore", "=", "None", ")", ":", "return", "F", ".", "cross_entropy", "(", "logits", ",", "Variable", "(", "labels", ")", ",", "ignore_index", "=", "255", ")" ]
[ 238, 0 ]
[ 242, 70 ]
python
en
['en', 'error', 'th']
False
hex
(s)
Convert string to hex.
Convert string to hex.
def hex(s): """Convert string to hex. """ if isinstance(s, str): return "".join(['%X' % ord(c) for c in s]) if isinstance(s, bytes): return "".join(['%X' % c for c in s]) return _hex(s)
[ "def", "hex", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "str", ")", ":", "return", "\"\"", ".", "join", "(", "[", "'%X'", "%", "ord", "(", "c", ")", "for", "c", "in", "s", "]", ")", "if", "isinstance", "(", "s", ",", "bytes", "...
[ 130, 0 ]
[ 137, 18 ]
python
en
['en', 'en', 'en']
True
execute_with_scope
(expr, scope, aggcontext=None, clients=None, **kwargs)
Execute an expression `expr`, with data provided in `scope`. Parameters ---------- expr : ibis.expr.types.Expr The expression to execute. scope : collections.Mapping A dictionary mapping :class:`~ibis.expr.operations.Node` subclass instances to concrete data such as a pandas Dat...
Execute an expression `expr`, with data provided in `scope`.
def execute_with_scope(expr, scope, aggcontext=None, clients=None, **kwargs): """Execute an expression `expr`, with data provided in `scope`. Parameters ---------- expr : ibis.expr.types.Expr The expression to execute. scope : collections.Mapping A dictionary mapping :class:`~ibis.e...
[ "def", "execute_with_scope", "(", "expr", ",", "scope", ",", "aggcontext", "=", "None", ",", "clients", "=", "None", ",", "*", "*", "kwargs", ")", ":", "op", "=", "expr", ".", "op", "(", ")", "# Call pre_execute, to allow clients to intercept the expression befo...
[ 128, 0 ]
[ 177, 17 ]
python
en
['en', 'en', 'en']
True
execute_until_in_scope
( expr, scope, aggcontext=None, clients=None, post_execute_=None, **kwargs )
Execute until our op is in `scope`. Parameters ---------- expr : ibis.expr.types.Expr scope : Mapping aggcontext : Optional[AggregationContext] clients : List[ibis.client.Client] kwargs : Mapping
Execute until our op is in `scope`.
def execute_until_in_scope( expr, scope, aggcontext=None, clients=None, post_execute_=None, **kwargs ): """Execute until our op is in `scope`. Parameters ---------- expr : ibis.expr.types.Expr scope : Mapping aggcontext : Optional[AggregationContext] clients : List[ibis.client.Client] ...
[ "def", "execute_until_in_scope", "(", "expr", ",", "scope", ",", "aggcontext", "=", "None", ",", "clients", "=", "None", ",", "post_execute_", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# these should never be None", "assert", "aggcontext", "is", "not", ...
[ 180, 0 ]
[ 215, 5 ]
python
en
['en', 'en', 'en']
True
is_computable_arg
(op, arg)
Is `arg` a valid input to an ``execute_node`` rule? Parameters ---------- arg : object Any Python object Returns ------- result : bool
Is `arg` a valid input to an ``execute_node`` rule?
def is_computable_arg(op, arg): """Is `arg` a valid input to an ``execute_node`` rule? Parameters ---------- arg : object Any Python object Returns ------- result : bool """ return ( isinstance(op, (ops.ExpressionList, ops.ValueList, ops.WindowOp)) or isinst...
[ "def", "is_computable_arg", "(", "op", ",", "arg", ")", ":", "return", "(", "isinstance", "(", "op", ",", "(", "ops", ".", "ExpressionList", ",", "ops", ".", "ValueList", ",", "ops", ".", "WindowOp", ")", ")", "or", "isinstance", "(", "arg", ",", "_V...
[ 218, 0 ]
[ 233, 5 ]
python
en
['en', 'en', 'en']
True
execute_bottom_up
( expr, scope, aggcontext=None, post_execute_=None, clients=None, **kwargs )
Execute `expr` bottom-up. Parameters ---------- expr : ibis.expr.types.Expr scope : Mapping[ibis.expr.operations.Node, object] aggcontext : Optional[ibis.pandas.aggcontext.AggregationContext] kwargs : Dict[str, object] Returns ------- result : Mapping[ ibis.expr.operations....
Execute `expr` bottom-up.
def execute_bottom_up( expr, scope, aggcontext=None, post_execute_=None, clients=None, **kwargs ): """Execute `expr` bottom-up. Parameters ---------- expr : ibis.expr.types.Expr scope : Mapping[ibis.expr.operations.Node, object] aggcontext : Optional[ibis.pandas.aggcontext.AggregationContex...
[ "def", "execute_bottom_up", "(", "expr", ",", "scope", ",", "aggcontext", "=", "None", ",", "post_execute_", "=", "None", ",", "clients", "=", "None", ",", "*", "*", "kwargs", ")", ":", "assert", "post_execute_", "is", "not", "None", ",", "'post_execute_ i...
[ 236, 0 ]
[ 311, 25 ]
python
en
['en', 'en', 'en']
True
main_execute
(expr, params=None, scope=None, aggcontext=None, **kwargs)
Execute an expression against data that are bound to it. If no data are bound, raise an Exception. Parameters ---------- expr : ibis.expr.types.Expr The expression to execute params : Mapping[ibis.expr.types.Expr, object] The data that an unbound parameter in `expr` maps to scop...
Execute an expression against data that are bound to it. If no data are bound, raise an Exception.
def main_execute(expr, params=None, scope=None, aggcontext=None, **kwargs): """Execute an expression against data that are bound to it. If no data are bound, raise an Exception. Parameters ---------- expr : ibis.expr.types.Expr The expression to execute params : Mapping[ibis.expr.types....
[ "def", "main_execute", "(", "expr", ",", "params", "=", "None", ",", "scope", "=", "None", ",", "aggcontext", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "scope", "is", "None", ":", "scope", "=", "{", "}", "if", "params", "is", "None", ...
[ 318, 0 ]
[ 360, 79 ]
python
en
['en', 'en', 'en']
True
execute_and_reset
( expr, params=None, scope=None, aggcontext=None, **kwargs )
Execute an expression against data that are bound to it. If no data are bound, raise an Exception. Notes ----- The difference between this function and :func:`~ibis.pandas.core.execute` is that this function resets the index of the result, if the result has an index. Parameters -------...
Execute an expression against data that are bound to it. If no data are bound, raise an Exception.
def execute_and_reset( expr, params=None, scope=None, aggcontext=None, **kwargs ): """Execute an expression against data that are bound to it. If no data are bound, raise an Exception. Notes ----- The difference between this function and :func:`~ibis.pandas.core.execute` is that this functi...
[ "def", "execute_and_reset", "(", "expr", ",", "params", "=", "None", ",", "scope", "=", "None", ",", "aggcontext", "=", "None", ",", "*", "*", "kwargs", ")", ":", "result", "=", "execute", "(", "expr", ",", "params", "=", "params", ",", "scope", "=",...
[ 363, 0 ]
[ 409, 17 ]
python
en
['en', 'en', 'en']
True
regression
(self, local, clickhouse_binary_path, stress=None, parallel=None)
ClickHouse integration with LDAP regression module.
ClickHouse integration with LDAP regression module.
def regression(self, local, clickhouse_binary_path, stress=None, parallel=None): """ClickHouse integration with LDAP regression module. """ top().terminating = False nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), } if stress is not None: self.context.stre...
[ "def", "regression", "(", "self", ",", "local", ",", "clickhouse_binary_path", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "top", "(", ")", ".", "terminating", "=", "False", "nodes", "=", "{", "\"clickhouse\"", ":", "(", "\"clickh...
[ 39, 0 ]
[ 61, 81 ]
python
en
['en', 'en', 'en']
True
arguments_from_signature
(signature, *args, **kwargs)
Validate signature against `args` and `kwargs` and return the kwargs asked for in the signature Parameters ---------- args : Tuple[object...] kwargs : Dict[str, object] Returns ------- args, kwargs : Tuple[Tuple[object...], Dict[str, object]] Examples -------- >>> from ibi...
Validate signature against `args` and `kwargs` and return the kwargs asked for in the signature
def arguments_from_signature(signature, *args, **kwargs): """Validate signature against `args` and `kwargs` and return the kwargs asked for in the signature Parameters ---------- args : Tuple[object...] kwargs : Dict[str, object] Returns ------- args, kwargs : Tuple[Tuple[object......
[ "def", "arguments_from_signature", "(", "signature", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bound", "=", "signature", ".", "bind_partial", "(", "*", "args", ")", "meta_kwargs", "=", "toolz", ".", "merge", "(", "{", "'kwargs'", ":", "kwargs...
[ 45, 0 ]
[ 92, 27 ]
python
en
['en', 'en', 'sw']
True
nullable
(datatype)
Return the signature of a scalar value that is allowed to be NULL (in SQL parlance). Parameters ---------- datatype : ibis.expr.datatypes.DataType Returns ------- Tuple[Type]
Return the signature of a scalar value that is allowed to be NULL (in SQL parlance).
def nullable(datatype): """Return the signature of a scalar value that is allowed to be NULL (in SQL parlance). Parameters ---------- datatype : ibis.expr.datatypes.DataType Returns ------- Tuple[Type] """ return (type(None),) if datatype.nullable else ()
[ "def", "nullable", "(", "datatype", ")", ":", "return", "(", "type", "(", "None", ")", ",", ")", "if", "datatype", ".", "nullable", "else", "(", ")" ]
[ 130, 0 ]
[ 142, 53 ]
python
en
['en', 'en', 'en']
True
udf_signature
(input_type, klass)
Compute the appropriate signature for an ibis Node from a list of input types. Parameters ---------- input_type : List[ibis.expr.datatypes.DataType] A list of ibis DataType instances klass : Type pd.Series or SeriesGroupBy Returns ------- Tuple[Type] A tuple of ...
Compute the appropriate signature for an ibis Node from a list of input types.
def udf_signature(input_type, klass): """Compute the appropriate signature for an ibis Node from a list of input types. Parameters ---------- input_type : List[ibis.expr.datatypes.DataType] A list of ibis DataType instances klass : Type pd.Series or SeriesGroupBy Returns ...
[ "def", "udf_signature", "(", "input_type", ",", "klass", ")", ":", "return", "tuple", "(", "(", "klass", ",", ")", "+", "rule_to_python_type", "(", "r", ")", "+", "nullable", "(", "r", ")", "for", "r", "in", "input_type", ")" ]
[ 145, 0 ]
[ 190, 5 ]
python
en
['en', 'en', 'en']
True
check_matching_signature
(input_type)
Make sure that the number of arguments declared by the user in `input_type` matches that of the wrapped function's signature. Parameters ---------- input_type : List[DataType] Returns ------- wrapper : callable
Make sure that the number of arguments declared by the user in `input_type` matches that of the wrapped function's signature.
def check_matching_signature(input_type): """Make sure that the number of arguments declared by the user in `input_type` matches that of the wrapped function's signature. Parameters ---------- input_type : List[DataType] Returns ------- wrapper : callable """ def wrapper(func):...
[ "def", "check_matching_signature", "(", "input_type", ")", ":", "def", "wrapper", "(", "func", ")", ":", "num_params", "=", "sum", "(", "param", ".", "kind", "in", "{", "param", ".", "POSITIONAL_OR_KEYWORD", ",", "param", ".", "POSITIONAL_ONLY", "}", "for", ...
[ 193, 0 ]
[ 223, 18 ]
python
en
['en', 'en', 'en']
True
udf
(input_type, output_type)
Define a UDF (user-defined function) that operates element wise on a Pandas Series. Parameters ---------- input_type : List[ibis.rules] A rules encoding the abstract type of each argument. These are found in :mod:`~ibis.expr.rules`. The length of this list must match the number ...
Define a UDF (user-defined function) that operates element wise on a Pandas Series.
def udf(input_type, output_type): """Define a UDF (user-defined function) that operates element wise on a Pandas Series. Parameters ---------- input_type : List[ibis.rules] A rules encoding the abstract type of each argument. These are found in :mod:`~ibis.expr.rules`. The length of...
[ "def", "udf", "(", "input_type", ",", "output_type", ")", ":", "def", "wrapper", "(", "func", ")", ":", "# generate a new custom node", "UDFNode", "=", "type", "(", "func", ".", "__name__", ",", "(", "ops", ".", "ValueOp", ",", ")", ",", "{", "'signature...
[ 226, 0 ]
[ 305, 18 ]
python
en
['en', 'en', 'en']
True
udaf
(input_type, output_type)
Define a UDAF (user-defined aggregation function) that takes N pandas. Series or scalar values as inputs. Parameters ---------- input_type : List[T] A rules encoding the abstract type of each argument or one of the types found in :mod:`~ibis.expr.datatypes`. These are found in :...
Define a UDAF (user-defined aggregation function) that takes N pandas. Series or scalar values as inputs.
def udaf(input_type, output_type): """Define a UDAF (user-defined aggregation function) that takes N pandas. Series or scalar values as inputs. Parameters ---------- input_type : List[T] A rules encoding the abstract type of each argument or one of the types found in :mod:`~ibis.exp...
[ "def", "udaf", "(", "input_type", ",", "output_type", ")", ":", "def", "wrapper", "(", "func", ")", ":", "UDAFNode", "=", "type", "(", "func", ".", "__name__", ",", "(", "ops", ".", "Reduction", ",", ")", ",", "{", "'signature'", ":", "sig", ".", "...
[ 308, 0 ]
[ 394, 18 ]
python
en
['en', 'da', 'en']
True
pareto_plot
(central, error)
Plots a Pareto front for a given algorithm. (Ellipses show errors in two dimensions). Parameters ---------- central: 2D nd.array Coordinates of solutions from the Pareto front. error: 2D nd.array Error measures of solutions from the Pareto front.
Plots a Pareto front for a given algorithm. (Ellipses show errors in two dimensions). Parameters ---------- central: 2D nd.array Coordinates of solutions from the Pareto front. error: 2D nd.array Error measures of solutions from the Pareto front.
def pareto_plot(central, error): """ Plots a Pareto front for a given algorithm. (Ellipses show errors in two dimensions). Parameters ---------- central: 2D nd.array Coordinates of solutions from the Pareto front. error: 2D nd.array Error measures of solutions from the Pareto fro...
[ "def", "pareto_plot", "(", "central", ",", "error", ")", ":", "n_points", "=", "central", ".", "shape", "[", "0", "]", "artists", ",", "ax", "=", "setup_figure", "(", ")", "if", "PLOT_STD", ":", "ellipses", "=", "[", "]", "for", "i", "in", "range", ...
[ 71, 0 ]
[ 97, 18 ]
python
en
['en', 'error', 'th']
False
extract_res
(folder, algo, max_costs, min_costs)
This function go through all runs from an algorithm folder, gathers data about their Pareto front and compute the stair-case functions. Saves information into text file at the algorithm level. Parameters ---------- folder: str Directory of the algorithm (full of directories, one for each r...
This function go through all runs from an algorithm folder, gathers data about their Pareto front and compute the stair-case functions. Saves information into text file at the algorithm level.
def extract_res(folder, algo, max_costs, min_costs): """ This function go through all runs from an algorithm folder, gathers data about their Pareto front and compute the stair-case functions. Saves information into text file at the algorithm level. Parameters ---------- folder: str Dir...
[ "def", "extract_res", "(", "folder", ",", "algo", ",", "max_costs", ",", "min_costs", ")", ":", "print", "(", "'\\n\\tExtracting: '", ",", "folder", ".", "split", "(", "'/'", ")", "[", "-", "2", "]", ")", "os", ".", "makedirs", "(", "folder", "+", "'...
[ 127, 0 ]
[ 223, 84 ]
python
en
['en', 'error', 'th']
False
plot_algo_fronts
(folder)
Plot Pareto fronts of all runs for a given algorithm. Parameters ---------- folder: str Directory of the algorithm (full of directories, one for each run).
Plot Pareto fronts of all runs for a given algorithm.
def plot_algo_fronts(folder): """ Plot Pareto fronts of all runs for a given algorithm. Parameters ---------- folder: str Directory of the algorithm (full of directories, one for each run). """ print('\n\tPlotting: ', folder.split('/')[-2]) all_data = np.loadtxt(folder + 'res/a...
[ "def", "plot_algo_fronts", "(", "folder", ")", ":", "print", "(", "'\\n\\tPlotting: '", ",", "folder", ".", "split", "(", "'/'", ")", "[", "-", "2", "]", ")", "all_data", "=", "np", ".", "loadtxt", "(", "folder", "+", "'res/all_data_pareto_{}.txt'", ".", ...
[ 226, 0 ]
[ 254, 20 ]
python
en
['en', 'error', 'th']
False
beta_plot
(folder)
Custom plotting function to plot the evolution of the two costs as a function of the mixing parameter beta. Parameters ---------- folder: str Directory of the algorithm (full of directories, one for each run).
Custom plotting function to plot the evolution of the two costs as a function of the mixing parameter beta.
def beta_plot(folder): """ Custom plotting function to plot the evolution of the two costs as a function of the mixing parameter beta. Parameters ---------- folder: str Directory of the algorithm (full of directories, one for each run). """ all_data = dict() goals = [] lis...
[ "def", "beta_plot", "(", "folder", ")", ":", "all_data", "=", "dict", "(", ")", "goals", "=", "[", "]", "list_folds", "=", "sorted", "(", "os", ".", "listdir", "(", "folder", ")", ")", "for", "f", "in", "list_folds", ":", "if", "'res'", "not", "in"...
[ 258, 0 ]
[ 308, 56 ]
python
en
['en', 'error', 'th']
False
plot_multi_algo
(folder)
Plot comparison of Pareto fronts. Parameters ---------- folder: str Directory that contains folders for each algorithm.
Plot comparison of Pareto fronts.
def plot_multi_algo(folder): """ Plot comparison of Pareto fronts. Parameters ---------- folder: str Directory that contains folders for each algorithm. """ list_conds = os.listdir(folder) data = [] data_std = [] labels = [] areas = [] for cond in list_conds: ...
[ "def", "plot_multi_algo", "(", "folder", ")", ":", "list_conds", "=", "os", ".", "listdir", "(", "folder", ")", "data", "=", "[", "]", "data_std", "=", "[", "]", "labels", "=", "[", "]", "areas", "=", "[", "]", "for", "cond", "in", "list_conds", ":...
[ 310, 0 ]
[ 408, 70 ]
python
en
['en', 'error', 'th']
False
privilege_granted_directly_or_via_role
(self, node=None)
Check that user is only able to execute DETACH VIEW when they have required privilege, either directly or via role.
Check that user is only able to execute DETACH VIEW when they have required privilege, either directly or via role.
def privilege_granted_directly_or_via_role(self, node=None): """Check that user is only able to execute DETACH VIEW when they have required privilege, either directly or via role. """ role_name = f"role_{getuid()}" user_name = f"user_{getuid()}" if node is None: node = self.context.node ...
[ "def", "privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "role_name", "=", "f\"role_{getuid()}\"", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node...
[ 5, 0 ]
[ 27, 92 ]
python
en
['en', 'en', 'en']
True
privilege_check
(grant_target_name, user_name, node=None)
Run scenarios to check the user's access with different privileges.
Run scenarios to check the user's access with different privileges.
def privilege_check(grant_target_name, user_name, node=None): """Run scenarios to check the user's access with different privileges. """ exitcode, message = errors.not_enough_privileges(name=f"{user_name}") with Scenario("user without privilege"): view_name = f"view_{getuid()}" try: ...
[ "def", "privilege_check", "(", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "f\"{user_name}\"", ")", "with", "Scenario", "(", "\"user without...
[ 29, 0 ]
[ 139, 62 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of DETACH VIEW.
Check the RBAC functionality of DETACH VIEW.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of DETACH VIEW. """ self.context.node = self.context.cluster.node(node) if parallel is not None: self.context.parallel = parallel if stress is not None: self.context.stress = stress ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 148, 0 ]
[ 159, 48 ]
python
en
['en', 'en', 'en']
True
TestPing.test_server_version
(self, connect)
target: test get the server version method: call the server_version method after connected expected: version should be the pymilvus version
target: test get the server version method: call the server_version method after connected expected: version should be the pymilvus version
def test_server_version(self, connect): ''' target: test get the server version method: call the server_version method after connected expected: version should be the pymilvus version ''' status, res = connect.server_version() assert res == __version__
[ "def", "test_server_version", "(", "self", ",", "connect", ")", ":", "status", ",", "res", "=", "connect", ".", "server_version", "(", ")", "assert", "res", "==", "__version__" ]
[ 7, 4 ]
[ 14, 33 ]
python
en
['en', 'error', 'th']
False
TestPing.test_server_status
(self, connect)
target: test get the server status method: call the server_status method after connected expected: status returned should be ok
target: test get the server status method: call the server_status method after connected expected: status returned should be ok
def test_server_status(self, connect): ''' target: test get the server status method: call the server_status method after connected expected: status returned should be ok ''' status, msg = connect.server_status() assert status.OK()
[ "def", "test_server_status", "(", "self", ",", "connect", ")", ":", "status", ",", "msg", "=", "connect", ".", "server_status", "(", ")", "assert", "status", ".", "OK", "(", ")" ]
[ 16, 4 ]
[ 23, 26 ]
python
en
['en', 'error', 'th']
False
TestPing.test_server_cmd_with_params_version
(self, connect)
target: test cmd: version method: cmd = "version" ... expected: when cmd = 'version', return version of server;
target: test cmd: version method: cmd = "version" ... expected: when cmd = 'version', return version of server;
def test_server_cmd_with_params_version(self, connect): ''' target: test cmd: version method: cmd = "version" ... expected: when cmd = 'version', return version of server; ''' cmd = "version" status, msg = connect._cmd(cmd) logging.getLogger().info(status)...
[ "def", "test_server_cmd_with_params_version", "(", "self", ",", "connect", ")", ":", "cmd", "=", "\"version\"", "status", ",", "msg", "=", "connect", ".", "_cmd", "(", "cmd", ")", "logging", ".", "getLogger", "(", ")", ".", "info", "(", "status", ")", "l...
[ 25, 4 ]
[ 36, 33 ]
python
en
['en', 'error', 'th']
False
TestPing.test_server_cmd_with_params_others
(self, connect)
target: test cmd: lalala method: cmd = "lalala" ... expected: when cmd = 'version', return version of server;
target: test cmd: lalala method: cmd = "lalala" ... expected: when cmd = 'version', return version of server;
def test_server_cmd_with_params_others(self, connect): ''' target: test cmd: lalala method: cmd = "lalala" ... expected: when cmd = 'version', return version of server; ''' cmd = "rm -rf test" status, msg = connect._cmd(cmd) logging.getLogger().info(status...
[ "def", "test_server_cmd_with_params_others", "(", "self", ",", "connect", ")", ":", "cmd", "=", "\"rm -rf test\"", "status", ",", "msg", "=", "connect", ".", "_cmd", "(", "cmd", ")", "logging", ".", "getLogger", "(", ")", ".", "info", "(", "status", ")", ...
[ 38, 4 ]
[ 48, 26 ]
python
en
['en', 'error', 'th']
False
TestPingDisconnect.test_server_version
(self, dis_connect)
target: test get the server version, after disconnect method: call the server_version method after connected expected: version should not be the pymilvus version
target: test get the server version, after disconnect method: call the server_version method after connected expected: version should not be the pymilvus version
def test_server_version(self, dis_connect): ''' target: test get the server version, after disconnect method: call the server_version method after connected expected: version should not be the pymilvus version ''' res = None with pytest.raises(Exception) as e: ...
[ "def", "test_server_version", "(", "self", ",", "dis_connect", ")", ":", "res", "=", "None", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", "e", ":", "status", ",", "res", "=", "connect", ".", "server_version", "(", ")", "assert", "res", ...
[ 57, 4 ]
[ 66, 26 ]
python
en
['en', 'error', 'th']
False
TestPingDisconnect.test_server_status
(self, dis_connect)
target: test get the server status, after disconnect method: call the server_status method after connected expected: status returned should be not ok
target: test get the server status, after disconnect method: call the server_status method after connected expected: status returned should be not ok
def test_server_status(self, dis_connect): ''' target: test get the server status, after disconnect method: call the server_status method after connected expected: status returned should be not ok ''' status = None with pytest.raises(Exception) as e: s...
[ "def", "test_server_status", "(", "self", ",", "dis_connect", ")", ":", "status", "=", "None", "with", "pytest", ".", "raises", "(", "Exception", ")", "as", "e", ":", "status", ",", "msg", "=", "connect", ".", "server_status", "(", ")", "assert", "status...
[ 68, 4 ]
[ 77, 29 ]
python
en
['en', 'error', 'th']
False
privilege_granted_directly_or_via_role
(self, node=None)
Check that user is only able to execute DROP DICTIONARY when they have required privilege, either directly or via role.
Check that user is only able to execute DROP DICTIONARY when they have required privilege, either directly or via role.
def privilege_granted_directly_or_via_role(self, node=None): """Check that user is only able to execute DROP DICTIONARY when they have required privilege, either directly or via role. """ role_name = f"role_{getuid()}" user_name = f"user_{getuid()}" if node is None: node = self.context.node...
[ "def", "privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "role_name", "=", "f\"role_{getuid()}\"", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node...
[ 5, 0 ]
[ 24, 92 ]
python
en
['en', 'en', 'en']
True
privilege_check
(grant_target_name, user_name, node=None)
Run scenarios to check the user's access with different privileges.
Run scenarios to check the user's access with different privileges.
def privilege_check(grant_target_name, user_name, node=None): """Run scenarios to check the user's access with different privileges. """ exitcode, message = errors.not_enough_privileges(name=f"{user_name}") with Scenario("user without privilege"): dict_name = f"dict_{getuid()}" try: ...
[ "def", "privilege_check", "(", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "f\"{user_name}\"", ")", "with", "Scenario", "(", "\"user without...
[ 26, 0 ]
[ 103, 68 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of DROP DICTIONARY.
Check the RBAC functionality of DROP DICTIONARY.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of DROP DICTIONARY. """ self.context.node = self.context.cluster.node(node) if parallel is not None: self.context.parallel = parallel if stress is not None: self.context.stress = stres...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 111, 0 ]
[ 122, 48 ]
python
en
['en', 'en', 'en']
True
drop_user_granted_directly
(self, node=None)
Check that a user is able to execute `DROP USER` with privileges are granted directly.
Check that a user is able to execute `DROP USER` with privileges are granted directly.
def drop_user_granted_directly(self, node=None): """Check that a user is able to execute `DROP USER` with privileges are granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite(run=drop_user, ...
[ "def", "drop_user_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\"{user_n...
[ 8, 0 ]
[ 22, 80 ]
python
en
['en', 'en', 'en']
True
drop_user_granted_via_role
(self, node=None)
Check that a user is able to execute `DROP USER` with privileges are granted through a role.
Check that a user is able to execute `DROP USER` with privileges are granted through a role.
def drop_user_granted_via_role(self, node=None): """Check that a user is able to execute `DROP USER` with privileges are granted through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"),...
[ "def", "drop_user_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with",...
[ 25, 0 ]
[ 43, 80 ]
python
en
['en', 'en', 'en']
True
drop_user
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `DROP USER` when they have the necessary privilege.
Check that user is only able to execute `DROP USER` when they have the necessary privilege.
def drop_user(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `DROP USER` when they have the necessary privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenar...
[ "def", "drop_user", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "i...
[ 51, 0 ]
[ 115, 55 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of DROP USER.
Check the RBAC functionality of DROP USER.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of DROP USER. """ self.context.node = self.context.cluster.node(node) Suite(run=drop_user_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=drop_user_granted_via_role, setup=instrument_clickhouse_server_log)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "drop_user_granted_directly", ",", ...
[ 124, 0 ]
[ 130, 81 ]
python
en
['en', 'en', 'en']
True
TestDistancesPositive.test_l2_pos
(self)
roundoff errors occur only with the L2 decomposition used with BLAS, ie. in IndexFlatL2 and with n > distance_compute_blas_threshold = 20
roundoff errors occur only with the L2 decomposition used with BLAS, ie. in IndexFlatL2 and with n > distance_compute_blas_threshold = 20
def test_l2_pos(self): """ roundoff errors occur only with the L2 decomposition used with BLAS, ie. in IndexFlatL2 and with n > distance_compute_blas_threshold = 20 """ d = 128 n = 100 rs = np.random.RandomState(1234) x = rs.rand(n, d).astype('fl...
[ "def", "test_l2_pos", "(", "self", ")", ":", "d", "=", "128", "n", "=", "100", "rs", "=", "np", ".", "random", ".", "RandomState", "(", "1234", ")", "x", "=", "rs", ".", "rand", "(", "n", ",", "d", ")", ".", "astype", "(", "'float32'", ")", "...
[ 511, 4 ]
[ 529, 29 ]
python
en
['en', 'error', 'th']
False
scenario
(self, node="clickhouse1")
Check that multiple LDAP servers can be used to authenticate users.
Check that multiple LDAP servers can be used to authenticate users.
def scenario(self, node="clickhouse1"): """Check that multiple LDAP servers can be used to authenticate users. """ self.context.node = self.context.cluster.node(node) servers = { "openldap1": { "host": "openldap1", "port": "389", "enable_tls": "no", ...
[ "def", "scenario", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ...
[ 11, 0 ]
[ 40, 30 ]
python
en
['en', 'en', 'en']
True
privileges_granted_directly
(self, node=None)
Check that a user is able to execute `CREATE ROLE` with privileges are granted directly.
Check that a user is able to execute `CREATE ROLE` with privileges are granted directly.
def privileges_granted_directly(self, node=None): """Check that a user is able to execute `CREATE ROLE` with privileges are granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite(run=create_role, ...
[ "def", "privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", "f\"{user_...
[ 8, 0 ]
[ 22, 74 ]
python
en
['en', 'en', 'en']
True
privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `CREATE ROLE` with privileges are granted through a role.
Check that a user is able to execute `CREATE ROLE` with privileges are granted through a role.
def privileges_granted_via_role(self, node=None): """Check that a user is able to execute `CREATE ROLE` with privileges are granted through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}...
[ "def", "privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with"...
[ 25, 0 ]
[ 43, 74 ]
python
en
['en', 'en', 'en']
True
create_role
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `CREATE ROLE` when they have the necessary privilege.
Check that user is only able to execute `CREATE ROLE` when they have the necessary privilege.
def create_role(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `CREATE ROLE` when they have the necessary privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Sc...
[ "def", "create_role", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", ...
[ 51, 0 ]
[ 121, 69 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of CREATE ROLE.
Check the RBAC functionality of CREATE ROLE.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of CREATE ROLE. """ self.context.node = self.context.cluster.node(node) Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "privileges_granted_directly", ",", ...
[ 130, 0 ]
[ 136, 82 ]
python
en
['en', 'en', 'en']
True