Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, df, encoding, change_hook, ipywidget_factory=None, testing=False, **kwargs):
assert encoding is not None
assert df is not None
assert type(df) is pd.DataFrame
kwargs['orientation'] = 'vertical'
if not testing:
super(EncodingWidget, self).__init__((), **kwargs)
if ipywidget_factory is None:
ipywidget_factory = IpyWidgetFactory()
self.ipywidget_factory = ipywidget_factory
self.df = df
self.encoding = encoding
self.change_hook = change_hook
self.widget = self.ipywidget_factory.get_vbox()
self.title = self.ipywidget_factory.get_html('Encoding:', width='148px', height='32px')
# X view
options_x_view = {text(i): text(i) for i in self.df.columns}
options_x_view["-"] = None
self.x_view = self.ipywidget_factory.get_dropdown(options=options_x_view,
description="X", value=self.encoding.x)
self.x_view.on_trait_change(self._x_changed_callback, 'value')
def __init__(self, spark_controller, ipywidget_factory=None, ipython_display=None,
nested_widget_mode=False, testing=False, **kwargs):
kwargs['orientation'] = 'vertical'
if not testing:
super(AbstractMenuWidget, self).__init__((), **kwargs)
self.spark_controller = spark_controller
if ipywidget_factory is None:
ipywidget_factory = IpyWidgetFactory()
self.ipywidget_factory = ipywidget_factory
if ipython_display is None:
ipython_display = IpythonDisplay()
self.ipython_display = ipython_display
self.children = []
if not nested_widget_mode:
self._repr_html_()
assert df is not None
assert type(df) is pd.DataFrame
kwargs['orientation'] = 'vertical'
if not testing:
super(AutoVizWidget, self).__init__((), **kwargs)
self.df = self._convert_to_displayable_dataframe(df)
if renderer is None:
renderer = GraphRenderer()
self.renderer = renderer
if ipywidget_factory is None:
ipywidget_factory = IpyWidgetFactory()
self.ipywidget_factory = ipywidget_factory
if encoding_widget is None:
encoding_widget = EncodingWidget(self.df, encoding, self.on_render_viz)
self.encoding_widget = encoding_widget
if ipython_display is None:
ipython_display = IpythonDisplay()
self.ipython_display = ipython_display
self.encoding = encoding
# Widget that will become the only child of AutoVizWidget
self.widget = self.ipywidget_factory.get_vbox()
# Create output area