Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __get_tab_save(self):
return widgets.VBox([widgets.HBox([self.figname, self.dpi, self.saveas], layout=_items_layout),
self.dlink, self.savemovie.widget], layout=_items_layout)
button_style='info',
disabled=False,
layout={'visibility': 'hidden'}
)
self._continue_workflow_button.on_click(
self._continue_workflow
)
self._worker_pool_selector = ipw.Dropdown()
self._run_button = ipw.Button(
description='Run Workflow',
button_style='success'
)
self._workflow_controls = ipw.VBox([
self._worker_pool_selector,
self._run_button
])
self._log_path_input = ipw.Text(
description='Log path',
value='',
disabled=True
)
self._log_html = ipw.HTML()
# self._info_area = ipw.VBox([
# self._readme_html,
# kale.aux_widgets.Space(height=20),
# self._metadata_html,
# self._notebook_button
# ])
link((obj, "background_type"), (background_type, "value"))
# Trigger the function that controls the visibility of poly order as
# setting the default value doesn't trigger it.
class Dummy:
new = background_type.value
enable_poly_order(change=Dummy())
link((obj, "polynomial_order"), (polynomial_order, "value"))
link((obj, "fast"), (fast, "value"))
wdict["left"] = left
wdict["right"] = right
wdict["fast"] = fast
wdict["polynomial_order"] = polynomial_order
wdict["background_type"] = background_type
wdict["apply_button"] = apply
box = ipywidgets.VBox([
left, right,
background_type,
polynomial_order,
fast,
help,
ipywidgets.HBox((apply, close)),
])
def on_apply_clicked(b):
obj.apply()
box.close()
apply.on_click(on_apply_clicked)
def on_close_clicked(b):
obj.span_selector_switch(False)
box.close()
def display(self):
self.progress_bar = MFTViewHelper.define_int_progress_bar()
self.nav_breadcrumbs = widgets.HBox()
self.button_folders = widgets.VBox()
self.button_files = widgets.VBox()
self.table_files = widgets.VBox()
self.box_folders = widgets.HBox()
self.box_files = widgets.HBox()
self.box_top = widgets.VBox()
self.tab_details = widgets.Tab()
self.update(None)
return self.box_top
self.ion_count_table,
self.level_count_table,
],
layout=ipw.Layout(**tables_container_layout),
)
self.shells_table.change_selection([1])
# Notes text explaining how to interpret tables widgets' data
text = ipw.HTML(
"<b>Frac. Ab.</b> denotes <i>Fractional Abundances</i> (i.e all "
"values sum to 1)<br><b>W</b> denotes <i>Dilution Factor</i> and "
"<b>Rad. Temp.</b> is <i>Radiative Temperature (in K)</i>"
)
# Put text horizontally before shell info container
shell_info_widget = ipw.VBox([text, shell_info_tables_container])
return shell_info_widget
children=tuple(self._sensor_outputs.values())
)
self._tab.children = tuple(list(self._tab.children) + [self._accordion])
self._tab.set_title(2, "Sensors")
# we know that the accordion will line up with the dict since dict order
# is preserved in Python 3.7+
for i, sensor in enumerate(self._sensor_outputs):
self._accordion.set_title(i, sensor.name)
# decide whether to show a pause button
buttons = [self._stop_button]
if type(self.dry_run) != int:
buttons.insert(0, self._pause_button)
self._output_widget = widgets.VBox(
[
widgets.HTML(value=f"<h3>Experiment {self.experiment_id}</h3>"),
widgets.HBox(buttons),
self._tab,
]
)
def _log(x):
with self._log_widget: # the log
# .xxx in floats
pad_length = len(str(int(self.protocol._inferred_duration))) + 4
# we don't (cleanup) to look weird, so pad to at least its length
pad_length = max((pad_length, len("cleanup")))
if self.is_executing and not self.was_executed:
elapsed_time = f"{time.time() - self.start_time:0{pad_length}.3f}"
def prep_log(obj):
return '\n' + str(obj)
class EvaluationCallbackLogging:
def __init__(self, logger):
self._logger = logger
def __call__(self, eval_res):
self._logger.info('Evaluation: {}'.format(prep_log(pd.DataFrame([eval_res])
.to_string(index=False))))
class ActiveLearnerUiWidget(VBox):
"""The main ui widget for active learning annotation.
Create widget in Jupyter, configure it with ActiveLearner object and invoke.
"""
_reset_check_time = 4
def __init__(self,
active_learner,
X_helper,
visualize_columns = [],
drop_labels = [],
display_feature_table = True,
y_labels = {"True" : True,
"False" : False},
def __init__(self):
self.style = {"description_width": "initial"}
self.bars = {}
self.labels = {}
self.last_job = None
self.progressbars = VBox([])
cancel_button = Button(button_style="", tooltip="Cancel Spark Job", icon="window-close")
cancel_button.add_class("db-button")
toggle_button = Button(
button_style="", tooltip="Toggle progress bar", icon="arrow-circle-right"
)
toggle_button.add_class("db-button")
toggle_button.on_click(self._toggle(self.progressbars))
self.indicator = HBox([toggle_button, self.progressbars])
self.progressbar_showing = False
def get_widget(self):
return ipywidgets.VBox([self.buttons_container, super(BaseImageChooser, self).get_widget()])
value=self.params['layout'],
width="100%",
padding=6
)
self.layout.observe(self.on_layout_change, names='value')
self.title = widgets.HTML(value="""<b style="font-size:18px;" class="gc-layout">Graph Layout</b><br>""")
self.k_box = widgets.HBox(children=[self.iterations,
self.kmet,
self.kfloat])
self.top_box = widgets.HBox(children=[self.dim,
self.scale,
self.center_display])
self.wi_box = widgets.VBox(children=[self.weight,
self.k_box,
self.prog])
self.bot_box = widgets.HBox(children=[self.fixed_display,
self.wi_box])
self.r_box = widgets.VBox(children=[self.top_box,
self.bot_box])
self.body = widgets.HBox(children=[self.layout,
self.r_box])
self.widget = widgets.VBox(children=[self.title,
self.body])
self.update_display()
#Can inherit a target when not used as a widget
self.update_value()