#Script generated by Orange3 from Orange.data.io import FileFormat from Orange.data.io import UrlReader from Orange.widgets.settings import ContextSetting from Orange.widgets.settings import Setting from Orange.widgets.utils.domaineditor import DomainEditor from Orange.widgets.utils.filedialogs import RecentPath from warnings import catch_warnings import os class File0(): def __init__(self): self.outputs = {} self.last_path = "/home/casey/Documents/orange-dev/orange3/Orange/datasets/housing.tab" self.url_text = "" self.sheet_text = "" def send(self, channel, data): """ Sets output """ self.outputs[channel] = data class info(): def setText(data): print(data) URL = 1 def _describe(self, table): domain = table.domain text = "{} instance(s), {} feature(s), {} meta attribute(s)".format( len(table), len(domain.attributes), len(domain.metas)) if domain.has_continuous_class: text += "\nRegression; numerical class." elif domain.has_discrete_class: text += "\nClassification; discrete class with {} values.".format( len(domain.class_var.values)) elif table.domain.class_vars: text += "\nMulti-target; {} target variables.".format( len(table.domain.class_vars)) else: text += "\nData has no target variable." if 'Timestamp' in table.domain: # Google Forms uses this header to timestamp responses text += '\n\nFirst entry: {}\nLast entry: {}'.format( table[0, 'Timestamp'], table[-1, 'Timestamp']) return text def _get_reader(self): """ Returns ------- FileFormat """ if self.source == self.LOCAL_FILE: reader = FileFormat.get_reader(self.last_path) return reader elif self.source == self.URL: return UrlReader(self.url_text) LOCAL_FILE = 0 source = 0 def get_output(self): self.reader = self._get_reader() errors = [] with catch_warnings(record=True) as warnings: try: data = self.reader.read() except Exception as ex: errors.append("An error occured:") errors.append(str(ex)) data = None if data is None: self.send("Data", None) self.info.setText("\n".join(errors)) return self.info.setText(self._describe(data)) self.send("Data", data) self.data = data class File2(): def __init__(self): self.outputs = {} self.last_path = "/home/casey/Documents/orange-dev/orange3/Orange/datasets/iris.tab" self.url_text = "" self.sheet_text = "" def send(self, channel, data): """ Sets output """ self.outputs[channel] = data class info(): def setText(data): print(data) URL = 1 def _describe(self, table): domain = table.domain text = "{} instance(s), {} feature(s), {} meta attribute(s)".format( len(table), len(domain.attributes), len(domain.metas)) if domain.has_continuous_class: text += "\nRegression; numerical class." elif domain.has_discrete_class: text += "\nClassification; discrete class with {} values.".format( len(domain.class_var.values)) elif table.domain.class_vars: text += "\nMulti-target; {} target variables.".format( len(table.domain.class_vars)) else: text += "\nData has no target variable." if 'Timestamp' in table.domain: # Google Forms uses this header to timestamp responses text += '\n\nFirst entry: {}\nLast entry: {}'.format( table[0, 'Timestamp'], table[-1, 'Timestamp']) return text def _get_reader(self): """ Returns ------- FileFormat """ if self.source == self.LOCAL_FILE: reader = FileFormat.get_reader(self.last_path) return reader elif self.source == self.URL: return UrlReader(self.url_text) LOCAL_FILE = 0 source = 0 def get_output(self): self.reader = self._get_reader() errors = [] with catch_warnings(record=True) as warnings: try: data = self.reader.read() except Exception as ex: errors.append("An error occured:") errors.append(str(ex)) data = None if data is None: self.send("Data", None) self.info.setText("\n".join(errors)) return self.info.setText(self._describe(data)) self.send("Data", data) self.data = data _File0 = File0() _File0.get_output() #_Classification_Tree1 = _Classification_Tree1() #_Classification_Tree1.get_output() #Classification_Tree1.set_input("Data", File0.outputs["Data]") #_Scatter_Plot5 = _Scatter_Plot5() #_Scatter_Plot5.get_output() #Scatter_Plot5.set_input("Data", File0.outputs["Data]") _File2 = File2() _File2.get_output() #_Scatter_Plot3 = _Scatter_Plot3() #_Scatter_Plot3.get_output() #Scatter_Plot3.set_input("Data", File2.outputs["Data]")
Password: Filename:
Secret