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, 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_()
session_language, user_code_parser=None, **kwargs):
# Required by Jupyter - Override
self.implementation = implementation
self.implementation_version = implementation_version
self.language = language
self.language_version = language_version
self.language_info = language_info
# Override
self.session_language = session_language
super(SparkKernelBase, self).__init__(**kwargs)
self.logger = SparkLog(u"{}_jupyter_kernel".format(self.session_language))
self._fatal_error = None
self.ipython_display = IpythonDisplay()
if user_code_parser is None:
self.user_code_parser = UserCodeParser()
else:
self.user_code_parser = user_code_parser
# Disable warnings for test env in HDI
requests.packages.urllib3.disable_warnings()
if not kwargs.get("testing", False):
self._load_magics_extension()
self._change_language()
if conf.use_auto_viz():
self._register_auto_viz()
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
self.to_display = self.ipywidget_factory.get_output()
self.to_display.width = "800px"
self.output = self.ipywidget_factory.get_hbox()
self.output.children = [self.to_display]
self.controls = self._create_controls_widget()
if spark_events is None:
def __init__(self, display=None):
if display is None:
self.display = IpythonDisplay()
else:
self.display = display
def __init__(self, shell, data=None, spark_events=None):
# You must call the parent constructor
super(SparkMagicBase, self).__init__(shell)
self.logger = SparkLog(u"SparkMagics")
self.ipython_display = IpythonDisplay()
self.spark_controller = SparkController(self.ipython_display)
self.logger.debug("Initialized spark magics.")
if spark_events is None:
spark_events = SparkEvents()
spark_events.emit_library_loaded_event()