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") | Check usage of encryption functions with [MySQL table function].
[MySQL table function]: https://clickhouse.tech/docs/en/sql-reference/table-functions/mysql/
| Check usage of encryption functions with [MySQL table function]. | def feature(self, node="clickhouse1", mysql_node="mysql1"):
"""Check usage of encryption functions with [MySQL table function].
[MySQL table function]: https://clickhouse.tech/docs/en/sql-reference/table-functions/mysql/
"""
self.context.node = self.context.cluster.node(node)
self.context.mysql_nod... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
",",
"mysql_node",
"=",
"\"mysql1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"self",
".",
"context",... | [
173,
0
] | [
182,
40
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `CREATE SETTINGS PROFILE` with privileges are granted directly.
| Check that a user is able to execute `CREATE SETTINGS PROFILE` with privileges are granted directly.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `CREATE SETTINGS PROFILE` 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... | [
"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 SETTINGS PROFILE` with privileges are granted through a role.
| Check that a user is able to execute `CREATE SETTINGS PROFILE` with privileges are granted through a role.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `CREATE SETTINGS PROFILE` 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... | [
"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_settings_profile | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `CREATE SETTINGS PROFILE` when they have the necessary privilege.
| Check that user is only able to execute `CREATE SETTINGS PROFILE` when they have the necessary privilege.
| def create_settings_profile(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `CREATE SETTINGS PROFILE` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.c... | [
"def",
"create_settings_profile",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
... | [
52,
0
] | [
122,
93
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check the RBAC functionality of CREATE SETTINGS PROFILE.
| Check the RBAC functionality of CREATE SETTINGS PROFILE.
| def feature(self, node="clickhouse1"):
"""Check the RBAC functionality of CREATE SETTINGS PROFILE.
"""
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_clickhous... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"self",
".",
"context",
".",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"Suite",
"(",
"run",
"=",
"privileges_granted_directly",
",",
... | [
131,
0
] | [
137,
82
] | python | en | ['en', 'en', 'en'] | True |
privilege_granted_directly_or_via_role | (self, table_type, privilege, node=None) | Check that user is only able to execute ALTER DELETE when they have required privilege,
either directly or via role.
| Check that user is only able to execute ALTER DELETE when they have required privilege,
either directly or via role.
| def privilege_granted_directly_or_via_role(self, table_type, privilege, node=None):
"""Check that user is only able to execute ALTER DELETE when they have required privilege,
either directly or via role.
"""
role_name = f"role_{getuid()}"
user_name = f"user_{getuid()}"
if node is None:
... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"table_type",
",",
"privilege",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",... | [
10,
0
] | [
33,
136
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, table_type, privilege, 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, table_type, privilege, 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", setup=instrument_clickhouse_serve... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"table_type",
",",
"privilege",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"... | [
35,
0
] | [
79,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of ALTER DELETE.
| Check the RBAC functionality of ALTER DELETE.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of ALTER DELETE.
"""
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",
")",
... | [
91,
0
] | [
110,
98
] | python | en | ['en', 'en', 'en'] | True |
TestMixBase.test_mix_multi_collections | (self, connect) |
target: test functions with multiple collections of different metric_types and index_types
method: create 60 collections which 30 are L2 and the other are IP, add vectors into them
and test describe index and search
expected: status ok
|
target: test functions with multiple collections of different metric_types and index_types
method: create 60 collections which 30 are L2 and the other are IP, add vectors into them
and test describe index and search
expected: status ok
| def test_mix_multi_collections(self, connect):
'''
target: test functions with multiple collections of different metric_types and index_types
method: create 60 collections which 30 are L2 and the other are IP, add vectors into them
and test describe index and search
expec... | [
"def",
"test_mix_multi_collections",
"(",
"self",
",",
"connect",
")",
":",
"nq",
"=",
"10000",
"collection_list",
"=",
"[",
"]",
"idx",
"=",
"[",
"]",
"index_param",
"=",
"{",
"'nlist'",
":",
"nlist",
"}",
"#create collection and add vectors",
"for",
"i",
"... | [
74,
4
] | [
159,
62
] | python | en | ['en', 'error', 'th'] | False |
compile | (expr, params=None) |
Force compilation of expression as though it were an expression depending
on Impala. Note you can also call expr.compile()
Returns
-------
compiled : string
|
Force compilation of expression as though it were an expression depending
on Impala. Note you can also call expr.compile() | def compile(expr, params=None):
"""
Force compilation of expression as though it were an expression depending
on Impala. Note you can also call expr.compile()
Returns
-------
compiled : string
"""
from ibis.impala.compiler import to_sql
return to_sql(expr, dialect.make_context(param... | [
"def",
"compile",
"(",
"expr",
",",
"params",
"=",
"None",
")",
":",
"from",
"ibis",
".",
"impala",
".",
"compiler",
"import",
"to_sql",
"return",
"to_sql",
"(",
"expr",
",",
"dialect",
".",
"make_context",
"(",
"params",
"=",
"params",
")",
")"
] | [
10,
0
] | [
20,
60
] | python | en | ['en', 'error', 'th'] | False |
verify | (expr, params=None) |
Determine if expression can be successfully translated to execute on Impala
|
Determine if expression can be successfully translated to execute on Impala
| def verify(expr, params=None):
"""
Determine if expression can be successfully translated to execute on Impala
"""
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"
] | [
23,
0
] | [
31,
20
] | python | en | ['en', 'error', 'th'] | False |
connect | (host='localhost', port=21050, database='default', timeout=45,
use_ssl=False, ca_cert=None, user=None,
password=None, auth_mechanism='NOSASL',
kerberos_service_name='impala', pool_size=8, hdfs_client=None) | Create an ImpalaClient for use with Ibis.
Parameters
----------
host : str, optional
Host name of the impalad or HiveServer2 in Hive
port : int, optional
Impala's HiveServer2 port
database : str, optional
Default database when obtaining new cursors
timeout : int, optiona... | Create an ImpalaClient for use with Ibis. | def connect(host='localhost', port=21050, database='default', timeout=45,
use_ssl=False, ca_cert=None, user=None,
password=None, auth_mechanism='NOSASL',
kerberos_service_name='impala', pool_size=8, hdfs_client=None):
"""Create an ImpalaClient for use with Ibis.
Parameters
... | [
"def",
"connect",
"(",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"21050",
",",
"database",
"=",
"'default'",
",",
"timeout",
"=",
"45",
",",
"use_ssl",
"=",
"False",
",",
"ca_cert",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"No... | [
34,
0
] | [
114,
17
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check show create user query syntax.
```
SHOW CREATE USER [name | CURRENT_USER]
```
| Check show create user query syntax. | def feature(self, node="clickhouse1"):
"""Check show create user query syntax.
```
SHOW CREATE USER [name | CURRENT_USER]
```
"""
node = self.context.cluster.node(node)
@contextmanager
def setup(user):
try:
with Given("I have a user"):
node.query(f"C... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"setup",
"(",
"user",
")",
":",
"try",
":",
"with",
"Given... | [
8,
0
] | [
36,
55
] | python | en | ['pt', 'en', 'en'] | True |
window | (preceding=None, following=None, group_by=None, order_by=None) |
Create a window clause for use with window (analytic and aggregate)
functions. This ROW window clause aggregates adjacent rows based
on differences in row number.
All window frames / ranges are inclusive.
Parameters
----------
preceding : int, tuple, or None, default None
Specify No... |
Create a window clause for use with window (analytic and aggregate)
functions. This ROW window clause aggregates adjacent rows based
on differences in row number. | def window(preceding=None, following=None, group_by=None, order_by=None):
"""
Create a window clause for use with window (analytic and aggregate)
functions. This ROW window clause aggregates adjacent rows based
on differences in row number.
All window frames / ranges are inclusive.
Parameters
... | [
"def",
"window",
"(",
"preceding",
"=",
"None",
",",
"following",
"=",
"None",
",",
"group_by",
"=",
"None",
",",
"order_by",
"=",
"None",
")",
":",
"return",
"Window",
"(",
"preceding",
"=",
"preceding",
",",
"following",
"=",
"following",
",",
"group_b... | [
177,
0
] | [
204,
67
] | python | en | ['en', 'error', 'th'] | False |
range_window | (preceding=None, following=None, group_by=None, order_by=None) |
Create a window clause for use with window (analytic and aggregate)
functions. This RANGE window clause aggregates rows based upon differences
in the value of the order-by expression.
All window frames / ranges are inclusive.
Parameters
----------
preceding : int, tuple, or None, default ... |
Create a window clause for use with window (analytic and aggregate)
functions. This RANGE window clause aggregates rows based upon differences
in the value of the order-by expression. | def range_window(preceding=None, following=None, group_by=None, order_by=None):
"""
Create a window clause for use with window (analytic and aggregate)
functions. This RANGE window clause aggregates rows based upon differences
in the value of the order-by expression.
All window frames / ranges are ... | [
"def",
"range_window",
"(",
"preceding",
"=",
"None",
",",
"following",
"=",
"None",
",",
"group_by",
"=",
"None",
",",
"order_by",
"=",
"None",
")",
":",
"return",
"Window",
"(",
"preceding",
"=",
"preceding",
",",
"following",
"=",
"following",
",",
"g... | [
207,
0
] | [
234,
68
] | python | en | ['en', 'error', 'th'] | False |
cumulative_window | (group_by=None, order_by=None) |
Create a cumulative window clause for use with aggregate window functions.
All window frames / ranges are inclusive.
Parameters
----------
group_by : expressions, default None
Either specify here or with TableExpr.group_by
order_by : expressions, default None
For analytic function... |
Create a cumulative window clause for use with aggregate window functions. | def cumulative_window(group_by=None, order_by=None):
"""
Create a cumulative window clause for use with aggregate window functions.
All window frames / ranges are inclusive.
Parameters
----------
group_by : expressions, default None
Either specify here or with TableExpr.group_by
orde... | [
"def",
"cumulative_window",
"(",
"group_by",
"=",
"None",
",",
"order_by",
"=",
"None",
")",
":",
"return",
"Window",
"(",
"preceding",
"=",
"None",
",",
"following",
"=",
"0",
",",
"group_by",
"=",
"group_by",
",",
"order_by",
"=",
"order_by",
")"
] | [
237,
0
] | [
256,
55
] | python | en | ['en', 'error', 'th'] | False |
trailing_window | (rows, group_by=None, order_by=None) |
Create a trailing window for use with aggregate window functions.
Parameters
----------
rows : int
Number of trailing rows to include. 0 includes only the current row
group_by : expressions, default None
Either specify here or with TableExpr.group_by
order_by : expressions, default... |
Create a trailing window for use with aggregate window functions. | def trailing_window(rows, group_by=None, order_by=None):
"""
Create a trailing window for use with aggregate window functions.
Parameters
----------
rows : int
Number of trailing rows to include. 0 includes only the current row
group_by : expressions, default None
Either specify her... | [
"def",
"trailing_window",
"(",
"rows",
",",
"group_by",
"=",
"None",
",",
"order_by",
"=",
"None",
")",
":",
"return",
"Window",
"(",
"preceding",
"=",
"rows",
",",
"following",
"=",
"0",
",",
"group_by",
"=",
"group_by",
",",
"order_by",
"=",
"order_by"... | [
259,
0
] | [
278,
55
] | python | en | ['en', 'error', 'th'] | False |
trailing_range_window | (preceding, order_by, group_by=None) |
Create a trailing time window for use with aggregate window functions.
Parameters
----------
preceding : float or expression of intervals, i.e.
1 * ibis.day() + 5 * ibis.hour()
order_by : expressions, default None
For analytic functions requiring an ordering, specify here, or let Ibis
... |
Create a trailing time window for use with aggregate window functions. | def trailing_range_window(preceding, order_by, group_by=None):
"""
Create a trailing time window for use with aggregate window functions.
Parameters
----------
preceding : float or expression of intervals, i.e.
1 * ibis.day() + 5 * ibis.hour()
order_by : expressions, default None
Fo... | [
"def",
"trailing_range_window",
"(",
"preceding",
",",
"order_by",
",",
"group_by",
"=",
"None",
")",
":",
"return",
"Window",
"(",
"preceding",
"=",
"preceding",
",",
"following",
"=",
"0",
",",
"group_by",
"=",
"group_by",
",",
"order_by",
"=",
"order_by",... | [
281,
0
] | [
300,
68
] | python | en | ['en', 'error', 'th'] | False |
AuthorizeRoute.post | (self, request: Request) | Generate an authorization token. | Generate an authorization token. | async def post(self, request: Request) -> JSONResponse:
"""Generate an authorization token."""
data = await request.json()
try:
bearer_token = await fetch_bearer_token(data["token"])
user_details = await fetch_user_details(bearer_token["access_token"])
except htt... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
":",
"Request",
")",
"->",
"JSONResponse",
":",
"data",
"=",
"await",
"request",
".",
"json",
"(",
")",
"try",
":",
"bearer_token",
"=",
"await",
"fetch_bearer_token",
"(",
"data",
"[",
"\"token\"",
"]... | [
39,
4
] | [
57,
45
] | python | en | ['de', 'en', 'en'] | True |
chunks | (lst, n) | Yield successive n-sized chunks from lst. | Yield successive n-sized chunks from lst. | def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n] | [
"def",
"chunks",
"(",
"lst",
",",
"n",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"lst",
")",
",",
"n",
")",
":",
"yield",
"lst",
"[",
"i",
":",
"i",
"+",
"n",
"]"
] | [
56,
0
] | [
59,
26
] | python | en | ['en', 'en', 'en'] | True |
plot_scatter | (X, out_prefix, title, kde = True) | Draws a 2D scatter plot (png) of the core and accessory distances
Also draws contours of kernel density estimare
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n samples.
out_prefix (str)
Prefix for output plot file (.png will be appended)
... | Draws a 2D scatter plot (png) of the core and accessory distances | def plot_scatter(X, out_prefix, title, kde = True):
"""Draws a 2D scatter plot (png) of the core and accessory distances
Also draws contours of kernel density estimare
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n samples.
out_prefix (str)
... | [
"def",
"plot_scatter",
"(",
"X",
",",
"out_prefix",
",",
"title",
",",
"kde",
"=",
"True",
")",
":",
"# Plot results - max 1M for speed",
"max_plot_samples",
"=",
"1000000",
"if",
"X",
".",
"shape",
"[",
"0",
"]",
">",
"max_plot_samples",
":",
"X",
"=",
"u... | [
32,
0
] | [
83,
15
] | python | en | ['en', 'en', 'en'] | True |
plot_fit | (klist, raw_matching, raw_fit, corrected_matching, corrected_fit, out_prefix, title) | Draw a scatter plot (pdf) of k-mer sizes vs match probability, and the
fit used to assign core and accessory distance
K-mer sizes on x-axis, log(pr(match)) on y - expect a straight line fit
with intercept representing accessory distance and slope core distance
Args:
klist (list)
Li... | Draw a scatter plot (pdf) of k-mer sizes vs match probability, and the
fit used to assign core and accessory distance | def plot_fit(klist, raw_matching, raw_fit, corrected_matching, corrected_fit, out_prefix, title):
"""Draw a scatter plot (pdf) of k-mer sizes vs match probability, and the
fit used to assign core and accessory distance
K-mer sizes on x-axis, log(pr(match)) on y - expect a straight line fit
with interce... | [
"def",
"plot_fit",
"(",
"klist",
",",
"raw_matching",
",",
"raw_fit",
",",
"corrected_matching",
",",
"corrected_fit",
",",
"out_prefix",
",",
"title",
")",
":",
"k_fit",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"klist",
"[",
"-",
"1",
"]",
",",
"num... | [
85,
0
] | [
129,
15
] | python | en | ['en', 'en', 'en'] | True |
plot_results | (X, Y, means, covariances, scale, title, out_prefix) | Draw a scatter plot (png) to show the BGMM model fit
A scatter plot of core and accessory distances, coloured by component
membership. Also shown are ellipses for each component (centre: means
axes: covariances).
This is based on the example in the sklearn documentation.
Args:
X (numpy.ar... | Draw a scatter plot (png) to show the BGMM model fit | def plot_results(X, Y, means, covariances, scale, title, out_prefix):
"""Draw a scatter plot (png) to show the BGMM model fit
A scatter plot of core and accessory distances, coloured by component
membership. Also shown are ellipses for each component (centre: means
axes: covariances).
This is base... | [
"def",
"plot_results",
"(",
"X",
",",
"Y",
",",
"means",
",",
"covariances",
",",
"scale",
",",
"title",
",",
"out_prefix",
")",
":",
"color_iter",
"=",
"itertools",
".",
"cycle",
"(",
"[",
"'navy'",
",",
"'c'",
",",
"'cornflowerblue'",
",",
"'gold'",
... | [
131,
0
] | [
184,
15
] | python | en | ['en', 'en', 'en'] | True |
plot_dbscan_results | (X, y, n_clusters, out_prefix) | Draw a scatter plot (png) to show the DBSCAN model fit
A scatter plot of core and accessory distances, coloured by component
membership. Black is noise
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n samples.
Y (numpy.array)
n x 1 array of ... | Draw a scatter plot (png) to show the DBSCAN model fit | def plot_dbscan_results(X, y, n_clusters, out_prefix):
"""Draw a scatter plot (png) to show the DBSCAN model fit
A scatter plot of core and accessory distances, coloured by component
membership. Black is noise
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n... | [
"def",
"plot_dbscan_results",
"(",
"X",
",",
"y",
",",
"n_clusters",
",",
"out_prefix",
")",
":",
"# Black removed and is used for noise instead.",
"unique_labels",
"=",
"set",
"(",
"y",
")",
"colours",
"=",
"[",
"plt",
".",
"cm",
".",
"Spectral",
"(",
"each",... | [
186,
0
] | [
224,
15
] | python | en | ['en', 'en', 'en'] | True |
plot_refined_results | (X, Y, x_boundary, y_boundary, core_boundary, accessory_boundary,
mean0, mean1, min_move, max_move, scale, threshold, indiv_boundaries,
unconstrained, title, out_prefix) | Draw a scatter plot (png) to show the refined model fit
A scatter plot of core and accessory distances, coloured by component
membership. The triangular decision boundary is also shown
Args:
X (numpy.array)
n x 2 array of core and accessory distances for n samples.
Y (numpy.arr... | Draw a scatter plot (png) to show the refined model fit | def plot_refined_results(X, Y, x_boundary, y_boundary, core_boundary, accessory_boundary,
mean0, mean1, min_move, max_move, scale, threshold, indiv_boundaries,
unconstrained, title, out_prefix):
"""Draw a scatter plot (png) to show the refined model fit
A scatter plot of core and accessory dist... | [
"def",
"plot_refined_results",
"(",
"X",
",",
"Y",
",",
"x_boundary",
",",
"y_boundary",
",",
"core_boundary",
",",
"accessory_boundary",
",",
"mean0",
",",
"mean1",
",",
"min_move",
",",
"max_move",
",",
"scale",
",",
"threshold",
",",
"indiv_boundaries",
","... | [
226,
0
] | [
314,
15
] | python | en | ['en', 'en', 'en'] | True |
plot_contours | (model, assignments, title, out_prefix) | Draw contours of mixture model assignments
Will draw the decision boundary for between/within in red
Args:
model (BGMMFit)
Model we are plotting from
assignments (numpy.array)
n-vectors of cluster assignments for model
title (str)
The title to displa... | Draw contours of mixture model assignments | def plot_contours(model, assignments, title, out_prefix):
"""Draw contours of mixture model assignments
Will draw the decision boundary for between/within in red
Args:
model (BGMMFit)
Model we are plotting from
assignments (numpy.array)
n-vectors of cluster assignme... | [
"def",
"plot_contours",
"(",
"model",
",",
"assignments",
",",
"title",
",",
"out_prefix",
")",
":",
"# avoid recursive import",
"from",
".",
"bgmm",
"import",
"log_likelihood",
"from",
".",
"bgmm",
"import",
"findWithinLabel",
"xx",
",",
"yy",
",",
"xy",
"=",... | [
316,
0
] | [
354,
15
] | python | en | ['en', 'en', 'en'] | True |
get_grid | (minimum, maximum, resolution) | Get a square grid of points to evaluate a function across
Used for :func:`~plot_scatter` and :func:`~plot_contours`
Args:
minimum (float)
Minimum value for grid
maximum (float)
Maximum value for grid
resolution (int)
Number of points along each axis
... | Get a square grid of points to evaluate a function across | def get_grid(minimum, maximum, resolution):
"""Get a square grid of points to evaluate a function across
Used for :func:`~plot_scatter` and :func:`~plot_contours`
Args:
minimum (float)
Minimum value for grid
maximum (float)
Maximum value for grid
resolution ... | [
"def",
"get_grid",
"(",
"minimum",
",",
"maximum",
",",
"resolution",
")",
":",
"x",
"=",
"np",
".",
"linspace",
"(",
"minimum",
",",
"maximum",
",",
"resolution",
")",
"y",
"=",
"np",
".",
"linspace",
"(",
"minimum",
",",
"maximum",
",",
"resolution",... | [
356,
0
] | [
381,
22
] | python | en | ['en', 'en', 'en'] | True |
distHistogram | (dists, rank, outPrefix) | Plot a histogram of distances (1D)
Args:
dists (np.array)
Distance vector
rank (int)
Rank (used for name and title)
outPrefix (int)
Full path prefix for plot file
| Plot a histogram of distances (1D) | def distHistogram(dists, rank, outPrefix):
"""Plot a histogram of distances (1D)
Args:
dists (np.array)
Distance vector
rank (int)
Rank (used for name and title)
outPrefix (int)
Full path prefix for plot file
"""
plt.figure(figsize=(11, 8), dp... | [
"def",
"distHistogram",
"(",
"dists",
",",
"rank",
",",
"outPrefix",
")",
":",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"11",
",",
"8",
")",
",",
"dpi",
"=",
"160",
",",
"facecolor",
"=",
"'w'",
",",
"edgecolor",
"=",
"'k'",
")",
"plt",
".... | [
383,
0
] | [
406,
15
] | python | en | ['en', 'fr', 'en'] | True |
drawMST | (mst, outPrefix, isolate_clustering, clustering_name, overwrite) | Plot a layout of the minimum spanning tree
Args:
mst (graph_tool.Graph)
A minimum spanning tree
outPrefix (str)
Output prefix for save files
isolate_clustering (dict)
Dictionary of ID: cluster, used for colouring vertices
clustering_name (str)
... | Plot a layout of the minimum spanning tree | def drawMST(mst, outPrefix, isolate_clustering, clustering_name, overwrite):
"""Plot a layout of the minimum spanning tree
Args:
mst (graph_tool.Graph)
A minimum spanning tree
outPrefix (str)
Output prefix for save files
isolate_clustering (dict)
Dict... | [
"def",
"drawMST",
"(",
"mst",
",",
"outPrefix",
",",
"isolate_clustering",
",",
"clustering_name",
",",
"overwrite",
")",
":",
"import",
"graph_tool",
".",
"all",
"as",
"gt",
"graph1_file_name",
"=",
"outPrefix",
"+",
"\"/\"",
"+",
"os",
".",
"path",
".",
... | [
408,
0
] | [
450,
70
] | python | en | ['en', 'en', 'en'] | True |
outputsForCytoscape | (G, G_mst, isolate_names, clustering, outPrefix, epiCsv, queryList = None,
suffix = None, writeCsv = True, viz_subset = None) | Write outputs for cytoscape. A graphml of the network, and CSV with metadata
Args:
G (graph)
The network to write
G_mst (graph)
The minimum spanning tree of G
isolate_names (list)
Ordered list of sequence names
clustering (dict)
Dictio... | Write outputs for cytoscape. A graphml of the network, and CSV with metadata | def outputsForCytoscape(G, G_mst, isolate_names, clustering, outPrefix, epiCsv, queryList = None,
suffix = None, writeCsv = True, viz_subset = None):
"""Write outputs for cytoscape. A graphml of the network, and CSV with metadata
Args:
G (graph)
The network to write
... | [
"def",
"outputsForCytoscape",
"(",
"G",
",",
"G_mst",
",",
"isolate_names",
",",
"clustering",
",",
"outPrefix",
",",
"epiCsv",
",",
"queryList",
"=",
"None",
",",
"suffix",
"=",
"None",
",",
"writeCsv",
"=",
"True",
",",
"viz_subset",
"=",
"None",
")",
... | [
452,
0
] | [
524,
34
] | python | en | ['en', 'en', 'en'] | True |
writeClusterCsv | (outfile, nodeNames, nodeLabels, clustering,
output_format = 'microreact', epiCsv = None,
queryNames = None, suffix = '_Cluster') | Print CSV file of clustering and optionally epi data
Writes CSV output of clusters which can be used as input to microreact and cytoscape.
Uses pandas to deal with CSV reading and writing nicely.
The epiCsv, if provided, should have the node labels in the first column.
Args:
outfile (str)
... | Print CSV file of clustering and optionally epi data | def writeClusterCsv(outfile, nodeNames, nodeLabels, clustering,
output_format = 'microreact', epiCsv = None,
queryNames = None, suffix = '_Cluster'):
"""Print CSV file of clustering and optionally epi data
Writes CSV output of clusters which can be used as input to micro... | [
"def",
"writeClusterCsv",
"(",
"outfile",
",",
"nodeNames",
",",
"nodeLabels",
",",
"clustering",
",",
"output_format",
"=",
"'microreact'",
",",
"epiCsv",
"=",
"None",
",",
"queryNames",
"=",
"None",
",",
"suffix",
"=",
"'_Cluster'",
")",
":",
"# set order of... | [
526,
0
] | [
686,
19
] | python | en | ['en', 'en', 'en'] | True |
outputsForMicroreact | (combined_list, clustering, nj_tree, mst_tree, accMat, perplexity,
outPrefix, epiCsv, queryList = None, overwrite = False,
use_gpu = False) | Generate files for microreact
Output a neighbour joining tree (.nwk) from core distances, a plot of t-SNE clustering
of accessory distances (.dot) and cluster assignment (.csv)
Args:
combined_list (list)
Name of sequences being analysed. The part of the name before the first '.' will
... | Generate files for microreact | def outputsForMicroreact(combined_list, clustering, nj_tree, mst_tree, accMat, perplexity,
outPrefix, epiCsv, queryList = None, overwrite = False,
use_gpu = False):
"""Generate files for microreact
Output a neighbour joining tree (.nwk) from core distances, a p... | [
"def",
"outputsForMicroreact",
"(",
"combined_list",
",",
"clustering",
",",
"nj_tree",
",",
"mst_tree",
",",
"accMat",
",",
"perplexity",
",",
"outPrefix",
",",
"epiCsv",
",",
"queryList",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"use_gpu",
"=",
"F... | [
688,
0
] | [
742,
62
] | python | en | ['en', 'en', 'en'] | True |
outputsForPhandango | (combined_list, clustering, nj_tree, mst_tree, outPrefix, epiCsv,
queryList = None, overwrite = False) | Generate files for Phandango
Write a neighbour joining tree (.tree) from core distances
and cluster assignment (.csv)
Args:
combined_list (list)
Name of sequences being analysed. The part of the name before the first '.' will
be shown in the output
clustering (dict ... | Generate files for Phandango | def outputsForPhandango(combined_list, clustering, nj_tree, mst_tree, outPrefix, epiCsv,
queryList = None, overwrite = False):
"""Generate files for Phandango
Write a neighbour joining tree (.tree) from core distances
and cluster assignment (.csv)
Args:
combined_list (l... | [
"def",
"outputsForPhandango",
"(",
"combined_list",
",",
"clustering",
",",
"nj_tree",
",",
"mst_tree",
",",
"outPrefix",
",",
"epiCsv",
",",
"queryList",
"=",
"None",
",",
"overwrite",
"=",
"False",
")",
":",
"# generate sequence labels",
"seqLabels",
"=",
"iso... | [
744,
0
] | [
785,
66
] | python | en | ['en', 'id', 'en'] | True |
outputsForGrapetree | (combined_list, clustering, nj_tree, mst_tree, outPrefix, epiCsv,
queryList = None, overwrite = False) | Generate files for Grapetree
Write a neighbour joining tree (.nwk) from core distances
and cluster assignment (.csv)
Args:
combined_list (list)
Name of sequences being analysed. The part of the name before the
first '.' will be shown in the output
clustering (dict o... | Generate files for Grapetree | def outputsForGrapetree(combined_list, clustering, nj_tree, mst_tree, outPrefix, epiCsv,
queryList = None, overwrite = False):
"""Generate files for Grapetree
Write a neighbour joining tree (.nwk) from core distances
and cluster assignment (.csv)
Args:
combined_list (li... | [
"def",
"outputsForGrapetree",
"(",
"combined_list",
",",
"clustering",
",",
"nj_tree",
",",
"mst_tree",
",",
"outPrefix",
",",
"epiCsv",
",",
"queryList",
"=",
"None",
",",
"overwrite",
"=",
"False",
")",
":",
"# generate sequence labels",
"seqLabels",
"=",
"iso... | [
787,
0
] | [
831,
67
] | python | en | ['en', 'en', 'en'] | True |
showPage | (request) | Show the PCA page, which has a list of available datasets so that user can plot PCA for
a different dataset after loading the page. The dataset can be selected by passing a parameter
(eg. pca?dataset=lanner), otherwise the first dataset from the list will be selected.
| Show the PCA page, which has a list of available datasets so that user can plot PCA for
a different dataset after loading the page. The dataset can be selected by passing a parameter
(eg. pca?dataset=lanner), otherwise the first dataset from the list will be selected.
| def showPage(request):
"""Show the PCA page, which has a list of available datasets so that user can plot PCA for
a different dataset after loading the page. The dataset can be selected by passing a parameter
(eg. pca?dataset=lanner), otherwise the first dataset from the list will be selected.
"""
# Supply names ... | [
"def",
"showPage",
"(",
"request",
")",
":",
"# Supply names of all datasets available for user to chooose from",
"datasetNames",
"=",
"[",
"item",
"[",
"'name'",
"]",
"for",
"item",
"in",
"datasets",
".",
"datasetAttributes",
"(",
"request",
")",
"]",
"# Fetch BPData... | [
9,
0
] | [
39,
49
] | python | en | ['en', 'en', 'en'] | True |
no_privilege | (self, node=None) | Check that user doesn't need privileges to execute `KILL MUTATION` with no mutations.
| Check that user doesn't need privileges to execute `KILL MUTATION` with no mutations.
| def no_privilege(self, node=None):
"""Check that user doesn't need privileges to execute `KILL MUTATION` with no mutations.
"""
if node is None:
node = self.context.node
with Scenario("kill mutation on a table"):
user_name = f"user_{getuid()}"
table_name = f"merge_tree_{getuid()... | [
"def",
"no_privilege",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"Scenario",
"(",
"\"kill mutation on a table\"",
")",
":",
"user_name",
"=",
"f\"user_{getuid... | [
5,
0
] | [
43,
163
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `KILL MUTATION` on a table with a mutation
if and only if the user has privilege matching the source of the mutation on that table.
For example, to execute `KILL MUTATION` after `ALTER UPDATE`, the user needs `ALTER UPDATE` privilege.
| Check that a user is able to execute `KILL MUTATION` on a table with a mutation
if and only if the user has privilege matching the source of the mutation on that table.
For example, to execute `KILL MUTATION` after `ALTER UPDATE`, the user needs `ALTER UPDATE` privilege.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `KILL MUTATION` on a table with a mutation
if and only if the user has privilege matching the source of the mutation on that table.
For example, to execute `KILL MUTATION` after `ALTER UPDATE`, the user needs `ALTER UP... | [
"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_... | [
46,
0
] | [
60,
81
] | python | en | ['en', 'en', 'en'] | True |
privileges_granted_via_role | (self, node=None) | Check that a user is able to execute `KILL MUTATION` on a table with a mutation
if and only if the user has privilege matching the source of the mutation on that table.
For example, to execute `KILL MUTATION` after `ALTER UPDATE`, the user needs `ALTER UPDATE` privilege.
| Check that a user is able to execute `KILL MUTATION` on a table with a mutation
if and only if the user has privilege matching the source of the mutation on that table.
For example, to execute `KILL MUTATION` after `ALTER UPDATE`, the user needs `ALTER UPDATE` privilege.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `KILL MUTATION` on a table with a mutation
if and only if the user has privilege matching the source of the mutation on that table.
For example, to execute `KILL MUTATION` after `ALTER UPDATE`, the user needs `ALTER UP... | [
"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"... | [
63,
0
] | [
81,
81
] | python | en | ['en', 'en', 'en'] | True |
update | (self, user_name, grant_target_name, node=None) | Check that the user is able to execute `KILL MUTATION` after `ALTER UPDATE`
if and only if the user has `ALTER UPDATE` privilege.
| Check that the user is able to execute `KILL MUTATION` after `ALTER UPDATE`
if and only if the user has `ALTER UPDATE` privilege.
| def update(self, user_name, grant_target_name, node=None):
"""Check that the user is able to execute `KILL MUTATION` after `ALTER UPDATE`
if and only if the user has `ALTER UPDATE` privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.c... | [
"def",
"update",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
"None",
":",
"n... | [
87,
0
] | [
179,
132
] | python | en | ['en', 'en', 'en'] | True |
delete | (self, user_name, grant_target_name, node=None) | Check that the user is able to execute `KILL MUTATION` after `ALTER DELETE`
if and only if the user has `ALTER DELETE` privilege.
| Check that the user is able to execute `KILL MUTATION` after `ALTER DELETE`
if and only if the user has `ALTER DELETE` privilege.
| def delete(self, user_name, grant_target_name, node=None):
"""Check that the user is able to execute `KILL MUTATION` after `ALTER DELETE`
if and only if the user has `ALTER DELETE` privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.c... | [
"def",
"delete",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
"None",
":",
"n... | [
185,
0
] | [
277,
132
] | python | en | ['en', 'en', 'en'] | True |
drop_column | (self, user_name, grant_target_name, node=None) | Check that the user is able to execute `KILL MUTATION` after `ALTER DROP COLUMN`
if and only if the user has `ALTER DROP COLUMN` privilege.
| Check that the user is able to execute `KILL MUTATION` after `ALTER DROP COLUMN`
if and only if the user has `ALTER DROP COLUMN` privilege.
| def drop_column(self, user_name, grant_target_name, node=None):
"""Check that the user is able to execute `KILL MUTATION` after `ALTER DROP COLUMN`
if and only if the user has `ALTER DROP COLUMN` privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
... | [
"def",
"drop_column",
"(",
"self",
",",
"user_name",
",",
"grant_target_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node",
"is",
"None",
":",... | [
283,
0
] | [
375,
132
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of KILL MUTATION.
| Check the RBAC functionality of KILL MUTATION.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of KILL MUTATION.
"""
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",
")",
... | [
384,
0
] | [
396,
82
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1") | Check drop user query syntax.
```sql
DROP USER [IF EXISTS] name [,...] [ON CLUSTER cluster_name]
```
| Check drop user query syntax. | def feature(self, node="clickhouse1"):
"""Check drop user query syntax.
```sql
DROP USER [IF EXISTS] name [,...] [ON CLUSTER cluster_name]
```
"""
node = self.context.cluster.node(node)
@contextmanager
def setup(user):
try:
with Given("I have a user"):
... | [
"def",
"feature",
"(",
"self",
",",
"node",
"=",
"\"clickhouse1\"",
")",
":",
"node",
"=",
"self",
".",
"context",
".",
"cluster",
".",
"node",
"(",
"node",
")",
"@",
"contextmanager",
"def",
"setup",
"(",
"user",
")",
":",
"try",
":",
"with",
"Given... | [
9,
0
] | [
97,
101
] | python | en | ['pt', 'gl', 'en'] | False |
default_frame | (self) | Check default frame.
| Check default frame.
| def default_frame(self):
"""Check default frame.
"""
with Scenario("with order by"):
expected = convert_output("""
number | sum
---------+------
1 | 2
1 | 2
2 | 4
3 | 10
3 | 10
""")
... | [
"def",
"default_frame",
"(",
"self",
")",
":",
"with",
"Scenario",
"(",
"\"with order by\"",
")",
":",
"expected",
"=",
"convert_output",
"(",
"\"\"\"\n number | sum\n ---------+------\n 1 | 2\n 1 | 2\n 2 | 4\n ... | [
9,
0
] | [
42,
9
] | python | da | ['es', 'da', 'en'] | False |
feature | (self) | Check defining frame clause.
| Check defining frame clause.
| def feature(self):
"""Check defining frame clause.
"""
Feature(run=default_frame, flags=TE)
Feature(run=load("window_functions.tests.rows_frame", "feature"), flags=TE)
Feature(run=load("window_functions.tests.range_frame", "feature"), flags=TE)
Feature(run=load("window_functions.tests.range_over... | [
"def",
"feature",
"(",
"self",
")",
":",
"Feature",
"(",
"run",
"=",
"default_frame",
",",
"flags",
"=",
"TE",
")",
"Feature",
"(",
"run",
"=",
"load",
"(",
"\"window_functions.tests.rows_frame\"",
",",
"\"feature\"",
")",
",",
"flags",
"=",
"TE",
")",
"... | [
60,
0
] | [
68,
81
] | python | en | ['de', 'en', 'en'] | True |
PooledVentralStream._gen_spatial_masks | (self, n_angles=4) | r"""Generate spatial masks
Create and return masks that allow us to specifically select
values from ``self.representation`` that correspond to different
regions of the image. See ``summarize_representation()`` for an
example of how to use them
Parameters
----------
... | r"""Generate spatial masks | def _gen_spatial_masks(self, n_angles=4):
r"""Generate spatial masks
Create and return masks that allow us to specifically select
values from ``self.representation`` that correspond to different
regions of the image. See ``summarize_representation()`` for an
example of how to us... | [
"def",
"_gen_spatial_masks",
"(",
"self",
",",
"n_angles",
"=",
"4",
")",
":",
"masks",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_scales",
")",
":",
"ecc",
"=",
"torch",
".",
"ones_like",
"(",
"self",
".",
"PoolingWindows",
"."... | [
223,
4
] | [
255,
20
] | python | en | ['en', 'id', 'it'] | False |
PooledVentralStream._calculate_moments | (self, image, second=True, third=True,
fourth=True, pooled_mean=None) | Calculate weighted moments of image.
Note that we're computing nth root of the first 4 moments, not the
central or standardized moments (which are more common and go by the
names variance, skew, and kurtosis; these involve subtracting off the
mean and dividing by the variance raised to ... | Calculate weighted moments of image. | def _calculate_moments(self, image, second=True, third=True,
fourth=True, pooled_mean=None):
"""Calculate weighted moments of image.
Note that we're computing nth root of the first 4 moments, not the
central or standardized moments (which are more common and go by the... | [
"def",
"_calculate_moments",
"(",
"self",
",",
"image",
",",
"second",
"=",
"True",
",",
"third",
"=",
"True",
",",
"fourth",
"=",
"True",
",",
"pooled_mean",
"=",
"None",
")",
":",
"moments",
"=",
"{",
"}",
"# clamp with min=0 to avoid NaNs. see",
"# https:... | [
257,
4
] | [
305,
22
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.to | (self, *args, do_windows=True, **kwargs) | r"""Moves and/or casts the parameters and buffers.
This can be called as
.. function:: to(device=None, dtype=None, non_blocking=False)
.. function:: to(dtype, non_blocking=False)
.. function:: to(tensor, non_blocking=False)
Its signature is similar to :meth:`torch.Tensor.to`... | r"""Moves and/or casts the parameters and buffers. | def to(self, *args, do_windows=True, **kwargs):
r"""Moves and/or casts the parameters and buffers.
This can be called as
.. function:: to(device=None, dtype=None, non_blocking=False)
.. function:: to(dtype, non_blocking=False)
.. function:: to(tensor, non_blocking=False)
... | [
"def",
"to",
"(",
"self",
",",
"*",
"args",
",",
"do_windows",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"do_windows",
":",
"self",
".",
"PoolingWindows",
".",
"to",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"for",
"k",
",",
"... | [
307,
4
] | [
354,
19
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.plot_windows | (self, ax=None, contour_levels=None, colors='r', subset=True, **kwargs) | r"""plot the pooling windows on an image.
This is just a simple little helper to plot the pooling windows
on an existing axis. The use case is overlaying this on top of
the image we're pooling (as returned by ``pyrtools.imshow``),
and so we require an axis to be passed
Any addi... | r"""plot the pooling windows on an image. | def plot_windows(self, ax=None, contour_levels=None, colors='r', subset=True, **kwargs):
r"""plot the pooling windows on an image.
This is just a simple little helper to plot the pooling windows
on an existing axis. The use case is overlaying this on top of
the image we're pooling (as r... | [
"def",
"plot_windows",
"(",
"self",
",",
"ax",
"=",
"None",
",",
"contour_levels",
"=",
"None",
",",
"colors",
"=",
"'r'",
",",
"subset",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"PoolingWindows",
".",
"plot_windows",
"(",... | [
356,
4
] | [
399,
93
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.summarize_window_sizes | (self) | r"""Summarize window sizes
This function returns a dictionary summarizing the window sizes
at the minimum and maximum eccentricity. Let ``min_window`` be
the window whose center is closest to ``self.min_eccentricity``
and ``max_window`` the one whose center is closest to
``self.... | r"""Summarize window sizes | def summarize_window_sizes(self):
r"""Summarize window sizes
This function returns a dictionary summarizing the window sizes
at the minimum and maximum eccentricity. Let ``min_window`` be
the window whose center is closest to ``self.min_eccentricity``
and ``max_window`` the one ... | [
"def",
"summarize_window_sizes",
"(",
"self",
")",
":",
"return",
"self",
".",
"PoolingWindows",
".",
"summarize_window_sizes",
"(",
")"
] | [
401,
4
] | [
419,
59
] | python | en | ['en', 'zu', 'tr'] | False |
PooledVentralStream.plot_window_widths | (self, units='degrees', scale_num=0, figsize=(5, 5), jitter=.25) | r"""plot the widths of the windows, in degrees or pixels
We plot the width of the window in both angular and radial
direction, as well as showing the 'top', 'half', and 'full'
widths (top is the width of the flat-top region of each window,
where the window's value is 1; full is the widt... | r"""plot the widths of the windows, in degrees or pixels | def plot_window_widths(self, units='degrees', scale_num=0, figsize=(5, 5), jitter=.25):
r"""plot the widths of the windows, in degrees or pixels
We plot the width of the window in both angular and radial
direction, as well as showing the 'top', 'half', and 'full'
widths (top is the widt... | [
"def",
"plot_window_widths",
"(",
"self",
",",
"units",
"=",
"'degrees'",
",",
"scale_num",
"=",
"0",
",",
"figsize",
"=",
"(",
"5",
",",
"5",
")",
",",
"jitter",
"=",
".25",
")",
":",
"return",
"self",
".",
"PoolingWindows",
".",
"plot_window_widths",
... | [
421,
4
] | [
461,
88
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.plot_window_areas | (self, units='degrees', scale_num=0, figsize=(5, 5)) | r"""plot the approximate areas of the windows, in degrees or pixels
We plot the approximate area of the window, calculated using
'top', 'half', and 'full' widths (top is the width of the
flat-top region of each window, where the window's value is 1;
full is the width of the entire windo... | r"""plot the approximate areas of the windows, in degrees or pixels | def plot_window_areas(self, units='degrees', scale_num=0, figsize=(5, 5)):
r"""plot the approximate areas of the windows, in degrees or pixels
We plot the approximate area of the window, calculated using
'top', 'half', and 'full' widths (top is the width of the
flat-top region of each w... | [
"def",
"plot_window_areas",
"(",
"self",
",",
"units",
"=",
"'degrees'",
",",
"scale_num",
"=",
"0",
",",
"figsize",
"=",
"(",
"5",
",",
"5",
")",
")",
":",
"return",
"self",
".",
"PoolingWindows",
".",
"plot_window_areas",
"(",
"units",
",",
"scale_num"... | [
463,
4
] | [
504,
79
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.save_reduced | (self, file_path) | r"""save the relevant parameters to make saving/loading more efficient
This saves self.state_dict_reduced, which contains the
attributes necessary to initialize the model plus a 'model_name'
key, which the ``load_reduced`` method uses to determine which
model constructor to call
... | r"""save the relevant parameters to make saving/loading more efficient | def save_reduced(self, file_path):
r"""save the relevant parameters to make saving/loading more efficient
This saves self.state_dict_reduced, which contains the
attributes necessary to initialize the model plus a 'model_name'
key, which the ``load_reduced`` method uses to determine whic... | [
"def",
"save_reduced",
"(",
"self",
",",
"file_path",
")",
":",
"torch",
".",
"save",
"(",
"self",
".",
"state_dict_reduced",
",",
"file_path",
")"
] | [
506,
4
] | [
520,
54
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.load_reduced | (cls, file_path) | r"""load from the dictionary saved by ``save_reduced``
Parameters
----------
file_path : str
The path to load the model object from
| r"""load from the dictionary saved by ``save_reduced`` | def load_reduced(cls, file_path):
r"""load from the dictionary saved by ``save_reduced``
Parameters
----------
file_path : str
The path to load the model object from
"""
state_dict_reduced = torch.load(file_path)
return cls.from_state_dict_reduced(sta... | [
"def",
"load_reduced",
"(",
"cls",
",",
"file_path",
")",
":",
"state_dict_reduced",
"=",
"torch",
".",
"load",
"(",
"file_path",
")",
"return",
"cls",
".",
"from_state_dict_reduced",
"(",
"state_dict_reduced",
")"
] | [
523,
4
] | [
532,
62
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.from_state_dict_reduced | (cls, state_dict_reduced) | r"""initialize model from ``state_dict_reduced``
Parameters
----------
state_dict_reduced : dict
The reduced state dict to load
| r"""initialize model from ``state_dict_reduced`` | def from_state_dict_reduced(cls, state_dict_reduced):
r"""initialize model from ``state_dict_reduced``
Parameters
----------
state_dict_reduced : dict
The reduced state dict to load
"""
state_dict_reduced = state_dict_reduced.copy()
model_name = state... | [
"def",
"from_state_dict_reduced",
"(",
"cls",
",",
"state_dict_reduced",
")",
":",
"state_dict_reduced",
"=",
"state_dict_reduced",
".",
"copy",
"(",
")",
"model_name",
"=",
"state_dict_reduced",
".",
"pop",
"(",
"'model_name'",
")",
"# want to remove class if it's here... | [
535,
4
] | [
556,
83
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.summarize_representation | (self, data=None, summary_func='mse', by_angle=False) | r"""summarize representation by key and (optionally) quadrant
This takes data and summarizes it within each key of the
dictionary. The intended use case is to get the mean-squared
error (by passing ``data=metamer.representation_error()``)
within each orientation and scale. With ``by_ang... | r"""summarize representation by key and (optionally) quadrant | def summarize_representation(self, data=None, summary_func='mse', by_angle=False):
r"""summarize representation by key and (optionally) quadrant
This takes data and summarizes it within each key of the
dictionary. The intended use case is to get the mean-squared
error (by passing ``data... | [
"def",
"summarize_representation",
"(",
"self",
",",
"data",
"=",
"None",
",",
"summary_func",
"=",
"'mse'",
",",
"by_angle",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_spatial_masks",
"and",
"by_angle",
":",
"self",
".",
"_spatial_masks",
"=",
"s... | [
558,
4
] | [
625,
25
] | python | en | ['en', 'cy', 'en'] | True |
PooledVentralStream._representation_for_plotting | (self, batch_idx=0, data=None) | r"""Get the representation in the form required for plotting
PooledVentralStream objects' representation has a lot of structure:
each consists of some number of different representation types,
each averaged per window. And the windows themselves are
structured: we have several different... | r"""Get the representation in the form required for plotting | def _representation_for_plotting(self, batch_idx=0, data=None):
r"""Get the representation in the form required for plotting
PooledVentralStream objects' representation has a lot of structure:
each consists of some number of different representation types,
each averaged per window. And ... | [
"def",
"_representation_for_plotting",
"(",
"self",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"self",
".",
"representation",
"if",
"not",
"isinstance",
"(",
"data",
",",
"dict",
")",
"... | [
627,
4
] | [
678,
23
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.representation_to_output | (self, data=None) | r"""convert representation to output
This takes data that looks like ``self.representation`` (i.e., a
dictionary whose keys are ``"mean_luminance"`` and ``(scale,
orientation)`` tuples) and flattens it to an output that looks
like what we get from the ``forward()`` call.
Plenop... | r"""convert representation to output | def representation_to_output(self, data=None):
r"""convert representation to output
This takes data that looks like ``self.representation`` (i.e., a
dictionary whose keys are ``"mean_luminance"`` and ``(scale,
orientation)`` tuples) and flattens it to an output that looks
like w... | [
"def",
"representation_to_output",
"(",
"self",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"self",
".",
"representation",
"return",
"torch",
".",
"cat",
"(",
"list",
"(",
"data",
".",
"values",
"(",
")",
")",
",... | [
680,
4
] | [
707,
52
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.output_to_representation | (self, data) | r"""convert output to representation
This takes data that looks like the output from the
``forward()`` call (a big 3d tensor) and returns something that
looks like ``self.representation`` (i.e., a dictionary whose
keys are ``"mean_luminance"`` and ``(scale, orientation)``
tuples... | r"""convert output to representation | def output_to_representation(self, data):
r"""convert output to representation
This takes data that looks like the output from the
``forward()`` call (a big 3d tensor) and returns something that
looks like ``self.representation`` (i.e., a dictionary whose
keys are ``"mean_lumina... | [
"def",
"output_to_representation",
"(",
"self",
",",
"data",
")",
":",
"data_dict",
"=",
"{",
"}",
"idx",
"=",
"0",
"for",
"k",
",",
"v",
"in",
"self",
".",
"representation",
".",
"items",
"(",
")",
":",
"data_dict",
"[",
"k",
"]",
"=",
"data",
"["... | [
709,
4
] | [
743,
19
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream._get_title | (cls, title_list, idx, default_title) | r"""helper function for dealing with the default way we handle title
We have a couple possible ways of handling title in these
plotting functions, so this helper function consolidates
that.
When picking a title, we know we'll either have a list of titles
or a single None.
... | r"""helper function for dealing with the default way we handle title | def _get_title(cls, title_list, idx, default_title):
r"""helper function for dealing with the default way we handle title
We have a couple possible ways of handling title in these
plotting functions, so this helper function consolidates
that.
When picking a title, we know we'll... | [
"def",
"_get_title",
"(",
"cls",
",",
"title_list",
",",
"idx",
",",
"default_title",
")",
":",
"try",
":",
"title",
"=",
"title_list",
"[",
"idx",
"]",
"if",
"'|'",
"in",
"title",
":",
"if",
"title",
".",
"index",
"(",
"'|'",
")",
"==",
"0",
":",
... | [
746,
4
] | [
792,
20
] | python | en | ['en', 'en', 'en'] | True |
PooledVentralStream.update_plot | (self, axes, batch_idx=0, data=None) | r"""Update the information in our representation plot
This is used for creating an animation of the representation
over time. In order to create the animation, we need to know how
to update the matplotlib Artists, and this provides a simple way
of doing that. It relies on the fact that ... | r"""Update the information in our representation plot | def update_plot(self, axes, batch_idx=0, data=None):
r"""Update the information in our representation plot
This is used for creating an animation of the representation
over time. In order to create the animation, we need to know how
to update the matplotlib Artists, and this provides a ... | [
"def",
"update_plot",
"(",
"self",
",",
"axes",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"stem_artists",
"=",
"[",
"]",
"axes",
"=",
"[",
"ax",
"for",
"ax",
"in",
"axes",
"if",
"len",
"(",
"ax",
".",
"containers",
")",
"=="... | [
794,
4
] | [
850,
27
] | python | en | ['en', 'en', 'en'] | True |
PooledRGC.forward | (self, image) | r"""Generate the RGC representation of an image
Parameters
----------
image : torch.Tensor
A tensor containing the image to analyze. We want to operate
on this in the pytorch-y way, so we want it to be 4d (batch,
channel, height, width). If it has fewer than ... | r"""Generate the RGC representation of an image | def forward(self, image):
r"""Generate the RGC representation of an image
Parameters
----------
image : torch.Tensor
A tensor containing the image to analyze. We want to operate
on this in the pytorch-y way, so we want it to be 4d (batch,
channel, hei... | [
"def",
"forward",
"(",
"self",
",",
"image",
")",
":",
"while",
"image",
".",
"ndimension",
"(",
")",
"<",
"4",
":",
"image",
"=",
"image",
".",
"unsqueeze",
"(",
"0",
")",
"self",
".",
"image",
"=",
"image",
".",
"detach",
"(",
")",
".",
"clone"... | [
1047,
4
] | [
1072,
46
] | python | en | ['en', 'en', 'en'] | True |
PooledRGC._plot_helper | (self, n_cols=1, figsize=(10, 5), ax=None, title=None, batch_idx=0, data=None) | r"""helper function for plotting that takes care of a lot of the standard stuff
I'm pretty sure that n_cols should only ever be 1, but provided as an
option, just in case.
Parameters
----------
n_cols : int
The number of columns in the (sub-)figure we're creating (w... | r"""helper function for plotting that takes care of a lot of the standard stuff | def _plot_helper(self, n_cols=1, figsize=(10, 5), ax=None, title=None, batch_idx=0, data=None):
r"""helper function for plotting that takes care of a lot of the standard stuff
I'm pretty sure that n_cols should only ever be 1, but provided as an
option, just in case.
Parameters
... | [
"def",
"_plot_helper",
"(",
"self",
",",
"n_cols",
"=",
"1",
",",
"figsize",
"=",
"(",
"10",
",",
"5",
")",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"isinsta... | [
1074,
4
] | [
1121,
30
] | python | en | ['en', 'en', 'en'] | True |
PooledRGC.plot_representation | (self, figsize=(10, 5), ylim=None, ax=None, title=None, batch_idx=0,
data=None) | r"""plot the representation of the RGC model
Because our model just takes the average pixel intensities in each
window, our representation plot is just a simple stem plot showing each
of these average intensities (different positions on the x axis
correspond to different windows). We ha... | r"""plot the representation of the RGC model | def plot_representation(self, figsize=(10, 5), ylim=None, ax=None, title=None, batch_idx=0,
data=None):
r"""plot the representation of the RGC model
Because our model just takes the average pixel intensities in each
window, our representation plot is just a simple st... | [
"def",
"plot_representation",
"(",
"self",
",",
"figsize",
"=",
"(",
"10",
",",
"5",
")",
",",
"ylim",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"ax",
",",
"d... | [
1123,
4
] | [
1172,
30
] | python | en | ['en', 'en', 'en'] | True |
PooledRGC.plot_representation_image | (self, figsize=(5, 5), ax=None, title=None, batch_idx=0,
data=None, vrange='indep1', zoom=1) | r"""Plot representation as an image, using the weights from PoolingWindows
The RGC model consists of average pixel intensity per window, thus, our
representation has a single value for each pooling window, so we take
that value and multiply it by the pooling window, and then sum across
... | r"""Plot representation as an image, using the weights from PoolingWindows | def plot_representation_image(self, figsize=(5, 5), ax=None, title=None, batch_idx=0,
data=None, vrange='indep1', zoom=1):
r"""Plot representation as an image, using the weights from PoolingWindows
The RGC model consists of average pixel intensity per window, thus, our... | [
"def",
"plot_representation_image",
"(",
"self",
",",
"figsize",
"=",
"(",
"5",
",",
"5",
")",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
",",
"vrange",
"=",
"'indep1'",
",",
"zoom",
"="... | [
1174,
4
] | [
1229,
28
] | python | en | ['en', 'en', 'en'] | True |
PooledV1.to | (self, *args, do_windows=True, **kwargs) | r"""Moves and/or casts the parameters and buffers.
This can be called as
.. function:: to(device=None, dtype=None, non_blocking=False)
.. function:: to(dtype, non_blocking=False)
.. function:: to(tensor, non_blocking=False)
Its signature is similar to :meth:`torch.Tensor.to`... | r"""Moves and/or casts the parameters and buffers. | def to(self, *args, do_windows=True, **kwargs):
r"""Moves and/or casts the parameters and buffers.
This can be called as
.. function:: to(device=None, dtype=None, non_blocking=False)
.. function:: to(dtype, non_blocking=False)
.. function:: to(tensor, non_blocking=False)
... | [
"def",
"to",
"(",
"self",
",",
"*",
"args",
",",
"do_windows",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"complex_steerable_pyramid",
".",
"to",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"super",
"(",
"self",
".",
"__class_... | [
1496,
4
] | [
1534,
19
] | python | en | ['en', 'en', 'en'] | True |
PooledV1.forward | (self, image, scales=[]) | r"""Generate the V1 representation of an image
Parameters
----------
image : torch.Tensor
A tensor containing the image to analyze. We want to operate
on this in the pytorch-y way, so we want it to be 4d (batch,
channel, height, width). If it has fewer than 4... | r"""Generate the V1 representation of an image | def forward(self, image, scales=[]):
r"""Generate the V1 representation of an image
Parameters
----------
image : torch.Tensor
A tensor containing the image to analyze. We want to operate
on this in the pytorch-y way, so we want it to be 4d (batch,
ch... | [
"def",
"forward",
"(",
"self",
",",
"image",
",",
"scales",
"=",
"[",
"]",
")",
":",
"while",
"image",
".",
"ndimension",
"(",
")",
"<",
"4",
":",
"image",
"=",
"image",
".",
"unsqueeze",
"(",
"0",
")",
"if",
"not",
"scales",
":",
"scales",
"=",
... | [
1536,
4
] | [
1609,
46
] | python | en | ['en', 'en', 'en'] | True |
PooledV1._representation_for_plotting | (self, batch_idx=0, data=None) | r"""Get data into the form required for plotting
PooledV1 objects' representation has a lot of
structure: each consists of some number of different
representation types, each averaged per window. And the windows
themselves are structured: we have several different
eccentricity b... | r"""Get data into the form required for plotting | def _representation_for_plotting(self, batch_idx=0, data=None):
r"""Get data into the form required for plotting
PooledV1 objects' representation has a lot of
structure: each consists of some number of different
representation types, each averaged per window. And the windows
the... | [
"def",
"_representation_for_plotting",
"(",
"self",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"data",
"=",
"self",
".",
"output_to_... | [
1611,
4
] | [
1673,
68
] | python | en | ['en', 'en', 'en'] | True |
PooledV1._plot_helper | (self, n_rows, n_cols, figsize=(25, 15), ax=None, title=None, batch_idx=0,
data=None) | r"""helper function for plotting that takes care of a lot of the standard stuff
Parameters
----------
n_rows : int
The number of rows in the (sub-)figure we're creating
n_cols : int
The number oc columns in the (sub-)figure we're creating
figsize : tuple,... | r"""helper function for plotting that takes care of a lot of the standard stuff | def _plot_helper(self, n_rows, n_cols, figsize=(25, 15), ax=None, title=None, batch_idx=0,
data=None):
r"""helper function for plotting that takes care of a lot of the standard stuff
Parameters
----------
n_rows : int
The number of rows in the (sub-)figu... | [
"def",
"_plot_helper",
"(",
"self",
",",
"n_rows",
",",
"n_cols",
",",
"figsize",
"=",
"(",
"25",
",",
"15",
")",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"if",
"ax",
"is... | [
1675,
4
] | [
1736,
35
] | python | en | ['en', 'en', 'en'] | True |
PooledV1.plot_representation | (self, figsize=(25, 15), ylim=None, ax=None, title=None, batch_idx=0,
data=None) | r"""plot the representation of the V1 model
Since our PooledV1 model has more statistics than the
PooledRGC model, this is a much more complicated
plot. We end up creating a grid, showing each band and scale
separately, and then a separate plot, off to the side, for the
mean pix... | r"""plot the representation of the V1 model | def plot_representation(self, figsize=(25, 15), ylim=None, ax=None, title=None, batch_idx=0,
data=None):
r"""plot the representation of the V1 model
Since our PooledV1 model has more statistics than the
PooledRGC model, this is a much more complicated
plot. W... | [
"def",
"plot_representation",
"(",
"self",
",",
"figsize",
"=",
"(",
"25",
",",
"15",
")",
",",
"ylim",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
")",
":",
"n_cols",
"=",... | [
1738,
4
] | [
1822,
24
] | python | en | ['en', 'no', 'en'] | True |
PooledV1.plot_representation_image | (self, figsize=(22, 11), ax=None, title=None, batch_idx=0,
data=None, vrange='auto1', zoom=1) | r"""Plot representation as an image, using the weights from PoolingWindows
Our representation is composed of pooled energy at several
different scales and orientations, plus the pooled mean pixel
intensity. In order to visualize these as images, we take each
statistic, multiply it by th... | r"""Plot representation as an image, using the weights from PoolingWindows | def plot_representation_image(self, figsize=(22, 11), ax=None, title=None, batch_idx=0,
data=None, vrange='auto1', zoom=1):
r"""Plot representation as an image, using the weights from PoolingWindows
Our representation is composed of pooled energy at several
dif... | [
"def",
"plot_representation_image",
"(",
"self",
",",
"figsize",
"=",
"(",
"22",
",",
"11",
")",
",",
"ax",
"=",
"None",
",",
"title",
"=",
"None",
",",
"batch_idx",
"=",
"0",
",",
"data",
"=",
"None",
",",
"vrange",
"=",
"'auto1'",
",",
"zoom",
"=... | [
1824,
4
] | [
1929,
24
] | python | en | ['en', 'en', 'en'] | True |
privilege_granted_directly_or_via_role | (self, table_type, privilege, node=None) | Check that user is only able to execute ALTER UPDATE when they have required privilege, either directly or via role.
| Check that user is only able to execute ALTER UPDATE when they have required privilege, either directly or via role.
| def privilege_granted_directly_or_via_role(self, table_type, privilege, node=None):
"""Check that user is only able to execute ALTER UPDATE 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... | [
"def",
"privilege_granted_directly_or_via_role",
"(",
"self",
",",
"table_type",
",",
"privilege",
",",
"node",
"=",
"None",
")",
":",
"role_name",
"=",
"f\"role_{getuid()}\"",
"user_name",
"=",
"f\"user_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",... | [
10,
0
] | [
29,
136
] | python | en | ['en', 'en', 'en'] | True |
privilege_check | (grant_target_name, user_name, table_type, privilege, 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, table_type, privilege, 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", setup=instrument_clickhouse_serve... | [
"def",
"privilege_check",
"(",
"grant_target_name",
",",
"user_name",
",",
"table_type",
",",
"privilege",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"f\"{user_name}\"",
")",
"... | [
31,
0
] | [
75,
55
] | python | en | ['en', 'en', 'en'] | True |
feature | (self, node="clickhouse1", stress=None, parallel=None) | Check the RBAC functionality of ALTER UPDATE.
| Check the RBAC functionality of ALTER UPDATE.
| def feature(self, node="clickhouse1", stress=None, parallel=None):
"""Check the RBAC functionality of ALTER UPDATE.
"""
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",
")",
... | [
88,
0
] | [
107,
98
] | python | en | ['en', 'en', 'en'] | True |
ResultHeap.__init__ | (self, nq, k) | nq: number of query vectors, k: number of results per query | nq: number of query vectors, k: number of results per query | def __init__(self, nq, k):
" nq: number of query vectors, k: number of results per query "
self.I = np.zeros((nq, k), dtype='int64')
self.D = np.zeros((nq, k), dtype='float32')
self.nq, self.k = nq, k
heaps = faiss.float_maxheap_array_t()
heaps.k = k
heaps.nh = nq... | [
"def",
"__init__",
"(",
"self",
",",
"nq",
",",
"k",
")",
":",
"self",
".",
"I",
"=",
"np",
".",
"zeros",
"(",
"(",
"nq",
",",
"k",
")",
",",
"dtype",
"=",
"'int64'",
")",
"self",
".",
"D",
"=",
"np",
".",
"zeros",
"(",
"(",
"nq",
",",
"k... | [
78,
4
] | [
89,
26
] | python | en | ['en', 'en', 'pt'] | True |
privileges_granted_directly | (self, node=None) | Check that a user is able to execute `ALTER ROW POLICY` with privileges are granted directly.
| Check that a user is able to execute `ALTER ROW POLICY` with privileges are granted directly.
| def privileges_granted_directly(self, node=None):
"""Check that a user is able to execute `ALTER ROW POLICY` 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_row_pol... | [
"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 `ALTER ROW POLICY` with privileges are granted through a role.
| Check that a user is able to execute `ALTER ROW POLICY` with privileges are granted through a role.
| def privileges_granted_via_role(self, node=None):
"""Check that a user is able to execute `ALTER ROW POLICY` 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_... | [
"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 |
alter_row_policy | (self, privilege, grant_target_name, user_name, node=None) | Check that user is only able to execute `ALTER ROW POLICY` when they have the necessary privilege.
| Check that user is only able to execute `ALTER ROW POLICY` when they have the necessary privilege.
| def alter_row_policy(self, privilege, grant_target_name, user_name, node=None):
"""Check that user is only able to execute `ALTER ROW POLICY` when they have the necessary privilege.
"""
exitcode, message = errors.not_enough_privileges(name=user_name)
if node is None:
node = self.context.node
... | [
"def",
"alter_row_policy",
"(",
"self",
",",
"privilege",
",",
"grant_target_name",
",",
"user_name",
",",
"node",
"=",
"None",
")",
":",
"exitcode",
",",
"message",
"=",
"errors",
".",
"not_enough_privileges",
"(",
"name",
"=",
"user_name",
")",
"if",
"node... | [
52,
0
] | [
137,
96
] | python | en | ['en', 'en', 'en'] | True |
no_grants | (self, node=None) | Check that user is unable to select from a table without a row policy
after a row policy has been altered to have a condition.
| Check that user is unable to select from a table without a row policy
after a row policy has been altered to have a condition.
| def no_grants(self, node=None):
"""Check that user is unable to select from a table without a row policy
after a row policy has been altered to have a condition.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(... | [
"def",
"no_grants",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
"("... | [
143,
0
] | [
171,
40
] | python | en | ['en', 'en', 'en'] | True |
permissive | (self, node=None) | Check that user is able to see from a table when they have a PERMISSIVE policy.
| Check that user is able to see from a table when they have a PERMISSIVE policy.
| def permissive(self, node=None):
"""Check that user is able to see from a table when they have a PERMISSIVE policy.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
with Given("I have a r... | [
"def",
"permissive",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
"(... | [
177,
0
] | [
200,
63
] | python | en | ['en', 'en', 'en'] | True |
restrictive | (self, node=None) | Check that user is able to see values they have a RESTRICTIVE policy for.
| Check that user is able to see values they have a RESTRICTIVE policy for.
| def restrictive(self, node=None):
"""Check that user is able to see values they have a RESTRICTIVE policy for.
"""
table_name = f"table_{getuid()}"
perm_pol_name = f"perm_pol_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_... | [
"def",
"restrictive",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"perm_pol_name",
"=",
"f\"perm_pol_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
"."... | [
206,
0
] | [
236,
63
] | python | en | ['en', 'en', 'en'] | True |
for_select | (self, node=None) | Check that user is able to see values allowed by the row policy condition in the FOR SELECT clause.
| Check that user is able to see values allowed by the row policy condition in the FOR SELECT clause.
| def for_select(self, node=None):
"""Check that user is able to see values allowed by the row policy condition in the FOR SELECT clause.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
wi... | [
"def",
"for_select",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
"(... | [
242,
0
] | [
265,
41
] | python | en | ['en', 'en', 'en'] | True |
condition | (self, node=None) | Check that user is able to see values allowed by the row policy condition.
| Check that user is able to see values allowed by the row policy condition.
| def condition(self, node=None):
"""Check that user is able to see values allowed by the row policy condition.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
with Given("I have a row pol... | [
"def",
"condition",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
"("... | [
271,
0
] | [
294,
41
] | python | en | ['en', 'en', 'en'] | True |
remove_condition | (self, node=None) | Check that user is able to see the table after row policy condition has been removed.
| Check that user is able to see the table after row policy condition has been removed.
| def remove_condition(self, node=None):
"""Check that user is able to see the table after row policy condition has been removed.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
with Given... | [
"def",
"remove_condition",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table"... | [
300,
0
] | [
326,
41
] | python | en | ['en', 'en', 'en'] | True |
if_exists | (self, node=None) | Check that a row policy altered using IF EXISTS restricts rows as expected.
| Check that a row policy altered using IF EXISTS restricts rows as expected.
| def if_exists(self, node=None):
"""Check that a row policy altered using IF EXISTS restricts rows as expected.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
with Given("I have a row po... | [
"def",
"if_exists",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
"("... | [
332,
0
] | [
355,
41
] | python | en | ['en', 'en', 'en'] | True |
rename | (self, node=None) | Check that a row policy altered using RENAME restricts rows as expected.
| Check that a row policy altered using RENAME restricts rows as expected.
| def rename(self, node=None):
"""Check that a row policy altered using RENAME restricts rows as expected.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
pol_new_name = f"pol_new_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
... | [
"def",
"rename",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"pol_new_name",
"=",
"f\"pol_new_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"co... | [
361,
0
] | [
392,
87
] | python | en | ['en', 'en', 'en'] | True |
on_cluster | (self, node=None) | Check that a row policy altered using ON CLUSTER applies to the nodes of the cluster correctly.
| Check that a row policy altered using ON CLUSTER applies to the nodes of the cluster correctly.
| def on_cluster(self, node=None):
"""Check that a row policy altered using ON CLUSTER applies to the nodes of the cluster correctly.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
node2 = self.context.node2
try:
... | [
"def",
"on_cluster",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"node2",
"=",
"self... | [
398,
0
] | [
438,
77
] | python | en | ['en', 'en', 'en'] | True |
diff_policies_on_diff_nodes | (self, node=None) | Check that a row policy altered on a node, does not effect row policy on a different node.
| Check that a row policy altered on a node, does not effect row policy on a different node.
| def diff_policies_on_diff_nodes(self, node=None):
"""Check that a row policy altered on a node, does not effect row policy on a different node.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
node2 = self.context.node2
... | [
"def",
"diff_policies_on_diff_nodes",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"node2... | [
441,
0
] | [
481,
77
] | python | en | ['en', 'en', 'en'] | True |
assignment | (self, node=None) | Check that user is able to see rows from a table when they have PERMISSIVE policy assigned to them.
| Check that user is able to see rows from a table when they have PERMISSIVE policy assigned to them.
| def assignment(self, node=None):
"""Check that user is able to see rows from a table when they have PERMISSIVE policy assigned to them.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
wi... | [
"def",
"assignment",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
"(... | [
487,
0
] | [
513,
41
] | python | en | ['en', 'en', 'en'] | True |
assignment_none | (self, node=None) | Check that no one is affected when a row policy is altered to be assigned to NONE.
| Check that no one is affected when a row policy is altered to be assigned to NONE.
| def assignment_none(self, node=None):
"""Check that no one is affected when a row policy is altered to be assigned to NONE.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
with Given("I ... | [
"def",
"assignment_none",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",... | [
519,
0
] | [
545,
40
] | python | en | ['en', 'en', 'en'] | True |
assignment_all | (self, node=None) | Check that everyone is effected with a row policy is altered to be assigned to ALL.
| Check that everyone is effected with a row policy is altered to be assigned to ALL.
| def assignment_all(self, node=None):
"""Check that everyone is effected with a row policy is altered to be assigned to ALL.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(node, table_name):
with Given("I ... | [
"def",
"assignment_all",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"table",
... | [
551,
0
] | [
577,
41
] | python | en | ['en', 'en', 'en'] | True |
assignment_all_except | (self, node=None) | Check that everyone is except the specified user is effect by a row policy is altered to be assigned to ALL EXCEPT.
| Check that everyone is except the specified user is effect by a row policy is altered to be assigned to ALL EXCEPT.
| def assignment_all_except(self, node=None):
"""Check that everyone is except the specified user is effect by a row policy is altered to be assigned to ALL EXCEPT.
"""
table_name = f"table_{getuid()}"
pol_name = f"pol_{getuid()}"
if node is None:
node = self.context.node
with table(nod... | [
"def",
"assignment_all_except",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"context",
".",
"node",
"with",
"t... | [
583,
0
] | [
609,
40
] | python | en | ['en', 'en', 'en'] | True |
nested_view | (self, node=None) | Check that if a user has a row policy on a table and a view is altered to use a condition on that table,
the user is only able to access the rows specified by the assigned policies.
| Check that if a user has a row policy on a table and a view is altered to use a condition on that table,
the user is only able to access the rows specified by the assigned policies.
| def nested_view(self, node=None):
"""Check that if a user has a row policy on a table and a view is altered to use a condition on that table,
the user is only able to access the rows specified by the assigned policies.
"""
table_name = f"table_{getuid()}"
view_name = f"view_{getuid()}"
pol_name... | [
"def",
"nested_view",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"con... | [
615,
0
] | [
648,
62
] | python | en | ['en', 'en', 'en'] | True |
nested_live_view_before_policy | (self, node=None) | Check that if a live view exists on a table and then a row policy is created,
the user is only able to select rows specified by the assigned policies from the view.
| Check that if a live view exists on a table and then a row policy is created,
the user is only able to select rows specified by the assigned policies from the view.
| def nested_live_view_before_policy(self, node=None):
"""Check that if a live view exists on a table and then a row policy is created,
the user is only able to select rows specified by the assigned policies from the view.
"""
table_name = f"table_{getuid()}"
view_name = f"view_{getuid()}"
pol_na... | [
"def",
"nested_live_view_before_policy",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"s... | [
654,
0
] | [
697,
28
] | python | en | ['en', 'en', 'en'] | True |
nested_live_view_after_policy | (self, node=None) | Check that if a user has a row policy on a table and a materialized view is created on that table,
the user is only able to select rows specified by the assigned policies from the view.
| Check that if a user has a row policy on a table and a materialized view is created on that table,
the user is only able to select rows specified by the assigned policies from the view.
| def nested_live_view_after_policy(self, node=None):
"""Check that if a user has a row policy on a table and a materialized view is created on that table,
the user is only able to select rows specified by the assigned policies from the view.
"""
table_name = f"table_{getuid()}"
view_name = f"view_{g... | [
"def",
"nested_live_view_after_policy",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"se... | [
703,
0
] | [
746,
28
] | python | en | ['en', 'en', 'en'] | True |
nested_mat_view_before_policy | (self, node=None) | Check that if a materialized view exists on a table and then a row policy is created,
the user is only able to select rows specified by the assigned policies from the view.
| Check that if a materialized view exists on a table and then a row policy is created,
the user is only able to select rows specified by the assigned policies from the view.
| def nested_mat_view_before_policy(self, node=None):
"""Check that if a materialized view exists on a table and then a row policy is created,
the user is only able to select rows specified by the assigned policies from the view.
"""
table_name = f"table_{getuid()}"
view_name = f"view_{getuid()}"
... | [
"def",
"nested_mat_view_before_policy",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"se... | [
752,
0
] | [
784,
62
] | python | en | ['en', 'en', 'en'] | True |
nested_mat_view_after_policy | (self, node=None) | Check that if a user has a row policy on a table and a materialized view is created on that table,
the user is only able to select rows specified by the assigned policies from the view.
| Check that if a user has a row policy on a table and a materialized view is created on that table,
the user is only able to select rows specified by the assigned policies from the view.
| def nested_mat_view_after_policy(self, node=None):
"""Check that if a user has a row policy on a table and a materialized view is created on that table,
the user is only able to select rows specified by the assigned policies from the view.
"""
table_name = f"table_{getuid()}"
view_name = f"view_{ge... | [
"def",
"nested_mat_view_after_policy",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"sel... | [
790,
0
] | [
822,
62
] | python | en | ['en', 'en', 'en'] | True |
populate_mat_view | (self, node=None) | Check that if a user has a row policy on a table and a materialized view is created using POPULATE from that table,
the user can only select the rows from the materialized view specified in the row policy.
| Check that if a user has a row policy on a table and a materialized view is created using POPULATE from that table,
the user can only select the rows from the materialized view specified in the row policy.
| def populate_mat_view(self, node=None):
"""Check that if a user has a row policy on a table and a materialized view is created using POPULATE from that table,
the user can only select the rows from the materialized view specified in the row policy.
"""
table_name = f"table_{getuid()}"
view_name = f... | [
"def",
"populate_mat_view",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"view_name",
"=",
"f\"view_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
... | [
828,
0
] | [
860,
62
] | python | en | ['en', 'en', 'en'] | True |
dist_table | (self, node=None) | Check that if a user has a row policy on a table and a distributed table is created on that table,
the user is only able to access the rows specified by the assigned policies.
| Check that if a user has a row policy on a table and a distributed table is created on that table,
the user is only able to access the rows specified by the assigned policies.
| def dist_table(self, node=None):
"""Check that if a user has a row policy on a table and a distributed table is created on that table,
the user is only able to access the rows specified by the assigned policies.
"""
table_name = f"table_{getuid()}"
dist_table_name = f"dist_table_{getuid()}"
pol... | [
"def",
"dist_table",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"dist_table_name",
"=",
"f\"dist_table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
... | [
866,
0
] | [
907,
65
] | python | en | ['en', 'en', 'en'] | True |
dist_table_diff_policies_on_diff_nodes | (self, node=None) | Check that user is only able to select from the distributed table what is allowed by the row policies on each node.
| Check that user is only able to select from the distributed table what is allowed by the row policies on each node.
| def dist_table_diff_policies_on_diff_nodes(self, node=None):
"""Check that user is only able to select from the distributed table what is allowed by the row policies on each node.
"""
table_name = f"table_{getuid()}"
dist_table_name = f"dist_table_{getuid()}"
pol_name = f"pol_{getuid()}"
if no... | [
"def",
"dist_table_diff_policies_on_diff_nodes",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"table_name",
"=",
"f\"table_{getuid()}\"",
"dist_table_name",
"=",
"f\"dist_table_{getuid()}\"",
"pol_name",
"=",
"f\"pol_{getuid()}\"",
"if",
"node",
"is",
"None",
":",
... | [
913,
0
] | [
956,
65
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.