# Path: orangecontrib/spark/base/shared_spark_context.py
# class SharedSparkContext:
#     _sc = None
#     _hc = None
# 
#     @property
#     def sc(self):
#         return SharedSparkContext._sc
# 
#     @sc.setter
#     def sc(self, val):
#         SharedSparkContext._sc = val
# 
#     @property
#     def hc(self):
#         return SharedSparkContext._hc
# 
#     @hc.setter
#     def hc(self, val):
#         SharedSparkContext._hc = val
# 
# Path: orangecontrib/spark/utils/data_utils.py
# def orange_to_pandas(dt):
#     fileIO = StringIO()
#     save_csv_IO(dt, fileIO, delimiter = ',')
#     pandas_data_frame = pd.read_csv(fileIO)
#     del fileIO
#     return pandas_data_frame


import pyspark
from Orange.data import Table
from Orange.widgets import widget, gui, settings
from orangecontrib.spark.base.shared_spark_context import SharedSparkContext
from orangecontrib.spark.utils.data_utils import orange_to_pandas
__author__ = 'jamh'




class OWSparkFromOrange(SharedSparkContext, widget.OWWidget):
    priority = 7
    name = "from Orange"
    description = "Convert Orange Table to Spark DataFrame"

# Path: orangecontrib/spark/base/shared_spark_context.py
# class SharedSparkContext:
#     _sc = None
#     _hc = None
# 
#     @property
#     def sc(self):
#         return SharedSparkContext._sc
# 
#     @sc.setter
#     def sc(self, val):
#         SharedSparkContext._sc = val
# 
#     @property
#     def hc(self):
#         return SharedSparkContext._hc
# 
#     @hc.setter
#     def hc(self, val):
#         SharedSparkContext._hc = val
# 
# Path: orangecontrib/spark/utils/data_utils.py
# def orange_to_pandas(dt):
#     fileIO = StringIO()
#     save_csv_IO(dt, fileIO, delimiter = ',')
#     pandas_data_frame = pd.read_csv(fileIO)
#     del fileIO
#     return pandas_data_frame


# Path: orangecontrib/spark/widgets/data/spark_from_orange.py
import pyspark
from Orange.data import Table
from Orange.widgets import widget, gui, settings
from orangecontrib.spark.base.shared_spark_context import SharedSparkContext
from orangecontrib.spark.utils.data_utils import orange_to_pandas

__author__ = 'jamh'




class OWSparkFromOrange(SharedSparkContext, widget.OWWidget):
    priority = 7
    name = "from Orange"
    description = "Convert Orange Table to Spark DataFrame"

    icon = "../icons/spark.png"