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
_init_optimizer
(self, optimizer, lr, scheduler=True, clip_grad_norm=False, optimizer_kwargs={}, swa=False, swa_kwargs={})
Initialize the optimzer and learning rate scheduler This gets called at the beginning of synthesize() and can also be called at other moments to make sure we're using the original learning rate (e.g., when moving to a different scale for coarse-to-fine optimization). we also (o...
Initialize the optimzer and learning rate scheduler
def _init_optimizer(self, optimizer, lr, scheduler=True, clip_grad_norm=False, optimizer_kwargs={}, swa=False, swa_kwargs={}): """Initialize the optimzer and learning rate scheduler This gets called at the beginning of synthesize() and can also be called at other moments...
[ "def", "_init_optimizer", "(", "self", ",", "optimizer", ",", "lr", ",", "scheduler", "=", "True", ",", "clip_grad_norm", "=", "False", ",", "optimizer_kwargs", "=", "{", "}", ",", "swa", "=", "False", ",", "swa_kwargs", "=", "{", "}", ")", ":", "# the...
[ 753, 4 ]
[ 879, 48 ]
python
en
['en', 'en', 'en']
True
_closure
(self)
r"""An abstraction of the gradient calculation, before the optimization step. This enables optimization algorithms that perform several evaluations of the gradient before taking a step (ie. second order methods like LBFGS). Note that the fraction removed also happens here, and for now ...
r"""An abstraction of the gradient calculation, before the optimization step.
def _closure(self): r"""An abstraction of the gradient calculation, before the optimization step. This enables optimization algorithms that perform several evaluations of the gradient before taking a step (ie. second order methods like LBFGS). Note that the fraction removed als...
[ "def", "_closure", "(", "self", ")", ":", "self", ".", "_optimizer", ".", "zero_grad", "(", ")", "analyze_kwargs", "=", "{", "}", "if", "self", ".", "coarse_to_fine", ":", "# if we've reached 'all', we act the same as if", "# coarse_to_fine was False", "if", "self",...
[ 881, 4 ]
[ 945, 19 ]
python
en
['en', 'en', 'en']
True
_optimizer_step
(self, pbar=None, **kwargs)
r"""Compute and propagate gradients, then step the optimizer to update synthesized_signal Parameters ---------- pbar : tqdm.tqdm or None, optional A tqdm progress-bar, which we update with a postfix describing the current loss, gradient norm, and learning rat...
r"""Compute and propagate gradients, then step the optimizer to update synthesized_signal
def _optimizer_step(self, pbar=None, **kwargs): r"""Compute and propagate gradients, then step the optimizer to update synthesized_signal Parameters ---------- pbar : tqdm.tqdm or None, optional A tqdm progress-bar, which we update with a postfix describing the c...
[ "def", "_optimizer_step", "(", "self", ",", "pbar", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_last_iter_synthesized_signal", "=", "self", ".", "synthesized_signal", ".", "clone", "(", ")", "postfix_dict", "=", "{", "}", "if", "self", ...
[ 947, 4 ]
[ 1023, 82 ]
python
en
['en', 'en', 'en']
True
save
(self, file_path, save_model_reduced=False, attrs=['model'], model_attr_names=['model'])
r"""save all relevant variables in .pt file This is an abstractmethod only because you need to specify which attributes to save. See ``metamer.save`` as an example, but the save method in your synthesis object should probably should have a line defining the attributes to save and then a...
r"""save all relevant variables in .pt file
def save(self, file_path, save_model_reduced=False, attrs=['model'], model_attr_names=['model']): r"""save all relevant variables in .pt file This is an abstractmethod only because you need to specify which attributes to save. See ``metamer.save`` as an example, but the sav...
[ "def", "save", "(", "self", ",", "file_path", ",", "save_model_reduced", "=", "False", ",", "attrs", "=", "[", "'model'", "]", ",", "model_attr_names", "=", "[", "'model'", "]", ")", ":", "save_dict", "=", "{", "}", "for", "name", "in", "model_attr_names...
[ 1026, 4 ]
[ 1077, 60 ]
python
en
['en', 'en', 'en']
True
load
(cls, file_path, model_attr_name='model', model_constructor=None, map_location='cpu', **state_dict_kwargs)
r"""load all relevant stuff from a .pt file We will iterate through any additional key word arguments provided and, if the model in the saved representation is a dictionary, add them to the state_dict of the model. In this way, you can replace, e.g., paths that have changed between ...
r"""load all relevant stuff from a .pt file
def load(cls, file_path, model_attr_name='model', model_constructor=None, map_location='cpu', **state_dict_kwargs): r"""load all relevant stuff from a .pt file We will iterate through any additional key word arguments provided and, if the model in the saved representation is a ...
[ "def", "load", "(", "cls", ",", "file_path", ",", "model_attr_name", "=", "'model'", ",", "model_constructor", "=", "None", ",", "map_location", "=", "'cpu'", ",", "*", "*", "state_dict_kwargs", ")", ":", "tmp_dict", "=", "torch", ".", "load", "(", "file_p...
[ 1081, 4 ]
[ 1189, 20 ]
python
en
['en', 'en', 'en']
True
to
(self, *args, attrs=[], **kwargs)
r"""Moves and/or casts the parameters and buffers. Similar to ``save``, this is an abstract method only because you need to define the attributes to call to on. NOTE: We always call ``model.to(*args, **kwargs)`` (and thus ``'model'`` does not need to be in the ``attrs`` argument), but ...
r"""Moves and/or casts the parameters and buffers.
def to(self, *args, attrs=[], **kwargs): r"""Moves and/or casts the parameters and buffers. Similar to ``save``, this is an abstract method only because you need to define the attributes to call to on. NOTE: We always call ``model.to(*args, **kwargs)`` (and thus ``'model'`` doe...
[ "def", "to", "(", "self", ",", "*", "args", ",", "attrs", "=", "[", "]", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "model", "=", "self", ".", "model", ".", "to", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "A...
[ 1192, 4 ]
[ 1251, 19 ]
python
en
['en', 'en', 'en']
True
plot_representation_error
(self, batch_idx=0, iteration=None, figsize=(5, 5), ylim=None, ax=None, title=None, as_rgb=False)
r"""Plot distance ratio showing how close we are to convergence. We plot ``self.representation_error(iteration)`` The goal is to use the model's ``plot_representation`` method. However, in order for this to work, it needs to not only have that method, but a way to make a 'mock copy', a...
r"""Plot distance ratio showing how close we are to convergence.
def plot_representation_error(self, batch_idx=0, iteration=None, figsize=(5, 5), ylim=None, ax=None, title=None, as_rgb=False): r"""Plot distance ratio showing how close we are to convergence. We plot ``self.representation_error(iteration)`` The goal is to use...
[ "def", "plot_representation_error", "(", "self", ",", "batch_idx", "=", "0", ",", "iteration", "=", "None", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "ylim", "=", "None", ",", "ax", "=", "None", ",", "title", "=", "None", ",", "as_rgb", "=...
[ 1253, 4 ]
[ 1306, 60 ]
python
en
['en', 'en', 'en']
True
plot_loss
(self, iteration=None, figsize=(5, 5), ax=None, title='Loss', **kwargs)
Plot the synthesis loss. We plot ``self.loss`` over all iterations. We also plot a red dot at ``iteration``, to highlight the loss there. If ``iteration=None``, then the dot will be at the final iteration. Parameters ---------- iteration : int or None, optional ...
Plot the synthesis loss.
def plot_loss(self, iteration=None, figsize=(5, 5), ax=None, title='Loss', **kwargs): """Plot the synthesis loss. We plot ``self.loss`` over all iterations. We also plot a red dot at ``iteration``, to highlight the loss there. If ``iteration=None``, then the dot will be at the final ite...
[ "def", "plot_loss", "(", "self", ",", "iteration", "=", "None", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "ax", "=", "None", ",", "title", "=", "'Loss'", ",", "*", "*", "kwargs", ")", ":", "if", "iteration", "is", "None", ":", "loss_idx"...
[ 1308, 4 ]
[ 1354, 18 ]
python
en
['en', 'en', 'en']
True
plot_synthesized_image
(self, batch_idx=0, channel_idx=None, iteration=None, title=None, figsize=(5, 5), ax=None, imshow_zoom=None, vrange=(0, 1))
Show the synthesized image. You can specify what iteration to view by using the ``iteration`` arg. The default, ``None``, shows the final one. We use ``plenoptic.imshow`` to display the synthesized image and attempt to automatically find the most reasonable zoom value. You can ...
Show the synthesized image.
def plot_synthesized_image(self, batch_idx=0, channel_idx=None, iteration=None, title=None, figsize=(5, 5), ax=None, imshow_zoom=None, vrange=(0, 1)): """Show the synthesized image. You can specify what iteration to view by using the ``iteration`` arg. The default...
[ "def", "plot_synthesized_image", "(", "self", ",", "batch_idx", "=", "0", ",", "channel_idx", "=", "None", ",", "iteration", "=", "None", ",", "title", "=", "None", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "ax", "=", "None", ",", "imshow_zo...
[ 1356, 4 ]
[ 1434, 18 ]
python
en
['en', 'en', 'en']
True
plot_image_hist
(self, batch_idx=0, channel_idx=None, iteration=None, figsize=(5, 5), ylim=None, ax=None, **kwargs)
r"""Plot histogram of target and matched image. As a way to check the distributions of pixel intensities and see if there's any values outside the allowed range Parameters ---------- batch_idx : int, optional Which index to take from the batch dimension chan...
r"""Plot histogram of target and matched image.
def plot_image_hist(self, batch_idx=0, channel_idx=None, iteration=None, figsize=(5, 5), ylim=None, ax=None, **kwargs): r"""Plot histogram of target and matched image. As a way to check the distributions of pixel intensities and see if there's any values outside the allo...
[ "def", "plot_image_hist", "(", "self", ",", "batch_idx", "=", "0", ",", "channel_idx", "=", "None", ",", "iteration", "=", "None", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "ylim", "=", "None", ",", "ax", "=", "None", ",", "*", "*", "kwa...
[ 1436, 4 ]
[ 1507, 18 ]
python
en
['en', 'en', 'en']
True
_grab_value_for_comparison
(self, value, batch_idx=0, channel_idx=None, iteration=None, scatter_subsample=1, **kwargs)
Grab and shape values for comparison plot. This grabs the appropriate batch_idx, channel_idx, and iteration from the saved representation or signal, respectively, and subsamples it if necessary. We then concatenate thema long the last dimension. Parameters ---------- ...
Grab and shape values for comparison plot.
def _grab_value_for_comparison(self, value, batch_idx=0, channel_idx=None, iteration=None, scatter_subsample=1, **kwargs): """Grab and shape values for comparison plot. This grabs the appropriate batch_idx, channel_idx, and iteration...
[ "def", "_grab_value_for_comparison", "(", "self", ",", "value", ",", "batch_idx", "=", "0", ",", "channel_idx", "=", "None", ",", "iteration", "=", "None", ",", "scatter_subsample", "=", "1", ",", "*", "*", "kwargs", ")", ":", "if", "value", "==", "'repr...
[ 1509, 4 ]
[ 1574, 50 ]
python
en
['en', 'en', 'en']
True
plot_value_comparison
(self, value='representation', batch_idx=0, channel_idx=None, iteration=None, figsize=(5, 5), ax=None, func='scatter', hist2d_nbins=21, hist2d_cmap='Blues', scatter_subsample=1, **kwargs)
Plot comparison of base vs. synthesized representation or signal. Plotting representation is another way of visualizing the representation error, while plotting signal is similar to plot_image_hist, but allows you to see whether there's any pattern of individual correspondence. ...
Plot comparison of base vs. synthesized representation or signal.
def plot_value_comparison(self, value='representation', batch_idx=0, channel_idx=None, iteration=None, figsize=(5, 5), ax=None, func='scatter', hist2d_nbins=21, hist2d_cmap='Blues', scatter_subsample=1, ...
[ "def", "plot_value_comparison", "(", "self", ",", "value", "=", "'representation'", ",", "batch_idx", "=", "0", ",", "channel_idx", "=", "None", ",", "iteration", "=", "None", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "ax", "=", "None", ",", ...
[ 1577, 4 ]
[ 1649, 18 ]
python
en
['en', 'en', 'en']
True
_setup_synthesis_fig
(self, fig, axes_idx, figsize, plot_synthesized_image=True, plot_loss=True, plot_representation_error=True, plot_image_hist=False, plot_rep_comparison=False, plot_signal_comparison=False, ...
Set up figure for plot_synthesis_status. Creates figure with enough axes for the all the plots you want. Will also create index in axes_idx for them if you haven't done so already. By default, all axes will be on the same row and have the same width. If you want them to be on different...
Set up figure for plot_synthesis_status.
def _setup_synthesis_fig(self, fig, axes_idx, figsize, plot_synthesized_image=True, plot_loss=True, plot_representation_error=True, plot_image_hist=False, plot_rep_comparison=False, plot_signal_comparison...
[ "def", "_setup_synthesis_fig", "(", "self", ",", "fig", ",", "axes_idx", ",", "figsize", ",", "plot_synthesized_image", "=", "True", ",", "plot_loss", "=", "True", ",", "plot_representation_error", "=", "True", ",", "plot_image_hist", "=", "False", ",", "plot_re...
[ 1651, 4 ]
[ 1772, 34 ]
python
en
['en', 'en', 'en']
True
plot_synthesis_status
(self, batch_idx=0, channel_idx=None, iteration=None, figsize=None, ylim=None, plot_synthesized_image=True, plot_loss=True, plot_representation_error=True, imshow_zoom=None, vrange=(0, 1), fig=None, p...
r"""Make a plot showing synthesis status. We create several subplots to analyze this. By default, we create three subplots on a new figure: the first one contains the synthesized image, the second contains the loss, and the third contains the representation error. There are sev...
r"""Make a plot showing synthesis status.
def plot_synthesis_status(self, batch_idx=0, channel_idx=None, iteration=None, figsize=None, ylim=None, plot_synthesized_image=True, plot_loss=True, plot_representation_error=True, imshow_zoom=None, v...
[ "def", "plot_synthesis_status", "(", "self", ",", "batch_idx", "=", "0", ",", "channel_idx", "=", "None", ",", "iteration", "=", "None", ",", "figsize", "=", "None", ",", "ylim", "=", "None", ",", "plot_synthesized_image", "=", "True", ",", "plot_loss", "=...
[ 1774, 4 ]
[ 1970, 18 ]
python
en
['en', 'en', 'en']
True
regression
(self, local, clickhouse_binary_path, stress=None, parallel=None)
ClickHouse regression.
ClickHouse regression.
def regression(self, local, clickhouse_binary_path, stress=None, parallel=None): """ClickHouse regression. """ top().terminating = False args = {"local": local, "clickhouse_binary_path": clickhouse_binary_path, "stress": stress, "parallel": parallel} self.context.stress = stress self.context.pa...
[ "def", "regression", "(", "self", ",", "local", ",", "clickhouse_binary_path", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "top", "(", ")", ".", "terminating", "=", "False", "args", "=", "{", "\"local\"", ":", "local", ",", "\"c...
[ 12, 0 ]
[ 34, 23 ]
python
en
['en', 'ca', 'en']
False
convert_output
(s)
Convert expected output to TSV format.
Convert expected output to TSV format.
def convert_output(s): """Convert expected output to TSV format. """ return '\n'.join([l.strip() for i, l in enumerate(re.sub('\s+\|\s+', '\t', s).strip().splitlines()) if i != 1])
[ "def", "convert_output", "(", "s", ")", ":", "return", "'\\n'", ".", "join", "(", "[", "l", ".", "strip", "(", ")", "for", "i", ",", "l", "in", "enumerate", "(", "re", ".", "sub", "(", "'\\s+\\|\\s+'", ",", "'\\t'", ",", "s", ")", ".", "strip", ...
[ 44, 0 ]
[ 47, 115 ]
python
en
['en', 'en', 'en']
True
execute_query
(sql, expected=None, exitcode=None, message=None, format="TabSeparatedWithNames")
Execute SQL query and compare the output to the snapshot.
Execute SQL query and compare the output to the snapshot.
def execute_query(sql, expected=None, exitcode=None, message=None, format="TabSeparatedWithNames"): """Execute SQL query and compare the output to the snapshot. """ name = basename(current().name) with When("I execute query", description=sql): r = current().context.node.query(sql + " FORMAT " +...
[ "def", "execute_query", "(", "sql", ",", "expected", "=", "None", ",", "exitcode", "=", "None", ",", "message", "=", "None", ",", "format", "=", "\"TabSeparatedWithNames\"", ")", ":", "name", "=", "basename", "(", "current", "(", ")", ".", "name", ")", ...
[ 49, 0 ]
[ 64, 115 ]
python
en
['en', 'en', 'en']
True
t1_table
(self, name="t1", distributed=False)
Create t1 table.
Create t1 table.
def t1_table(self, name="t1", distributed=False): """Create t1 table. """ table = None data = [ "(1, 1)", "(1, 2)", "(2, 2)" ] if not distributed: with By("creating table"): sql = """ CREATE TABLE {name} ( f1 Int8, ...
[ "def", "t1_table", "(", "self", ",", "name", "=", "\"t1\"", ",", "distributed", "=", "False", ")", ":", "table", "=", "None", "data", "=", "[", "\"(1, 1)\"", ",", "\"(1, 2)\"", ",", "\"(2, 2)\"", "]", "if", "not", "distributed", ":", "with", "By", "(",...
[ 67, 0 ]
[ 110, 16 ]
python
en
['en', 'en', 'en']
True
datetimes_table
(self, name="datetimes", distributed=False)
Create datetimes table.
Create datetimes table.
def datetimes_table(self, name="datetimes", distributed=False): """Create datetimes table. """ table = None data = [ "(1, '2000-10-19 10:23:54', '2000-10-19 10:23:54')", "(2, '2001-10-19 10:23:54', '2001-10-19 10:23:54')", "(3, '2001-10-19 10:23:54', '2001-10-19 10:23:54')", ...
[ "def", "datetimes_table", "(", "self", ",", "name", "=", "\"datetimes\"", ",", "distributed", "=", "False", ")", ":", "table", "=", "None", "data", "=", "[", "\"(1, '2000-10-19 10:23:54', '2000-10-19 10:23:54')\"", ",", "\"(2, '2001-10-19 10:23:54', '2001-10-19 10:23:54')...
[ 113, 0 ]
[ 165, 16 ]
python
en
['fr', 'ro', 'en']
False
numerics_table
(self, name="numerics", distributed=False)
Create numerics tables.
Create numerics tables.
def numerics_table(self, name="numerics", distributed=False): """Create numerics tables. """ table = None data = [ "(0, '-infinity', '-infinity', toDecimal64(-1000,15))", "(1, -3, -3, -3)", "(2, -1, -1, -1)", "(3, 0, 0, 0)", "(4, 1.1, 1.1, 1.1)", "(5, 1.1...
[ "def", "numerics_table", "(", "self", ",", "name", "=", "\"numerics\"", ",", "distributed", "=", "False", ")", ":", "table", "=", "None", "data", "=", "[", "\"(0, '-infinity', '-infinity', toDecimal64(-1000,15))\"", ",", "\"(1, -3, -3, -3)\"", ",", "\"(2, -1, -1, -1)\...
[ 168, 0 ]
[ 223, 16 ]
python
en
['en', 'et', 'en']
True
tenk1_table
(self, name="tenk1", distributed=False)
Create tenk1 table.
Create tenk1 table.
def tenk1_table(self, name="tenk1", distributed=False): """Create tenk1 table. """ table = None if not distributed: with By("creating a table"): sql = """ CREATE TABLE {name} ( unique1 Int32, unique2 Int32, ...
[ "def", "tenk1_table", "(", "self", ",", "name", "=", "\"tenk1\"", ",", "distributed", "=", "False", ")", ":", "table", "=", "None", "if", "not", "distributed", ":", "with", "By", "(", "\"creating a table\"", ")", ":", "sql", "=", "\"\"\"\n CREATE ...
[ 226, 0 ]
[ 303, 16 ]
python
en
['en', 'en', 'en']
True
empsalary_table
(self, name="empsalary", distributed=False)
Create employee salary reference table.
Create employee salary reference table.
def empsalary_table(self, name="empsalary", distributed=False): """Create employee salary reference table. """ table = None data = [ "('develop', 10, 5200, '2007-08-01')", "('sales', 1, 5000, '2006-10-01')", "('personnel', 5, 3500, '2007-12-10')", "('sales', 4, 4800, '20...
[ "def", "empsalary_table", "(", "self", ",", "name", "=", "\"empsalary\"", ",", "distributed", "=", "False", ")", ":", "table", "=", "None", "data", "=", "[", "\"('develop', 10, 5200, '2007-08-01')\"", ",", "\"('sales', 1, 5000, '2006-10-01')\"", ",", "\"('personnel', ...
[ 306, 0 ]
[ 367, 16 ]
python
en
['en', 'en', 'en']
True
create_table
(self, name, statement, on_cluster=False)
Create table.
Create table.
def create_table(self, name, statement, on_cluster=False): """Create table. """ node = current().context.node try: with Given(f"I have a {name} table"): node.query(statement.format(name=name)) yield name finally: with Finally("I drop the table"): if on...
[ "def", "create_table", "(", "self", ",", "name", ",", "statement", ",", "on_cluster", "=", "False", ")", ":", "node", "=", "current", "(", ")", ".", "context", ".", "node", "try", ":", "with", "Given", "(", "f\"I have a {name} table\"", ")", ":", "node",...
[ 370, 0 ]
[ 383, 58 ]
python
en
['en', 'ga', 'en']
False
allow_experimental_window_functions
(self)
Set allow_experimental_window_functions = 1
Set allow_experimental_window_functions = 1
def allow_experimental_window_functions(self): """Set allow_experimental_window_functions = 1 """ setting = ("allow_experimental_window_functions", 1) default_query_settings = None try: with By("adding allow_experimental_window_functions to the default query settings"): default_...
[ "def", "allow_experimental_window_functions", "(", "self", ")", ":", "setting", "=", "(", "\"allow_experimental_window_functions\"", ",", "1", ")", "default_query_settings", "=", "None", "try", ":", "with", "By", "(", "\"adding allow_experimental_window_functions to the def...
[ 386, 0 ]
[ 403, 24 ]
python
en
['en', 'en', 'en']
True
check_dir_exists
(output_dir)
Returns ``True`` if ``output_dir`` exists, otherwise returns ``False``.
Returns ``True`` if ``output_dir`` exists, otherwise returns ``False``.
def check_dir_exists(output_dir): """ Returns ``True`` if ``output_dir`` exists, otherwise returns ``False``. """ if not os.path.isdir(output_dir): _logger.error('"{}" is not an existing directory'.format(output_dir)) return False return True
[ "def", "check_dir_exists", "(", "output_dir", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "output_dir", ")", ":", "_logger", ".", "error", "(", "'\"{}\" is not an existing directory'", ".", "format", "(", "output_dir", ")", ")", "return", "F...
[ 24, 0 ]
[ 32, 15 ]
python
en
['en', 'error', 'th']
False
sorted_headers_by_component
(l)
Take a list of header files and sort them by the path after ``src/``. E.g. for ``src/ast/fpa/fpa2bv_converter.h`` the sorting key is ``ast/fpa/fpa2bv_converter.h``. The sort is done this way because for the CMake build there are two directories for every component (e.g. ``<src_dir>...
Take a list of header files and sort them by the path after ``src/``. E.g. for ``src/ast/fpa/fpa2bv_converter.h`` the sorting key is ``ast/fpa/fpa2bv_converter.h``.
def sorted_headers_by_component(l): """ Take a list of header files and sort them by the path after ``src/``. E.g. for ``src/ast/fpa/fpa2bv_converter.h`` the sorting key is ``ast/fpa/fpa2bv_converter.h``. The sort is done this way because for the CMake build there are two directories ...
[ "def", "sorted_headers_by_component", "(", "l", ")", ":", "assert", "isinstance", "(", "l", ",", "list", ")", "def", "get_key", "(", "path", ")", ":", "_logger", ".", "debug", "(", "\"get_key({})\"", ".", "format", "(", "path", ")", ")", "path_components",...
[ 42, 0 ]
[ 75, 25 ]
python
en
['en', 'error', 'th']
False
mk_z3consts_py_internal
(api_files, output_dir)
Generate ``z3consts.py`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory Returns the path to the generated file.
Generate ``z3consts.py`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory
def mk_z3consts_py_internal(api_files, output_dir): """ Generate ``z3consts.py`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory Returns the path to the generated file. """ assert os.path.isdir(output_dir) as...
[ "def", "mk_z3consts_py_internal", "(", "api_files", ",", "output_dir", ")", ":", "assert", "os", ".", "path", ".", "isdir", "(", "output_dir", ")", "assert", "isinstance", "(", "api_files", ",", "list", ")", "blank_pat", "=", "re", ".", "compile", "(", "\"...
[ 83, 0 ]
[ 164, 31 ]
python
en
['en', 'error', 'th']
False
mk_z3consts_dotnet_internal
(api_files, output_dir)
Generate ``Enumerations.cs`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory Returns the path to the generated file.
Generate ``Enumerations.cs`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory
def mk_z3consts_dotnet_internal(api_files, output_dir): """ Generate ``Enumerations.cs`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory Returns the path to the generated file. """ assert os.path.isdir(output_dir...
[ "def", "mk_z3consts_dotnet_internal", "(", "api_files", ",", "output_dir", ")", ":", "assert", "os", ".", "path", ".", "isdir", "(", "output_dir", ")", "assert", "isinstance", "(", "api_files", ",", "list", ")", "blank_pat", "=", "re", ".", "compile", "(", ...
[ 166, 0 ]
[ 256, 31 ]
python
en
['en', 'error', 'th']
False
mk_z3consts_java_internal
(api_files, package_name, output_dir)
Generate "com.microsoft.z3.enumerations" package from the list of API header files in ``api_files`` and write the package directory into the ``output_dir`` directory Returns a list of the generated java source files.
Generate "com.microsoft.z3.enumerations" package from the list of API header files in ``api_files`` and write the package directory into the ``output_dir`` directory
def mk_z3consts_java_internal(api_files, package_name, output_dir): """ Generate "com.microsoft.z3.enumerations" package from the list of API header files in ``api_files`` and write the package directory into the ``output_dir`` directory Returns a list of the generated java source f...
[ "def", "mk_z3consts_java_internal", "(", "api_files", ",", "package_name", ",", "output_dir", ")", ":", "blank_pat", "=", "re", ".", "compile", "(", "\"^ *$\"", ")", "comment_pat", "=", "re", ".", "compile", "(", "\"^ *//.*$\"", ")", "typedef_pat", "=", "re", ...
[ 259, 0 ]
[ 377, 38 ]
python
en
['en', 'error', 'th']
False
mk_z3consts_ml_internal
(api_files, output_dir)
Generate ``z3enums.ml`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory Returns the path to the generated file.
Generate ``z3enums.ml`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory
def mk_z3consts_ml_internal(api_files, output_dir): """ Generate ``z3enums.ml`` from the list of API header files in ``api_files`` and write the output file into the ``output_dir`` directory Returns the path to the generated file. """ assert os.path.isdir(output_dir) ass...
[ "def", "mk_z3consts_ml_internal", "(", "api_files", ",", "output_dir", ")", ":", "assert", "os", ".", "path", ".", "isdir", "(", "output_dir", ")", "assert", "isinstance", "(", "api_files", ",", "list", ")", "blank_pat", "=", "re", ".", "compile", "(", "\"...
[ 380, 0 ]
[ 479, 31 ]
python
en
['en', 'error', 'th']
False
mk_def_file_internal
(defname, dll_name, export_header_files)
Writes to a module definition file to a file named ``defname``. ``dll_name`` is the name of the dll (without the ``.dll`` suffix). ``export_header_file`` is a list of header files to scan for symbols to include in the module definition file.
Writes to a module definition file to a file named ``defname``.
def mk_def_file_internal(defname, dll_name, export_header_files): """ Writes to a module definition file to a file named ``defname``. ``dll_name`` is the name of the dll (without the ``.dll`` suffix). ``export_header_file`` is a list of header files to scan for symbols to include in the mod...
[ "def", "mk_def_file_internal", "(", "defname", ",", "dll_name", ",", "export_header_files", ")", ":", "assert", "isinstance", "(", "export_header_files", ",", "list", ")", "pat1", "=", "re", ".", "compile", "(", "\".*Z3_API.*\"", ")", "fout", "=", "open", "(",...
[ 558, 0 ]
[ 585, 16 ]
python
en
['en', 'error', 'th']
False
mk_gparams_register_modules_internal
(h_files_full_path, path)
Generate a ``gparams_register_modules.cpp`` file in the directory ``path``. Returns the path to the generated file. This file implements the procedure ``` void gparams_register_modules() ``` This procedure is invoked by gparams::init()
Generate a ``gparams_register_modules.cpp`` file in the directory ``path``. Returns the path to the generated file.
def mk_gparams_register_modules_internal(h_files_full_path, path): """ Generate a ``gparams_register_modules.cpp`` file in the directory ``path``. Returns the path to the generated file. This file implements the procedure ``` void gparams_register_modules() ``` ...
[ "def", "mk_gparams_register_modules_internal", "(", "h_files_full_path", ",", "path", ")", ":", "assert", "isinstance", "(", "h_files_full_path", ",", "list", ")", "assert", "check_dir_exists", "(", "path", ")", "cmds", "=", "[", "]", "mod_cmds", "=", "[", "]", ...
[ 598, 0 ]
[ 651, 19 ]
python
en
['en', 'error', 'th']
False
mk_install_tactic_cpp_internal
(h_files_full_path, path)
Generate a ``install_tactics.cpp`` file in the directory ``path``. Returns the path the generated file. This file implements the procedure ``` void install_tactics(tactic_manager & ctx) ``` It installs all tactics declared in the given header files ``h...
Generate a ``install_tactics.cpp`` file in the directory ``path``. Returns the path the generated file.
def mk_install_tactic_cpp_internal(h_files_full_path, path): """ Generate a ``install_tactics.cpp`` file in the directory ``path``. Returns the path the generated file. This file implements the procedure ``` void install_tactics(tactic_manager & ctx) ``` It...
[ "def", "mk_install_tactic_cpp_internal", "(", "h_files_full_path", ",", "path", ")", ":", "ADD_TACTIC_DATA", "=", "[", "]", "ADD_PROBE_DATA", "=", "[", "]", "def", "ADD_TACTIC", "(", "name", ",", "descr", ",", "cmd", ")", ":", "ADD_TACTIC_DATA", ".", "append",...
[ 657, 0 ]
[ 734, 19 ]
python
en
['en', 'error', 'th']
False
mk_mem_initializer_cpp_internal
(h_files_full_path, path)
Generate a ``mem_initializer.cpp`` file in the directory ``path``. Returns the path to the generated file. This file implements the procedures ``` void mem_initialize() void mem_finalize() ``` These procedures are invoked by the Z3 memory_manager
Generate a ``mem_initializer.cpp`` file in the directory ``path``. Returns the path to the generated file.
def mk_mem_initializer_cpp_internal(h_files_full_path, path): """ Generate a ``mem_initializer.cpp`` file in the directory ``path``. Returns the path to the generated file. This file implements the procedures ``` void mem_initialize() void mem_finalize() ```...
[ "def", "mk_mem_initializer_cpp_internal", "(", "h_files_full_path", ",", "path", ")", ":", "assert", "isinstance", "(", "h_files_full_path", ",", "list", ")", "assert", "check_dir_exists", "(", "path", ")", "initializer_cmds", "=", "[", "]", "finalizer_cmds", "=", ...
[ 740, 0 ]
[ 799, 19 ]
python
en
['en', 'error', 'th']
False
mk_pat_db_internal
(inputFilePath, outputFilePath)
Generate ``g_pattern_database[]`` declaration header file.
Generate ``g_pattern_database[]`` declaration header file.
def mk_pat_db_internal(inputFilePath, outputFilePath): """ Generate ``g_pattern_database[]`` declaration header file. """ with open(inputFilePath, 'r') as fin: with open(outputFilePath, 'w') as fout: fout.write('static char const g_pattern_database[] =\n') for line in...
[ "def", "mk_pat_db_internal", "(", "inputFilePath", ",", "outputFilePath", ")", ":", "with", "open", "(", "inputFilePath", ",", "'r'", ")", "as", "fin", ":", "with", "open", "(", "outputFilePath", ",", "'w'", ")", "as", "fout", ":", "fout", ".", "write", ...
[ 805, 0 ]
[ 814, 29 ]
python
en
['en', 'error', 'th']
False
mk_hpp_from_pyg
(pyg_file, output_dir)
Generates the corresponding header file for the input pyg file at the path ``pyg_file``. The file is emitted into the directory ``output_dir``. Returns the path to the generated file
Generates the corresponding header file for the input pyg file at the path ``pyg_file``. The file is emitted into the directory ``output_dir``.
def mk_hpp_from_pyg(pyg_file, output_dir): """ Generates the corresponding header file for the input pyg file at the path ``pyg_file``. The file is emitted into the directory ``output_dir``. Returns the path to the generated file """ CURRENT_PYG_HPP_DEST_DIR = output_dir ...
[ "def", "mk_hpp_from_pyg", "(", "pyg_file", ",", "output_dir", ")", ":", "CURRENT_PYG_HPP_DEST_DIR", "=", "output_dir", "# Note OUTPUT_HPP_FILE cannot be a string as we need a mutable variable", "# for the nested function to modify", "OUTPUT_HPP_FILE", "=", "[", "]", "# The function...
[ 865, 0 ]
[ 943, 29 ]
python
en
['en', 'error', 'th']
False
DockerImage.build
(self)
build docker image from target
build docker image from target
def build(self) -> None: ''' build docker image from target ''' logger.info(f'Building docker image for target: {self._target.info}') logger.info(f"Docker image: {self._docker_image_uri}") # Pull existing docker image try: docker_command = ['pull', self._dock...
[ "def", "build", "(", "self", ")", "->", "None", ":", "logger", ".", "info", "(", "f'Building docker image for target: {self._target.info}'", ")", "logger", ".", "info", "(", "f\"Docker image: {self._docker_image_uri}\"", ")", "# Pull existing docker image", "try", ":", ...
[ 68, 4 ]
[ 91, 50 ]
python
en
['en', 'da', 'en']
True
DockerImage.test
(self)
test docker image for target
test docker image for target
def test(self) -> None: ''' test docker image for target ''' logger.info(f'Testing docker image for target: {self._target.info}') logger.info(f"Docker image: {self._docker_image_uri}") # Run tests for docker image tests_volume_path = f"{self._target.path.absolute().joinp...
[ "def", "test", "(", "self", ")", "->", "None", ":", "logger", ".", "info", "(", "f'Testing docker image for target: {self._target.info}'", ")", "logger", ".", "info", "(", "f\"Docker image: {self._docker_image_uri}\"", ")", "# Run tests for docker image", "tests_volume_path...
[ 93, 4 ]
[ 110, 49 ]
python
en
['en', 'da', 'en']
True
DockerImage.remove
(self)
remove docker image for target
remove docker image for target
def remove(self) -> None: ''' remove docker image for target ''' logger.info(f'Removing docker image for target: {self._target.info}') logger.info(f"Docker image: {self._docker_image_uri}") try: self._run_command(['image', 'rm', self._docker_image_uri]) excep...
[ "def", "remove", "(", "self", ")", "->", "None", ":", "logger", ".", "info", "(", "f'Removing docker image for target: {self._target.info}'", ")", "logger", ".", "info", "(", "f\"Docker image: {self._docker_image_uri}\"", ")", "try", ":", "self", ".", "_run_command", ...
[ 112, 4 ]
[ 122, 47 ]
python
en
['en', 'da', 'en']
True
DockerImage.publish
(self)
Publish docker image for target
Publish docker image for target
def publish(self) -> None: ''' Publish docker image for target ''' logger.info(f'Removing docker image for target: {self._target.info} ' + f'to GitLab Registry: {self._settings.get("registry", None)}') logger.info(f"Docker image: {self._docker_image_uri}") #...
[ "def", "publish", "(", "self", ")", "->", "None", ":", "logger", ".", "info", "(", "f'Removing docker image for target: {self._target.info} '", "+", "f'to GitLab Registry: {self._settings.get(\"registry\", None)}'", ")", "logger", ".", "info", "(", "f\"Docker image: {self._do...
[ 124, 4 ]
[ 136, 48 ]
python
en
['en', 'da', 'en']
True
maybe_download
(train_data, test_data)
Maybe downloads training data and returns train and test file names.
Maybe downloads training data and returns train and test file names.
def maybe_download(train_data, test_data): """Maybe downloads training data and returns train and test file names.""" if train_data: f = open(train_data, "r") print(f.name) train_file_name = f.name f.close() else: train_file = tempfile.NamedTemporaryFile(delete=False) urllib.request.urlret...
[ "def", "maybe_download", "(", "train_data", ",", "test_data", ")", ":", "if", "train_data", ":", "f", "=", "open", "(", "train_data", ",", "\"r\"", ")", "print", "(", "f", ".", "name", ")", "train_file_name", "=", "f", ".", "name", "f", ".", "close", ...
[ 111, 0 ]
[ 141, 40 ]
python
en
['en', 'en', 'en']
True
build_estimator
(model_dir, model_type)
Build an estimator.
Build an estimator.
def build_estimator(model_dir, model_type): """Build an estimator.""" if model_type == "wide": m = tf.estimator.LinearClassifier( model_dir=model_dir, feature_columns=feature_columns) elif model_type == "deep": m = tf.estimator.DNNClassifier( model_dir=model_dir, feature_columns=fe...
[ "def", "build_estimator", "(", "model_dir", ",", "model_type", ")", ":", "if", "model_type", "==", "\"wide\"", ":", "m", "=", "tf", ".", "estimator", ".", "LinearClassifier", "(", "model_dir", "=", "model_dir", ",", "feature_columns", "=", "feature_columns", "...
[ 144, 0 ]
[ 164, 10 ]
python
en
['en', 'ro', 'en']
True
input_fn
(data_file, num_epochs, shuffle)
Input builder function.
Input builder function.
def input_fn(data_file, num_epochs, shuffle): """Input builder function.""" df_data = pd.read_csv( tf.gfile.Open(data_file), names=CSV_COLUMNS, skipinitialspace=True, engine="python", skiprows=1) labels = df_data["result"] return tf.estimator.inputs.pandas_input_fn( x=df_data...
[ "def", "input_fn", "(", "data_file", ",", "num_epochs", ",", "shuffle", ")", ":", "df_data", "=", "pd", ".", "read_csv", "(", "tf", ".", "gfile", ".", "Open", "(", "data_file", ")", ",", "names", "=", "CSV_COLUMNS", ",", "skipinitialspace", "=", "True", ...
[ 167, 0 ]
[ 182, 20 ]
python
en
['en', 'nl', 'en']
True
train_and_eval
(model_dir, model_type, train_steps, train_data, test_data, train_new, eval_new, user_input)
Train and evaluate the model.
Train and evaluate the model.
def train_and_eval(model_dir, model_type, train_steps, train_data, test_data, train_new, eval_new, user_input): """Train and evaluate the model.""" #print(train_new, eval_new) model_dir = tempfile.mkdtemp() if not model_dir else model_dir m = build_estimator(model_dir, model_type) # set num_epo...
[ "def", "train_and_eval", "(", "model_dir", ",", "model_type", ",", "train_steps", ",", "train_data", ",", "test_data", ",", "train_new", ",", "eval_new", ",", "user_input", ")", ":", "#print(train_new, eval_new)", "model_dir", "=", "tempfile", ".", "mkdtemp", "(",...
[ 185, 0 ]
[ 227, 45 ]
python
en
['en', 'en', 'en']
True
main
()
Main function. Parses cmd line args and runs in the specified mode.
Main function. Parses cmd line args and runs in the specified mode.
def main(): """Main function. Parses cmd line args and runs in the specified mode. """ #******************************# #* *# #* Check command options *# #* *# #******************************# if sys.version_info[0] < 3: ...
[ "def", "main", "(", ")", ":", "#******************************#", "#* *#", "#* Check command options *#", "#* *#", "#******************************#", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "s...
[ 184, 0 ]
[ 598, 32 ]
python
en
['en', 'en', 'en']
True
create_without_create_table_privilege
(self, node=None)
Check that user is unable to create a table without CREATE TABLE privilege.
Check that user is unable to create a table without CREATE TABLE privilege.
def create_without_create_table_privilege(self, node=None): """Check that user is unable to create a table without CREATE TABLE privilege. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") if node is None: ...
[ "def", "create_without_create_table_privilege", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name",...
[ 11, 0 ]
[ 38, 64 ]
python
en
['en', 'en', 'en']
True
create_with_create_table_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table with CREATE TABLE privilege, either granted directly or through a role.
Check that user is able to create a table with CREATE TABLE privilege, either granted directly or through a role.
def create_with_create_table_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table with CREATE TABLE privilege, either granted directly or through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node ...
[ "def", "create_with_create_table_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", ...
[ 41, 0 ]
[ 61, 127 ]
python
en
['en', 'en', 'en']
True
create_with_create_table_privilege
(self, grant_target_name, user_name, node=None)
Check that user is able to create a table with the granted privileges.
Check that user is able to create a table with the granted privileges.
def create_with_create_table_privilege(self, grant_target_name, user_name, node=None): """Check that user is able to create a table with the granted privileges. """ table_name = f"table_{getuid()}" if node is None: node = self.context.node try: with Given("I don't have a table"): ...
[ "def", "create_with_create_table_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "no...
[ 64, 0 ]
[ 83, 60 ]
python
en
['en', 'en', 'en']
True
create_with_all_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table with ALL privilege, either granted directly or through a role.
Check that user is able to create a table with ALL privilege, either granted directly or through a role.
def create_with_all_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table with ALL privilege, either granted directly or through a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.context.nod...
[ "def", "create_with_all_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context"...
[ 89, 0 ]
[ 109, 118 ]
python
en
['en', 'en', 'en']
True
create_with_all_privilege
(self, grant_target_name, user_name, node=None)
Check that user is able to create a table with the granted privileges.
Check that user is able to create a table with the granted privileges.
def create_with_all_privilege(self, grant_target_name, user_name, node=None): """Check that user is able to create a table with the granted privileges. """ table_name = f"table_{getuid()}" if node is None: node = self.context.node try: with Given("I don't have a table"): ...
[ "def", "create_with_all_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "t...
[ 112, 0 ]
[ 131, 60 ]
python
en
['en', 'en', 'en']
True
create_with_revoked_create_table_privilege_revoked_directly_or_from_role
(self, node=None)
Check that user is unable to create table after the CREATE TABLE privilege is revoked, either directly or from a role.
Check that user is unable to create table after the CREATE TABLE privilege is revoked, either directly or from a role.
def create_with_revoked_create_table_privilege_revoked_directly_or_from_role(self, node=None): """Check that user is unable to create table after the CREATE TABLE privilege is revoked, either directly or from a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None:...
[ "def", "create_with_revoked_create_table_privilege_revoked_directly_or_from_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ...
[ 134, 0 ]
[ 154, 124 ]
python
en
['en', 'en', 'en']
True
create_with_revoked_create_table_privilege
(self, grant_target_name, user_name, node=None)
Revoke CREATE TABLE privilege and check the user is unable to create a table.
Revoke CREATE TABLE privilege and check the user is unable to create a table.
def create_with_revoked_create_table_privilege(self, grant_target_name, user_name, node=None): """Revoke CREATE TABLE privilege and check the user is unable to create a table. """ table_name = f"table_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") if node is None:...
[ "def", "create_with_revoked_create_table_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", ...
[ 157, 0 ]
[ 182, 60 ]
python
en
['en', 'en', 'en']
True
create_with_all_privileges_revoked_directly_or_from_role
(self, node=None)
Check that user is unable to create table after ALL privileges are revoked, either directly or from a role.
Check that user is unable to create table after ALL privileges are revoked, either directly or from a role.
def create_with_all_privileges_revoked_directly_or_from_role(self, node=None): """Check that user is unable to create table after ALL privileges are revoked, either directly or from a role. """ user_name = f"user_{getuid()}" role_name = f"role_{getuid()}" if node is None: node = self.contex...
[ "def", "create_with_all_privileges_revoked_directly_or_from_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "contex...
[ 185, 0 ]
[ 205, 115 ]
python
en
['en', 'en', 'en']
True
create_with_revoked_all_privilege
(self, grant_target_name, user_name, node=None)
Revoke ALL privilege and check the user is unable to create a table.
Revoke ALL privilege and check the user is unable to create a table.
def create_with_revoked_all_privilege(self, grant_target_name, user_name, node=None): """Revoke ALL privilege and check the user is unable to create a table. """ table_name = f"table_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") if node is None: node = se...
[ "def", "create_with_revoked_all_privilege", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name",...
[ 208, 0 ]
[ 233, 60 ]
python
en
['en', 'en', 'en']
True
create_without_source_table_privilege
(self, node=None)
Check that user is unable to create a table without select privilege on the source table.
Check that user is unable to create a table without select privilege on the source table.
def create_without_source_table_privilege(self, node=None): """Check that user is unable to create a table without select privilege on the source table. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" source_table_name = f"source_table_{getuid()}" exitcode, message = erro...
[ "def", "create_without_source_table_privilege", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "source_table_name", "=", "f\"source_table_{getuid()}\"", "exitcode", ",", "message", "="...
[ 236, 0 ]
[ 264, 68 ]
python
en
['en', 'en', 'en']
True
create_without_insert_privilege
(self, node=None)
Check that user is unable to create a table without insert privilege on that table.
Check that user is unable to create a table without insert privilege on that table.
def create_without_insert_privilege(self, node=None): """Check that user is unable to create a table without insert privilege on that table. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" source_table_name = f"source_table_{getuid()}" exitcode, message = errors.not_enoug...
[ "def", "create_without_insert_privilege", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "source_table_name", "=", "f\"source_table_{getuid()}\"", "exitcode", ",", "message", "=", "e...
[ 267, 0 ]
[ 294, 68 ]
python
en
['en', 'en', 'en']
True
create_with_source_table_privilege_granted_directly_or_via_role
(self, node=None)
Check that a user is able to create a table if and only if the user has create table privilege and select privilege on the source table, either granted directly or through a role.
Check that a user is able to create a table if and only if the user has create table privilege and select privilege on the source table, either granted directly or through a role.
def create_with_source_table_privilege_granted_directly_or_via_role(self, node=None): """Check that a user is able to create a table if and only if the user has create table privilege and select privilege on the source table, either granted directly or through a role. """ user_name = f"user_{getuid()}" ...
[ "def", "create_with_source_table_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", ...
[ 297, 0 ]
[ 318, 138 ]
python
en
['en', 'en', 'en']
True
create_with_source_table_privilege
(self, user_name, grant_target_name, node=None)
Check that user is unable to create a table without SELECT privilege on the source table.
Check that user is unable to create a table without SELECT privilege on the source table.
def create_with_source_table_privilege(self, user_name, grant_target_name, node=None): """Check that user is unable to create a table without SELECT privilege on the source table. """ table_name = f"table_{getuid()}" source_table_name = f"source_table_{getuid()}" if node is None: node = sel...
[ "def", "create_with_source_table_privilege", "(", "self", ",", "user_name", ",", "grant_target_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "source_table_name", "=", "f\"source_table_{getuid()}\"", "if", "node", "is", "None", ...
[ 321, 0 ]
[ 348, 64 ]
python
en
['en', 'en', 'en']
True
create_with_subquery_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table where the stored query has two subqueries if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
Check that user is able to create a table where the stored query has two subqueries if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
def create_with_subquery_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table where the stored query has two subqueries if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role. """ user_name = f"use...
[ "def", "create_with_subquery_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "con...
[ 351, 0 ]
[ 373, 124 ]
python
en
['en', 'en', 'en']
True
create_with_subquery
(self, user_name, grant_target_name, node=None)
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
def create_with_subquery(self, user_name, grant_target_name, node=None): """Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges. """ table_name = f"table_{getuid()}" table0_name = f"table0_{getuid()}" table1_nam...
[ "def", "create_with_subquery", "(", "self", ",", "user_name", ",", "grant_target_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "table2_na...
[ 376, 0 ]
[ 421, 64 ]
python
en
['en', 'en', 'en']
True
create_with_join_query_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table where the stored query includes a `JOIN` statement if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
Check that user is able to create a table where the stored query includes a `JOIN` statement if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
def create_with_join_query_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table where the stored query includes a `JOIN` statement if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role. """ user_n...
[ "def", "create_with_join_query_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "c...
[ 424, 0 ]
[ 446, 126 ]
python
en
['en', 'en', 'en']
True
create_with_join_query
(self, grant_target_name, user_name, node=None)
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
def create_with_join_query(self, grant_target_name, user_name, node=None): """Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges. """ table_name = f"table_{getuid()}" table0_name = f"table0_{getuid()}" table1_n...
[ "def", "create_with_join_query", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "exitcod...
[ 449, 0 ]
[ 492, 64 ]
python
en
['en', 'en', 'en']
True
create_with_union_query_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table where the stored query includes a `UNION ALL` statement if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
Check that user is able to create a table where the stored query includes a `UNION ALL` statement if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
def create_with_union_query_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table where the stored query includes a `UNION ALL` statement if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role. """ ...
[ "def", "create_with_union_query_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "...
[ 495, 0 ]
[ 517, 127 ]
python
en
['en', 'en', 'en']
True
create_with_union_query
(self, grant_target_name, user_name, node=None)
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
def create_with_union_query(self, grant_target_name, user_name, node=None): """Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges. """ table_name = f"table_{getuid()}" table0_name = f"table0_{getuid()}" table1_...
[ "def", "create_with_union_query", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "exitco...
[ 520, 0 ]
[ 563, 64 ]
python
en
['en', 'en', 'en']
True
create_with_join_union_subquery_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table with a stored query that includes `UNION ALL`, `JOIN` and two subqueries if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
Check that user is able to create a table with a stored query that includes `UNION ALL`, `JOIN` and two subqueries if and only if the user has SELECT privilege on all of the tables, either granted directly or through a role.
def create_with_join_union_subquery_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table with a stored query that includes `UNION ALL`, `JOIN` and two subqueries if and only if the user has SELECT privilege on all of the tables, either granted directly or through...
[ "def", "create_with_join_union_subquery_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ...
[ 566, 0 ]
[ 587, 135 ]
python
en
['en', 'en', 'en']
True
create_with_join_union_subquery
(self, grant_target_name, user_name, node=None)
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
def create_with_join_union_subquery(self, grant_target_name, user_name, node=None): """Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges. """ table_name = f"table_{getuid()}" table0_name = f"table0_{getuid()}" ...
[ "def", "create_with_join_union_subquery", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", ...
[ 590, 0 ]
[ 644, 68 ]
python
en
['en', 'en', 'en']
True
create_with_nested_tables_privilege_granted_directly_or_via_role
(self, node=None)
Check that user is able to create a table with a stored query that includes other tables if and only if they have SELECT privilege on all the tables and the source tables for those tables.
Check that user is able to create a table with a stored query that includes other tables if and only if they have SELECT privilege on all the tables and the source tables for those tables.
def create_with_nested_tables_privilege_granted_directly_or_via_role(self, node=None): """Check that user is able to create a table with a stored query that includes other tables if and only if they have SELECT privilege on all the tables and the source tables for those tables. """ user_name = f"user_{g...
[ "def", "create_with_nested_tables_privilege_granted_directly_or_via_role", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "role_name", "=", "f\"role_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", ...
[ 647, 0 ]
[ 668, 129 ]
python
en
['en', 'en', 'en']
True
create_with_nested_tables
(self, grant_target_name, user_name, node=None)
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges.
def create_with_nested_tables(self, grant_target_name, user_name, node=None): """Grant select and create table privileges and check that user is able to create a table if and only if they have all necessary privileges. """ table_name = f"table_{getuid()}" table0_name = f"table0_{getuid()}" table...
[ "def", "create_with_nested_tables", "(", "self", ",", "grant_target_name", ",", "user_name", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "table0_name", "=", "f\"table0_{getuid()}\"", "table1_name", "=", "f\"table1_{getuid()}\"", "tabl...
[ 671, 0 ]
[ 742, 65 ]
python
en
['en', 'en', 'en']
True
create_as_another_table
(self, node=None)
Check that user is able to create a table as another table with only CREATE TABLE privilege.
Check that user is able to create a table as another table with only CREATE TABLE privilege.
def create_as_another_table(self, node=None): """Check that user is able to create a table as another table with only CREATE TABLE privilege. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" source_table_name = f"source_table_{getuid()}" exitcode, message = errors.not_enough_p...
[ "def", "create_as_another_table", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "source_table_name", "=", "f\"source_table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ...
[ 745, 0 ]
[ 768, 68 ]
python
en
['en', 'en', 'en']
True
create_as_numbers
(self, node=None)
Check that user is able to create a table as numbers table function.
Check that user is able to create a table as numbers table function.
def create_as_numbers(self, node=None): """Check that user is able to create a table as numbers table function. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") if node is None: node = self.context....
[ "def", "create_as_numbers", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "f\"{user_...
[ 771, 0 ]
[ 795, 64 ]
python
en
['en', 'en', 'en']
True
create_as_merge
(self, node=None)
Check that user is able to create a table as merge table function.
Check that user is able to create a table as merge table function.
def create_as_merge(self, node=None): """Check that user is able to create a table as merge table function. """ user_name = f"user_{getuid()}" table_name = f"table_{getuid()}" source_table_name = f"source_table_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") ...
[ "def", "create_as_merge", "(", "self", ",", "node", "=", "None", ")", ":", "user_name", "=", "f\"user_{getuid()}\"", "table_name", "=", "f\"table_{getuid()}\"", "source_table_name", "=", "f\"source_table_{getuid()}\"", "exitcode", ",", "message", "=", "errors", ".", ...
[ 798, 0 ]
[ 824, 68 ]
python
en
['en', 'en', 'en']
True
feature
(self, stress=None, parallel=None, node="clickhouse1")
Check the RBAC functionality of CREATE TABLE.
Check the RBAC functionality of CREATE TABLE.
def feature(self, stress=None, parallel=None, node="clickhouse1"): """Check the RBAC functionality of CREATE TABLE. """ 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 = parallel ...
[ "def", "feature", "(", "self", ",", "stress", "=", "None", ",", "parallel", "=", "None", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 831, 0 ]
[ 847, 23 ]
python
en
['en', 'en', 'en']
True
check_inputs
(in1, in2, flags)
Perform checking on the user provided inputs and diagnose any abnormalities
Perform checking on the user provided inputs and diagnose any abnormalities
def check_inputs(in1, in2, flags): """ Perform checking on the user provided inputs and diagnose any abnormalities """ in1_kind, in1_err = classify_input_file(in1) in2_kind, in2_err = classify_input_file(in2) output_file = find_benchmark_flag('--benchmark_out=', flags) output_type = find_ben...
[ "def", "check_inputs", "(", "in1", ",", "in2", ",", "flags", ")", ":", "in1_kind", ",", "in1_err", "=", "classify_input_file", "(", "in1", ")", "in2_kind", ",", "in2_err", "=", "classify_input_file", "(", "in2", ")", "output_file", "=", "find_benchmark_flag", ...
[ 14, 0 ]
[ 31, 19 ]
python
en
['en', 'error', 'th']
False
train
(config, expe_name, trial_id, beta_default)
Main training script. Defines the cost function and epidemiological model to form the environment model. Parameters ---------- config: str Identifier of the configuration parameters. expe_name: str String to describe your experiment, will be used for the logging directory. tria...
Main training script. Defines the cost function and epidemiological model to form the environment model.
def train(config, expe_name, trial_id, beta_default): """ Main training script. Defines the cost function and epidemiological model to form the environment model. Parameters ---------- config: str Identifier of the configuration parameters. expe_name: str String to describe your...
[ "def", "train", "(", "config", ",", "expe_name", ",", "trial_id", ",", "beta_default", ")", ":", "# Get the configuration", "params", "=", "get_params", "(", "config_id", "=", "config", ",", "expe_name", "=", "expe_name", ")", "params", ".", "update", "(", "...
[ 12, 0 ]
[ 65, 62 ]
python
en
['en', 'error', 'th']
False
JWTAuthenticationBackend.get_token_from_header
(header: str)
Parse JWT token from header value.
Parse JWT token from header value.
def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" try: prefix, token = header.split() except ValueError: raise authentication.AuthenticationError( "Unable to split prefix and token from Authorization header." ...
[ "def", "get_token_from_header", "(", "header", ":", "str", ")", "->", "str", ":", "try", ":", "prefix", ",", "token", "=", "header", ".", "split", "(", ")", "except", "ValueError", ":", "raise", "authentication", ".", "AuthenticationError", "(", "\"Unable to...
[ 15, 4 ]
[ 29, 20 ]
python
en
['en', 'en', 'en']
True
JWTAuthenticationBackend.authenticate
( self, request: Request )
Handles JWT authentication process.
Handles JWT authentication process.
async def authenticate( self, request: Request ) -> t.Optional[tuple[authentication.AuthCredentials, authentication.BaseUser]]: """Handles JWT authentication process.""" if "Authorization" not in request.headers: return None auth = request.headers["Authorization"] ...
[ "async", "def", "authenticate", "(", "self", ",", "request", ":", "Request", ")", "->", "t", ".", "Optional", "[", "tuple", "[", "authentication", ".", "AuthCredentials", ",", "authentication", ".", "BaseUser", "]", "]", ":", "if", "\"Authorization\"", "not"...
[ 31, 4 ]
[ 51, 75 ]
python
de
['de', 'fr', 'en']
False
_get_image_evals
(pair)
Evaluate the results for a given image :param pair: tuple containing list of GroundTruthInstances and DetectionInstances for the given image respectively :return: results dictionary containing total overall spatial quality, total spatial quality on positively assigned detections, total label quality on...
Evaluate the results for a given image :param pair: tuple containing list of GroundTruthInstances and DetectionInstances for the given image respectively :return: results dictionary containing total overall spatial quality, total spatial quality on positively assigned detections, total label quality on...
def _get_image_evals(pair): """ Evaluate the results for a given image :param pair: tuple containing list of GroundTruthInstances and DetectionInstances for the given image respectively :return: results dictionary containing total overall spatial quality, total spatial quality on positively assigned ...
[ "def", "_get_image_evals", "(", "pair", ")", ":", "gt_instances", ",", "det_instances", "=", "pair", "results", "=", "_calc_qual_img", "(", "gt_instances", ",", "det_instances", ")", "return", "results" ]
[ 144, 0 ]
[ 156, 18 ]
python
en
['en', 'error', 'th']
False
_vectorize_img_gts
(gt_instances, img_shape)
Vectorizes the required elements for all GroundTruthInstances as necessary for a given image. These elements are the segmentation mask, background mask, number of foreground pixels, and label for each. :param gt_instances: list of all GroundTruthInstances for a given image :param img_shape: shape of th...
Vectorizes the required elements for all GroundTruthInstances as necessary for a given image. These elements are the segmentation mask, background mask, number of foreground pixels, and label for each. :param gt_instances: list of all GroundTruthInstances for a given image :param img_shape: shape of th...
def _vectorize_img_gts(gt_instances, img_shape): """ Vectorizes the required elements for all GroundTruthInstances as necessary for a given image. These elements are the segmentation mask, background mask, number of foreground pixels, and label for each. :param gt_instances: list of all GroundTruthInsta...
[ "def", "_vectorize_img_gts", "(", "gt_instances", ",", "img_shape", ")", ":", "gt_seg_mat", "=", "np", ".", "stack", "(", "[", "gt_instance", ".", "segmentation_mask", "for", "gt_instance", "in", "gt_instances", "]", ",", "axis", "=", "2", ")", "# h x w x g", ...
[ 159, 0 ]
[ 183, 66 ]
python
en
['en', 'error', 'th']
False
_vectorize_img_dets
(det_instances, img_shape)
Vectorize the required elements for all DetectionInstances as necessary for a given image. These elements are the thresholded detection heatmap, and the detection label list for each. :param det_instances: list of all DetectionInstances for a given image. :param img_shape: shape of the image that the D...
Vectorize the required elements for all DetectionInstances as necessary for a given image. These elements are the thresholded detection heatmap, and the detection label list for each. :param det_instances: list of all DetectionInstances for a given image. :param img_shape: shape of the image that the D...
def _vectorize_img_dets(det_instances, img_shape): """ Vectorize the required elements for all DetectionInstances as necessary for a given image. These elements are the thresholded detection heatmap, and the detection label list for each. :param det_instances: list of all DetectionInstances for a given ...
[ "def", "_vectorize_img_dets", "(", "det_instances", ",", "img_shape", ")", ":", "det_label_prob_mat", "=", "np", ".", "stack", "(", "[", "det_instance", ".", "class_list", "for", "det_instance", "in", "det_instances", "]", ",", "axis", "=", "0", ")", "# d x c"...
[ 186, 0 ]
[ 200, 50 ]
python
en
['en', 'error', 'th']
False
_calc_bg_loss
(bg_seg_mat, det_seg_heatmap_mat)
Calculate the background pixel loss for all detections on all ground truth objects for a given image. :param bg_seg_mat: h x w x g vectorized background masks for each ground truth object in the image. :param det_seg_heatmap_mat: h x w x d vectorized segmented heatmaps for each detection in the image. ...
Calculate the background pixel loss for all detections on all ground truth objects for a given image. :param bg_seg_mat: h x w x g vectorized background masks for each ground truth object in the image. :param det_seg_heatmap_mat: h x w x d vectorized segmented heatmaps for each detection in the image. ...
def _calc_bg_loss(bg_seg_mat, det_seg_heatmap_mat): """ Calculate the background pixel loss for all detections on all ground truth objects for a given image. :param bg_seg_mat: h x w x g vectorized background masks for each ground truth object in the image. :param det_seg_heatmap_mat: h x w x d vectoriz...
[ "def", "_calc_bg_loss", "(", "bg_seg_mat", ",", "det_seg_heatmap_mat", ")", ":", "bg_log_loss_mat", "=", "_safe_log", "(", "1", "-", "det_seg_heatmap_mat", ")", "*", "(", "det_seg_heatmap_mat", ">", "0", ")", "bg_loss_sum", "=", "np", ".", "tensordot", "(", "b...
[ 203, 0 ]
[ 215, 22 ]
python
en
['en', 'error', 'th']
False
_calc_fg_loss
(gt_seg_mat, det_seg_heatmap_mat)
Calculate the foreground pixel loss for all detections on all ground truth objects for a given image. :param gt_seg_mat: h x w x g vectorized segmentation masks for each ground truth object in the image. :param det_seg_heatmap_mat: h x w x d vectorized segmented heatmaps for each detection in the image. ...
Calculate the foreground pixel loss for all detections on all ground truth objects for a given image. :param gt_seg_mat: h x w x g vectorized segmentation masks for each ground truth object in the image. :param det_seg_heatmap_mat: h x w x d vectorized segmented heatmaps for each detection in the image. ...
def _calc_fg_loss(gt_seg_mat, det_seg_heatmap_mat): """ Calculate the foreground pixel loss for all detections on all ground truth objects for a given image. :param gt_seg_mat: h x w x g vectorized segmentation masks for each ground truth object in the image. :param det_seg_heatmap_mat: h x w x d vector...
[ "def", "_calc_fg_loss", "(", "gt_seg_mat", ",", "det_seg_heatmap_mat", ")", ":", "log_heatmap_mat", "=", "_safe_log", "(", "det_seg_heatmap_mat", ")", "fg_loss_sum", "=", "np", ".", "tensordot", "(", "gt_seg_mat", ",", "log_heatmap_mat", ",", "axes", "=", "(", "...
[ 218, 0 ]
[ 227, 22 ]
python
en
['en', 'error', 'th']
False
_calc_spatial_qual
(fg_loss_sum, bg_loss_sum, num_fg_pixels_vec)
Calculate the spatial quality for all detections on all ground truth objects for a given image. :param fg_loss_sum: g x d total foreground loss between each of the g ground truth objects and d detections. :param bg_loss_sum: g x d total background loss between each of the g ground truth objects and d detec...
Calculate the spatial quality for all detections on all ground truth objects for a given image. :param fg_loss_sum: g x d total foreground loss between each of the g ground truth objects and d detections. :param bg_loss_sum: g x d total background loss between each of the g ground truth objects and d detec...
def _calc_spatial_qual(fg_loss_sum, bg_loss_sum, num_fg_pixels_vec): """ Calculate the spatial quality for all detections on all ground truth objects for a given image. :param fg_loss_sum: g x d total foreground loss between each of the g ground truth objects and d detections. :param bg_loss_sum: g x d ...
[ "def", "_calc_spatial_qual", "(", "fg_loss_sum", ",", "bg_loss_sum", ",", "num_fg_pixels_vec", ")", ":", "total_loss", "=", "fg_loss_sum", "+", "bg_loss_sum", "loss_per_gt_pixel", "=", "total_loss", "/", "num_fg_pixels_vec", "spatial_quality", "=", "np", ".", "exp", ...
[ 234, 0 ]
[ 253, 26 ]
python
en
['en', 'error', 'th']
False
_calc_label_qual
(gt_label_vec, det_label_prob_mat)
Calculate the label quality for all detections on all ground truth objects for a given image. :param gt_label_vec: g, numpy array containing the class label as an integer for each object. :param det_label_prob_mat: d x c numpy array of label probability scores across all c classes for each of the d de...
Calculate the label quality for all detections on all ground truth objects for a given image. :param gt_label_vec: g, numpy array containing the class label as an integer for each object. :param det_label_prob_mat: d x c numpy array of label probability scores across all c classes for each of the d de...
def _calc_label_qual(gt_label_vec, det_label_prob_mat): """ Calculate the label quality for all detections on all ground truth objects for a given image. :param gt_label_vec: g, numpy array containing the class label as an integer for each object. :param det_label_prob_mat: d x c numpy array of label p...
[ "def", "_calc_label_qual", "(", "gt_label_vec", ",", "det_label_prob_mat", ")", ":", "label_qual_mat", "=", "det_label_prob_mat", "[", ":", ",", "gt_label_vec", "]", ".", "T", ".", "astype", "(", "np", ".", "float32", ")", "# g x d", "return", "label_qual_mat" ]
[ 256, 0 ]
[ 266, 25 ]
python
en
['en', 'error', 'th']
False
_calc_overall_qual
(label_qual, spatial_qual)
Calculate the overall quality for all detections on all ground truth objects for a given image :param label_qual: g x d label quality score between zero and one for each possible combination of g ground truth objects and d detections. :param spatial_qual: g x d spatial quality score between zero and on...
Calculate the overall quality for all detections on all ground truth objects for a given image :param label_qual: g x d label quality score between zero and one for each possible combination of g ground truth objects and d detections. :param spatial_qual: g x d spatial quality score between zero and on...
def _calc_overall_qual(label_qual, spatial_qual): """ Calculate the overall quality for all detections on all ground truth objects for a given image :param label_qual: g x d label quality score between zero and one for each possible combination of g ground truth objects and d detections. :param spat...
[ "def", "_calc_overall_qual", "(", "label_qual", ",", "spatial_qual", ")", ":", "combined_mat", "=", "np", ".", "dstack", "(", "(", "label_qual", ",", "spatial_qual", ")", ")", "# Calculate the geometric mean between label quality and spatial quality.", "# Note we ignore div...
[ 269, 0 ]
[ 286, 27 ]
python
en
['en', 'error', 'th']
False
_gen_cost_tables
(gt_instances, det_instances)
Generate the cost tables containing the cost values (1 - quality) for each combination of ground truth objects and detections within a given image. :param gt_instances: list of all GroundTruthInstances for a given image. :param det_instances: list of all DetectionInstances for a given image. :retur...
Generate the cost tables containing the cost values (1 - quality) for each combination of ground truth objects and detections within a given image. :param gt_instances: list of all GroundTruthInstances for a given image. :param det_instances: list of all DetectionInstances for a given image. :retur...
def _gen_cost_tables(gt_instances, det_instances): """ Generate the cost tables containing the cost values (1 - quality) for each combination of ground truth objects and detections within a given image. :param gt_instances: list of all GroundTruthInstances for a given image. :param det_instances: li...
[ "def", "_gen_cost_tables", "(", "gt_instances", ",", "det_instances", ")", ":", "n_pairs", "=", "max", "(", "len", "(", "gt_instances", ")", ",", "len", "(", "det_instances", ")", ")", "overall_cost_table", "=", "np", ".", "ones", "(", "(", "n_pairs", ",",...
[ 289, 0 ]
[ 322, 100 ]
python
en
['en', 'error', 'th']
False
_calc_qual_img
(gt_instances, det_instances, background_idx=0)
Calculates the sum of qualities for the best matches between ground truth objects and detections for an image. Each ground truth object can only be matched to a single detection and vice versa as an object-detection pair. Note that if a ground truth object or detection does not have a match, the quality is...
Calculates the sum of qualities for the best matches between ground truth objects and detections for an image. Each ground truth object can only be matched to a single detection and vice versa as an object-detection pair. Note that if a ground truth object or detection does not have a match, the quality is...
def _calc_qual_img(gt_instances, det_instances, background_idx=0): """ Calculates the sum of qualities for the best matches between ground truth objects and detections for an image. Each ground truth object can only be matched to a single detection and vice versa as an object-detection pair. Note that i...
[ "def", "_calc_qual_img", "(", "gt_instances", ",", "det_instances", ",", "background_idx", "=", "0", ")", ":", "# if there are no detections or gt instances respectively the quality is zero", "if", "len", "(", "gt_instances", ")", "==", "0", "or", "len", "(", "det_insta...
[ 325, 0 ]
[ 422, 103 ]
python
en
['en', 'error', 'th']
False
_is_gt_included
(gt_instance)
Determines if a ground-truth instance is large enough to be considered valid for detection :param gt_instance: GroundTruthInstance object being evaluated :return: Boolean describing if the object is valid for detection
Determines if a ground-truth instance is large enough to be considered valid for detection :param gt_instance: GroundTruthInstance object being evaluated :return: Boolean describing if the object is valid for detection
def _is_gt_included(gt_instance): """ Determines if a ground-truth instance is large enough to be considered valid for detection :param gt_instance: GroundTruthInstance object being evaluated :return: Boolean describing if the object is valid for detection """ return (gt_instance.bounding_box[2]...
[ "def", "_is_gt_included", "(", "gt_instance", ")", ":", "return", "(", "gt_instance", ".", "bounding_box", "[", "2", "]", "-", "gt_instance", ".", "bounding_box", "[", "0", "]", ">", "10", ")", "and", "(", "gt_instance", ".", "bounding_box", "[", "3", "]...
[ 425, 0 ]
[ 433, 64 ]
python
en
['en', 'error', 'th']
False
PDQ.add_img_eval
(self, gt_instances, det_instances)
Adds a single image's detections and ground-truth to the overall evaluation analysis. :param gt_instances: list of GroundTruthInstance objects present in the given image. :param det_instances: list of DetectionInstance objects provided for the given image :return: None
Adds a single image's detections and ground-truth to the overall evaluation analysis. :param gt_instances: list of GroundTruthInstance objects present in the given image. :param det_instances: list of DetectionInstance objects provided for the given image :return: None
def add_img_eval(self, gt_instances, det_instances): """ Adds a single image's detections and ground-truth to the overall evaluation analysis. :param gt_instances: list of GroundTruthInstance objects present in the given image. :param det_instances: list of DetectionInstance objects prov...
[ "def", "add_img_eval", "(", "self", ",", "gt_instances", ",", "det_instances", ")", ":", "results", "=", "_calc_qual_img", "(", "gt_instances", ",", "det_instances", ")", "self", ".", "_tot_overall_quality", "+=", "results", "[", "'overall'", "]", "self", ".", ...
[ 25, 4 ]
[ 39, 37 ]
python
en
['en', 'error', 'th']
False
PDQ.get_pdq_score
(self)
Get the current PDQ score for all frames analysed at the current time. :return: The average PDQ across all images as a float.
Get the current PDQ score for all frames analysed at the current time. :return: The average PDQ across all images as a float.
def get_pdq_score(self): """ Get the current PDQ score for all frames analysed at the current time. :return: The average PDQ across all images as a float. """ denominator = self._tot_TP + self._tot_fp_cost + self._tot_FN return self._tot_overall_quality/denominator
[ "def", "get_pdq_score", "(", "self", ")", ":", "denominator", "=", "self", ".", "_tot_TP", "+", "self", ".", "_tot_fp_cost", "+", "self", ".", "_tot_FN", "return", "self", ".", "_tot_overall_quality", "/", "denominator" ]
[ 41, 4 ]
[ 47, 52 ]
python
en
['en', 'error', 'th']
False
PDQ.reset
(self)
Reset all internally stored evaluation measures to zero. :return: None
Reset all internally stored evaluation measures to zero. :return: None
def reset(self): """ Reset all internally stored evaluation measures to zero. :return: None """ self._tot_overall_quality = 0.0 self._tot_spatial_quality = 0.0 self._tot_label_quality = 0.0 self._tot_TP = 0 self._tot_FP = 0 self._tot_FN = 0
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_tot_overall_quality", "=", "0.0", "self", ".", "_tot_spatial_quality", "=", "0.0", "self", ".", "_tot_label_quality", "=", "0.0", "self", ".", "_tot_TP", "=", "0", "self", ".", "_tot_FP", "=", "0", "s...
[ 49, 4 ]
[ 59, 24 ]
python
en
['en', 'error', 'th']
False
PDQ.score
(self, matches)
Calculates the average probabilistic detection quality for a set of detections on a set of ground truth objects over a series of images. The average is calculated as the average pairwise quality over the number of object-detection pairs observed. Note that this removes any evaluation in...
Calculates the average probabilistic detection quality for a set of detections on a set of ground truth objects over a series of images. The average is calculated as the average pairwise quality over the number of object-detection pairs observed. Note that this removes any evaluation in...
def score(self, matches): """ Calculates the average probabilistic detection quality for a set of detections on a set of ground truth objects over a series of images. The average is calculated as the average pairwise quality over the number of object-detection pairs observed. Not...
[ "def", "score", "(", "self", ",", "matches", ")", ":", "self", ".", "reset", "(", ")", "pool", "=", "Pool", "(", "processes", "=", "6", ")", "for", "img_results", "in", "pool", ".", "imap_unordered", "(", "_get_image_evals", ",", "iterable", "=", "matc...
[ 61, 4 ]
[ 88, 35 ]
python
en
['en', 'error', 'th']
False
PDQ.get_avg_spatial_score
(self)
Get the average spatial quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. :return: average spatial quality of e...
Get the average spatial quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. :return: average spatial quality of e...
def get_avg_spatial_score(self): """ Get the average spatial quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. ...
[ "def", "get_avg_spatial_score", "(", "self", ")", ":", "if", "self", ".", "_tot_TP", ">", "0.0", ":", "return", "self", ".", "_tot_spatial_quality", "/", "float", "(", "self", ".", "_tot_TP", ")", "return", "0.0" ]
[ 90, 4 ]
[ 99, 18 ]
python
en
['en', 'error', 'th']
False
PDQ.get_avg_label_score
(self)
Get the average label quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. :return: average label quality of every...
Get the average label quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. :return: average label quality of every...
def get_avg_label_score(self): """ Get the average label quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. ...
[ "def", "get_avg_label_score", "(", "self", ")", ":", "if", "self", ".", "_tot_TP", ">", "0.0", ":", "return", "self", ".", "_tot_label_quality", "/", "float", "(", "self", ".", "_tot_TP", ")", "return", "0.0" ]
[ 101, 4 ]
[ 110, 18 ]
python
en
['en', 'error', 'th']
False
PDQ.get_avg_fp_score
(self)
Get the average quality (1 - cost) for all false positive detections across all frames analysed at the current time. Note that this is averaged only over the number of FPs and not the full set of TPs, FPs, and FNs. Note that at present false positive cost/quality is based soley upon lab...
Get the average quality (1 - cost) for all false positive detections across all frames analysed at the current time. Note that this is averaged only over the number of FPs and not the full set of TPs, FPs, and FNs. Note that at present false positive cost/quality is based soley upon lab...
def get_avg_fp_score(self): """ Get the average quality (1 - cost) for all false positive detections across all frames analysed at the current time. Note that this is averaged only over the number of FPs and not the full set of TPs, FPs, and FNs. Note that at present false positi...
[ "def", "get_avg_fp_score", "(", "self", ")", ":", "if", "self", ".", "_tot_FP", ">", "0.0", ":", "return", "(", "self", ".", "_tot_FP", "-", "self", ".", "_tot_fp_cost", ")", "/", "self", ".", "_tot_FP", "return", "1.0" ]
[ 112, 4 ]
[ 122, 18 ]
python
en
['en', 'error', 'th']
False
PDQ.get_avg_overall_quality_score
(self)
Get the average overall pairwise quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. :return: average ove...
Get the average overall pairwise quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs like the final PDQ score. :return: average ove...
def get_avg_overall_quality_score(self): """ Get the average overall pairwise quality score for all assigned detections in all frames analysed at the current time. Note that this is averaged over the number of assigned detections (TPs) and not the full set of TPs, FPs, and FNs li...
[ "def", "get_avg_overall_quality_score", "(", "self", ")", ":", "if", "self", ".", "_tot_TP", ">", "0.0", ":", "return", "self", ".", "_tot_overall_quality", "/", "float", "(", "self", ".", "_tot_TP", ")", "return", "0.0" ]
[ 124, 4 ]
[ 134, 18 ]
python
en
['en', 'error', 'th']
False
PDQ.get_assignment_counts
(self)
Get the total number of TP, FP, and FN detections across all frames analysed at the current time. :return: tuple containing (TP, FP, FN)
Get the total number of TP, FP, and FN detections across all frames analysed at the current time. :return: tuple containing (TP, FP, FN)
def get_assignment_counts(self): """ Get the total number of TP, FP, and FN detections across all frames analysed at the current time. :return: tuple containing (TP, FP, FN) """ return self._tot_TP, self._tot_FP, self._tot_FN
[ "def", "get_assignment_counts", "(", "self", ")", ":", "return", "self", ".", "_tot_TP", ",", "self", ".", "_tot_FP", ",", "self", ".", "_tot_FN" ]
[ 136, 4 ]
[ 141, 55 ]
python
en
['en', 'error', 'th']
False
DepsTree.__init__
(self, sources)
Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A namespace is provided by muplitple sources. NamespaceNotFoundError: A namespace is required but never provided.
Initializes the tree with a set of sources.
def __init__(self, sources): """Initializes the tree with a set of sources. Args: sources: A set of JavaScript sources. Raises: MultipleProvideError: A namespace is provided by muplitple sources. NamespaceNotFoundError: A namespace is required but never provided. """ self._sourc...
[ "def", "__init__", "(", "self", ",", "sources", ")", ":", "self", ".", "_sources", "=", "sources", "self", ".", "_provides_map", "=", "dict", "(", ")", "# Ensure nothing was provided twice.", "for", "source", "in", "sources", ":", "for", "provide", "in", "so...
[ 28, 2 ]
[ 55, 55 ]
python
en
['en', 'en', 'en']
True
DepsTree.GetDependencies
(self, required_namespaces)
Get source dependencies, in order, for the given namespaces. Args: required_namespaces: A string (for one) or list (for one or more) of namespaces. Returns: A list of source objects that provide those namespaces and all requirements, in dependency order. Raises: NamespaceN...
Get source dependencies, in order, for the given namespaces.
def GetDependencies(self, required_namespaces): """Get source dependencies, in order, for the given namespaces. Args: required_namespaces: A string (for one) or list (for one or more) of namespaces. Returns: A list of source objects that provide those namespaces and all requireme...
[ "def", "GetDependencies", "(", "self", ",", "required_namespaces", ")", ":", "if", "isinstance", "(", "required_namespaces", ",", "str", ")", ":", "required_namespaces", "=", "[", "required_namespaces", "]", "deps_sources", "=", "[", "]", "for", "namespace", "in...
[ 57, 2 ]
[ 83, 23 ]
python
en
['en', 'en', 'en']
True
DepsTree._ResolveDependencies
(required_namespace, deps_list, provides_map, traversal_path)
Resolve dependencies for Closure source files. Follows the dependency tree down and builds a list of sources in dependency order. This function will recursively call itself to fill all dependencies below the requested namespaces, and then append its sources at the end of the list. Args: req...
Resolve dependencies for Closure source files.
def _ResolveDependencies(required_namespace, deps_list, provides_map, traversal_path): """Resolve dependencies for Closure source files. Follows the dependency tree down and builds a list of sources in dependency order. This function will recursively call itself to fill all depe...
[ "def", "_ResolveDependencies", "(", "required_namespace", ",", "deps_list", ",", "provides_map", ",", "traversal_path", ")", ":", "source", "=", "provides_map", ".", "get", "(", "required_namespace", ")", "if", "not", "source", ":", "raise", "NamespaceNotFoundError"...
[ 86, 2 ]
[ 139, 20 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check show create quota query syntax. ```sql SHOW CREATE QUOTA [name | CURRENT] ```
Check show create quota query syntax.
def feature(self, node="clickhouse1"): """Check show create quota query syntax. ```sql SHOW CREATE QUOTA [name | CURRENT] ``` """ node = self.context.cluster.node(node) @contextmanager def cleanup(quota): try: with Given("I have a quota"): node.query...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "@", "contextmanager", "def", "cleanup", "(", "quota", ")", ":", "try", ":", "with", "Gi...
[ 8, 0 ]
[ 43, 47 ]
python
en
['pt', 'en', 'en']
True