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
Expr.pipe
(self, f, *args, **kwargs)
Generic composition function to enable expression pipelining. Parameters ---------- f : function or (function, arg_name) tuple If the expression needs to be passed as anything other than the first argument to the function, pass a tuple with the argument name. For e...
Generic composition function to enable expression pipelining.
def pipe(self, f, *args, **kwargs): """Generic composition function to enable expression pipelining. Parameters ---------- f : function or (function, arg_name) tuple If the expression needs to be passed as anything other than the first argument to the function, pass ...
[ "def", "pipe", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "f", ",", "tuple", ")", ":", "f", ",", "data_keyword", "=", "f", "kwargs", "=", "kwargs", ".", "copy", "(", ")", "kwargs", "[", ...
[ 88, 4 ]
[ 140, 43 ]
python
en
['en', 'en', 'en']
True
Expr.execute
(self, limit='default', params=None, **kwargs)
If this expression is based on physical tables in a database backend, execute it against that backend. Parameters ---------- limit : integer or None, default 'default' Pass an integer to effect a specific row limit. limit=None means "no limit". The default i...
If this expression is based on physical tables in a database backend, execute it against that backend.
def execute(self, limit='default', params=None, **kwargs): """ If this expression is based on physical tables in a database backend, execute it against that backend. Parameters ---------- limit : integer or None, default 'default' Pass an integer to effect a sp...
[ "def", "execute", "(", "self", ",", "limit", "=", "'default'", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "from", "ibis", ".", "client", "import", "execute", "return", "execute", "(", "self", ",", "limit", "=", "limit", ",", "para...
[ 153, 4 ]
[ 170, 66 ]
python
en
['en', 'error', 'th']
False
Expr.compile
(self, limit=None, params=None)
Compile expression to whatever execution target, to verify Returns ------- compiled : value or list query representation or list thereof
Compile expression to whatever execution target, to verify
def compile(self, limit=None, params=None): """ Compile expression to whatever execution target, to verify Returns ------- compiled : value or list query representation or list thereof """ from ibis.client import compile return compile(self, li...
[ "def", "compile", "(", "self", ",", "limit", "=", "None", ",", "params", "=", "None", ")", ":", "from", "ibis", ".", "client", "import", "compile", "return", "compile", "(", "self", ",", "limit", "=", "limit", ",", "params", "=", "params", ")" ]
[ 172, 4 ]
[ 182, 56 ]
python
en
['en', 'error', 'th']
False
Expr.verify
(self)
Returns True if expression can be compiled to its attached client
Returns True if expression can be compiled to its attached client
def verify(self): """ Returns True if expression can be compiled to its attached client """ try: self.compile() except Exception: return False else: return True
[ "def", "verify", "(", "self", ")", ":", "try", ":", "self", ".", "compile", "(", ")", "except", "Exception", ":", "return", "False", "else", ":", "return", "True" ]
[ 184, 4 ]
[ 193, 23 ]
python
en
['en', 'error', 'th']
False
ExprList.concat
(self, *others)
Concatenate expression lists Returns ------- combined : ExprList
Concatenate expression lists
def concat(self, *others): """ Concatenate expression lists Returns ------- combined : ExprList """ import ibis.expr.operations as ops exprs = list(self.exprs()) for o in others: if not isinstance(o, ExprList): raise Ty...
[ "def", "concat", "(", "self", ",", "*", "others", ")", ":", "import", "ibis", ".", "expr", ".", "operations", "as", "ops", "exprs", "=", "list", "(", "self", ".", "exprs", "(", ")", ")", "for", "o", "in", "others", ":", "if", "not", "isinstance", ...
[ 239, 4 ]
[ 253, 50 ]
python
en
['en', 'error', 'th']
False
ColumnExpr.to_projection
(self)
Promote this column expression to a table projection
Promote this column expression to a table projection
def to_projection(self): """ Promote this column expression to a table projection """ roots = self._root_tables() if len(roots) > 1: raise com.RelationError('Cannot convert array expression ' 'involving multiple base table reference...
[ "def", "to_projection", "(", "self", ")", ":", "roots", "=", "self", ".", "_root_tables", "(", ")", "if", "len", "(", "roots", ")", ">", "1", ":", "raise", "com", ".", "RelationError", "(", "'Cannot convert array expression '", "'involving multiple base table re...
[ 321, 4 ]
[ 332, 39 ]
python
en
['en', 'error', 'th']
False
TableExpr.get_columns
(self, iterable)
Get multiple columns from the table Examples -------- >>> import ibis >>> table = ibis.table( ... [ ... ('a', 'int64'), ... ('b', 'string'), ... ('c', 'timestamp'), ... ('d', 'float'), ... ], ...
Get multiple columns from the table
def get_columns(self, iterable): """ Get multiple columns from the table Examples -------- >>> import ibis >>> table = ibis.table( ... [ ... ('a', 'int64'), ... ('b', 'string'), ... ('c', 'timestamp'), ... ...
[ "def", "get_columns", "(", "self", ",", "iterable", ")", ":", "return", "[", "self", ".", "get_column", "(", "x", ")", "for", "x", "in", "iterable", "]" ]
[ 464, 4 ]
[ 486, 53 ]
python
en
['en', 'error', 'th']
False
TableExpr.get_column
(self, name)
Get a reference to a single column from the table Returns ------- column : array expression
Get a reference to a single column from the table
def get_column(self, name): """ Get a reference to a single column from the table Returns ------- column : array expression """ import ibis.expr.operations as ops ref = ops.TableColumn(name, self) return ref.to_expr()
[ "def", "get_column", "(", "self", ",", "name", ")", ":", "import", "ibis", ".", "expr", ".", "operations", "as", "ops", "ref", "=", "ops", ".", "TableColumn", "(", "name", ",", "self", ")", "return", "ref", ".", "to_expr", "(", ")" ]
[ 488, 4 ]
[ 498, 28 ]
python
en
['en', 'error', 'th']
False
TableExpr.schema
(self)
Get the schema for this table (if one is known) Returns ------- schema : Schema
Get the schema for this table (if one is known)
def schema(self): """ Get the schema for this table (if one is known) Returns ------- schema : Schema """ if not self._is_materialized(): raise com.IbisError('Table operation is not yet materialized') return self.op().schema
[ "def", "schema", "(", "self", ")", ":", "if", "not", "self", ".", "_is_materialized", "(", ")", ":", "raise", "com", ".", "IbisError", "(", "'Table operation is not yet materialized'", ")", "return", "self", ".", "op", "(", ")", ".", "schema" ]
[ 504, 4 ]
[ 514, 31 ]
python
en
['en', 'error', 'th']
False
TableExpr.group_by
(self, by=None, **additional_grouping_expressions)
Create an intermediate grouped table expression, pending some group operation to be applied with it. Examples -------- >>> import ibis >>> pairs = [('a', 'int32'), ('b', 'timestamp'), ('c', 'double')] >>> t = ibis.table(pairs) >>> b1, b2 = t.a, t.b ...
Create an intermediate grouped table expression, pending some group operation to be applied with it.
def group_by(self, by=None, **additional_grouping_expressions): """ Create an intermediate grouped table expression, pending some group operation to be applied with it. Examples -------- >>> import ibis >>> pairs = [('a', 'int32'), ('b', 'timestamp'), ('c', 'doub...
[ "def", "group_by", "(", "self", ",", "by", "=", "None", ",", "*", "*", "additional_grouping_expressions", ")", ":", "from", "ibis", ".", "expr", ".", "groupby", "import", "GroupedTableExpr", "return", "GroupedTableExpr", "(", "self", ",", "by", ",", "*", "...
[ 520, 4 ]
[ 543, 76 ]
python
en
['en', 'error', 'th']
False
TopKExpr.to_aggregation
(self, metric_name=None, parent_table=None, backup_metric_name=None)
Convert the TopK operation to a table aggregation
Convert the TopK operation to a table aggregation
def to_aggregation(self, metric_name=None, parent_table=None, backup_metric_name=None): """ Convert the TopK operation to a table aggregation """ op = self.op() arg_table = find_base_table(op.arg) by = op.by if not isinstance(by, Expr): ...
[ "def", "to_aggregation", "(", "self", ",", "metric_name", "=", "None", ",", "parent_table", "=", "None", ",", "backup_metric_name", "=", "None", ")", ":", "op", "=", "self", ".", "op", "(", ")", "arg_table", "=", "find_base_table", "(", "op", ".", "arg",...
[ 695, 4 ]
[ 725, 64 ]
python
en
['en', 'error', 'th']
False
DayOfWeek.index
(self)
Get the index of the day of the week. Returns ------- IntegerValue The index of the day of the week. Ibis follows pandas conventions, where **Monday = 0 and Sunday = 6**.
Get the index of the day of the week.
def index(self): """Get the index of the day of the week. Returns ------- IntegerValue The index of the day of the week. Ibis follows pandas conventions, where **Monday = 0 and Sunday = 6**. """ import ibis.expr.operations as ops return op...
[ "def", "index", "(", "self", ")", ":", "import", "ibis", ".", "expr", ".", "operations", "as", "ops", "return", "ops", ".", "DayOfWeekIndex", "(", "self", ".", "op", "(", ")", ".", "arg", ")", ".", "to_expr", "(", ")" ]
[ 738, 4 ]
[ 748, 58 ]
python
en
['en', 'en', 'en']
True
DayOfWeek.full_name
(self)
Get the name of the day of the week. Returns ------- StringValue The name of the day of the week
Get the name of the day of the week.
def full_name(self): """Get the name of the day of the week. Returns ------- StringValue The name of the day of the week """ import ibis.expr.operations as ops return ops.DayOfWeekName(self.op().arg).to_expr()
[ "def", "full_name", "(", "self", ")", ":", "import", "ibis", ".", "expr", ".", "operations", "as", "ops", "return", "ops", ".", "DayOfWeekName", "(", "self", ".", "op", "(", ")", ".", "arg", ")", ".", "to_expr", "(", ")" ]
[ 750, 4 ]
[ 759, 57 ]
python
en
['en', 'en', 'en']
True
_GetOptionsParser
()
Get the options parser.
Get the options parser.
def _GetOptionsParser(): """Get the options parser.""" parser = optparse.OptionParser(__doc__) parser.add_option('-i', '--input', dest='inputs', action='append', default=[], help='One or more input files to calcul...
[ "def", "_GetOptionsParser", "(", ")", ":", "parser", "=", "optparse", ".", "OptionParser", "(", "__doc__", ")", "parser", ".", "add_option", "(", "'-i'", ",", "'--input'", ",", "dest", "=", "'inputs'", ",", "action", "=", "'append'", ",", "default", "=", ...
[ 43, 0 ]
[ 112, 15 ]
python
en
['en', 'en', 'en']
True
_GetInputByPath
(path, sources)
Get the source identified by a path. Args: path: str, A path to a file that identifies a source. sources: An iterable collection of source objects. Returns: The source from sources identified by path, if found. Converts to real paths for comparison.
Get the source identified by a path.
def _GetInputByPath(path, sources): """Get the source identified by a path. Args: path: str, A path to a file that identifies a source. sources: An iterable collection of source objects. Returns: The source from sources identified by path, if found. Converts to real paths for comparison. """ ...
[ "def", "_GetInputByPath", "(", "path", ",", "sources", ")", ":", "for", "js_source", "in", "sources", ":", "# Convert both to real paths for comparison.", "if", "os", ".", "path", ".", "realpath", "(", "path", ")", "==", "os", ".", "path", ".", "realpath", "...
[ 115, 0 ]
[ 129, 22 ]
python
en
['en', 'en', 'en']
True
_GetClosureBaseFile
(sources)
Given a set of sources, returns the one base.js file. Note that if zero or two or more base.js files are found, an error message will be written and the program will be exited. Args: sources: An iterable of _PathSource objects. Returns: The _PathSource representing the base Closure file.
Given a set of sources, returns the one base.js file.
def _GetClosureBaseFile(sources): """Given a set of sources, returns the one base.js file. Note that if zero or two or more base.js files are found, an error message will be written and the program will be exited. Args: sources: An iterable of _PathSource objects. Returns: The _PathSource represent...
[ "def", "_GetClosureBaseFile", "(", "sources", ")", ":", "base_files", "=", "[", "js_source", "for", "js_source", "in", "sources", "if", "_IsClosureBaseFile", "(", "js_source", ")", "]", "if", "not", "base_files", ":", "logging", ".", "error", "(", "'No Closure...
[ 132, 0 ]
[ 156, 22 ]
python
en
['en', 'en', 'en']
True
_IsClosureBaseFile
(js_source)
Returns true if the given _PathSource is the Closure base.js source.
Returns true if the given _PathSource is the Closure base.js source.
def _IsClosureBaseFile(js_source): """Returns true if the given _PathSource is the Closure base.js source.""" return (os.path.basename(js_source.GetPath()) == 'base.js' and js_source.provides == set(['goog']))
[ "def", "_IsClosureBaseFile", "(", "js_source", ")", ":", "return", "(", "os", ".", "path", ".", "basename", "(", "js_source", ".", "GetPath", "(", ")", ")", "==", "'base.js'", "and", "js_source", ".", "provides", "==", "set", "(", "[", "'goog'", "]", "...
[ 159, 0 ]
[ 162, 46 ]
python
en
['en', 'en', 'en']
True
_PathSource.__init__
(self, path)
Initialize a source. Args: path: str, Path to a JavaScript file. The source string will be read from this file.
Initialize a source.
def __init__(self, path): """Initialize a source. Args: path: str, Path to a JavaScript file. The source string will be read from this file. """ super(_PathSource, self).__init__(source.GetFileContents(path)) self._path = path
[ "def", "__init__", "(", "self", ",", "path", ")", ":", "super", "(", "_PathSource", ",", "self", ")", ".", "__init__", "(", "source", ".", "GetFileContents", "(", "path", ")", ")", "self", ".", "_path", "=", "path" ]
[ 168, 2 ]
[ 177, 21 ]
python
en
['en', 'en', 'en']
True
_PathSource.GetPath
(self)
Returns the path.
Returns the path.
def GetPath(self): """Returns the path.""" return self._path
[ "def", "GetPath", "(", "self", ")", ":", "return", "self", ".", "_path" ]
[ 182, 2 ]
[ 184, 21 ]
python
en
['en', 'en', 'en']
True
affine_coord
(x: RegressionMask, mat=None, coord_tfm=None, sz=None, mode='nearest', pad_mode=PadMode.Reflection, align_corners=True)
RegressionMask can't be `long` type
RegressionMask can't be `long` type
def affine_coord(x: RegressionMask, mat=None, coord_tfm=None, sz=None, mode='nearest', pad_mode=PadMode.Reflection, align_corners=True): "RegressionMask can't be `long` type" add_dim = (x.ndim==3) if add_dim: x = x[:,None] res = TensorImage.affine_coord(x.float(), mat, coord_tfm, sz, mo...
[ "def", "affine_coord", "(", "x", ":", "RegressionMask", ",", "mat", "=", "None", ",", "coord_tfm", "=", "None", ",", "sz", "=", "None", ",", "mode", "=", "'nearest'", ",", "pad_mode", "=", "PadMode", ".", "Reflection", ",", "align_corners", "=", "True", ...
[ 14, 0 ]
[ 21, 30 ]
python
en
['en', 'en', 'en']
True
segmentation_aug_tfms_fastai
(size=160)
Utilize `tfms.A.aug_tfms` with fastai and SegmentationDataloaders
Utilize `tfms.A.aug_tfms` with fastai and SegmentationDataloaders
def segmentation_aug_tfms_fastai(size=160): "Utilize `tfms.A.aug_tfms` with fastai and SegmentationDataloaders" return SegmentationAlbumentationsTransform(A.Compose(tfms.A.aug_tfms(size=size, crop_fn=tfms.A.RandomCrop)))
[ "def", "segmentation_aug_tfms_fastai", "(", "size", "=", "160", ")", ":", "return", "SegmentationAlbumentationsTransform", "(", "A", ".", "Compose", "(", "tfms", ".", "A", ".", "aug_tfms", "(", "size", "=", "size", ",", "crop_fn", "=", "tfms", ".", "A", "....
[ 99, 0 ]
[ 101, 112 ]
python
en
['en', 'en', 'en']
True
SegmentationAlbumentationsTransform.encodes
(self, x)
Because TypeDispatch doesn't work on tuple with specific types we need to do this
Because TypeDispatch doesn't work on tuple with specific types we need to do this
def encodes(self, x): "Because TypeDispatch doesn't work on tuple with specific types we need to do this" img, mask = x if isinstance(img, PILImage) and isinstance(mask, PILMask): aug = self.aug(image=np.array(img), mask=np.array(mask)) return PILImage.create(aug['image']...
[ "def", "encodes", "(", "self", ",", "x", ")", ":", "img", ",", "mask", "=", "x", "if", "isinstance", "(", "img", ",", "PILImage", ")", "and", "isinstance", "(", "mask", ",", "PILMask", ")", ":", "aug", "=", "self", ".", "aug", "(", "image", "=", ...
[ 58, 4 ]
[ 95, 22 ]
python
en
['en', 'en', 'en']
True
privilege_granted_directly_or_via_role
(self, node=None)
Check that user is only able to execute DETACH TABLE when they have required privilege, either directly or via role.
Check that user is only able to execute DETACH TABLE when they have required privilege, either directly or via role.
def privilege_granted_directly_or_via_role(self, node=None): """Check that user is only able to execute DETACH TABLE when they have required privilege, either directly or via role. """ role_name = f"role_{getuid()}" user_name = f"user_{getuid()}" if node is None: node = self.context.node ...
[ "def", "privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "role_name", "=", "f\"role_{getuid()}\"", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node...
[ 5, 0 ]
[ 27, 92 ]
python
en
['en', 'en', 'en']
True
privilege_check
(grant_target_name, user_name, node=None)
Run scenarios to check the user's access with different privileges.
Run scenarios to check the user's access with different privileges.
def privilege_check(grant_target_name, user_name, node=None): """Run scenarios to check the user's access with different privileges. """ exitcode, message = errors.not_enough_privileges(name=f"{user_name}") with Scenario("user without privilege"): table_name = f"table_{getuid()}" try: ...
[ "def", "privilege_check", "(", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "f\"{user_name}\"", ")", "with", "Scenario", "(", "\"user without...
[ 29, 0 ]
[ 139, 64 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of DETACH TABLE.
Check the RBAC functionality of DETACH TABLE.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of DETACH TABLE. """ self.context.node = self.context.cluster.node(node) if parallel is not None: self.context.parallel = parallel if stress is not None: self.context.stress = stress ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 148, 0 ]
[ 159, 48 ]
python
en
['en', 'en', 'en']
True
clean_up_axes
(ax, ylim=None, spines_to_remove=['top', 'right', 'bottom'], axes_to_remove=['x'])
r"""Clean up an axis, as desired when making a stem plot of the representation Parameters ---------- ax : `matplotlib.pyplot.axis` The axis to clean up. ylim : `tuple`, False, or None If a tuple, the y-limits to use for this plot. If None, we use the default, slightly adjusted so that t...
r"""Clean up an axis, as desired when making a stem plot of the representation
def clean_up_axes(ax, ylim=None, spines_to_remove=['top', 'right', 'bottom'], axes_to_remove=['x']): r"""Clean up an axis, as desired when making a stem plot of the representation Parameters ---------- ax : `matplotlib.pyplot.axis` The axis to clean up. ylim : `tuple`, Fal...
[ "def", "clean_up_axes", "(", "ax", ",", "ylim", "=", "None", ",", "spines_to_remove", "=", "[", "'top'", ",", "'right'", ",", "'bottom'", "]", ",", "axes_to_remove", "=", "[", "'x'", "]", ")", ":", "if", "spines_to_remove", "is", "None", ":", "spines_to_...
[ 13, 0 ]
[ 51, 13 ]
python
en
['en', 'en', 'en']
True
update_stem
(stem_container, ydata)
r"""Update the information in a stem plot We update the information in a single stem plot to match that given by ``ydata``. We update the position of the markers and and the lines connecting them to the baseline, but we don't change the baseline at all and assume that the xdata shouldn't change at all....
r"""Update the information in a stem plot
def update_stem(stem_container, ydata): r"""Update the information in a stem plot We update the information in a single stem plot to match that given by ``ydata``. We update the position of the markers and and the lines connecting them to the baseline, but we don't change the baseline at all and as...
[ "def", "update_stem", "(", "stem_container", ",", "ydata", ")", ":", "stem_container", ".", "markerline", ".", "set_ydata", "(", "ydata", ")", "try", ":", "segments", "=", "stem_container", ".", "stemlines", ".", "get_segments", "(", ")", ".", "copy", "(", ...
[ 54, 0 ]
[ 100, 25 ]
python
en
['en', 'en', 'en']
True
rescale_ylim
(axes, data)
r"""rescale y-limits nicely We take the axes and set their limits to be ``(-y_max, y_max)``, where ``y_max=np.abs(data).max()`` Parameters ---------- axes : `list` A list of matplotlib axes to rescale data : array_like or dict The data to use when rescaling (or a dictiontary of...
r"""rescale y-limits nicely
def rescale_ylim(axes, data): r"""rescale y-limits nicely We take the axes and set their limits to be ``(-y_max, y_max)``, where ``y_max=np.abs(data).max()`` Parameters ---------- axes : `list` A list of matplotlib axes to rescale data : array_like or dict The data to use w...
[ "def", "rescale_ylim", "(", "axes", ",", "data", ")", ":", "def", "find_ymax", "(", "data", ")", ":", "try", ":", "return", "np", ".", "abs", "(", "data", ")", ".", "max", "(", ")", "except", "RuntimeError", ":", "# then we need to call to_numpy on it beca...
[ 103, 0 ]
[ 130, 36 ]
python
de
['de', 'en', 'es']
False
clean_stem_plot
(data, ax=None, title='', ylim=None, xvals=None, **kwargs)
r"""convenience wrapper for plotting stem plots This plots the data, baseline, cleans up the axis, and sets the title Should not be called by users directly, but is a helper function for the various plot_representation() functions By default, stem plot would have a baseline that covers the entire...
r"""convenience wrapper for plotting stem plots
def clean_stem_plot(data, ax=None, title='', ylim=None, xvals=None, **kwargs): r"""convenience wrapper for plotting stem plots This plots the data, baseline, cleans up the axis, and sets the title Should not be called by users directly, but is a helper function for the various plot_representation(...
[ "def", "clean_stem_plot", "(", "data", ",", "ax", "=", "None", ",", "title", "=", "''", ",", "ylim", "=", "None", ",", "xvals", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ...
[ 133, 0 ]
[ 225, 13 ]
python
en
['en', 'en', 'en']
True
_get_artists_from_axes
(axes, data)
Grab artists from axes. For now, we only grab containers (stem plots), images, or lines See the docstring of :meth:`update_plot()` for details on how `axes` and `data` should be structured Parameters ---------- axes : list or matplotlib.axes.Axes The axis/axes to update. data : to...
Grab artists from axes.
def _get_artists_from_axes(axes, data): """Grab artists from axes. For now, we only grab containers (stem plots), images, or lines See the docstring of :meth:`update_plot()` for details on how `axes` and `data` should be structured Parameters ---------- axes : list or matplotlib.axes.Axes...
[ "def", "_get_artists_from_axes", "(", "axes", ",", "data", ")", ":", "if", "not", "hasattr", "(", "axes", ",", "'__iter__'", ")", ":", "# then we only have one axis, so we may be able to update more than one", "# data element.", "if", "len", "(", "axes", ".", "contain...
[ 228, 0 ]
[ 316, 18 ]
python
en
['en', 'en', 'en']
True
update_plot
(axes, data, model=None, batch_idx=0)
r"""Update the information in some axes. This is used for creating an animation 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 assumes the plot has been created by something like ``plot_representation``...
r"""Update the information in some axes.
def update_plot(axes, data, model=None, batch_idx=0): r"""Update the information in some axes. This is used for creating an animation 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 assumes the plot ...
[ "def", "update_plot", "(", "axes", ",", "data", ",", "model", "=", "None", ",", "batch_idx", "=", "0", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "for", "v", "in", "data", ".", "values", "(", ")", ":", "if", "v", ".", "nd...
[ 319, 0 ]
[ 456, 18 ]
python
en
['en', 'en', 'en']
True
plot_representation
(model=None, data=None, ax=None, figsize=(5, 5), ylim=False, batch_idx=0, title='', as_rgb=False)
r"""Helper function for plotting model representation We are trying to plot ``data`` on ``ax``, using ``model.plot_representation`` method, if it has it, and otherwise default to a function that makes sense based on the shape of ``data``. All of these arguments are optional, but at least some of them ...
r"""Helper function for plotting model representation
def plot_representation(model=None, data=None, ax=None, figsize=(5, 5), ylim=False, batch_idx=0, title='', as_rgb=False): r"""Helper function for plotting model representation We are trying to plot ``data`` on ``ax``, using ``model.plot_representation`` method, if it has it, and oth...
[ "def", "plot_representation", "(", "model", "=", "None", ",", "data", "=", "None", ",", "ax", "=", "None", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "ylim", "=", "False", ",", "batch_idx", "=", "0", ",", "title", "=", "''", ",", "as_rgb"...
[ 459, 0 ]
[ 589, 14 ]
python
no
['no', 'no', 'en']
True
mask_rcnn_custom_anchors
(num_classes:int, backbone=None, pretrained:bool=True, sizes:tuple=((32,), (64,), (128,), (256,), (512,)), aspect_ratios:tuple=(0.5, 1.0, 2.0), min_size:int=800, ...
Make icevision Mask RCNN with custom anchors. Default values are torchvision defaults
Make icevision Mask RCNN with custom anchors. Default values are torchvision defaults
def mask_rcnn_custom_anchors(num_classes:int, backbone=None, pretrained:bool=True, sizes:tuple=((32,), (64,), (128,), (256,), (512,)), aspect_ratios:tuple=(0.5, 1.0, 2.0), min...
[ "def", "mask_rcnn_custom_anchors", "(", "num_classes", ":", "int", ",", "backbone", "=", "None", ",", "pretrained", ":", "bool", "=", "True", ",", "sizes", ":", "tuple", "=", "(", "(", "32", ",", ")", ",", "(", "64", ",", ")", ",", "(", "128", ",",...
[ 17, 0 ]
[ 60, 23 ]
python
en
['en', 'en', 'en']
True
faster_rcnn_custom_anchors
(num_classes:int, backbone=None, pretrained:bool=True, sizes:tuple=((32,), (64,), (128,), (256,), (512,)), aspect_ratios:tuple=(0.5, 1.0, 2.0), min_size:int=800, # D...
Make icevision Faster RCNN with custom anchors. Default values are torchvision defaults
Make icevision Faster RCNN with custom anchors. Default values are torchvision defaults
def faster_rcnn_custom_anchors(num_classes:int, backbone=None, pretrained:bool=True, sizes:tuple=((32,), (64,), (128,), (256,), (512,)), aspect_ratios:tuple=(0.5, 1.0, 2.0), ...
[ "def", "faster_rcnn_custom_anchors", "(", "num_classes", ":", "int", ",", "backbone", "=", "None", ",", "pretrained", ":", "bool", "=", "True", ",", "sizes", ":", "tuple", "=", "(", "(", "32", ",", ")", ",", "(", "64", ",", ")", ",", "(", "128", ",...
[ 63, 0 ]
[ 100, 23 ]
python
en
['en', 'en', 'en']
True
load_rcnn_from_config
(path_to_conf)
Load model according to config
Load model according to config
def load_rcnn_from_config(path_to_conf): "Load model according to config" with open(f'{path_to_conf}/config.json') as conf: conf_dict = json.load(conf) backbone_name = conf_dict['backbone_name'] anchor_generator_sizes = tuple([(s,) for s in conf_dict['anchor_generator_sizes']]) aspect_rat...
[ "def", "load_rcnn_from_config", "(", "path_to_conf", ")", ":", "with", "open", "(", "f'{path_to_conf}/config.json'", ")", "as", "conf", ":", "conf_dict", "=", "json", ".", "load", "(", "conf", ")", "backbone_name", "=", "conf_dict", "[", "'backbone_name'", "]", ...
[ 137, 0 ]
[ 175, 23 ]
python
en
['en', 'en', 'en']
True
make_grid
(path, gridsize_x:int=640, gridsize_y:int=480, overlap:Tuple[int, int]=(100,100))
Creates a grid template with `gridsize_x` times `gridsize_y` cells, with `overlap` pixels of overlap based on geotiff file in `path`. Returns a gpd.GeoDataFrame with `RyyCxx` identifier for each geometry
Creates a grid template with `gridsize_x` times `gridsize_y` cells, with `overlap` pixels of overlap based on geotiff file in `path`. Returns a gpd.GeoDataFrame with `RyyCxx` identifier for each geometry
def make_grid(path, gridsize_x:int=640, gridsize_y:int=480, overlap:Tuple[int, int]=(100,100)) -> gpd.GeoDataFrame: """Creates a grid template with `gridsize_x` times `gridsize_y` cells, with `overlap` pixels of overlap based on geotiff file in `path`. Returns a gpd.GeoDataFrame with `RyyCxx` iden...
[ "def", "make_grid", "(", "path", ",", "gridsize_x", ":", "int", "=", "640", ",", "gridsize_y", ":", "int", "=", "480", ",", "overlap", ":", "Tuple", "[", "int", ",", "int", "]", "=", "(", "100", ",", "100", ")", ")", "->", "gpd", ".", "GeoDataFra...
[ 12, 0 ]
[ 40, 15 ]
python
en
['en', 'en', 'en']
True
untile_raster
(path_to_targets:str, outfile:str, method:str='first')
Create a single raster file from a directory of predicted rasters, based on the grid generated in `self.tile_raster`
Create a single raster file from a directory of predicted rasters, based on the grid generated in `self.tile_raster`
def untile_raster(path_to_targets:str, outfile:str, method:str='first'): """Create a single raster file from a directory of predicted rasters, based on the grid generated in `self.tile_raster`""" rasters = [f'{path_to_targets}/{f}' for f in os.listdir(path_to_targets) if f.endswith('.tif')] if method ...
[ "def", "untile_raster", "(", "path_to_targets", ":", "str", ",", "outfile", ":", "str", ",", "method", ":", "str", "=", "'first'", ")", ":", "rasters", "=", "[", "f'{path_to_targets}/{f}'", "for", "f", "in", "os", ".", "listdir", "(", "path_to_targets", ")...
[ 125, 0 ]
[ 148, 71 ]
python
en
['en', 'en', 'en']
True
copy_sum
(merged_data, new_data, merged_mask, new_mask, **kwargs)
Useful with prediction data
Useful with prediction data
def copy_sum(merged_data, new_data, merged_mask, new_mask, **kwargs): "Useful with prediction data" newregion = merged_data + new_data np.copyto(merged_data, newregion)
[ "def", "copy_sum", "(", "merged_data", ",", "new_data", ",", "merged_mask", ",", "new_mask", ",", "*", "*", "kwargs", ")", ":", "newregion", "=", "merged_data", "+", "new_data", "np", ".", "copyto", "(", "merged_data", ",", "newregion", ")" ]
[ 150, 0 ]
[ 153, 37 ]
python
en
['en', 'en', 'en']
True
untile_vector
(path_to_targets:str, outpath:str, non_max_suppression_thresh:float=0.0, nms_criterion:str='score')
Create single shapefile from a directory of predicted shapefiles
Create single shapefile from a directory of predicted shapefiles
def untile_vector(path_to_targets:str, outpath:str, non_max_suppression_thresh:float=0.0, nms_criterion:str='score'): "Create single shapefile from a directory of predicted shapefiles" pred_files = [f for f in os.listdir(path_to_targets) if f.endswith(('.shp', '.geojson'))] gdf = None for p in tqdm(pred...
[ "def", "untile_vector", "(", "path_to_targets", ":", "str", ",", "outpath", ":", "str", ",", "non_max_suppression_thresh", ":", "float", "=", "0.0", ",", "nms_criterion", ":", "str", "=", "'score'", ")", ":", "pred_files", "=", "[", "f", "for", "f", "in", ...
[ 155, 0 ]
[ 176, 10 ]
python
en
['en', 'en', 'en']
True
Tiler.tile_vector
(self, path_to_vector:str)
Tiles a vector data file into smaller tiles. Converts all multipolygons to a singular polygons.
Tiles a vector data file into smaller tiles. Converts all multipolygons to a singular polygons.
def tile_vector(self, path_to_vector:str) -> None: "Tiles a vector data file into smaller tiles. Converts all multipolygons to a singular polygons." if self.grid is None: print('No raster grid specified, use Tiler.tile_raster to determine grid limits') return if not os.p...
[ "def", "tile_vector", "(", "self", ",", "path_to_vector", ":", "str", ")", "->", "None", ":", "if", "self", ".", "grid", "is", "None", ":", "print", "(", "'No raster grid specified, use Tiler.tile_raster to determine grid limits'", ")", "return", "if", "not", "os"...
[ 70, 4 ]
[ 92, 14 ]
python
en
['en', 'en', 'en']
True
Tiler.tile_and_rasterize_vector
(self, column:str)
Rasterizes vectors based on tiled rasters. Requires that shapefile has numeric data in `column`
Rasterizes vectors based on tiled rasters. Requires that shapefile has numeric data in `column`
def tile_and_rasterize_vector(self, column:str) -> None: """Rasterizes vectors based on tiled rasters. Requires that shapefile has numeric data in `column`""" if not os.path.exists(self.rasterized_vector_path): os.makedirs(self.rasterized_vector_path) vector_files = [f for f...
[ "def", "tile_and_rasterize_vector", "(", "self", ",", "column", ":", "str", ")", "->", "None", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "rasterized_vector_path", ")", ":", "os", ".", "makedirs", "(", "self", ".", "rasterized_...
[ 94, 4 ]
[ 123, 14 ]
python
en
['en', 'no', 'en']
True
time_wrapper
(func)
This decorator prints the execution time for the decorated function.
This decorator prints the execution time for the decorated function.
def time_wrapper(func): """ This decorator prints the execution time for the decorated function. """ def wrapper(*args, **kwargs): start = time.time() result = func(*args, **kwargs) end = time.time() logger.info("Milvus {} run in {}s".format(func.__name__, round(end - sta...
[ "def", "time_wrapper", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start", "=", "time", ".", "time", "(", ")", "result", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "end", "=",...
[ 26, 0 ]
[ 36, 18 ]
python
en
['en', 'error', 'th']
False
enumerate_sets
(csolver, map)
Basic MUS/MCS enumeration, as a simple example.
Basic MUS/MCS enumeration, as a simple example.
def enumerate_sets(csolver, map): """Basic MUS/MCS enumeration, as a simple example.""" while True: seed = map.next_seed() if seed is None: return if csolver.check_subset(seed): MSS = csolver.grow(seed) yield ("MSS", csolver.to_c_lits(MSS)) map...
[ "def", "enumerate_sets", "(", "csolver", ",", "map", ")", ":", "while", "True", ":", "seed", "=", "map", ".", "next_seed", "(", ")", "if", "seed", "is", "None", ":", "return", "if", "csolver", ".", "check_subset", "(", "seed", ")", ":", "MSS", "=", ...
[ 168, 0 ]
[ 181, 28 ]
python
en
['en', 'en', 'en']
True
MapSolver.__init__
(self, n)
Initialization. Args: n: The number of constraints to map.
Initialization. Args: n: The number of constraints to map.
def __init__(self, n): """Initialization. Args: n: The number of constraints to map. """ self.solver = Solver() self.n = n self.all_n = set(range(n))
[ "def", "__init__", "(", "self", ",", "n", ")", ":", "self", ".", "solver", "=", "Solver", "(", ")", "self", ".", "n", "=", "n", "self", ".", "all_n", "=", "set", "(", "range", "(", "n", ")", ")" ]
[ 130, 3 ]
[ 137, 33 ]
python
co
['es', 'co', 'en']
False
MapSolver.next_seed
(self)
Get the seed from the current model, if there is one. Returns: A seed as an array of 0-based constraint indexes.
Get the seed from the current model, if there is one. Returns: A seed as an array of 0-based constraint indexes.
def next_seed(self): """Get the seed from the current model, if there is one. Returns: A seed as an array of 0-based constraint indexes. """ if self.solver.check() == unsat: return None seed = self.all_n.copy() # default to all True for "high bias" ...
[ "def", "next_seed", "(", "self", ")", ":", "if", "self", ".", "solver", ".", "check", "(", ")", "==", "unsat", ":", "return", "None", "seed", "=", "self", ".", "all_n", ".", "copy", "(", ")", "# default to all True for \"high bias\"", "model", "=", "self...
[ 139, 3 ]
[ 151, 24 ]
python
en
['en', 'en', 'en']
True
MapSolver.complement
(self, aset)
Return the complement of a given set w.r.t. the set of mapped constraints.
Return the complement of a given set w.r.t. the set of mapped constraints.
def complement(self, aset): """Return the complement of a given set w.r.t. the set of mapped constraints.""" return self.all_n.difference(aset)
[ "def", "complement", "(", "self", ",", "aset", ")", ":", "return", "self", ".", "all_n", ".", "difference", "(", "aset", ")" ]
[ 153, 3 ]
[ 155, 41 ]
python
en
['en', 'en', 'en']
True
MapSolver.block_down
(self, frompoint)
Block down from a given set.
Block down from a given set.
def block_down(self, frompoint): """Block down from a given set.""" comp = self.complement(frompoint) self.solver.add( Or( [Bool(str(i)) for i in comp] ) )
[ "def", "block_down", "(", "self", ",", "frompoint", ")", ":", "comp", "=", "self", ".", "complement", "(", "frompoint", ")", "self", ".", "solver", ".", "add", "(", "Or", "(", "[", "Bool", "(", "str", "(", "i", ")", ")", "for", "i", "in", "comp",...
[ 157, 3 ]
[ 160, 60 ]
python
en
['en', 'en', 'en']
True
MapSolver.block_up
(self, frompoint)
Block up from a given set.
Block up from a given set.
def block_up(self, frompoint): """Block up from a given set.""" self.solver.add( Or( [Not(Bool(str(i))) for i in frompoint] ) )
[ "def", "block_up", "(", "self", ",", "frompoint", ")", ":", "self", ".", "solver", ".", "add", "(", "Or", "(", "[", "Not", "(", "Bool", "(", "str", "(", "i", ")", ")", ")", "for", "i", "in", "frompoint", "]", ")", ")" ]
[ 162, 3 ]
[ 164, 70 ]
python
en
['en', 'en', 'en']
True
SingleForm.get
(self, request: Request)
Returns single form information by ID.
Returns single form information by ID.
async def get(self, request: Request) -> JSONResponse: """Returns single form information by ID.""" admin = request.user.payload["admin"] if request.user.is_authenticated else False # noqa filters = { "_id": request.path_params["form_id"] } if not admin: ...
[ "async", "def", "get", "(", "self", ",", "request", ":", "Request", ")", "->", "JSONResponse", ":", "admin", "=", "request", ".", "user", ".", "payload", "[", "\"admin\"", "]", "if", "request", ".", "user", ".", "is_authenticated", "else", "False", "# no...
[ 26, 4 ]
[ 41, 68 ]
python
en
['en', 'en', 'en']
True
SingleForm.patch
(self, request: Request)
Updates form by ID.
Updates form by ID.
async def patch(self, request: Request) -> JSONResponse: """Updates form by ID.""" data = await request.json() form_id = {"_id": request.path_params["form_id"]} if raw_form := await request.state.db.forms.find_one(form_id): if "_id" in data or "id" in data: r...
[ "async", "def", "patch", "(", "self", ",", "request", ":", "Request", ")", "->", "JSONResponse", ":", "data", "=", "await", "request", ".", "json", "(", ")", "form_id", "=", "{", "\"_id\"", ":", "request", ".", "path_params", "[", "\"form_id\"", "]", "...
[ 52, 4 ]
[ 82, 72 ]
python
en
['en', 'en', 'en']
True
SingleForm.delete
(self, request: Request)
Deletes form by ID.
Deletes form by ID.
async def delete(self, request: Request) -> JSONResponse: """Deletes form by ID.""" if not await request.state.db.forms.find_one( {"_id": request.path_params["form_id"]} ): return JSONResponse({"error": "not_found"}, status_code=404) await request.state.db.forms....
[ "async", "def", "delete", "(", "self", ",", "request", ":", "Request", ")", "->", "JSONResponse", ":", "if", "not", "await", "request", ".", "state", ".", "db", ".", "forms", ".", "find_one", "(", "{", "\"_id\"", ":", "request", ".", "path_params", "["...
[ 89, 4 ]
[ 103, 45 ]
python
en
['en', 'en', 'en']
True
binary_mask_to_polygon
(binary_mask, tolerance=0)
Converts a binary mask to COCO polygon representation Args: binary_mask: a 2D binary numpy array where '1's represent the object tolerance: Maximum distance from original points of polygon to approximated polygonal chain. If tolerance is 0, the original coordinate array is returned.
Converts a binary mask to COCO polygon representation Args: binary_mask: a 2D binary numpy array where '1's represent the object tolerance: Maximum distance from original points of polygon to approximated polygonal chain. If tolerance is 0, the original coordinate array is returned.
def binary_mask_to_polygon(binary_mask, tolerance=0): """Converts a binary mask to COCO polygon representation Args: binary_mask: a 2D binary numpy array where '1's represent the object tolerance: Maximum distance from original points of polygon to approximated polygonal chain. If to...
[ "def", "binary_mask_to_polygon", "(", "binary_mask", ",", "tolerance", "=", "0", ")", ":", "polygons", "=", "[", "]", "# pad mask to close contours of shapes which start and end at an edge", "padded_binary_mask", "=", "np", ".", "pad", "(", "binary_mask", ",", "pad_widt...
[ 32, 0 ]
[ 55, 19 ]
python
en
['en', 'it', 'en']
True
icevision_mask_preds_to_coco_anns
(preds:list)
Process list of IceVision `samples` and `preds` to COCO-annotation polygon format. Returns a dict with Coco-style `images` and `annotations` TODO replace these with functions from icevision somehow
Process list of IceVision `samples` and `preds` to COCO-annotation polygon format. Returns a dict with Coco-style `images` and `annotations`
def icevision_mask_preds_to_coco_anns(preds:list) -> dict: """Process list of IceVision `samples` and `preds` to COCO-annotation polygon format. Returns a dict with Coco-style `images` and `annotations` TODO replace these with functions from icevision somehow""" outdict = {} outdict['annotations'] ...
[ "def", "icevision_mask_preds_to_coco_anns", "(", "preds", ":", "list", ")", "->", "dict", ":", "outdict", "=", "{", "}", "outdict", "[", "'annotations'", "]", "=", "[", "]", "outdict", "[", "'images'", "]", "=", "[", "{", "'file_name'", ":", "str", "(", ...
[ 193, 0 ]
[ 225, 18 ]
python
en
['en', 'en', 'en']
True
icevision_bbox_preds_to_coco_anns
(preds:list)
Process list of IceVision `samples` and `preds` to COCO-annotation polygon format. Returns a dict with Coco-style `images` and `annotations`
Process list of IceVision `samples` and `preds` to COCO-annotation polygon format. Returns a dict with Coco-style `images` and `annotations`
def icevision_bbox_preds_to_coco_anns(preds:list) -> dict: """Process list of IceVision `samples` and `preds` to COCO-annotation polygon format. Returns a dict with Coco-style `images` and `annotations`""" outdict = {} outdict['annotations'] = [] outdict['images'] = [{'file_name': str(f'{p.ground_tr...
[ "def", "icevision_bbox_preds_to_coco_anns", "(", "preds", ":", "list", ")", "->", "dict", ":", "outdict", "=", "{", "}", "outdict", "[", "'annotations'", "]", "=", "[", "]", "outdict", "[", "'images'", "]", "=", "[", "{", "'file_name'", ":", "str", "(", ...
[ 227, 0 ]
[ 255, 18 ]
python
en
['en', 'en', 'en']
True
detectron2_bbox_preds_to_coco_anns
(images:list, preds:list)
Process detectron2 prediction to COCO-annotation polygon format. Returns a dict with COCO-style `images` and `annotations`
Process detectron2 prediction to COCO-annotation polygon format. Returns a dict with COCO-style `images` and `annotations`
def detectron2_bbox_preds_to_coco_anns(images:list, preds:list): """Process detectron2 prediction to COCO-annotation polygon format. Returns a dict with COCO-style `images` and `annotations` """ outdict = {} outdict['annotations'] = [] outdict['images'] = images for i in rangeof(preds): ...
[ "def", "detectron2_bbox_preds_to_coco_anns", "(", "images", ":", "list", ",", "preds", ":", "list", ")", ":", "outdict", "=", "{", "}", "outdict", "[", "'annotations'", "]", "=", "[", "]", "outdict", "[", "'images'", "]", "=", "images", "for", "i", "in",...
[ 257, 0 ]
[ 288, 18 ]
python
en
['en', 'en', 'en']
True
detectron2_mask_preds_to_coco_anns
(images:list, preds:list)
Process detectron2 prediction to COCO-annotation polygon format. Returns a dict with COCO-style `images` and `annotations`
Process detectron2 prediction to COCO-annotation polygon format. Returns a dict with COCO-style `images` and `annotations`
def detectron2_mask_preds_to_coco_anns(images:list, preds:list): """Process detectron2 prediction to COCO-annotation polygon format. Returns a dict with COCO-style `images` and `annotations` """ outdict = {} outdict['annotations'] = [] outdict['images'] = images for i in rangeof(preds): ...
[ "def", "detectron2_mask_preds_to_coco_anns", "(", "images", ":", "list", ",", "preds", ":", "list", ")", ":", "outdict", "=", "{", "}", "outdict", "[", "'annotations'", "]", "=", "[", "]", "outdict", "[", "'images'", "]", "=", "images", "for", "i", "in",...
[ 291, 0 ]
[ 322, 18 ]
python
en
['en', 'en', 'en']
True
_process_shp_to_coco
(image_id, category_id, ann_id, poly:Polygon)
TODO handle multipolygons
TODO handle multipolygons
def _process_shp_to_coco(image_id, category_id, ann_id, poly:Polygon): "TODO handle multipolygons" ann_dict = { 'segmentation': [], 'area': None, 'bbox': [], 'category_id': category_id, 'id' : ann_id, 'image_id': image_id, 'iscrowd': 0, } if poly....
[ "def", "_process_shp_to_coco", "(", "image_id", ",", "category_id", ",", "ann_id", ",", "poly", ":", "Polygon", ")", ":", "ann_dict", "=", "{", "'segmentation'", ":", "[", "]", ",", "'area'", ":", "None", ",", "'bbox'", ":", "[", "]", ",", "'category_id'...
[ 324, 0 ]
[ 358, 19 ]
python
en
['en', 'es', 'en']
True
COCOProcessor.shp_to_coco
(self, label_col:str='label', outfile:str='coco.json', min_bbox_area:int=16)
Process shapefiles from self.vector_path to coco-format and save to self.outpath/outfile
Process shapefiles from self.vector_path to coco-format and save to self.outpath/outfile
def shp_to_coco(self, label_col:str='label', outfile:str='coco.json', min_bbox_area:int=16): "Process shapefiles from self.vector_path to coco-format and save to self.outpath/outfile" vector_tiles = [f for f in os.listdir(self.vector_path) if f.endswith(('.shp', '.geojson'))] # If no annotations...
[ "def", "shp_to_coco", "(", "self", ",", "label_col", ":", "str", "=", "'label'", ",", "outfile", ":", "str", "=", "'coco.json'", ",", "min_bbox_area", ":", "int", "=", "16", ")", ":", "vector_tiles", "=", "[", "f", "for", "f", "in", "os", ".", "listd...
[ 83, 4 ]
[ 106, 14 ]
python
en
['en', 'en', 'en']
True
COCOProcessor.coco_to_shp
(self, coco_data:dict=None, outdir:str='predicted_vectors', downsample_factor:int=1)
Generates shapefiles from a dictionary with coco annotations. TODO handle multipolygons better
Generates shapefiles from a dictionary with coco annotations. TODO handle multipolygons better
def coco_to_shp(self, coco_data:dict=None, outdir:str='predicted_vectors', downsample_factor:int=1): """Generates shapefiles from a dictionary with coco annotations. TODO handle multipolygons better""" if not os.path.exists(f'{self.outpath}/{outdir}'): os.makedirs(f'{self.outpath}/{outdir}') ...
[ "def", "coco_to_shp", "(", "self", ",", "coco_data", ":", "dict", "=", "None", ",", "outdir", ":", "str", "=", "'predicted_vectors'", ",", "downsample_factor", ":", "int", "=", "1", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "f'{self...
[ 108, 4 ]
[ 164, 14 ]
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...
[ 86, 4 ]
[ 97, 26 ]
python
en
['en', 'en', 'pt']
True
aes_encrypt_mysql
(self, plaintext=None, key=None, mode=None, iv=None, exitcode=0, message=None, step=When)
Execute `aes_encrypt_mysql` function with the specified parameters.
Execute `aes_encrypt_mysql` function with the specified parameters.
def aes_encrypt_mysql(self, plaintext=None, key=None, mode=None, iv=None, exitcode=0, message=None, step=When): """Execute `aes_encrypt_mysql` function with the specified parameters. """ params = [] if mode is not None: params.append(mode) if plaintext is not None: params.append(plai...
[ "def", "aes_encrypt_mysql", "(", "self", ",", "plaintext", "=", "None", ",", "key", "=", "None", ",", "mode", "=", "None", ",", "iv", "=", "None", ",", "exitcode", "=", "0", ",", "message", "=", "None", ",", "step", "=", "When", ")", ":", "params",...
[ 8, 0 ]
[ 23, 91 ]
python
en
['en', 'en', 'en']
True
unsupported_modes
(self, mode)
Check that `aes_encrypt_mysql` function returns an error when unsupported modes are specified.
Check that `aes_encrypt_mysql` function returns an error when unsupported modes are specified.
def unsupported_modes(self, mode): """Check that `aes_encrypt_mysql` function returns an error when unsupported modes are specified. """ aes_encrypt_mysql(plaintext="'hello there'", mode=mode, key=f"'{'1'* 32}'", exitcode=36, message="DB::Exception: Unsupported cipher mode")
[ "def", "unsupported_modes", "(", "self", ",", "mode", ")", ":", "aes_encrypt_mysql", "(", "plaintext", "=", "\"'hello there'\"", ",", "mode", "=", "mode", ",", "key", "=", "f\"'{'1'* 32}'\"", ",", "exitcode", "=", "36", ",", "message", "=", "\"DB::Exception: U...
[ 38, 0 ]
[ 41, 142 ]
python
en
['en', 'en', 'en']
True
invalid_parameters
(self)
Check that `aes_encrypt_mysql` function returns an error when we call it with invalid parameters.
Check that `aes_encrypt_mysql` function returns an error when we call it with invalid parameters.
def invalid_parameters(self): """Check that `aes_encrypt_mysql` function returns an error when we call it with invalid parameters. """ with Example("no parameters"): aes_encrypt_mysql(exitcode=42, message="DB::Exception: Incorrect number of arguments for function aes_encrypt_mysql provided 0, ex...
[ "def", "invalid_parameters", "(", "self", ")", ":", "with", "Example", "(", "\"no parameters\"", ")", ":", "aes_encrypt_mysql", "(", "exitcode", "=", "42", ",", "message", "=", "\"DB::Exception: Incorrect number of arguments for function aes_encrypt_mysql provided 0, expected...
[ 47, 0 ]
[ 107, 67 ]
python
en
['en', 'gd', 'en']
True
invalid_plaintext_data_type
(self, data_type, value)
Check that aes_encrypt_mysql function returns an error if the plaintext parameter has invalid data type.
Check that aes_encrypt_mysql function returns an error if the plaintext parameter has invalid data type.
def invalid_plaintext_data_type(self, data_type, value): """Check that aes_encrypt_mysql function returns an error if the plaintext parameter has invalid data type. """ with When("I try to encrypt plaintext with invalid data type", description=f"{data_type} with value {value}"): aes_encrypt_mysq...
[ "def", "invalid_plaintext_data_type", "(", "self", ",", "data_type", ",", "value", ")", ":", "with", "When", "(", "\"I try to encrypt plaintext with invalid data type\"", ",", "description", "=", "f\"{data_type} with value {value}\"", ")", ":", "aes_encrypt_mysql", "(", "...
[ 138, 0 ]
[ 144, 75 ]
python
en
['en', 'en', 'en']
True
key_or_iv_length_for_mode
(self, mode, key_len, iv_len)
Check that key or iv length for mode.
Check that key or iv length for mode.
def key_or_iv_length_for_mode(self, mode, key_len, iv_len): """Check that key or iv length for mode. """ plaintext = "'hello there'" key = "0123456789" * 4 iv = "0123456789" * 4 with When("key is too short"): aes_encrypt_mysql(plaintext=plaintext, key=f"'{key[:key_len-1]}'", mode=mode, ...
[ "def", "key_or_iv_length_for_mode", "(", "self", ",", "mode", ",", "key_len", ",", "iv_len", ")", ":", "plaintext", "=", "\"'hello there'\"", "key", "=", "\"0123456789\"", "*", "4", "iv", "=", "\"0123456789\"", "*", "4", "with", "When", "(", "\"key is too shor...
[ 173, 0 ]
[ 194, 156 ]
python
en
['en', 'en', 'en']
True
iv_parameter_types
(self)
Check that `aes_encrypt_mysql` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types.
Check that `aes_encrypt_mysql` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types.
def iv_parameter_types(self): """Check that `aes_encrypt_mysql` function accepts `iv` parameter as the fourth argument of either `String` or `FixedString` types. """ plaintext = "'hello there'" iv = "'0123456789123456'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("iv is ...
[ "def", "iv_parameter_types", "(", "self", ")", ":", "plaintext", "=", "\"'hello there'\"", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"iv is specified using String type\"", ")", ":"...
[ 200, 0 ]
[ 219, 154 ]
python
en
['en', 'en', 'en']
True
key_parameter_types
(self)
Check that `aes_encrypt_mysql` function accepts `key` parameter as the second argument of either `String` or `FixedString` types.
Check that `aes_encrypt_mysql` function accepts `key` parameter as the second argument of either `String` or `FixedString` types.
def key_parameter_types(self): """Check that `aes_encrypt_mysql` function accepts `key` parameter as the second argument of either `String` or `FixedString` types. """ plaintext = "'hello there'" iv = "'0123456789123456'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("key ...
[ "def", "key_parameter_types", "(", "self", ")", ":", "plaintext", "=", "\"'hello there'\"", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"key is specified using String type\"", ")", "...
[ 226, 0 ]
[ 245, 146 ]
python
en
['en', 'en', 'en']
True
mode_parameter_types
(self)
Check that `aes_encrypt_mysql` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types.
Check that `aes_encrypt_mysql` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types.
def mode_parameter_types(self): """Check that `aes_encrypt_mysql` function accepts `mode` parameter as the third argument of either `String` or `FixedString` types. """ plaintext = "'hello there'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("mode is specified using String ty...
[ "def", "mode_parameter_types", "(", "self", ")", ":", "plaintext", "=", "\"'hello there'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"mode is specified using String type\"", ")", ":", "aes_encrypt_mysql", "(", "plai...
[ 252, 0 ]
[ 264, 134 ]
python
en
['en', 'en', 'en']
True
return_value
(self)
Check that `aes_encrypt_mysql` functions returns String data type.
Check that `aes_encrypt_mysql` functions returns String data type.
def return_value(self): """Check that `aes_encrypt_mysql` functions returns String data type. """ plaintext = "'hello there'" iv = "'0123456789123456'" mode = "'aes-128-cbc'" key = "'0123456789123456'" with When("I get type of the return value"): sql = "SELECT toTypeName(aes_encrypt...
[ "def", "return_value", "(", "self", ")", ":", "plaintext", "=", "\"'hello there'\"", "iv", "=", "\"'0123456789123456'\"", "mode", "=", "\"'aes-128-cbc'\"", "key", "=", "\"'0123456789123456'\"", "with", "When", "(", "\"I get type of the return value\"", ")", ":", "sql"...
[ 270, 0 ]
[ 286, 117 ]
python
en
['en', 'no', 'en']
True
syntax
(self)
Check that `aes_encrypt_mysql` function supports syntax ```sql aes_encrypt_mysql(plaintext, key, mode, [iv]) ```
Check that `aes_encrypt_mysql` function supports syntax
def syntax(self): """Check that `aes_encrypt_mysql` function supports syntax ```sql aes_encrypt_mysql(plaintext, key, mode, [iv]) ``` """ sql = "SELECT hex(aes_encrypt_mysql('aes-128-ofb', 'hello there', '0123456789123456', '0123456789123456'))" self.context.node.query(sql, step=When, messa...
[ "def", "syntax", "(", "self", ")", ":", "sql", "=", "\"SELECT hex(aes_encrypt_mysql('aes-128-ofb', 'hello there', '0123456789123456', '0123456789123456'))\"", "self", ".", "context", ".", "node", ".", "query", "(", "sql", ",", "step", "=", "When", ",", "message", "=",...
[ 292, 0 ]
[ 300, 77 ]
python
en
['en', 'en', 'en']
True
encryption
(self)
Check that `aes_encrypt_mysql` functions accepts `plaintext` as the second parameter with any data type and `mode` as the first parameter.
Check that `aes_encrypt_mysql` functions accepts `plaintext` as the second parameter with any data type and `mode` as the first parameter.
def encryption(self): """Check that `aes_encrypt_mysql` functions accepts `plaintext` as the second parameter with any data type and `mode` as the first parameter. """ key = f"{'1' * 64}" iv = f"{'2' * 64}" for mode, key_len, iv_len in mysql_modes: for datatype, plaintext in plaintexts:...
[ "def", "encryption", "(", "self", ")", ":", "key", "=", "f\"{'1' * 64}\"", "iv", "=", "f\"{'2' * 64}\"", "for", "mode", ",", "key_len", ",", "iv_len", "in", "mysql_modes", ":", "for", "datatype", ",", "plaintext", "in", "plaintexts", ":", "with", "Example", ...
[ 309, 0 ]
[ 327, 139 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the behavior of the `aes_encrypt_mysql` function.
Check the behavior of the `aes_encrypt_mysql` function.
def feature(self, node="clickhouse1"): """Check the behavior of the `aes_encrypt_mysql` function. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): Scenario(run=scenario, flags=TE)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 334, 0 ]
[ 340, 40 ]
python
en
['en', 'no', 'en']
True
without_privilege
(self, table_type, node=None)
Check that user without select privilege on a table is not able to select on that table.
Check that user without select privilege on a table is not able to select on that table.
def without_privilege(self, table_type, node=None): """Check that user without select privilege on a table is not able to select on that table. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" if node is None: node = self.context.node with table(node, table_name, tab...
[ "def", "without_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "...
[ 14, 0 ]
[ 37, 63 ]
python
en
['en', 'en', 'en']
True
user_with_privilege
(self, table_type, node=None)
Check that user can select from a table on which they have select privilege.
Check that user can select from a table on which they have select privilege.
def user_with_privilege(self, table_type, node=None): """Check that user can select from a table on which they have select privilege. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" if node is None: node = self.context.node with table(node, table_name, table_type): ...
[ "def", "user_with_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", ...
[ 43, 0 ]
[ 66, 68 ]
python
en
['en', 'en', 'en']
True
user_with_all_privilege
(self, table_type, node=None)
Check that user can select from a table if have ALL privilege.
Check that user can select from a table if have ALL privilege.
def user_with_all_privilege(self, table_type, node=None): """Check that user can select from a table if have ALL privilege. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" if node is None: node = self.context.node with table(node, table_name, table_type): w...
[ "def", "user_with_all_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", "....
[ 72, 0 ]
[ 95, 68 ]
python
en
['en', 'en', 'en']
True
user_with_revoked_privilege
(self, table_type, node=None)
Check that user is unable to select from a table after select privilege on that table has been revoked from the user.
Check that user is unable to select from a table after select privilege on that table has been revoked from the user.
def user_with_revoked_privilege(self, table_type, node=None): """Check that user is unable to select from a table after select privilege on that table has been revoked from the user. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" if node is None: node = self.context...
[ "def", "user_with_revoked_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ...
[ 101, 0 ]
[ 124, 55 ]
python
en
['en', 'en', 'en']
True
user_with_revoked_all_privilege
(self, table_type, node=None)
Check that user is unable to select from a table after ALL privilege on that table has been revoked from the user.
Check that user is unable to select from a table after ALL privilege on that table has been revoked from the user.
def user_with_revoked_all_privilege(self, table_type, node=None): """Check that user is unable to select from a table after ALL privilege on that table has been revoked from the user. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" if node is None: node = self.contex...
[ "def", "user_with_revoked_all_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "contex...
[ 127, 0 ]
[ 150, 55 ]
python
en
['en', 'en', 'en']
True
user_column_privileges
(self, grant_columns, select_columns_pass, data_pass, table_type, revoke_columns=None, select_columns_fail=None, node=None)
Check that user is able to select on granted columns and unable to select on not granted or revoked columns.
Check that user is able to select on granted columns and unable to select on not granted or revoked columns.
def user_column_privileges(self, grant_columns, select_columns_pass, data_pass, table_type, revoke_columns=None, select_columns_fail=None, node=None): """Check that user is able to select on granted columns and unable to select on not granted or revoked columns. """ user_name = f"user_{getuid()}" ta...
[ "def", "user_column_privileges", "(", "self", ",", "grant_columns", ",", "select_columns_pass", ",", "data_pass", ",", "table_type", ",", "revoke_columns", "=", "None", ",", "select_columns_fail", "=", "None", ",", "node", "=", "None", ")", ":", "user_name", "="...
[ 168, 0 ]
[ 205, 148 ]
python
en
['en', 'en', 'en']
True
role_with_privilege
(self, table_type, node=None)
Check that user can select from a table after it is granted a role that has the select privilege for that table.
Check that user can select from a table after it is granted a role that has the select privilege for that table.
def role_with_privilege(self, table_type, node=None): """Check that user can select from a table after it is granted a role that has the select privilege for that table. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" table_name = f"table_{getuid()}" if node is None: ...
[ "def", "role_with_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node...
[ 211, 0 ]
[ 240, 72 ]
python
en
['en', 'en', 'en']
True
role_with_revoked_privilege
(self, table_type, node=None)
Check that user with a role that has select privilege on a table is unable to select from that table after select privilege has been revoked from the role.
Check that user with a role that has select privilege on a table is unable to select from that table after select privilege has been revoked from the role.
def role_with_revoked_privilege(self, table_type, node=None): """Check that user with a role that has select privilege on a table is unable to select from that table after select privilege has been revoked from the role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" table_nam...
[ "def", "role_with_revoked_privilege", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":",...
[ 246, 0 ]
[ 273, 55 ]
python
en
['en', 'en', 'en']
True
user_with_revoked_role
(self, table_type, node=None)
Check that user with a role that has select privilege on a table is unable to select from that table after the role with select privilege has been revoked from the user.
Check that user with a role that has select privilege on a table is unable to select from that table after the role with select privilege has been revoked from the user.
def user_with_revoked_role(self, table_type, node=None): """Check that user with a role that has select privilege on a table is unable to select from that table after the role with select privilege has been revoked from the user. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" ...
[ "def", "user_with_revoked_role", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "n...
[ 276, 0 ]
[ 303, 55 ]
python
en
['en', 'en', 'en']
True
role_column_privileges
(self, grant_columns, select_columns_pass, data_pass, table_type, revoke_columns=None, select_columns_fail=None, node=None)
Check that user is able to select from granted columns and unable to select from not granted or revoked columns.
Check that user is able to select from granted columns and unable to select from not granted or revoked columns.
def role_column_privileges(self, grant_columns, select_columns_pass, data_pass, table_type, revoke_columns=None, select_columns_fail=None, node=None): """Check that user is able to select from granted columns and unable to select from not granted or revoked columns. """ user_name = f"user_{getuid()}" ...
[ "def", "role_column_privileges", "(", "self", ",", "grant_columns", ",", "select_columns_pass", ",", "data_pass", ",", "table_type", ",", "revoke_columns", "=", "None", ",", "select_columns_fail", "=", "None", ",", "node", "=", "None", ")", ":", "user_name", "="...
[ 321, 0 ]
[ 364, 92 ]
python
en
['en', 'en', 'en']
True
user_with_privilege_on_cluster
(self, table_type, node=None)
Check that user is able to select from a table with privilege granted on a cluster.
Check that user is able to select from a table with privilege granted on a cluster.
def user_with_privilege_on_cluster(self, table_type, node=None): """Check that user is able to select from a table with privilege granted on a cluster. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" table_name = f"table_{getuid()}" if node is None: node = self.con...
[ "def", "user_with_privilege_on_cluster", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", "...
[ 370, 0 ]
[ 399, 79 ]
python
en
['en', 'en', 'en']
True
feature
(self, table_type, parallel=None, stress=None, node="clickhouse1")
Check the RBAC functionality of SELECT.
Check the RBAC functionality of SELECT.
def feature(self, table_type, parallel=None, stress=None, node="clickhouse1"): """Check the RBAC functionality of SELECT. """ self.context.node = self.context.cluster.node(node) if stress is not None: self.context.stress = stress if parallel is not None: self.context.stress = parall...
[ "def", "feature", "(", "self", ",", "table_type", ",", "parallel", "=", "None", ",", "stress", "=", "None", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", ...
[ 410, 0 ]
[ 426, 23 ]
python
en
['en', 'en', 'en']
True
regression
(self, local, clickhouse_binary_path, stress=None, parallel=None)
ClickHouse LDAP role mapping regression module.
ClickHouse LDAP role mapping regression module.
def regression(self, local, clickhouse_binary_path, stress=None, parallel=None): """ClickHouse LDAP role mapping regression module. """ top().terminating = False nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), } if stress is not None: self.context.stress =...
[ "def", "regression", "(", "self", ",", "local", ",", "clickhouse_binary_path", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "top", "(", ")", ".", "terminating", "=", "False", "nodes", "=", "{", "\"clickhouse\"", ":", "(", "\"clickh...
[ 29, 0 ]
[ 48, 71 ]
python
en
['fr', 'en', 'en']
True
privileges_granted_directly
(self, node=None)
Check that a user is able to execute `DROP QUOTA` with privileges are granted directly.
Check that a user is able to execute `DROP QUOTA` with privileges are granted directly.
def privileges_granted_directly(self, node=None): """Check that a user is able to execute `DROP QUOTA` with privileges are granted directly. """ user_name = f"user_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"): Suite(run=drop_quota, ...
[ "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 `DROP QUOTA` with privileges are granted through a role.
Check that a user is able to execute `DROP QUOTA` with privileges are granted through a role.
def privileges_granted_via_role(self, node=None): """Check that a user is able to execute `DROP QUOTA` with privileges are granted through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.node with user(node, f"{user_name}"...
[ "def", "privileges_granted_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with"...
[ 25, 0 ]
[ 43, 74 ]
python
en
['en', 'en', 'en']
True
drop_quota
(self, privilege, grant_target_name, user_name, node=None)
Check that user is only able to execute `DROP QUOTA` when they have the necessary privilege.
Check that user is only able to execute `DROP QUOTA` when they have the necessary privilege.
def drop_quota(self, privilege, grant_target_name, user_name, node=None): """Check that user is only able to execute `DROP QUOTA` when they have the necessary privilege. """ exitcode, message = errors.not_enough_privileges(name=user_name) if node is None: node = self.context.node with Scen...
[ "def", "drop_quota", "(", "self", ",", "privilege", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "user_name", ")", "if", "node", "...
[ 51, 0 ]
[ 132, 74 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check the RBAC functionality of DROP QUOTA.
Check the RBAC functionality of DROP QUOTA.
def feature(self, node="clickhouse1"): """Check the RBAC functionality of DROP QUOTA. """ self.context.node = self.context.cluster.node(node) Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log)
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Suite", "(", "run", "=", "privileges_granted_directly", ",", ...
[ 141, 0 ]
[ 147, 82 ]
python
en
['en', 'en', 'en']
True
predict
(item: Item)
Make random baseline predictions for classification problem 🔮 ### Request Body - `x1`: positive float - `x2`: integer - `x3`: string ### Response - `prediction`: boolean, at random - `predict_proba`: float between 0.5 and 1.0, representing the predicted class's probability ...
Make random baseline predictions for classification problem 🔮
async def predict(item: Item): """ Make random baseline predictions for classification problem 🔮 ### Request Body - `x1`: positive float - `x2`: integer - `x3`: string ### Response - `prediction`: boolean, at random - `predict_proba`: float between 0.5 and 1.0, representing t...
[ "async", "def", "predict", "(", "item", ":", "Item", ")", ":", "X_new", "=", "item", ".", "to_df", "(", ")", "log", ".", "info", "(", "X_new", ")", "y_pred", "=", "random", ".", "choice", "(", "[", "True", ",", "False", "]", ")", "y_pred_proba", ...
[ 30, 0 ]
[ 54, 5 ]
python
en
['en', 'error', 'th']
False
Item.to_df
(self)
Convert pydantic object to pandas dataframe with 1 row.
Convert pydantic object to pandas dataframe with 1 row.
def to_df(self): """Convert pydantic object to pandas dataframe with 1 row.""" return pd.DataFrame([dict(self)])
[ "def", "to_df", "(", "self", ")", ":", "return", "pd", ".", "DataFrame", "(", "[", "dict", "(", "self", ")", "]", ")" ]
[ 18, 4 ]
[ 20, 41 ]
python
en
['en', 'en', 'en']
True
Item.x1_must_be_positive
(cls, value)
Validate that x1 is a positive number.
Validate that x1 is a positive number.
def x1_must_be_positive(cls, value): """Validate that x1 is a positive number.""" assert value > 0, f'x1 == {value}, must be > 0' return value
[ "def", "x1_must_be_positive", "(", "cls", ",", "value", ")", ":", "assert", "value", ">", "0", ",", "f'x1 == {value}, must be > 0'", "return", "value" ]
[ 23, 4 ]
[ 26, 20 ]
python
en
['en', 'en', 'en']
True
dictionary
(name, node, mysql_node)
Create a table in MySQL and use it a source for a dictionary.
Create a table in MySQL and use it a source for a dictionary.
def dictionary(name, node, mysql_node): """Create a table in MySQL and use it a source for a dictionary. """ try: with Given("table in MySQL"): sql = f""" CREATE TABLE {name}( id INT NOT NULL AUTO_INCREMENT, int128 BIGINT, ...
[ "def", "dictionary", "(", "name", ",", "node", ",", "mysql_node", ")", ":", "try", ":", "with", "Given", "(", "\"table in MySQL\"", ")", ":", "sql", "=", "f\"\"\"\n CREATE TABLE {name}(\n id INT NOT NULL AUTO_INCREMENT,\n i...
[ 7, 0 ]
[ 62, 121 ]
python
en
['en', 'en', 'en']
True
table
(name, node, mysql_node)
Create a table in MySQL and use it a source for a table in ClickHouse.
Create a table in MySQL and use it a source for a table in ClickHouse.
def table(name, node, mysql_node): """Create a table in MySQL and use it a source for a table in ClickHouse. """ try: with Given("table in MySQL"): sql = f""" CREATE TABLE {name}( id INT NOT NULL AUTO_INCREMENT, int128 BIGINT, ...
[ "def", "table", "(", "name", ",", "node", ",", "mysql_node", ")", ":", "try", ":", "with", "Given", "(", "\"table in MySQL\"", ")", ":", "sql", "=", "f\"\"\"\n CREATE TABLE {name}(\n id INT NOT NULL AUTO_INCREMENT,\n int128...
[ 65, 0 ]
[ 113, 121 ]
python
en
['en', 'en', 'en']
True
table_func
(name, node, mysql_node)
Create a table in MySQL and use it a source for a table using mysql table function.
Create a table in MySQL and use it a source for a table using mysql table function.
def table_func(name, node, mysql_node): """Create a table in MySQL and use it a source for a table using mysql table function. """ try: with Given("table in MySQL"): sql = f""" CREATE TABLE {name}( id INT NOT NULL AUTO_INCREMENT, in...
[ "def", "table_func", "(", "name", ",", "node", ",", "mysql_node", ")", ":", "try", ":", "with", "Given", "(", "\"table in MySQL\"", ")", ":", "sql", "=", "f\"\"\"\n CREATE TABLE {name}(\n id INT NOT NULL AUTO_INCREMENT,\n i...
[ 116, 0 ]
[ 145, 121 ]
python
en
['en', 'en', 'en']
True
int_conversion
(self, int_type, min, max, node=None)
Check that ClickHouse converts values to Int128.
Check that ClickHouse converts values to Int128.
def int_conversion(self, int_type, min, max, node=None): """Check that ClickHouse converts values to Int128. """ if node is None: node = self.context.node with When(f"I convert {min}, {max}, 1 to {int_type}"): output = node.query(f"SELECT to{int_type}(\'{min}\'), to{int_type}(\'{max}\'...
[ "def", "int_conversion", "(", "self", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "with", "When", "(", "f\"I convert {min}, {max}, 1 to {i...
[ 154, 0 ]
[ 163, 52 ]
python
en
['en', 'en', 'en']
True
to_decimal256
(self, node=None)
Check that ClickHouse converts values to Int128.
Check that ClickHouse converts values to Int128.
def to_decimal256(self, node=None): """Check that ClickHouse converts values to Int128. """ min = Decimal256_min_max[0] max = Decimal256_min_max[1] if node is None: node = self.context.node with When(f"I check toDecimal256 with 0 scale with 1, {max}, and {min}"): for value in ...
[ "def", "to_decimal256", "(", "self", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "nod...
[ 169, 0 ]
[ 192, 69 ]
python
en
['en', 'en', 'en']
True
MySQL_table
(self, node=None)
Check that ClickHouse converts MySQL values from MySQL table into ClickHouse table.
Check that ClickHouse converts MySQL values from MySQL table into ClickHouse table.
def MySQL_table(self, node=None): """Check that ClickHouse converts MySQL values from MySQL table into ClickHouse table. """ table_name = f'table_{getuid()}' node = self.context.node mysql_node = self.context.mysql_node with table(table_name, node, mysql_node): with When("I insert par...
[ "def", "MySQL_table", "(", "self", ",", "node", "=", "None", ")", ":", "table_name", "=", "f'table_{getuid()}'", "node", "=", "self", ".", "context", ".", "node", "mysql_node", "=", "self", ".", "context", ".", "mysql_node", "with", "table", "(", "table_na...
[ 198, 0 ]
[ 216, 50 ]
python
en
['en', 'en', 'en']
True
MySQL_func
(self, node=None)
Check that ClickHouse converts MySQL values into a ClickHouse table using the MySQL table function.
Check that ClickHouse converts MySQL values into a ClickHouse table using the MySQL table function.
def MySQL_func(self, node=None): """Check that ClickHouse converts MySQL values into a ClickHouse table using the MySQL table function. """ table_name = f'table_{getuid()}' node = self.context.node mysql_node = self.context.mysql_node with table_func(table_name, node, mysql_node) as table_func...
[ "def", "MySQL_func", "(", "self", ",", "node", "=", "None", ")", ":", "table_name", "=", "f'table_{getuid()}'", "node", "=", "self", ".", "context", ".", "node", "mysql_node", "=", "self", ".", "context", ".", "mysql_node", "with", "table_func", "(", "tabl...
[ 222, 0 ]
[ 249, 57 ]
python
en
['en', 'en', 'en']
True
MySQL_dict
(self, node=None)
Check that ClickHouse converts MySQL values from MySQL table into ClickHouse dictionary.
Check that ClickHouse converts MySQL values from MySQL table into ClickHouse dictionary.
def MySQL_dict(self, node=None): """Check that ClickHouse converts MySQL values from MySQL table into ClickHouse dictionary. """ node = self.context.node mysql_node = self.context.mysql_node table_name = f'table_{getuid()}' with dictionary(table_name, node, mysql_node): with When("I ...
[ "def", "MySQL_dict", "(", "self", ",", "node", "=", "None", ")", ":", "node", "=", "self", ".", "context", ".", "node", "mysql_node", "=", "self", ".", "context", ".", "mysql_node", "table_name", "=", "f'table_{getuid()}'", "with", "dictionary", "(", "tabl...
[ 255, 0 ]
[ 274, 50 ]
python
en
['en', 'en', 'en']
True