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
from_unix_timestamp64_milli
(self)
Check the fromUnixTimestamp64Milli functions with DateTime64 extended range.
Check the fromUnixTimestamp64Milli functions with DateTime64 extended range.
def from_unix_timestamp64_milli(self): """Check the fromUnixTimestamp64Milli functions with DateTime64 extended range. """ from_unix_timestamp64_milli_micro_nano(scale=3)
[ "def", "from_unix_timestamp64_milli", "(", "self", ")", ":", "from_unix_timestamp64_milli_micro_nano", "(", "scale", "=", "3", ")" ]
[ 438, 0 ]
[ 441, 51 ]
python
en
['en', 'en', 'en']
True
from_unix_timestamp64_micro
(self)
Check the fromUnixTimestamp64Micro functions with DateTime64 extended range.
Check the fromUnixTimestamp64Micro functions with DateTime64 extended range.
def from_unix_timestamp64_micro(self): """Check the fromUnixTimestamp64Micro functions with DateTime64 extended range. """ from_unix_timestamp64_milli_micro_nano(scale=6)
[ "def", "from_unix_timestamp64_micro", "(", "self", ")", ":", "from_unix_timestamp64_milli_micro_nano", "(", "scale", "=", "6", ")" ]
[ 448, 0 ]
[ 451, 51 ]
python
en
['en', 'en', 'en']
True
from_unix_timestamp64_nano
(self)
Check the fromUnixTimestamp64Nano functions with DateTime64 extended range.
Check the fromUnixTimestamp64Nano functions with DateTime64 extended range.
def from_unix_timestamp64_nano(self): """Check the fromUnixTimestamp64Nano functions with DateTime64 extended range. """ from_unix_timestamp64_milli_micro_nano(scale=9)
[ "def", "from_unix_timestamp64_nano", "(", "self", ")", ":", "from_unix_timestamp64_milli_micro_nano", "(", "scale", "=", "9", ")" ]
[ 458, 0 ]
[ 461, 51 ]
python
en
['en', 'en', 'en']
True
type_conversion
(self, node="clickhouse1")
Check the type conversion operations with DateTime64. Cast can be set as Requirement thereby as the module tests exactly what CAST does.
Check the type conversion operations with DateTime64. Cast can be set as Requirement thereby as the module tests exactly what CAST does.
def type_conversion(self, node="clickhouse1"): """Check the type conversion operations with DateTime64. Cast can be set as Requirement thereby as the module tests exactly what CAST does. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): ...
[ "def", "type_conversion", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module"...
[ 468, 0 ]
[ 476, 30 ]
python
en
['en', 'en', 'en']
True
get_dataset_2
(d, nt, nb, nq)
A dataset that is not completely random but still challenging to index
A dataset that is not completely random but still challenging to index
def get_dataset_2(d, nt, nb, nq): """A dataset that is not completely random but still challenging to index """ d1 = 10 # intrinsic dimension (more or less) n = nb + nt + nq rs = np.random.RandomState(1338) x = rs.normal(size=(n, d1)) x = np.dot(x, rs.rand(d1, d)) # now we have a...
[ "def", "get_dataset_2", "(", "d", ",", "nt", ",", "nb", ",", "nq", ")", ":", "d1", "=", "10", "# intrinsic dimension (more or less)", "n", "=", "nb", "+", "nt", "+", "nq", "rs", "=", "np", ".", "random", ".", "RandomState", "(", "1338", ")", "x", "...
[ 84, 0 ]
[ 98, 45 ]
python
en
['en', 'en', 'en']
True
compare_binary_result_lists
(D1, I1, D2, I2)
comparing result lists is difficult because there are many ties. Here we sort by (distance, index) pairs and ignore the largest distance of each result. Compatible result lists should pass this.
comparing result lists is difficult because there are many ties. Here we sort by (distance, index) pairs and ignore the largest distance of each result. Compatible result lists should pass this.
def compare_binary_result_lists(D1, I1, D2, I2): """comparing result lists is difficult because there are many ties. Here we sort by (distance, index) pairs and ignore the largest distance of each result. Compatible result lists should pass this.""" assert D1.shape == I1.shape == D2.shape == I2.shape ...
[ "def", "compare_binary_result_lists", "(", "D1", ",", "I1", ",", "D2", ",", "I2", ")", ":", "assert", "D1", ".", "shape", "==", "I1", ".", "shape", "==", "D2", ".", "shape", "==", "I2", ".", "shape", "n", ",", "k", "=", "D1", ".", "shape", "ndiff...
[ 108, 0 ]
[ 127, 70 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check drop role query syntax. ```sql DROP ROLE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ```
Check drop role query syntax.
def feature(self, node="clickhouse1"): """Check drop role query syntax. ```sql DROP ROLE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ``` """ node = self.context.cluster.node(node) @contextmanager def setup(role): try: with Given("I have a role"): ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "@", "contextmanager", "def", "setup", "(", "role", ")", ":", "try", ":", "with", "Given...
[ 9, 0 ]
[ 83, 101 ]
python
en
['fr', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check drop quota query syntax. ```sql DROP QUOTA [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ```
Check drop quota query syntax.
def feature(self, node="clickhouse1"): """Check drop quota query syntax. ```sql DROP QUOTA [IF EXISTS] name [,...] [ON CLUSTER cluster_name] ``` """ node = self.context.cluster.node(node) @contextmanager def cleanup(quota): try: with Given("I have a quota"): ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "@", "contextmanager", "def", "cleanup", "(", "quota", ")", ":", "try", ":", "with", "Gi...
[ 9, 0 ]
[ 86, 103 ]
python
en
['es', 'en', 'en']
True
simple_get
(url)
with requests.Session() as s: try: s.mount("http://", requests.adapters.HTTPAdapter(max_retries=MAX_HTTP_RETRIES)) # set max retries to: MAX_HTTP_RETRIES s.mount("https://", requests.adapters.HTTPAdapter(max_retries=MAX_HTTP_RETRIES)) # set ...
with requests.Session() as s: try: s.mount("http://", requests.adapters.HTTPAdapter(max_retries=MAX_HTTP_RETRIES)) # set max retries to: MAX_HTTP_RETRIES s.mount("https://", requests.adapters.HTTPAdapter(max_retries=MAX_HTTP_RETRIES)) # set ...
def simple_get(url): ''' with requests.Session() as s: try: s.mount("http://", requests.adapters.HTTPAdapter(max_retries=MAX_HTTP_RETRIES)) # set max retries to: MAX_HTTP_RETRIES s.mount("https://", requests.adapters.HTTPAdapter(max_retri...
[ "def", "simple_get", "(", "url", ")", ":", "try", ":", "with", "closing", "(", "get", "(", "url", ",", "stream", "=", "True", ")", ")", "as", "resp", ":", "if", "is_good_response", "(", "resp", ")", ":", "return", "resp", ".", "content", "else", ":...
[ 28, 0 ]
[ 54, 19 ]
python
en
['en', 'error', 'th']
False
is_good_response
(resp)
Returns True if the response seems to be HTML, False otherwise.
Returns True if the response seems to be HTML, False otherwise.
def is_good_response(resp): """ Returns True if the response seems to be HTML, False otherwise. """ content_type = resp.headers['Content-Type'].lower() return (resp.status_code == 200 and content_type is not None and content_type.find('html') > -1)
[ "def", "is_good_response", "(", "resp", ")", ":", "content_type", "=", "resp", ".", "headers", "[", "'Content-Type'", "]", ".", "lower", "(", ")", "return", "(", "resp", ".", "status_code", "==", "200", "and", "content_type", "is", "not", "None", "and", ...
[ 56, 0 ]
[ 63, 47 ]
python
en
['en', 'error', 'th']
False
empty_server_name
(self, timeout=300)
Check that empty string as a server name is not allowed.
Check that empty string as a server name is not allowed.
def empty_server_name(self, timeout=300): """Check that empty string as a server name is not allowed. """ servers = {"": {"host": "foo", "port": "389", "enable_tls": "no", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com" }} invalid_server_config(servers, timeout=t...
[ "def", "empty_server_name", "(", "self", ",", "timeout", "=", "300", ")", ":", "servers", "=", "{", "\"\"", ":", "{", "\"host\"", ":", "\"foo\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\...
[ 10, 0 ]
[ 16, 51 ]
python
en
['en', 'en', 'en']
True
invalid_host
(self)
Check that server returns an error when LDAP server host name is invalid.
Check that server returns an error when LDAP server host name is invalid.
def invalid_host(self): """Check that server returns an error when LDAP server host name is invalid. """ servers = {"foo": {"host": "foo", "port": "389", "enable_tls": "no"}} users = [{ "server": "foo", "username": "user1", "password": "user1", "login": True, "exitcode": 4, "...
[ "def", "invalid_host", "(", "self", ")", ":", "servers", "=", "{", "\"foo\"", ":", "{", "\"host\"", ":", "\"foo\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", "}", "}", "users", "=", "[", "{", "\"server\"", ":", "\"foo\"", "...
[ 23, 0 ]
[ 33, 26 ]
python
en
['en', 'lb', 'en']
True
empty_host
(self)
Check that server returns an error when LDAP server host value is empty.
Check that server returns an error when LDAP server host value is empty.
def empty_host(self): """Check that server returns an error when LDAP server host value is empty. """ servers = {"foo": {"host": "", "port": "389", "enable_tls": "no"}} users = [{ "server": "foo", "username": "user1", "password": "user1", "login": True, "exitcode": 4, "messag...
[ "def", "empty_host", "(", "self", ")", ":", "servers", "=", "{", "\"foo\"", ":", "{", "\"host\"", ":", "\"\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", "}", "}", "users", "=", "[", "{", "\"server\"", ":", "\"foo\"", ",", ...
[ 40, 0 ]
[ 50, 26 ]
python
en
['en', 'lb', 'en']
True
missing_host
(self)
Check that server returns an error when LDAP server host is missing.
Check that server returns an error when LDAP server host is missing.
def missing_host(self): """Check that server returns an error when LDAP server host is missing. """ servers = {"foo": {"port": "389", "enable_tls": "no"}} users = [{ "server": "foo", "username": "user1", "password": "user1", "login": True, "exitcode": 4, "message": "DB::Excep...
[ "def", "missing_host", "(", "self", ")", ":", "servers", "=", "{", "\"foo\"", ":", "{", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", "}", "}", "users", "=", "[", "{", "\"server\"", ":", "\"foo\"", ",", "\"username\"", ":", "\"user1\"...
[ 57, 0 ]
[ 67, 26 ]
python
en
['en', 'lb', 'en']
True
invalid_port
(self)
Check that server returns an error when LDAP server port is not valid.
Check that server returns an error when LDAP server port is not valid.
def invalid_port(self): """Check that server returns an error when LDAP server port is not valid. """ servers = {"openldap1": {"host": "openldap1", "port": "3890", "enable_tls": "no"}} users = [{ "server": "openldap1", "username": "user1", "password": "user1", "login": True, "exitcod...
[ "def", "invalid_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"3890\"", ",", "\"enable_tls\"", ":", "\"no\"", "}", "}", "users", "=", "[", "{", "\"server\"", ":", "...
[ 73, 0 ]
[ 83, 26 ]
python
en
['en', 'lb', 'en']
True
invalid_auth_dn_prefix
(self)
Check that server returns an error when LDAP server port is not valid.
Check that server returns an error when LDAP server port is not valid.
def invalid_auth_dn_prefix(self): """Check that server returns an error when LDAP server port is not valid. """ servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "no", "auth_dn_prefix": "foo=", "auth_dn_suffix": ",ou=users,dc=company,dc=com" }} users = [{ ...
[ "def", "invalid_auth_dn_prefix", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"foo=\"", ",", "\...
[ 90, 0 ]
[ 102, 26 ]
python
en
['en', 'lb', 'en']
True
invalid_auth_dn_suffix
(self)
Check that server returns an error when LDAP server port is not valid.
Check that server returns an error when LDAP server port is not valid.
def invalid_auth_dn_suffix(self): """Check that server returns an error when LDAP server port is not valid. """ servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "no", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",foo=users,dc=company,dc=com" }} users = [{ ...
[ "def", "invalid_auth_dn_suffix", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"...
[ 108, 0 ]
[ 120, 26 ]
python
en
['en', 'lb', 'en']
True
invalid_enable_tls_value
(self)
Check that server returns an error when enable_tls option has invalid value.
Check that server returns an error when enable_tls option has invalid value.
def invalid_enable_tls_value(self): """Check that server returns an error when enable_tls option has invalid value. """ servers = {"openldap1": {"host": "openldap1", "port": "389", "enable_tls": "foo", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com" }} users = [{...
[ "def", "invalid_enable_tls_value", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"foo\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", ...
[ 126, 0 ]
[ 138, 26 ]
python
en
['en', 'en', 'en']
True
invalid_tls_require_cert_value
(self)
Check that server returns an error when tls_require_cert option has invalid value.
Check that server returns an error when tls_require_cert option has invalid value.
def invalid_tls_require_cert_value(self): """Check that server returns an error when tls_require_cert option has invalid value. """ servers = {"openldap2": { "host": "openldap2", "port": "636", "enable_tls": "yes", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com",...
[ "def", "invalid_tls_require_cert_value", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"port\"", ":", "\"636\"", ",", "\"enable_tls\"", ":", "\"yes\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", "...
[ 144, 0 ]
[ 160, 26 ]
python
en
['en', 'lb', 'en']
True
empty_ca_cert_dir
(self)
Check that server returns an error when ca_cert_dir is empty.
Check that server returns an error when ca_cert_dir is empty.
def empty_ca_cert_dir(self): """Check that server returns an error when ca_cert_dir is empty. """ servers = {"openldap2": {"host": "openldap2", "port": "636", "enable_tls": "yes", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com", "tls_require_cert": "demand", ...
[ "def", "empty_ca_cert_dir", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"port\"", ":", "\"636\"", ",", "\"enable_tls\"", ":", "\"yes\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth...
[ 166, 0 ]
[ 180, 26 ]
python
en
['en', 'lb', 'en']
True
empty_ca_cert_file
(self)
Check that server returns an error when ca_cert_file is empty.
Check that server returns an error when ca_cert_file is empty.
def empty_ca_cert_file(self): """Check that server returns an error when ca_cert_file is empty. """ servers = {"openldap2": {"host": "openldap2", "port": "636", "enable_tls": "yes", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com", "tls_require_cert": "demand", ...
[ "def", "empty_ca_cert_file", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"port\"", ":", "\"636\"", ",", "\"enable_tls\"", ":", "\"yes\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"aut...
[ 186, 0 ]
[ 200, 26 ]
python
en
['en', 'en', 'en']
True
auth_dn_value
(self)
Check that server configuration can properly define the `dn` value of the user.
Check that server configuration can properly define the `dn` value of the user.
def auth_dn_value(self): """Check that server configuration can properly define the `dn` value of the user.""" servers = { "openldap1": { "host": "openldap1", "port": "389", "enable_tls": "no", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company,dc=com" }} ...
[ "def", "auth_dn_value", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth_dn_s...
[ 208, 0 ]
[ 217, 24 ]
python
en
['en', 'en', 'en']
True
invalid_verification_cooldown_value
(self, invalid_value, timeout=300)
Check that server returns an error when LDAP server verification cooldown parameter is invalid.
Check that server returns an error when LDAP server verification cooldown parameter is invalid.
def invalid_verification_cooldown_value(self, invalid_value, timeout=300): """Check that server returns an error when LDAP server verification cooldown parameter is invalid. """ error_message = ("<Error> Access(user directories): Could not parse LDAP server" " \\`openldap1\\`: Poco::Exception. ...
[ "def", "invalid_verification_cooldown_value", "(", "self", ",", "invalid_value", ",", "timeout", "=", "300", ")", ":", "error_message", "=", "(", "\"<Error> Access(user directories): Could not parse LDAP server\"", "\" \\\\`openldap1\\\\`: Poco::Exception. Code: 1000, e.code() = 0,\"...
[ 231, 0 ]
[ 247, 87 ]
python
en
['en', 'lb', 'en']
True
syntax
(self)
Check that server configuration with valid syntax can be loaded. ```xml <yandex> <ldap_server> <host>localhost</host> <port>636</port> <auth_dn_prefix>cn=</auth_dn_prefix> <auth_dn_suffix>, ou=users, dc=example, dc=com</auth_dn_suffix> <verific...
Check that server configuration with valid syntax can be loaded. ```xml <yandex> <ldap_server> <host>localhost</host> <port>636</port> <auth_dn_prefix>cn=</auth_dn_prefix> <auth_dn_suffix>, ou=users, dc=example, dc=com</auth_dn_suffix> <verific...
def syntax(self): """Check that server configuration with valid syntax can be loaded. ```xml <yandex> <ldap_server> <host>localhost</host> <port>636</port> <auth_dn_prefix>cn=</auth_dn_prefix> <auth_dn_suffix>, ou=users, dc=example, dc=com</auth_dn_suf...
[ "def", "syntax", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"port\"", ":", "\"389\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth_dn_suffix\"", ":", "\",ou=users,dc=company,dc=com\"",...
[ 253, 0 ]
[ 293, 12 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check that LDAP server configuration.
Check that LDAP server configuration.
def feature(self, node="clickhouse1"): """Check that LDAP server configuration. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): scenario()
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 297, 0 ]
[ 303, 18 ]
python
en
['en', 'fr', 'en']
True
add_cutout_box
(axes, window_size=400, periphery_offset=(-800, -1000), colors='r', linestyles='--', plot_fovea=True, plot_periphery=True, **kwargs)
Add square to axes to show where the cutout comes from. Parameters ---------- axes : array_like arrays to add square to (different images should be indexed along first dimension) window_size : int The size of the cut-out to plot, in pixels (this is the length of one side...
Add square to axes to show where the cutout comes from.
def add_cutout_box(axes, window_size=400, periphery_offset=(-800, -1000), colors='r', linestyles='--', plot_fovea=True, plot_periphery=True, **kwargs): """Add square to axes to show where the cutout comes from. Parameters ---------- axes : array_like arrays...
[ "def", "add_cutout_box", "(", "axes", ",", "window_size", "=", "400", ",", "periphery_offset", "=", "(", "-", "800", ",", "-", "1000", ")", ",", "colors", "=", "'r'", ",", "linestyles", "=", "'--'", ",", "plot_fovea", "=", "True", ",", "plot_periphery", ...
[ 26, 0 ]
[ 74, 54 ]
python
en
['en', 'en', 'en']
True
add_fixation_cross
(axes, cross_size=50, colors='r', linestyles='-', **kwargs)
add fixation cross to center of axes Parameters ---------- axes : array_like arrays to add square to (different images should be indexed along first dimension) cross_size : int, optional total size of the lines in the cross, in pixels colors, linestyle : str, optional ...
add fixation cross to center of axes
def add_fixation_cross(axes, cross_size=50, colors='r', linestyles='-', **kwargs): """add fixation cross to center of axes Parameters ---------- axes : array_like arrays to add square to (different images should be indexed along first dimension) cross_size : int, optional to...
[ "def", "add_fixation_cross", "(", "axes", ",", "cross_size", "=", "50", ",", "colors", "=", "'r'", ",", "linestyles", "=", "'-'", ",", "*", "*", "kwargs", ")", ":", "axes", "=", "np", ".", "array", "(", "axes", ")", ".", "flatten", "(", ")", "for",...
[ 77, 0 ]
[ 103, 50 ]
python
en
['en', 'en', 'en']
True
get_image_cutout
(images, window_size=400, periphery_offset=(-800, -1000))
get foveal and peripheral cutouts from images Parameters ---------- images : array_like images to plot (different images should be indexed along first dimension) window_size : int The size of the cut-out to plot, in pixels (this is the length of one side of the square). ...
get foveal and peripheral cutouts from images
def get_image_cutout(images, window_size=400, periphery_offset=(-800, -1000)): """get foveal and peripheral cutouts from images Parameters ---------- images : array_like images to plot (different images should be indexed along first dimension) window_size : int The size of t...
[ "def", "get_image_cutout", "(", "images", ",", "window_size", "=", "400", ",", "periphery_offset", "=", "(", "-", "800", ",", "-", "1000", ")", ")", ":", "if", "images", ".", "ndim", "==", "2", ":", "images", "=", "images", "[", "None", ",", ":", "...
[ 106, 0 ]
[ 138, 27 ]
python
en
['en', 'en', 'en']
True
cutout_figure
(images, window_size=400, periphery_offset=(-800, -1000), max_ecc=26.8, plot_fovea=True, plot_periphery=True, label=True)
create figure showing cutout views of different images if both `plot_fovea` and `plot_periphery` are False, this just returns None Parameters ---------- images : array_like images to plot (different images should be indexed along first dimension) window_size : int The s...
create figure showing cutout views of different images
def cutout_figure(images, window_size=400, periphery_offset=(-800, -1000), max_ecc=26.8, plot_fovea=True, plot_periphery=True, label=True): """create figure showing cutout views of different images if both `plot_fovea` and `plot_periphery` are False, this just returns None Parameters...
[ "def", "cutout_figure", "(", "images", ",", "window_size", "=", "400", ",", "periphery_offset", "=", "(", "-", "800", ",", "-", "1000", ")", ",", "max_ecc", "=", "26.8", ",", "plot_fovea", "=", "True", ",", "plot_periphery", "=", "True", ",", "label", ...
[ 141, 0 ]
[ 202, 14 ]
python
en
['en', 'en', 'en']
True
scaling_comparison_figure
(model_name, image_name, scaling_vals, seed, window_size=400, periphery_offset=(-800, -1000), max_ecc=26.8, **kwargs)
r"""Create a figure showing cut-out views of all scaling values We want to be able to easily visually compare metamers across scaling values (and with the reference image), but they're very large. In order to facilitate this, we create this figure with 'cut-out' views, where we compare the reference im...
r"""Create a figure showing cut-out views of all scaling values
def scaling_comparison_figure(model_name, image_name, scaling_vals, seed, window_size=400, periphery_offset=(-800, -1000), max_ecc=26.8, **kwargs): r"""Create a figure showing cut-out views of all scaling values We want to be able to easily visually compare metamers across sca...
[ "def", "scaling_comparison_figure", "(", "model_name", ",", "image_name", ",", "scaling_vals", ",", "seed", ",", "window_size", "=", "400", ",", "periphery_offset", "=", "(", "-", "800", ",", "-", "1000", ")", ",", "max_ecc", "=", "26.8", ",", "*", "*", ...
[ 205, 0 ]
[ 267, 14 ]
python
en
['en', 'en', 'en']
True
pooling_window_example
(windows, image, target_eccentricity=24, windows_scale=0, linewidths=5, **kwargs)
Plot example window on image. This plots a single window, as close to the target_eccentricity as possible, at half-max amplitude, to visualize the size of the pooling windows Parameters ---------- windows : pooling.PoolingWindows The PoolingWindows object to plot. image : np.ndarra...
Plot example window on image.
def pooling_window_example(windows, image, target_eccentricity=24, windows_scale=0, linewidths=5, **kwargs): """Plot example window on image. This plots a single window, as close to the target_eccentricity as possible, at half-max amplitude, to visualize the size of the pooling ...
[ "def", "pooling_window_example", "(", "windows", ",", "image", ",", "target_eccentricity", "=", "24", ",", "windows_scale", "=", "0", ",", "linewidths", "=", "5", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "image", ",", "str", ")", ":", ...
[ 270, 0 ]
[ 319, 14 ]
python
en
['en', 'fi', 'en']
True
synthesis_schematic
(metamer, iteration=0, plot_synthesized_image=True, plot_rep_comparison=True, plot_signal_comparison=True, **kwargs)
Create schematic of synthesis, for animating. WARNING: Currently, only works with images of size (256, 256), will need a small amount of tweaking to work with differently sized images. (And may never look quite as good with them) Parameters ---------- metamer : pop.Metamer The Metamer ...
Create schematic of synthesis, for animating.
def synthesis_schematic(metamer, iteration=0, plot_synthesized_image=True, plot_rep_comparison=True, plot_signal_comparison=True, **kwargs): """Create schematic of synthesis, for animating. WARNING: Currently, only works with images of size (256, 256), will need ...
[ "def", "synthesis_schematic", "(", "metamer", ",", "iteration", "=", "0", ",", "plot_synthesized_image", "=", "True", ",", "plot_rep_comparison", "=", "True", ",", "plot_signal_comparison", "=", "True", ",", "*", "*", "kwargs", ")", ":", "# arrangement was all mad...
[ 322, 0 ]
[ 451, 24 ]
python
en
['en', 'en', 'en']
True
synthesis_video
(metamer_save_path, model_name=None)
Create video showing synthesis progress, for presentations. Creates videos showing the metamer, representation, and pixels over time. Works best if synthesis was run with store_progress=1, or some other low value. Will create three videos, so can be used for a build. Will be saved in the same directory...
Create video showing synthesis progress, for presentations.
def synthesis_video(metamer_save_path, model_name=None): """Create video showing synthesis progress, for presentations. Creates videos showing the metamer, representation, and pixels over time. Works best if synthesis was run with store_progress=1, or some other low value. Will create three videos, so ...
[ "def", "synthesis_video", "(", "metamer_save_path", ",", "model_name", "=", "None", ")", ":", "mpl", ".", "rc", "(", "'axes.spines'", ",", "right", "=", "False", ",", "top", "=", "False", ")", "if", "model_name", "is", "None", ":", "# try to infer from path"...
[ 454, 0 ]
[ 513, 29 ]
python
en
['en', 'en', 'en']
True
pooling_window_area
(windows, windows_scale=0, units='degrees')
Plot window area as function of eccentricity. Plots the area of the window bands as function of eccentricity, with a horizontal line corresponding to a single pixel. Parameters ---------- windows : pooling.PoolingWindows The PoolingWindows object to plot. windows_scale : int, optional ...
Plot window area as function of eccentricity.
def pooling_window_area(windows, windows_scale=0, units='degrees'): """Plot window area as function of eccentricity. Plots the area of the window bands as function of eccentricity, with a horizontal line corresponding to a single pixel. Parameters ---------- windows : pooling.PoolingWindows ...
[ "def", "pooling_window_area", "(", "windows", ",", "windows_scale", "=", "0", ",", "units", "=", "'degrees'", ")", ":", "fig", "=", "windows", ".", "plot_window_areas", "(", "units", ",", "scale_num", "=", "windows_scale", ",", "figsize", "=", "(", "15", "...
[ 516, 0 ]
[ 565, 14 ]
python
en
['en', 'en', 'en']
True
synthesis_pixel_diff
(stim, stim_df, scaling)
Show average pixel-wise squared error for a given scaling value. WARNING: This is reasonably memory-intensive. stim has dtype np.uint8. We convert back to np.float32 (and rescale to [0, 1] interval) for these calculations. Parameters ---------- stim : np.ndarray The array of metamers ...
Show average pixel-wise squared error for a given scaling value.
def synthesis_pixel_diff(stim, stim_df, scaling): """Show average pixel-wise squared error for a given scaling value. WARNING: This is reasonably memory-intensive. stim has dtype np.uint8. We convert back to np.float32 (and rescale to [0, 1] interval) for these calculations. Parameters ------...
[ "def", "synthesis_pixel_diff", "(", "stim", ",", "stim_df", ",", "scaling", ")", ":", "stim_df", "=", "stim_df", ".", "query", "(", "'scaling in [@scaling, None]'", ")", "num_seeds", "=", "stim_df", ".", "groupby", "(", "'image_name'", ")", ".", "seed", ".", ...
[ 568, 0 ]
[ 621, 22 ]
python
en
['en', 'en', 'en']
True
simulate_num_trials
(params, row='critical_scaling_true', col='variable')
Create figure summarizing num_trials simulations. Assumes only one true value of proportionality_factor (will still work if not true, just might not be as good-looking). Parameters ---------- params : pd.DataFrame DataFrame containing results from several num_trials simulations Return...
Create figure summarizing num_trials simulations.
def simulate_num_trials(params, row='critical_scaling_true', col='variable'): """Create figure summarizing num_trials simulations. Assumes only one true value of proportionality_factor (will still work if not true, just might not be as good-looking). Parameters ---------- params : pd.DataFrame...
[ "def", "simulate_num_trials", "(", "params", ",", "row", "=", "'critical_scaling_true'", ",", "col", "=", "'variable'", ")", ":", "tmp", "=", "params", ".", "melt", "(", "value_vars", "=", "[", "'critical_scaling_true'", ",", "'proportionality_factor_true'", "]", ...
[ 624, 0 ]
[ 655, 12 ]
python
en
['en', 'la', 'en']
True
performance_plot
(expt_df, col='image_name', row=None, hue=None, style=None, col_wrap=5, ci=95, curve_fit=False, logscale_xaxis=False, tabular_trial_type_legend=False, **kwargs)
Plot performance as function of scaling. With default arguments, this is meant to show the results for all sessions and a single subject, showing the different images on each column. It should be flexible enough to handle other variants. Parameters ---------- expt_df : pd.DataFrame Dat...
Plot performance as function of scaling.
def performance_plot(expt_df, col='image_name', row=None, hue=None, style=None, col_wrap=5, ci=95, curve_fit=False, logscale_xaxis=False, tabular_trial_type_legend=False, **kwargs): """Plot performance as function of scaling. With default arguments, this is meant to sh...
[ "def", "performance_plot", "(", "expt_df", ",", "col", "=", "'image_name'", ",", "row", "=", "None", ",", "hue", "=", "None", ",", "style", "=", "None", ",", "col_wrap", "=", "5", ",", "ci", "=", "95", ",", "curve_fit", "=", "False", ",", "logscale_x...
[ 658, 0 ]
[ 760, 12 ]
python
en
['en', 'en', 'en']
True
run_length_plot
(expt_df, col=None, row=None, hue=None, col_wrap=None, comparison='ref')
Plot run length. With default arguments, this is meant to show the results for all sessions and a single subject. It should be flexible enough to handle other variants. Parameters ---------- expt_df : pd.DataFrame DataFrame containing the results of at least one session for at least ...
Plot run length.
def run_length_plot(expt_df, col=None, row=None, hue=None, col_wrap=None, comparison='ref'): """Plot run length. With default arguments, this is meant to show the results for all sessions and a single subject. It should be flexible enough to handle other variants. Parameters ...
[ "def", "run_length_plot", "(", "expt_df", ",", "col", "=", "None", ",", "row", "=", "None", ",", "hue", "=", "None", ",", "col_wrap", "=", "None", ",", "comparison", "=", "'ref'", ")", ":", "expt_df", "[", "'approximate_run_length_min'", "]", "=", "expt_...
[ 763, 0 ]
[ 801, 12 ]
python
en
['es', 'ms', 'en']
False
compare_loss_and_performance_plot
(expt_df, stim_df, x='loss', col='scaling', row=None, hue='image_name', col_wrap=4, plot_kind='scatter', height=3, logscale_xaxis=True)
Compare an image metric with behavioral performance. By default, this plots synthesis loss on the x-axis and proportion correct on the y-axis, to see if there's any relationship there. Hopefully, there's not (that is, synthesis progressed to the point where there's no real difference in image from more...
Compare an image metric with behavioral performance.
def compare_loss_and_performance_plot(expt_df, stim_df, x='loss', col='scaling', row=None, hue='image_name', col_wrap=4, plot_kind='scatter', height=3, logscale_xaxis=True): """Compare an image metric w...
[ "def", "compare_loss_and_performance_plot", "(", "expt_df", ",", "stim_df", ",", "x", "=", "'loss'", ",", "col", "=", "'scaling'", ",", "row", "=", "None", ",", "hue", "=", "'image_name'", ",", "col_wrap", "=", "4", ",", "plot_kind", "=", "'scatter'", ",",...
[ 804, 0 ]
[ 895, 12 ]
python
en
['en', 'en', 'en']
True
posterior_predictive_check
(inf_data, col=None, row=None, hue=None, style=None, col_wrap=5, comparison='ref', logscale_xaxis=False, hdi=.95, query_str=None, tabular_trial_type_legend=False, **kwargs)
Plot posterior predictive check. In order to make sure that our MCMC gave us a reasonable fit, we plot the posterior predictive probability correct curve against the observed responses. Parameters ---------- inf_data : arviz.InferenceData arviz InferenceData object (xarray-like) create...
Plot posterior predictive check.
def posterior_predictive_check(inf_data, col=None, row=None, hue=None, style=None, col_wrap=5, comparison='ref', logscale_xaxis=False, hdi=.95, query_str=None, tabular_trial_type_legend=False, **kwargs): """Plot posterior p...
[ "def", "posterior_predictive_check", "(", "inf_data", ",", "col", "=", "None", ",", "row", "=", "None", ",", "hue", "=", "None", ",", "style", "=", "None", ",", "col_wrap", "=", "5", ",", "comparison", "=", "'ref'", ",", "logscale_xaxis", "=", "False", ...
[ 898, 0 ]
[ 1026, 12 ]
python
it
['it', 'it', 'en']
True
mcmc_diagnostics_plot
(inf_data)
Plot MCMC diagnostics. This plot contains the posterior distributions and sampling trace for all parameters (each chain showne), with r-hat and effective sample size (both diagnostic stats) on the plots. r-hat: ratio of average variance of samples within each chain to the variance of pooled sample...
Plot MCMC diagnostics.
def mcmc_diagnostics_plot(inf_data): """Plot MCMC diagnostics. This plot contains the posterior distributions and sampling trace for all parameters (each chain showne), with r-hat and effective sample size (both diagnostic stats) on the plots. r-hat: ratio of average variance of samples within eac...
[ "def", "mcmc_diagnostics_plot", "(", "inf_data", ")", ":", "axes", "=", "az", ".", "plot_trace", "(", "inf_data", ")", "rhat", "=", "az", ".", "rhat", "(", "inf_data", ".", "posterior", ")", "ess", "=", "az", ".", "ess", "(", "inf_data", ".", "posterio...
[ 1029, 0 ]
[ 1079, 14 ]
python
ca
['sl', 'ca', 'en']
False
parameter_pairplot
(inf_data, vars=None, query_str="distribution=='posterior'", **kwargs)
Joint distributions of posterior parameter values. Parameters ---------- inf_data : arviz.InferenceData arviz InferenceData object (xarray-like) created by `run_inference`. vars : list or None, optional List of strs giving the parameters to plot here. If None, will plot all. query_s...
Joint distributions of posterior parameter values.
def parameter_pairplot(inf_data, vars=None, query_str="distribution=='posterior'", **kwargs): """Joint distributions of posterior parameter values. Parameters ---------- inf_data : arviz.InferenceData arviz InferenceData object (xarray-like) created by `run_inference`. ...
[ "def", "parameter_pairplot", "(", "inf_data", ",", "vars", "=", "None", ",", "query_str", "=", "\"distribution=='posterior'\"", ",", "*", "*", "kwargs", ")", ":", "df", "=", "mcmc", ".", "inf_data_to_df", "(", "inf_data", ",", "'parameters'", ",", "query_str",...
[ 1082, 0 ]
[ 1129, 12 ]
python
en
['en', 'en', 'en']
True
psychophysical_curve_parameters
(inf_data, x='image_name', y='value', hue='subject_name', col='parameter', row='trial_type', style=None, query_str="distribution=='posterior'", height=2.5, x_dodge=.15, hdi=.95...
Show psychophysical curve parameters, with HDI error bars. This plots the psychophysical curve parameters for all full curves we can draw. That is, we combine the effects of our model and show the values for each trial type, image, and subject. Parameters ---------- inf_data : arviz.InferenceD...
Show psychophysical curve parameters, with HDI error bars.
def psychophysical_curve_parameters(inf_data, x='image_name', y='value', hue='subject_name', col='parameter', row='trial_type', style=None, query_str="distribution=='posterior'", ...
[ "def", "psychophysical_curve_parameters", "(", "inf_data", ",", "x", "=", "'image_name'", ",", "y", "=", "'value'", ",", "hue", "=", "'subject_name'", ",", "col", "=", "'parameter'", ",", "row", "=", "'trial_type'", ",", "style", "=", "None", ",", "query_str...
[ 1132, 0 ]
[ 1269, 14 ]
python
en
['en', 'en', 'en']
True
ref_image_summary
(stim, stim_df, zoom=.125)
Display grid of reference images used for metamer synthesis. We gamma-correct the reference images before display and title each with the simple name (e.g., "llama", "troop") Parameters ---------- stim : np.ndarray The array of metamers we want to check, should correspond to stim_df st...
Display grid of reference images used for metamer synthesis.
def ref_image_summary(stim, stim_df, zoom=.125): """Display grid of reference images used for metamer synthesis. We gamma-correct the reference images before display and title each with the simple name (e.g., "llama", "troop") Parameters ---------- stim : np.ndarray The array of metame...
[ "def", "ref_image_summary", "(", "stim", ",", "stim_df", ",", "zoom", "=", ".125", ")", ":", "ref_ims", "=", "stim_df", ".", "fillna", "(", "'None'", ")", ".", "query", "(", "\"model=='None'\"", ")", ".", "image_name", "ref_ims", "=", "ref_ims", ".", "ap...
[ 1272, 0 ]
[ 1306, 14 ]
python
en
['en', 'en', 'en']
True
synthesis_distance_plot
(distances, xy='trial_type', hue='ref_image', col='distance_scaling', row='image_1_init_supertype', x=None, y=None, **kwargs)
Plot distances between metamers and their reference images. With default arguments, scatterplot comparing the metamer_vs_metamer distance to the metamer_vs_reference distance (where distance and synthesis were computed using the same model). We can then see that metamers initialized with uniform noise ...
Plot distances between metamers and their reference images.
def synthesis_distance_plot(distances, xy='trial_type', hue='ref_image', col='distance_scaling', row='image_1_init_supertype', x=None, y=None, **kwargs): """Plot distances between metamers and their reference images. With defau...
[ "def", "synthesis_distance_plot", "(", "distances", ",", "xy", "=", "'trial_type'", ",", "hue", "=", "'ref_image'", ",", "col", "=", "'distance_scaling'", ",", "row", "=", "'image_1_init_supertype'", ",", "x", "=", "None", ",", "y", "=", "None", ",", "*", ...
[ 1309, 0 ]
[ 1400, 12 ]
python
en
['en', 'en', 'en']
True
partially_pooled_metaparameters
(inf_data, hue='model', style='trial_type', distribution='posterior', hdi=.95, height=5, aspect=1, rotate_xticklabels=False, x_dodge=False, **kwargs)
Plot the metaparameters of the partially pooled mcmc model. The metaparametesr are the lapse rate and those that control the distribution across images/subjects of a0 and s0. Parameters ---------- inf_data : arviz.InferenceData arviz InferenceData object (xarray-like) created by `run_infer...
Plot the metaparameters of the partially pooled mcmc model.
def partially_pooled_metaparameters(inf_data, hue='model', style='trial_type', distribution='posterior', hdi=.95, height=5, aspect=1, rotate_xticklabels=False, x_dodge=False, *...
[ "def", "partially_pooled_metaparameters", "(", "inf_data", ",", "hue", "=", "'model'", ",", "style", "=", "'trial_type'", ",", "distribution", "=", "'posterior'", ",", "hdi", "=", ".95", ",", "height", "=", "5", ",", "aspect", "=", "1", ",", "rotate_xticklab...
[ 1403, 0 ]
[ 1527, 14 ]
python
en
['en', 'en', 'en']
True
partially_pooled_parameters
(inf_data, hue='model', style='trial_type', distribution='posterior', hdi=.95, height=4, aspect=2, rotate_xticklabels=True, x_dodge=False, **kwargs)
Plot the subject/image level parameters of partially pooled mcmc model. These are log_a0/s0_image/subject. Parameters ---------- inf_data : arviz.InferenceData arviz InferenceData object (xarray-like) created by `run_inference` hue, style : str, optional variables to facet along. ...
Plot the subject/image level parameters of partially pooled mcmc model.
def partially_pooled_parameters(inf_data, hue='model', style='trial_type', distribution='posterior', hdi=.95, height=4, aspect=2, rotate_xticklabels=True, x_dodge=False, **kwargs): """Plot the subject/image level paramet...
[ "def", "partially_pooled_parameters", "(", "inf_data", ",", "hue", "=", "'model'", ",", "style", "=", "'trial_type'", ",", "distribution", "=", "'posterior'", ",", "hdi", "=", ".95", ",", "height", "=", "4", ",", "aspect", "=", "2", ",", "rotate_xticklabels"...
[ 1530, 0 ]
[ 1662, 14 ]
python
en
['en', 'en', 'en']
True
psychophysical_grouplevel_means
(inf_data, x='dependent_var', y='value', hue='model', col='level', row='parameter', style='trial_type', query_str="distribution=='posterior'", height=4, aspect=2, x_dodge=.15, ...
Show psychophysical group-level means, with HDI error bars. This plots the psychophysical group-level means for all full curves we can draw. That is, we compute the psychophysical curve parameters and then average over the images and subjects (separately), plotting their distributions. Parameters ...
Show psychophysical group-level means, with HDI error bars.
def psychophysical_grouplevel_means(inf_data, x='dependent_var', y='value', hue='model', col='level', row='parameter', style='trial_type', query_str="distribution=='posterior'", ...
[ "def", "psychophysical_grouplevel_means", "(", "inf_data", ",", "x", "=", "'dependent_var'", ",", "y", "=", "'value'", ",", "hue", "=", "'model'", ",", "col", "=", "'level'", ",", "row", "=", "'parameter'", ",", "style", "=", "'trial_type'", ",", "query_str"...
[ 1665, 0 ]
[ 1821, 14 ]
python
en
['en', 'en', 'en']
True
amplitude_spectra
(spectra, hue='scaling', style=None, col='image_name', row=None, col_wrap=5, kind='line', estimator=None, height=2.5, aspect=1, **kwargs)
Compare amplitude spectra of natural and synthesized images. Parameters ---------- spectra : xarray.Dataset Dataset containing the spectra for synthesized metamers and our natural reference images. hue, style, col, row : str or None, optional The dimensions in spectra to fac...
Compare amplitude spectra of natural and synthesized images. Parameters ---------- spectra : xarray.Dataset Dataset containing the spectra for synthesized metamers and our natural reference images. hue, style, col, row : str or None, optional The dimensions in spectra to fac...
def amplitude_spectra(spectra, hue='scaling', style=None, col='image_name', row=None, col_wrap=5, kind='line', estimator=None, height=2.5, aspect=1, **kwargs): """Compare amplitude spectra of natural and synthesized images. Parameters ---------- spectra :...
[ "def", "amplitude_spectra", "(", "spectra", ",", "hue", "=", "'scaling'", ",", "style", "=", "None", ",", "col", "=", "'image_name'", ",", "row", "=", "None", ",", "col_wrap", "=", "5", ",", "kind", "=", "'line'", ",", "estimator", "=", "None", ",", ...
[ 1824, 0 ]
[ 1917, 12 ]
python
en
['en', 'en', 'en']
True
amplitude_orientation
(spectra, hue='scaling', style=None, col='image_name', row=None, col_wrap=5, kind='point', estimator=np.median, height=2.5, aspect=2, demean=False, **kwargs)
Compare orientation distributions of natural and synthesized images. Note this is fairly memory intensive. Setting `n_boot` to a lower number (defaults to 1000) seems to help with this. Parameters ---------- spectra : xarray.Dataset Dataset containing the spectra for synthesized metamers a...
Compare orientation distributions of natural and synthesized images.
def amplitude_orientation(spectra, hue='scaling', style=None, col='image_name', row=None, col_wrap=5, kind='point', estimator=np.median, height=2.5, aspect=2, demean=False, **kwargs): """Compare orientation distributions of natural and sy...
[ "def", "amplitude_orientation", "(", "spectra", ",", "hue", "=", "'scaling'", ",", "style", "=", "None", ",", "col", "=", "'image_name'", ",", "row", "=", "None", ",", "col_wrap", "=", "5", ",", "kind", "=", "'point'", ",", "estimator", "=", "np", ".",...
[ 1920, 0 ]
[ 2033, 12 ]
python
en
['en', 'en', 'en']
True
dacey_mcmc_plot
(inf_data, df, aspect=1, logscale_axes=True, hdi=.95)
Plot data and predicted lines from Dacey 1992 data and our MCMC fit. We use MCMC to fit hinged line (with intercept) to Dacey 1992's dendritic field diameter data. This plots that data with the line with HDI. Parameters ---------- inf_data : arviz.InferenceData arviz InferenceData object (...
Plot data and predicted lines from Dacey 1992 data and our MCMC fit.
def dacey_mcmc_plot(inf_data, df, aspect=1, logscale_axes=True, hdi=.95): """Plot data and predicted lines from Dacey 1992 data and our MCMC fit. We use MCMC to fit hinged line (with intercept) to Dacey 1992's dendritic field diameter data. This plots that data with the line with HDI. Parameters -...
[ "def", "dacey_mcmc_plot", "(", "inf_data", ",", "df", ",", "aspect", "=", "1", ",", "logscale_axes", "=", "True", ",", "hdi", "=", ".95", ")", ":", "params", "=", "other_data", ".", "inf_data_to_df", "(", "inf_data", ",", "'parameters'", ",", "hdi", "=",...
[ 2036, 0 ]
[ 2097, 12 ]
python
en
['en', 'en', 'en']
True
compare_distance_and_performance
(expt_df, dist_df, col='image_name', row=None, hue='scaling', style='trial_type', col_wrap=5, height=3, logscale_xaxis=False)
Compare model distance and human performance. This is intended for use with a single distance model (e.g., the ObserverModel), to visualize the relationship between model distance and human behavioral performance. We just plot them against each other, not doing anything to try and use distance to predi...
Compare model distance and human performance.
def compare_distance_and_performance(expt_df, dist_df, col='image_name', row=None, hue='scaling', style='trial_type', col_wrap=5, height=3, logscale_xaxis=False): """Compare model distance and human perfor...
[ "def", "compare_distance_and_performance", "(", "expt_df", ",", "dist_df", ",", "col", "=", "'image_name'", ",", "row", "=", "None", ",", "hue", "=", "'scaling'", ",", "style", "=", "'trial_type'", ",", "col_wrap", "=", "5", ",", "height", "=", "3", ",", ...
[ 2100, 0 ]
[ 2233, 12 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check create settings profile query syntax. ```sql CREATE [SETTINGS] PROFILE [IF NOT EXISTS | OR REPLACE] name [ON CLUSTER cluster_name] [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY] | [INHERIT|PROFILE 'profile_name']] [,...] [TO {role [,...] | ALL | ALL EXCEPT...
Check create settings profile query syntax.
def feature(self, node="clickhouse1"): """Check create settings profile query syntax. ```sql CREATE [SETTINGS] PROFILE [IF NOT EXISTS | OR REPLACE] name [ON CLUSTER cluster_name] [SETTINGS variable [= value] [MIN [=] min_value] [MAX [=] max_value] [READONLY] | [INHERIT|PROFILE 'profile_name']] ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "@", "contextmanager", "def", "cleanup", "(", "profile", ")", ":", "try", ":", "with", "...
[ 10, 0 ]
[ 253, 52 ]
python
en
['es', 'en', 'en']
True
snr
(s, n)
Compute the signal-to-noise ratio in dB where X=SNR(signal,noise) (it does not subtract the means). Parameters ---------- s: `torch.Tensor` Signal tensor n: `torch.Tensor` Noise tensor
Compute the signal-to-noise ratio in dB where X=SNR(signal,noise) (it does not subtract the means).
def snr(s, n): """Compute the signal-to-noise ratio in dB where X=SNR(signal,noise) (it does not subtract the means). Parameters ---------- s: `torch.Tensor` Signal tensor n: `torch.Tensor` Noise tensor """ es = torch.sum(torch.sum(torch.abs(s).pow(2))) en = torch.sum(t...
[ "def", "snr", "(", "s", ",", "n", ")", ":", "es", "=", "torch", ".", "sum", "(", "torch", ".", "sum", "(", "torch", ".", "abs", "(", "s", ")", ".", "pow", "(", "2", ")", ")", ")", "en", "=", "torch", ".", "sum", "(", "torch", ".", "sum", ...
[ 180, 0 ]
[ 194, 12 ]
python
en
['en', 'en', 'en']
True
modskew
(ch, sk, p=1)
Adjust the sample skewness of a vector/matrix using gradient projection. This adjusts the skewness without affecting its sample mean and variance. This operation is not an orthogonal projection, but the projection angle is near pi/2 when sk is close to the original skewness, which is a realistic a...
Adjust the sample skewness of a vector/matrix using gradient projection.
def modskew(ch, sk, p=1): """Adjust the sample skewness of a vector/matrix using gradient projection. This adjusts the skewness without affecting its sample mean and variance. This operation is not an orthogonal projection, but the projection angle is near pi/2 when sk is close to the original ske...
[ "def", "modskew", "(", "ch", ",", "sk", ",", "p", "=", "1", ")", ":", "# NEVER USED", "N", "=", "ch", ".", "numel", "(", ")", "me", "=", "ch", ".", "mean", "(", ")", "ch", "=", "ch", "-", "me", "m", "=", "torch", ".", "zeros", "(", "6", "...
[ 321, 0 ]
[ 450, 23 ]
python
en
['en', 'en', 'en']
True
Clamper.clamp
(self)
Clamp the image
Clamp the image
def clamp(self): """Clamp the image """ pass
[ "def", "clamp", "(", "self", ")", ":", "pass" ]
[ 14, 4 ]
[ 17, 12 ]
python
en
['en', 'en', 'en']
True
RangeClamper.clamp
(self, im)
Clamp ``im`` so its range lies within ``range`` We use ``torch.clamp``, so that all values below ``self.range[0]`` are set to ``self.range[0]`` and all values above ``self.range[1]`` are set to ``self.range[1]``. Parameters ---------- im : torch.Tensor The i...
Clamp ``im`` so its range lies within ``range``
def clamp(self, im): """Clamp ``im`` so its range lies within ``range`` We use ``torch.clamp``, so that all values below ``self.range[0]`` are set to ``self.range[0]`` and all values above ``self.range[1]`` are set to ``self.range[1]``. Parameters ---------- im ...
[ "def", "clamp", "(", "self", ",", "im", ")", ":", "im", "=", "im", ".", "clamp", "(", "self", ".", "range", "[", "0", "]", ",", "self", ".", "range", "[", "1", "]", ")", "return", "im" ]
[ 36, 4 ]
[ 50, 17 ]
python
en
['en', 'sr', 'en']
True
TwoMomentsClamper.clamp
(self, im)
Clamp ``im`` so its range and first two moments match ``targ`` We first match the mean and variance, then clamp the range (so that all values below ``self.target.min()`` are set to ``self.targ.min()`` and all values above ``self.targ.max()`` are set to ``self.targ.max()``.) Par...
Clamp ``im`` so its range and first two moments match ``targ``
def clamp(self, im): """Clamp ``im`` so its range and first two moments match ``targ`` We first match the mean and variance, then clamp the range (so that all values below ``self.target.min()`` are set to ``self.targ.min()`` and all values above ``self.targ.max()`` are set to ``...
[ "def", "clamp", "(", "self", ",", "im", ")", ":", "# mean and variance", "im", "=", "(", "im", "-", "im", ".", "mean", "(", ")", ")", "/", "im", ".", "std", "(", ")", "*", "self", ".", "targ", ".", "std", "(", ")", "+", "self", ".", "targ", ...
[ 69, 4 ]
[ 87, 17 ]
python
en
['en', 'en', 'en']
True
FourMomentsClamper.clamp
(self, im)
Clamp ``im`` so its range and first four moments match ``targ`` We first match the kurtosis, then the skew, then mean and variance (together), then clamp the range (so that all values below ``self.target.min()`` are set to ``self.targ.min()`` and all values above ``self.targ.max()`` are...
Clamp ``im`` so its range and first four moments match ``targ``
def clamp(self, im): """Clamp ``im`` so its range and first four moments match ``targ`` We first match the kurtosis, then the skew, then mean and variance (together), then clamp the range (so that all values below ``self.target.min()`` are set to ``self.targ.min()`` and all valu...
[ "def", "clamp", "(", "self", ",", "im", ")", ":", "# kurtosis", "im", "=", "modkurt", "(", "im", ",", "kurtosis", "(", "self", ".", "targ", ")", ")", "# skew", "im", "=", "modskew", "(", "im", ",", "skew", "(", "self", ".", "targ", ")", ")", "#...
[ 106, 4 ]
[ 132, 17 ]
python
en
['en', 'en', 'en']
True
RangeRemapper.clamp
(self, im)
Remap the range of ``im`` to ``self.range`` We remap as follows: ``` im = im + im.min() + range[0] im = (im / im.max()) * range[1] ``` Note that we first check whether this is necessary: we don't do the first line if im.min() > range[0], and we don't do the ...
Remap the range of ``im`` to ``self.range``
def clamp(self, im): """Remap the range of ``im`` to ``self.range`` We remap as follows: ``` im = im + im.min() + range[0] im = (im / im.max()) * range[1] ``` Note that we first check whether this is necessary: we don't do the first line if im.min() > r...
[ "def", "clamp", "(", "self", ",", "im", ")", ":", "if", "im", ".", "min", "(", ")", "<", "self", ".", "range", "[", "0", "]", ":", "im", "=", "im", "-", "im", ".", "min", "(", ")", "+", "self", ".", "range", "[", "0", "]", "if", "im", "...
[ 153, 4 ]
[ 177, 17 ]
python
en
['en', 'sr', 'en']
True
summarize_trials
(raw_behavioral_path)
r"""Summarize trials in order to determine whether subject was correct or not. With this, we create a n_trials by 4 array with the following structure: [trial number, time of trial end, button pressed, time button press was recorded, time when image flashed off]. If you're using pyglet, as assumed her...
r"""Summarize trials in order to determine whether subject was correct or not.
def summarize_trials(raw_behavioral_path): r"""Summarize trials in order to determine whether subject was correct or not. With this, we create a n_trials by 4 array with the following structure: [trial number, time of trial end, button pressed, time button press was recorded, time when image flashed of...
[ "def", "summarize_trials", "(", "raw_behavioral_path", ")", ":", "f", "=", "h5py", ".", "File", "(", "raw_behavioral_path", ",", "'r'", ")", "trials", "=", "[", "]", "button_presses", "=", "f", "[", "'button_presses'", "]", "[", "(", ")", "]", "# these are...
[ 8, 0 ]
[ 73, 17 ]
python
en
['en', 'en', 'en']
True
plot_timing_info
(trials, subject_name, session_number, run_number, figsize=(5,5))
Create scatter plot of timing info. This takes the trials array created to summarize subject responses and plots the response time vs the time before trial end, with color determined by which button was pressed. This is mainly done to make sure everything's working as expected: time before trial end sh...
Create scatter plot of timing info.
def plot_timing_info(trials, subject_name, session_number, run_number, figsize=(5,5)): """Create scatter plot of timing info. This takes the trials array created to summarize subject responses and plots the response time vs the time before trial end, with color determined by which ...
[ "def", "plot_timing_info", "(", "trials", ",", "subject_name", ",", "session_number", ",", "run_number", ",", "figsize", "=", "(", "5", ",", "5", ")", ")", ":", "fig", ",", "ax", "=", "plt", ".", "subplots", "(", "1", ",", "1", ",", "figsize", "=", ...
[ 76, 0 ]
[ 126, 14 ]
python
en
['en', 'en', 'en']
True
_get_values
(df, trial_num, correct_answers, idx=[], labels=[], dep_variables=['scaling'])
Grab appropriate values out of df. Helper function for assembling the experiment_df based on a set of presentation indices
Grab appropriate values out of df.
def _get_values(df, trial_num, correct_answers, idx=[], labels=[], dep_variables=['scaling']): """Grab appropriate values out of df. Helper function for assembling the experiment_df based on a set of presentation indices """ sub_df = df[['image_name']] tmp = sub_df.loc[idx[0]]....
[ "def", "_get_values", "(", "df", ",", "trial_num", ",", "correct_answers", ",", "idx", "=", "[", "]", ",", "labels", "=", "[", "]", ",", "dep_variables", "=", "[", "'scaling'", "]", ")", ":", "sub_df", "=", "df", "[", "[", "'image_name'", "]", "]", ...
[ 129, 0 ]
[ 164, 14 ]
python
en
['en', 'en', 'en']
True
create_experiment_df_split
(df, presentation_idx, dep_variables=['scaling'])
r"""Create a dataframe summarizing the trials of the split-screen experiment. This function takes in the dataframe summarizing the stimuli, the presentation indices, and some dependent variables, and creates a dataframe summarizing each trial in the experiment. We have the following columns: - 'ima...
r"""Create a dataframe summarizing the trials of the split-screen experiment.
def create_experiment_df_split(df, presentation_idx, dep_variables=['scaling']): r"""Create a dataframe summarizing the trials of the split-screen experiment. This function takes in the dataframe summarizing the stimuli, the presentation indices, and some dependent variables, and creates a dataframe su...
[ "def", "create_experiment_df_split", "(", "df", ",", "presentation_idx", ",", "dep_variables", "=", "[", "'scaling'", "]", ")", ":", "dep_variables", ".", "append", "(", "'model'", ")", "correct_answers", "=", "np", ".", "where", "(", "presentation_idx", "[", ...
[ 167, 0 ]
[ 267, 18 ]
python
en
['en', 'en', 'en']
True
add_response_info
(expt_df, trials, subject_name, session_number, run_number)
r"""Add information about subject's response and correctness to expt_df. This function takes the expt_df, which summarizes the trials of the experiment, and adds several additional columns: - 'subject_response', which gives the number (1 or 2) the subject pressed on this trial - 'response_time',...
r"""Add information about subject's response and correctness to expt_df.
def add_response_info(expt_df, trials, subject_name, session_number, run_number): r"""Add information about subject's response and correctness to expt_df. This function takes the expt_df, which summarizes the trials of the experiment, and adds several additional columns: - 'subject_response', which gi...
[ "def", "add_response_info", "(", "expt_df", ",", "trials", ",", "subject_name", ",", "session_number", ",", "run_number", ")", ":", "# just in case it was an incomplete session", "expt_df", "=", "expt_df", ".", "iloc", "[", ":", "len", "(", "trials", ")", "]", "...
[ 270, 0 ]
[ 338, 18 ]
python
en
['en', 'en', 'en']
True
summarize_expt
(expt_df, dep_variables=['subject_name', 'scaling', 'trial_type'], bootstrap_num=0)
r"""Summarize expt_df to get proportion correct Here, we take the ``expt_df`` summarizing the experiment's trials and the subject's responses, and we compute the proportion correct on each trial type. We end up with a DataFrame that has the columns ``['subject_name', 'model', 'trial_type'] + dep_variab...
r"""Summarize expt_df to get proportion correct
def summarize_expt(expt_df, dep_variables=['subject_name', 'scaling', 'trial_type'], bootstrap_num=0): r"""Summarize expt_df to get proportion correct Here, we take the ``expt_df`` summarizing the experiment's trials and the subject's responses, and we compute the proportion correct on each trial type....
[ "def", "summarize_expt", "(", "expt_df", ",", "dep_variables", "=", "[", "'subject_name'", ",", "'scaling'", ",", "'trial_type'", "]", ",", "bootstrap_num", "=", "0", ")", ":", "expt_df", "=", "expt_df", ".", "copy", "(", ")", "gb_cols", "=", "(", "[", "...
[ 341, 0 ]
[ 392, 21 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check create row policy query syntax. ```sql CREATE [ROW] POLICY [IF NOT EXISTS | OR REPLACE] policy_name [ON CLUSTER cluster_name] ON [db.]table [AS {PERMISSIVE | RESTRICTIVE}] [FOR SELECT] [USING condition] [TO {role [,...] | ALL | ALL EXCEPT role [,...]}] ```
Check create row policy query syntax.
def feature(self, node="clickhouse1"): """Check create row policy query syntax. ```sql CREATE [ROW] POLICY [IF NOT EXISTS | OR REPLACE] policy_name [ON CLUSTER cluster_name] ON [db.]table [AS {PERMISSIVE | RESTRICTIVE}] [FOR SELECT] [USING condition] [TO {role [,...] | ALL | ALL EXCEPT role...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "@", "contextmanager", "def", "cleanup", "(", "policy", ",", "on", "=", "\"default.foo\"", ...
[ 10, 0 ]
[ 224, 59 ]
python
en
['en', 'en', 'en']
True
day_name
(obj)
Backwards compatible name of day getting function. Parameters ---------- obj : Union[Series, pd.Timestamp] Returns ------- str The name of the day corresponding to `obj`
Backwards compatible name of day getting function.
def day_name(obj): """Backwards compatible name of day getting function. Parameters ---------- obj : Union[Series, pd.Timestamp] Returns ------- str The name of the day corresponding to `obj` """ try: return obj.day_name() except AttributeError: return o...
[ "def", "day_name", "(", "obj", ")", ":", "try", ":", "return", "obj", ".", "day_name", "(", ")", "except", "AttributeError", ":", "return", "obj", ".", "weekday_name" ]
[ 184, 0 ]
[ 199, 31 ]
python
en
['en', 'en', 'en']
True
load_data
(database_filepath)
Read the data to be modeled from sqlite database :param database_filepath: Path of database, including database name :return: Messages to be used as features for modeling Binary values for target features Unique target classes in the data
Read the data to be modeled from sqlite database :param database_filepath: Path of database, including database name :return: Messages to be used as features for modeling Binary values for target features Unique target classes in the data
def load_data(database_filepath): """ Read the data to be modeled from sqlite database :param database_filepath: Path of database, including database name :return: Messages to be used as features for modeling Binary values for target features Unique target classes in the data ...
[ "def", "load_data", "(", "database_filepath", ")", ":", "engine", "=", "create_engine", "(", "'sqlite:///'", "+", "database_filepath", ")", "df", "=", "pd", ".", "read_sql_table", "(", "'disaster_response_etl'", ",", "engine", ")", "X", "=", "df", ".", "messag...
[ 20, 0 ]
[ 34, 27 ]
python
en
['en', 'error', 'th']
False
tokenize
(text)
Clean, tokenize and lemmatize text :param text: Text to tokenize :return: list of tokens
Clean, tokenize and lemmatize text :param text: Text to tokenize :return: list of tokens
def tokenize(text): """ Clean, tokenize and lemmatize text :param text: Text to tokenize :return: list of tokens """ tokenizer = RegexpTokenizer(r'\w+') tokens = tokenizer.tokenize(text) # tagged = nltk.pos_tag(tokens) lemmatizer = WordNetLemmatizer() clean_tokens = [] clean_...
[ "def", "tokenize", "(", "text", ")", ":", "tokenizer", "=", "RegexpTokenizer", "(", "r'\\w+'", ")", "tokens", "=", "tokenizer", ".", "tokenize", "(", "text", ")", "# tagged = nltk.pos_tag(tokens)", "lemmatizer", "=", "WordNetLemmatizer", "(", ")", "clean_tokens", ...
[ 37, 0 ]
[ 56, 23 ]
python
en
['en', 'error', 'th']
False
get_wordnet_pos
(treebank_tag)
Convert Treebank tags to Wordnet tags :param treebank_tag: Treebank tag :return: Wordnet tag or None
Convert Treebank tags to Wordnet tags :param treebank_tag: Treebank tag :return: Wordnet tag or None
def get_wordnet_pos(treebank_tag): """ Convert Treebank tags to Wordnet tags :param treebank_tag: Treebank tag :return: Wordnet tag or None """ if treebank_tag.startswith('J'): return wordnet.ADJ elif treebank_tag.startswith('V'): return wordnet.VERB elif treebank_tag.sta...
[ "def", "get_wordnet_pos", "(", "treebank_tag", ")", ":", "if", "treebank_tag", ".", "startswith", "(", "'J'", ")", ":", "return", "wordnet", ".", "ADJ", "elif", "treebank_tag", ".", "startswith", "(", "'V'", ")", ":", "return", "wordnet", ".", "VERB", "eli...
[ 58, 0 ]
[ 73, 19 ]
python
en
['en', 'error', 'th']
False
build_model
()
Pipeline model with grid search to tune parameters :return: Model
Pipeline model with grid search to tune parameters :return: Model
def build_model(): """ Pipeline model with grid search to tune parameters :return: Model """ pipeline = Pipeline([ ('vec', CountVectorizer(strip_accents='unicode', tokenizer=tokenize, max_features=5000, stop_words=stopwords.words('english'))), ('tfidf'...
[ "def", "build_model", "(", ")", ":", "pipeline", "=", "Pipeline", "(", "[", "(", "'vec'", ",", "CountVectorizer", "(", "strip_accents", "=", "'unicode'", ",", "tokenizer", "=", "tokenize", ",", "max_features", "=", "5000", ",", "stop_words", "=", "stopwords"...
[ 76, 0 ]
[ 94, 13 ]
python
en
['en', 'error', 'th']
False
evaluate_model
(model, X_test, Y_test, category_names)
Predict targets for test data and evaluate model performance through classification report :param model: Trained model :param X_test: Features for test data :param Y_test: Actual targets for test data :param category_names: Categories in data :return: None
Predict targets for test data and evaluate model performance through classification report :param model: Trained model :param X_test: Features for test data :param Y_test: Actual targets for test data :param category_names: Categories in data :return: None
def evaluate_model(model, X_test, Y_test, category_names): """ Predict targets for test data and evaluate model performance through classification report :param model: Trained model :param X_test: Features for test data :param Y_test: Actual targets for test data :param category_names: Categorie...
[ "def", "evaluate_model", "(", "model", ",", "X_test", ",", "Y_test", ",", "category_names", ")", ":", "Y_pred", "=", "model", ".", "predict", "(", "X_test", ")", "Y_pred", "=", "pd", ".", "DataFrame", "(", "Y_pred", ",", "columns", "=", "Y_test", ".", ...
[ 97, 0 ]
[ 108, 83 ]
python
en
['en', 'error', 'th']
False
save_model
(model, model_filepath)
Pickle trained model :param model: Trained model :param model_filepath: Location to save pickled model :return: None
Pickle trained model :param model: Trained model :param model_filepath: Location to save pickled model :return: None
def save_model(model, model_filepath): """ Pickle trained model :param model: Trained model :param model_filepath: Location to save pickled model :return: None """ pickle.dump(model, open(model_filepath, 'wb'))
[ "def", "save_model", "(", "model", ",", "model_filepath", ")", ":", "pickle", ".", "dump", "(", "model", ",", "open", "(", "model_filepath", ",", "'wb'", ")", ")" ]
[ 111, 0 ]
[ 118, 50 ]
python
en
['en', 'error', 'th']
False
privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM FLUSH LOGS` commands if and only if the privilege has been granted directly.
Check that a user is able to execute `SYSTEM FLUSH LOGS` commands if and only if the privilege has been granted directly.
def privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM FLUSH LOGS` commands if and only if the privilege has been granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): ...
[ "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, 80 ]
python
en
['en', 'en', 'en']
True
privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM FLUSH LOGS` commands if and only if the privilege has been granted via role.
Check that a user is able to execute `SYSTEM FLUSH LOGS` commands if and only if the privilege has been granted via role.
def privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM FLUSH LOGS` commands if and only if the privilege has been granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node ...
[ "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, 80 ]
python
en
['en', 'en', 'en']
True
flush_logs
(self, privilege, on, grant_target_name, user_name, node=None)
Check that user is only able to execute `SYSTEM START REPLICATED FLUSH` when they have privilege.
Check that user is only able to execute `SYSTEM START REPLICATED FLUSH` when they have privilege.
def flush_logs(self, privilege, on, grant_target_name, user_name, node=None): """Check that user is only able to execute `SYSTEM START REPLICATED FLUSH` when they have privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node ...
[ "def", "flush_logs", "(", "self", ",", "privilege", ",", "on", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if"...
[ 56, 0 ]
[ 94, 51 ]
python
en
['en', 'en', 'en']
True
distributed_privileges_granted_directly
(self, node=None)
Check that a user is able to execute `SYSTEM FLUSH DISTRIBUTED` commands if and only if the privilege has been granted directly.
Check that a user is able to execute `SYSTEM FLUSH DISTRIBUTED` commands if and only if the privilege has been granted directly.
def distributed_privileges_granted_directly(self, node=None): """Check that a user is able to execute `SYSTEM FLUSH DISTRIBUTED` commands if and only if the privilege has been granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node,...
[ "def", "distributed_privileges_granted_directly", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "user", "(", "node", ",", ...
[ 97, 0 ]
[ 112, 80 ]
python
en
['en', 'en', 'en']
True
distributed_privileges_granted_via_role
(self, node=None)
Check that a user is able to execute `SYSTEM FLUSH DISTRIBUTED` commands if and only if the privilege has been granted via role.
Check that a user is able to execute `SYSTEM FLUSH DISTRIBUTED` commands if and only if the privilege has been granted via role.
def distributed_privileges_granted_via_role(self, node=None): """Check that a user is able to execute `SYSTEM FLUSH DISTRIBUTED` commands if and only if the privilege has been granted via role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = sel...
[ "def", "distributed_privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "nod...
[ 115, 0 ]
[ 134, 80 ]
python
en
['en', 'en', 'en']
True
flush_distributed
(self, privilege, on, grant_target_name, user_name, table_name, node=None)
Check that user is only able to execute `SYSTEM FLUSH DISTRIBUTED` when they have privilege.
Check that user is only able to execute `SYSTEM FLUSH DISTRIBUTED` when they have privilege.
def flush_distributed(self, privilege, on, grant_target_name, user_name, table_name, node=None): """Check that user is only able to execute `SYSTEM FLUSH DISTRIBUTED` when they have privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) table0_name = f"table0_{getuid()}" if...
[ "def", "flush_distributed", "(", "self", ",", "privilege", ",", "on", ",", "grant_target_name", ",", "user_name", ",", "table_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "="...
[ 147, 0 ]
[ 197, 64 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of SYSTEM FLUSH.
Check the RBAC functionality of SYSTEM FLUSH.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of SYSTEM FLUSH. """ 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_lo...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "privileges_granted_directly", ",", ...
[ 207, 0 ]
[ 215, 94 ]
python
en
['en', 'en', 'en']
True
normal_range_start
(self)
Check DateTime64 can accept a dates around the start of the normal range that begins at 1970-01-01 00:00:00.000.
Check DateTime64 can accept a dates around the start of the normal range that begins at 1970-01-01 00:00:00.000.
def normal_range_start(self): """Check DateTime64 can accept a dates around the start of the normal range that begins at 1970-01-01 00:00:00.000. """ with When("I do incrementing time sweep", description="check different time points in the first 24 hours at given date"): walk_datetime_in_incrementin...
[ "def", "normal_range_start", "(", "self", ")", ":", "with", "When", "(", "\"I do incrementing time sweep\"", ",", "description", "=", "\"check different time points in the first 24 hours at given date\"", ")", ":", "walk_datetime_in_incrementing_steps", "(", "date", "=", "\"1...
[ 14, 0 ]
[ 18, 94 ]
python
en
['en', 'en', 'en']
True
normal_range_end
(self)
Check DateTime64 can accept a dates around the end of the normal range that ends at 2105-12-31 23:59:59.99999.
Check DateTime64 can accept a dates around the end of the normal range that ends at 2105-12-31 23:59:59.99999.
def normal_range_end(self): """Check DateTime64 can accept a dates around the end of the normal range that ends at 2105-12-31 23:59:59.99999. """ with When("I do decrementing time sweep", description="check different time points in the last 24 hours at given date"): walk_datetime_in_decr...
[ "def", "normal_range_end", "(", "self", ")", ":", "with", "When", "(", "\"I do decrementing time sweep\"", ",", "description", "=", "\"check different time points in the last 24 hours at given date\"", ")", ":", "walk_datetime_in_decrementing_steps", "(", "date", "=", "\"2105...
[ 25, 0 ]
[ 30, 94 ]
python
en
['en', 'en', 'en']
True
extended_range_start
(self)
Check DateTime64 supports dates around the beginning of the extended range that begins at 1698-01-01 00:00:00.000000.
Check DateTime64 supports dates around the beginning of the extended range that begins at 1698-01-01 00:00:00.000000.
def extended_range_start(self): """Check DateTime64 supports dates around the beginning of the extended range that begins at 1698-01-01 00:00:00.000000. """ with When("I do incrementing time sweep", description="check different time points in the first 24 hours at given date"): walk_date...
[ "def", "extended_range_start", "(", "self", ")", ":", "with", "When", "(", "\"I do incrementing time sweep\"", ",", "description", "=", "\"check different time points in the first 24 hours at given date\"", ")", ":", "walk_datetime_in_incrementing_steps", "(", "date", "=", "\...
[ 37, 0 ]
[ 42, 94 ]
python
en
['en', 'en', 'en']
True
extended_range_end
(self, precision=3)
Check DateTime64 supports dates around the beginning of the extended range that ends at 2377-12-31T23:59:59.999999.
Check DateTime64 supports dates around the beginning of the extended range that ends at 2377-12-31T23:59:59.999999.
def extended_range_end(self, precision=3): """Check DateTime64 supports dates around the beginning of the extended range that ends at 2377-12-31T23:59:59.999999. """ with When("I do decrementing time sweep", description="check different time points in the last 24 hours at given date"): w...
[ "def", "extended_range_end", "(", "self", ",", "precision", "=", "3", ")", ":", "with", "When", "(", "\"I do decrementing time sweep\"", ",", "description", "=", "\"check different time points in the last 24 hours at given date\"", ")", ":", "walk_datetime_in_decrementing_ste...
[ 49, 0 ]
[ 54, 94 ]
python
en
['en', 'en', 'en']
True
timezone_local_below_normal_range
(self)
Check how UTC normal range time value treated when current timezone time value is out of normal range.
Check how UTC normal range time value treated when current timezone time value is out of normal range.
def timezone_local_below_normal_range(self): """Check how UTC normal range time value treated when current timezone time value is out of normal range. """ with When("I do incrementing time sweep", description="check different time points when UTC datetime fits normal range but below it for l...
[ "def", "timezone_local_below_normal_range", "(", "self", ")", ":", "with", "When", "(", "\"I do incrementing time sweep\"", ",", "description", "=", "\"check different time points when UTC datetime fits normal range but below it for local datetime\"", ")", ":", "walk_datetime_in_incr...
[ 61, 0 ]
[ 67, 110 ]
python
en
['en', 'en', 'en']
True
timezone_local_above_normal_range
(self)
Check how UTC normal range time value treated when current timezone time value is out of normal range.
Check how UTC normal range time value treated when current timezone time value is out of normal range.
def timezone_local_above_normal_range(self): """Check how UTC normal range time value treated when current timezone time value is out of normal range. """ with When("I do decrementing time sweep", description="check different time points when UTC datetime fits normal range but above it for...
[ "def", "timezone_local_above_normal_range", "(", "self", ")", ":", "with", "When", "(", "\"I do decrementing time sweep\"", ",", "description", "=", "\"check different time points when UTC datetime fits normal range but above it for local datetime\"", ")", ":", "walk_datetime_in_decr...
[ 74, 0 ]
[ 80, 109 ]
python
en
['en', 'en', 'en']
True
comparison_check
(self)
Check how comparison works with DateTime64 extended range.
Check how comparison works with DateTime64 extended range.
def comparison_check(self): """Check how comparison works with DateTime64 extended range. """ stress = self.context.stress comparators = (">", "<", "==", "<=", ">=", "!=") timezones = timezones_range(stress=stress) datetimes = [] for year in years_range(stress=stress): datetimes += ...
[ "def", "comparison_check", "(", "self", ")", ":", "stress", "=", "self", ".", "context", ".", "stress", "comparators", "=", "(", "\">\"", ",", "\"<\"", ",", "\"==\"", ",", "\"<=\"", ",", "\">=\"", ",", "\"!=\"", ")", "timezones", "=", "timezones_range", ...
[ 87, 0 ]
[ 111, 68 ]
python
en
['en', 'en', 'en']
True
timezones_support
(self)
Check how timezones work with DateTime64 extended range.
Check how timezones work with DateTime64 extended range.
def timezones_support(self): """Check how timezones work with DateTime64 extended range. """ stress = self.context.stress timezones = timezones_range(stress=stress) for year in years_range(stress): with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year...
[ "def", "timezones_support", "(", "self", ")", ":", "stress", "=", "self", ".", "context", ".", "stress", "timezones", "=", "timezones_range", "(", "stress", "=", "stress", ")", "for", "year", "in", "years_range", "(", "stress", ")", ":", "with", "Given", ...
[ 118, 0 ]
[ 136, 71 ]
python
en
['en', 'en', 'en']
True
generic
(self, node="clickhouse1")
Check the basic operations with DateTime64
Check the basic operations with DateTime64
def generic(self, node="clickhouse1"): """Check the basic operations with DateTime64 """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario, Suite): Scenario(run=scenario)
[ "def", "generic", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 140, 0 ]
[ 146, 30 ]
python
en
['en', 'en', 'en']
True
compile
(expr, params=None)
Force compilation of expression as though it were an expression depending on MapD. Note you can also call expr.compile() Returns ------- compiled : string
Force compilation of expression as though it were an expression depending on MapD. Note you can also call expr.compile()
def compile(expr, params=None): """ Force compilation of expression as though it were an expression depending on MapD. Note you can also call expr.compile() Returns ------- compiled : string """ from ibis.mapd.compiler import to_sql return to_sql(expr, dialect.make_context(params=pa...
[ "def", "compile", "(", "expr", ",", "params", "=", "None", ")", ":", "from", "ibis", ".", "mapd", ".", "compiler", "import", "to_sql", "return", "to_sql", "(", "expr", ",", "dialect", ".", "make_context", "(", "params", "=", "params", ")", ")" ]
[ 7, 0 ]
[ 17, 60 ]
python
en
['en', 'error', 'th']
False
verify
(expr, params=None)
Determine if expression can be successfully translated to execute on MapD
Determine if expression can be successfully translated to execute on MapD
def verify(expr, params=None): """ Determine if expression can be successfully translated to execute on MapD """ try: compile(expr, params=params) return True except com.TranslationError: return False
[ "def", "verify", "(", "expr", ",", "params", "=", "None", ")", ":", "try", ":", "compile", "(", "expr", ",", "params", "=", "params", ")", "return", "True", "except", "com", ".", "TranslationError", ":", "return", "False" ]
[ 20, 0 ]
[ 29, 20 ]
python
en
['en', 'error', 'th']
False
connect
( uri=None, user=None, password=None, host=None, port=9091, database=None, protocol='binary', execution_type=EXECUTION_TYPE_CURSOR )
Create a MapDClient for use with Ibis Parameters could be :param uri: str :param user: str :param password: str :param host: str :param port: int :param database: str :param protocol: str :param execution_type: int Returns ------- MapDClient
Create a MapDClient for use with Ibis
def connect( uri=None, user=None, password=None, host=None, port=9091, database=None, protocol='binary', execution_type=EXECUTION_TYPE_CURSOR ): """Create a MapDClient for use with Ibis Parameters could be :param uri: str :param user: str :param password: str :param host: str :...
[ "def", "connect", "(", "uri", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "9091", ",", "database", "=", "None", ",", "protocol", "=", "'binary'", ",", "execution_type", "=", "EXECUT...
[ 32, 0 ]
[ 63, 17 ]
python
en
['en', 'en', 'en']
True
privileges_granted_directly
(self, node=None)
Check that a user is able to grant role with `ROLE ADMIN` privilege granted directly.
Check that a user is able to grant role with `ROLE ADMIN` privilege granted directly.
def privileges_granted_directly(self, node=None): """Check that a user is able to grant role with `ROLE ADMIN` privilege granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite(test=role_admin)(grant_ta...
[ "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 ]
[ 19, 80 ]
python
en
['en', 'en', 'en']
True
privileges_granted_via_role
(self, node=None)
Check that a user is able to grant role with `ROLE ADMIN` privilege granted through a role.
Check that a user is able to grant role with `ROLE ADMIN` privilege granted through a role.
def privileges_granted_via_role(self, node=None): """Check that a user is able to grant role with `ROLE ADMIN` privilege 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"...
[ 22, 0 ]
[ 37, 80 ]
python
en
['en', 'en', 'en']
True
role_admin
(self, grant_target_name, user_name, node=None)
Check that user is able to execute to grant roles if and only if they have `ROLE ADMIN`.
Check that user is able to execute to grant roles if and only if they have `ROLE ADMIN`.
def role_admin(self, grant_target_name, user_name, node=None): """Check that user is able to execute to grant roles if and only if they have `ROLE ADMIN`. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scenario("Grant rol...
[ "def", "role_admin", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "is", "None", ":", ...
[ 40, 0 ]
[ 139, 115 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of ROLE ADMIN.
Check the RBAC functionality of ROLE ADMIN.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of ROLE ADMIN. """ 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", ",", ...
[ 148, 0 ]
[ 154, 82 ]
python
en
['en', 'en', 'en']
True
GroupedTableExpr.having
(self, expr)
Add a post-aggregation result filter (like the having argument in `aggregate`), for composability with the group_by API Parameters ---------- expr : ibis.expr.types.Expr Returns ------- grouped : GroupedTableExpr
Add a post-aggregation result filter (like the having argument in `aggregate`), for composability with the group_by API
def having(self, expr): """ Add a post-aggregation result filter (like the having argument in `aggregate`), for composability with the group_by API Parameters ---------- expr : ibis.expr.types.Expr Returns ------- grouped : GroupedTableExpr ...
[ "def", "having", "(", "self", ",", "expr", ")", ":", "exprs", "=", "util", ".", "promote_list", "(", "expr", ")", "new_having", "=", "self", ".", "_having", "+", "exprs", "return", "GroupedTableExpr", "(", "self", ".", "table", ",", "self", ".", "by", ...
[ 97, 4 ]
[ 115, 9 ]
python
en
['en', 'error', 'th']
False
GroupedTableExpr.order_by
(self, expr)
Expressions to use for ordering data for a window function computation. Ignored in aggregations. Parameters ---------- expr : value expression or list of value expressions Returns ------- grouped : GroupedTableExpr
Expressions to use for ordering data for a window function computation. Ignored in aggregations.
def order_by(self, expr): """ Expressions to use for ordering data for a window function computation. Ignored in aggregations. Parameters ---------- expr : value expression or list of value expressions Returns ------- grouped : GroupedTableExpr ...
[ "def", "order_by", "(", "self", ",", "expr", ")", ":", "exprs", "=", "util", ".", "promote_list", "(", "expr", ")", "new_order", "=", "self", ".", "_order_by", "+", "exprs", "return", "GroupedTableExpr", "(", "self", ".", "table", ",", "self", ".", "by...
[ 117, 4 ]
[ 135, 9 ]
python
en
['en', 'error', 'th']
False
GroupedTableExpr.mutate
(self, exprs=None, **kwds)
Returns a table projection with analytic / window functions applied. Any arguments can be functions. Parameters ---------- exprs : list, default None kwds : key=value pairs Examples -------- >>> import ibis >>> t = ibis.table([ ....
Returns a table projection with analytic / window functions applied. Any arguments can be functions.
def mutate(self, exprs=None, **kwds): """ Returns a table projection with analytic / window functions applied. Any arguments can be functions. Parameters ---------- exprs : list, default None kwds : key=value pairs Examples -------- >>> i...
[ "def", "mutate", "(", "self", ",", "exprs", "=", "None", ",", "*", "*", "kwds", ")", ":", "if", "exprs", "is", "None", ":", "exprs", "=", "[", "]", "else", ":", "exprs", "=", "util", ".", "promote_list", "(", "exprs", ")", "kwd_names", "=", "list...
[ 137, 4 ]
[ 214, 52 ]
python
en
['en', 'error', 'th']
False