Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def update_data(self, uindex):
newval = self._get_widget_value()
old_class_index = self._calc_class_index(uindex)
if newval != self.classes[old_class_index]:
class_index = self.classes.index(newval)
if self.datadepth == 'onehot':
self._set_data(uindex, old_class_index, 0)
self._set_data(uindex, class_index, 1)
elif self.datadepth == 'simple':
self._set_data(uindex, class_index)
else:
# colvector
self._set_data(uindex, 0, class_index)
class BinaryClassInnotation(MultiClassInnotation):
def _guess_classes(self):
self.classes = ['False', 'True']
def _create_widget(self):
return Checkbox(description=self.desc, layout=self.layout, disabled=self.disabled)
def update_ui(self, uindex):
self.get_widget().value = bool(self._calc_class_index(uindex) == 1)
def _get_widget_value(self):
return self.classes[self.get_widget().value and 1 or 0]
class TextInnotation(Innotation, DataMixin):