rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
return lambda data2, remover=self.removerConstructor(data), imputer=self.imputerConstructor(data): imputer(remover(data2)) | return lambda data2, remover=self.removerConstructor(data), imputer=self.imputerConstructor(data): imputer(data2 if isinstance(data2, orange.Example) else remover(data2)) | def __call__(self, data): return lambda data2, remover=self.removerConstructor(data), imputer=self.imputerConstructor(data): imputer(remover(data2)) |
See DomainContinuizer_ for list of accepted arguments. | See DomainContinuizer for list of accepted arguments. | def __call__(self, data, weightId=None): attrs = [attr for attr in data.domain.attributes if attr.varType == orange.VarTypes.Discrete] domain = orange.Domain(attrs, data.domain.classVar) domain.addmetas(data.domain.getmetas()) return orange.ExampleTable(domain, data) |
- `limit`: The number of selected fetures (default 10) | - `filter`: a filter function to use for selection (default Preprocessor_featureSelection.bestN - `limit`: The number of selected features (default 10) | def __call__(self, data, weightId=None): measures = self.attrScores(data) attrs = [attr for _, attr in self.filter(measures, self.limit)] domain = orange.Domain(attrs, data.domain.classVar) domain.addmetas(data.domain.getmetas()) return orange.ExampleTable(domain, data) |
def __init__(self, limit=10): | def __init__(self, filter=None, limit=10): | def __init__(self, limit=10): self.limit = limit |
return rfe(data, self.limit) | filterd = self.filter(range(len(self.data)), self.limit) return rfe(data, len(filterd)) | def __call__(self, data, weightId=None): from orngSVM import RFE rfe = RFE() return rfe(data, self.limit) |
OWGUI.hSlider(self.sliderBox, self, "numberOfIntervals", callback=self.onChange) | OWGUI.hSlider(self.sliderBox, self, "numberOfIntervals", callback=self.onChange, minValue=1) | def __init__(self, parent=None): BaseEditor.__init__(self, parent) self.discInd = 0 self.numberOfIntervals = 3 |
class NamedTupleItemDelegate(QStyledItemDelegate): """ Item delegate for displaying the name of (name, [...]) structured tuples """ | class PreprocessorSchema(object): """ Preprocessor schema holds a saved a named preprocessor list for display. """ def __init__(self, name="New schema", preprocessors=[], selectedPreprocessor=0, modified=False): self.name = name self.preprocessors = preprocessors self.selectedPreprocessor = selectedPreprocessor self.mo... | def replace(match): attr = match.groups()[0] if hasattr(obj, attr): return self.format(getattr(obj, attr)) |
obj = value.toPyObject() return str(obj[0]) except Exception, ex: return repr(ex) | if schema.modified: return QString("*" + schema.name) else: return QString(schema.name) except Exception: return QString("Invalid schema") def paint(self, painter, option, index): schema = self.asSchema(index.data(Qt.DisplayRole).toPyObject()) if getattr(schema, "modified", False): option = QStyleOptionViewItemV4(opti... | def displayText(self, value, locale): try: obj = value.toPyObject() return str(obj[0]) except Exception, ex: return repr(ex) |
t = index.data().toPyObject() editor.setText(t[0]) | schema = self.asSchema(index.data().toPyObject()) editor.setText(schema.name) | def setEditorData(self, editor, index): t = index.data().toPyObject() editor.setText(t[0]) |
t = tuple(index.data().toPyObject()) name = editor.text() model.setData(index, QVariant((name,) + t[1:])) | schema = self.asSchema(index.data().toPyObject()) schema.name = editor.text() model.setData(index, QVariant(schema)) | def setModelData(self, editor, model, index): t = tuple(index.data().toPyObject()) name = editor.text() model.setData(index, QVariant((name,) + t[1:])) |
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Preprocess") | def __init__(self, parent=None, signalManager=None, name="Preprocess"): OWWidget.__init__(self, parent, signalManager, name) | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Preprocess") self.inputs = [("Example Table", ExampleTable, self.setData)] #, ("Learner", orange.Learner, self.setLearner)] self.outputs = [("Preprocessing", orngWrap.PreprocessedLearner), ("Preprocessed Example Table"... |
self.outputs = [("Preprocessing", orngWrap.PreprocessedLearner), ("Preprocessed Example Table", ExampleTable)] | self.outputs = [("Preprocess", orngWrap.PreprocessedLearner), ("Preprocessed Example Table", ExampleTable)] | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Preprocess") self.inputs = [("Example Table", ExampleTable, self.setData)] #, ("Learner", orange.Learner, self.setLearner)] self.outputs = [("Preprocessing", orngWrap.PreprocessedLearner), ("Preprocessed Example Table"... |
box.layout().setSpacing(1) self.setStyleSheet("QListView::item { margin: 1px;}") | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Preprocess") self.inputs = [("Example Table", ExampleTable, self.setData)] #, ("Learner", orange.Learner, self.setLearner)] self.outputs = [("Preprocessing", orngWrap.PreprocessedLearner), ("Preprocessed Example Table"... | |
self.schemaListView.setItemDelegate(NamedTupleItemDelegate(self)) | self.schemaListView.setItemDelegate(PreprocessorSchemaDelegate(self)) | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Preprocess") self.inputs = [("Example Table", ExampleTable, self.setData)] #, ("Learner", orange.Learner, self.setLearner)] self.outputs = [("Preprocessing", orngWrap.PreprocessedLearner), ("Preprocessed Example Table"... |
self.setActiveSchema(*index.data().toPyObject()) | self.setActiveSchema(index.data().toPyObject()) | def onSchemaSelection(self, index): self.updateSchemaAction.setEnabled(index.isValid()) self.removeSchemaAction.setEnabled(index.isValid()) if index.isValid(): self.lastSelectedSchemaIndex = index.row() self.setActiveSchema(*index.data().toPyObject()) |
self.schemaList.append(("New schema", schema, self.preprocessorsListSelectionModel.selectedRow().row())) | self.schemaList.append(PreprocessorSchema("New schema", schema, self.preprocessorsListSelectionModel.selectedRow().row())) | def onAddSchema(self): schema = list(self.preprocessorsList) self.schemaList.append(("New schema", schema, self.preprocessorsListSelectionModel.selectedRow().row())) index = self.schemaList.index(len(self.schemaList) - 1) self.schemaListSelectionModel.setCurrentIndex(index, QItemSelectionModel.ClearAndSelect) self.sche... |
i = index.row() name, old, index = self.schemaList[i] self.schemaList[i] = (name, list(self.preprocessorsList), self.preprocessorsListSelectionModel.selectedRow().row()) | if index.isValid(): row = index.row() schema = self.schemaList[row] self.schemaList[row] = PreprocessorSchema(schema.name, list(self.preprocessorsList), self.preprocessorsListSelectionModel.selectedRow().row()) | def onUpdateSchema(self): index = self.schemaListSelectionModel.selectedRow() i = index.row() name, old, index = self.schemaList[i] self.schemaList[i] = (name, list(self.preprocessorsList), self.preprocessorsListSelectionModel.selectedRow().row()) |
def setActiveSchema(self, name, schema, selectedIndex): self.preprocessorsList[:] = list(schema) self.preprocessorsListSelectionModel.select(selectedIndex, QItemSelectionModel.ClearAndSelect) | def setActiveSchema(self, schema): if schema.modified and hasattr(schema, "_tmp_preprocessors"): self.preprocessorsList[:] = list(schema._tmp_preprocessors) else: self.preprocessorsList[:] = list(schema.preprocessors) self.preprocessorsListSelectionModel.select(schema.selectedPreprocessor, QItemSelectionModel.ClearAndS... | def setActiveSchema(self, name, schema, selectedIndex): self.preprocessorsList[:] = list(schema) self.preprocessorsListSelectionModel.select(selectedIndex, QItemSelectionModel.ClearAndSelect) |
self.onUpdateSchema() | self.setSchemaModified(True) self.commitIf() def setSchemaModified(self, state): index = self.schemaListSelectionModel.selectedRow() if index.isValid(): row = index.row() self.schemaList[row].modified = True self.schemaList[row]._tmp_preprocessors = list(self.preprocessorsList) self.schemaList.emitDataChanged([row]) | def setEditedPreprocessor(self, pp): self.preprocessorsList[self.preprocessorsListSelectionModel.selectedRow().row()] = pp self.onUpdateSchema() |
self.send("Preprocessing", wrap) | self.send("Preprocess", wrap) | def commit(self): wrap = orngWrap.PreprocessedLearner(list(self.preprocessorsList)) if self.data is not None: data = wrap.processData(self.data) self.send("Preprocessed Example Table", data) |
[("Attributes derived by", ", ".join(self.attributes[i][0] for i in self.dimensions) or "none"), | [("Class is derived by", ", ".join(self.attributes[i][0] for i in self.dimensions) or "none"), | def sendReport(self): self.reportSettings("Learning parameters", [("Attributes derived by", ", ".join(self.attributes[i][0] for i in self.dimensions) or "none"), ("Method", self.methodNames[self.method]), ("Threshold", self.threshold if self.enableThreshold else "None"), ]) self.reportSettings("Output", [("Label", self... |
self.__dict__["exCont"+paletteName+"passThroughColor"+str(i)+"Checkbox"] = OWGUI.checkBox(box, self, "exCont"+paletteName+"passThroughColor"+str(i), "", tooltip="Use color", callback = self.colorSchemaChange) | self.__dict__["exCont"+paletteName+"passThroughColor"+str(i)+"Checkbox"] = cb = OWGUI.checkBox(box, self, "exCont"+paletteName+"passThroughColor"+str(i), "", tooltip="Use color", callback = self.colorSchemaChange) | def createExtendedContinuousPalette(self, paletteName, boxCaption, passThroughColors = 0, initialColor1 = QColor(Qt.white), initialColor2 = Qt.black, extendedPassThroughColors = ((Qt.red, 1), (Qt.black, 1), (Qt.green, 1))): buttBox = OWGUI.widgetBox(self.mainArea, boxCaption) box = OWGUI.widgetBox(buttBox, orientation ... |
tax = cPickle.load(open(os.path.join(tmpDir, "taxonomy.pickle"), "rb")) | tax = cPickle.load(open(orngServerFiles.localpath_download("GO", "taxonomy.pickle"), "rb")) | def pp(*args, **kw): print args, kw |
print minval, maxval | def colorSchema(attr): if attr is None: return lambda val: QColor(Qt.white) elif type(attr) == int: attr = self.map.examples.domain[attr] if attr.varType == orange.VarTypes.Discrete: index = self.map.examples.domain.index(attr) vals = [n.vector[index] for n in self.map.map] minval, maxval = min(vals), max(vals) print m... | |
matrix[a1, a2] = orange.PearsonCorrelation(a1, a2, self.data, 0).r | matrix[a1, a2] = orange.PearsonCorrelation(a1, a2, self.data, 0).p | def computeMatrix(self): self.error() if self.data: atts = self.data.domain.attributes matrix = orange.SymMatrix(len(atts)) matrix.setattr('items', atts) |
matrix[a1, a2] = statc.spearmanr(f1, filleds[a2])[0] | matrix[a1, a2] = statc.spearmanr(f1, filleds[a2])[1] | def computeMatrix(self): self.error() if self.data: atts = self.data.domain.attributes matrix = orange.SymMatrix(len(atts)) matrix.setattr('items', atts) |
ind = items.index(self.settings.get("style", "WindowsXP")) | itemsLower = [s.lower() for s in items] ind = itemsLower.index(self.settings.get("style", "Windows").lower()) self.settings["style"] = items[ind] | def __init__(self, canvasDlg, *args): apply(QDialog.__init__,(self,) + args) self.canvasDlg = canvasDlg self.settings = dict(canvasDlg.settings) # create a copy of the settings dict. in case we accept the dialog, we update the canvasDlg.settings with this dict if sys.platform == "darwin": self.setWindowTitle("Pr... |
open(os.path.join(self.directoryDocumentation(), "widgets", docFile+".skeleton"), 'w').write(self.widgetDocSkeleton(w, prototype=p)) | skeletonFileName = os.path.join(self.directoryDocumentation(), "widgets", docFile+".skeleton") if not os.path.isdir(os.path.dirname(skeletonFileName)): os.mkdir(os.path.dirname(skeletonFileName)) open(skeletonFileName, 'w').write(self.widgetDocSkeleton(w, prototype=p)) | def iconListHtml(self, createSkeletonDocs=True): html = """ |
self.selectionRectItem.hide() self.removeItem(self.selectionRectItem) self.selectionRectItem = None | if self.selectionRectItem: self.selectionRectItem.hide() self.removeItem(self.selectionRectItem) self.selectionRectItem = None def mouseDoubleClickEvent(self, event): return | def mouseReleaseEvent(self, event): if event.button() & Qt.LeftButton: self.selectionManager.end(event) self.selectionRectItem.hide() self.removeItem(self.selectionRectItem) self.selectionRectItem = None |
self.drawMode = 0 self.objSize = 10 | self.drawMode = 2 self.objSize = 15 | def __init__(self, parent=None, signalManager=None, name="SOM visualizer"): OWWidget.__init__(self, parent, signalManager, name, wantGraph=True) self.inputs = [("SOMMap", orngSOM.SOMMap, self.setSomMap), ("Examples", ExampleTable, self.data)] self.outputs = [("Examples", ExampleTable)] self.drawMode = 0 self.objSize =... |
self.showNodeOutlines = 0 | self.showNodeOutlines = 1 | def __init__(self, parent=None, signalManager=None, name="SOM visualizer"): OWWidget.__init__(self, parent, signalManager, name, wantGraph=True) self.inputs = [("SOMMap", orngSOM.SOMMap, self.setSomMap), ("Examples", ExampleTable, self.data)] self.outputs = [("Examples", ExampleTable)] self.drawMode = 0 self.objSize =... |
if ev.button() == Qt.LeftButton: widgets = [item for item in self.doc.widgets if item.mouseInsideRightChannel(self.mouseDownPosition) or item.mouseInsideLeftChannel(self.mouseDownPosition)] if widgets: self.tempWidget = widgets[0] if not self.doc.signalManager.signalProcessingInProgress: self.unselectAllWidgets() self.... | def mousePressEvent(self, ev): self.mouseDownPosition = self.mapToScene(ev.pos()) | |
matrix[a1, a2] = orange.PearsonCorrelation(a1, a2, self.data, 0).p | matrix[a1, a2] = orange.PearsonCorrelation(a1, a2, self.data, 0).r | def computeMatrix(self): self.error() if self.data: atts = self.data.domain.attributes matrix = orange.SymMatrix(len(atts)) matrix.setattr('items', atts) |
matrix[a1, a2] = statc.spearmanr(f1, filleds[a2])[1] | matrix[a1, a2] = statc.spearmanr(f1, filleds[a2])[0] | def computeMatrix(self): self.error() if self.data: atts = self.data.domain.attributes matrix = orange.SymMatrix(len(atts)) matrix.setattr('items', atts) |
c=[i for i in range(len(maps)) for j in maps[i]] | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... | |
clustFilter = orange.Filter_sameValue(position=aid) | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... | |
clustFilter.value = clustVar("Cluster %i" % i) clusterEx = clustFilter(self.selectedExamples) | clusterEx = [ex for cluster, ex in zip(c, self.selectedExamples) if cluster == i] clusterEx = orange.ExampleTable(clusterEx) | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... |
print self.centroids.domain print ex | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... | |
if aid!=-1: | if aid is not None and aid!=-1: | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... |
else: | elif aid is not None: | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... |
self.bubbleRect=BubbleRect(None) | def __init__(self, *args): apply(QGraphicsScene.__init__, (self,)+args) self.parent=args[0] self.rootCluster=None self.rootTree=None self.highlighted=None #MyCanvasRect(None) self.header=None self.footer=None self.cutOffLineDragged=False self.selectionList=[] self.pen=QPen(QColor("blue")) self.selectedPen=QPen(QColor("... | |
self.bubbleRect=BubbleRect(None) self.addItem(self.bubbleRect) self.otherObj.append(self.bubbleRect) | def displayTree(self, root): self.clear() self.rootCluster=root if not self.rootCluster: return if not self.parent.ManualHorSize: width=self.parent.dendrogramView.size().width() else: width=self.parent.HDSize self.setSceneRect(0, 0, width, self.height()) self.textAreaWidth=100 | |
self.bubbleRect.hide() | def mouseReleaseEvent(self, e): self.holdoff=False if not self.rootCluster: return if self.parent.SelectionMode and self.cutOffLineDragged: self.cutOffLineDragged=False self.bubbleRect.hide() self.setCutOffLine(e.scenePos().x()) | |
self.bubbleRect.setText("Cut off height: \n %f" % self.cutOffHeight) self.bubbleRect.setPos(e.scenePos().x(), e.scenePos().y()) self.bubbleRect.show() self.update() | QToolTip.showText(e.screenPos(), "Cut off height: \n %f" % self.cutOffHeight, e.widget(), toolTipRect) | def mouseMoveEvent(self, e): |
self.bubbleRect.setText(text) self.bubbleRect.setPos(e.scenePos().x(),e.scenePos().y()) self.bubbleRect.show() self.update() else: self.bubbleRect.hide() self.update() | QToolTip.showText(e.screenPos(), text, e.widget(), toolTipRect) | def mouseMoveEvent(self, e): |
self.bubbleRect.setText(head+body) self.bubbleRect.setPos(e.scenePos().x(),e.scenePos().y()) if body!="": self.bubbleRect.show() self.update() | QToolTip.showText(e.screenPos(), head+body, e.widget(), toolTipRect) | def mouseMoveEvent(self, e): |
class BubbleRect(QGraphicsRectItem): def __init__(self, *args): QGraphicsRectItem.__init__(self, *args) self.setBrush(QBrush(Qt.white)) self.text=QGraphicsTextItem(self) self.text.setPos(5, 5) self.setZValue(30) def setText(self, text): self.text.setPlainText(text) self.setRect(0, 0, self.text.boundingRect().width()+6... | def clearGraphics(self): self.scene().removeItem(self) | |
return robjects.NA_Real | return NA_Real | def float_or_NA(value): if value.isSpecial(): return robjects.NA_Real else: return float(value) |
return robjects.NA_Integer | return NA_Integer | def int_or_NA(value): if value.isSpecial(): return robjects.NA_Integer else: return int(value) |
return robjects.NA_Character | return NA_Character | def str_or_NA(value): if value.isSpecial(): return robjects.NA_Character else: return str(value) |
self.lbClasses = OWGUI.listBox(self.copt, self, selectionMode = QListWidget.MultiSelection, callback = self.updateTableOutcomes) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Predictions") | |
self.connect(self.header, SIGNAL("pressed(int)"), self.sort) | self.connect(self.header, SIGNAL("sectionPressed(int)"), self.sort) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Predictions") |
sindx = len(self.data.domain.attributes) + 1 | sindx = len(self.data.domain.variables) | def updateTableOutcomes(self): """updates the columns associated with the classifiers""" if not self.data or not self.predictors or not self.outvar: return |
for i in range(len(self.data.domain.attributes)): | for i in range(len(self.data.domain.variables)): | def updateAttributes(self): if self.ShowAttributeMethod == 0: for i in range(len(self.data.domain.attributes)): self.table.showColumn(i) |
self.table.setColumnCount(len(self.data.domain.attributes) + (self.data.domain.classVar <> None) + len(self.predictors)) | self.table.setColumnCount(len(self.data.domain.attributes) + (self.data.domain.classVar != None) + len(self.predictors)) | def setTable(self): """defines the attribute/predictions table and paints its contents""" if not self.outvar or self.data==None: return |
getValueFrom = lambda ex, rw, cindx=i: orange.Value(c(ex, c.GetProbabilities)[cindx])) \ | getValueFrom = lambda ex, rw, cindx=i, c=c: orange.Value(c(ex, c.GetProbabilities)[cindx])) \ | def sendpredictions(self): if not self.data or not self.outvar: self.send("Predictions", None) return |
getValueFrom = lambda ex, rw: orange.Value(c(ex))) | getValueFrom = lambda ex, rw, c=c: orange.Value(c(ex))) | def sendpredictions(self): if not self.data or not self.outvar: self.send("Predictions", None) return |
from distutils.file_util import copy_file | def build_extension(self, ext): if isinstance(ext, LibStatic): self.build_static(ext) elif isinstance(ext, PyXtractExtension): self.build_pyxtract(ext) else: build_ext.build_extension(self, ext) if isinstance(ext, PyXtractSharedExtension): # Make lib{name}.so link to {name}.so from distutils.file_util import copy_file... | |
print realpath, ext_path | def build_extension(self, ext): if isinstance(ext, LibStatic): self.build_static(ext) elif isinstance(ext, PyXtractExtension): self.build_pyxtract(ext) else: build_ext.build_extension(self, ext) if isinstance(ext, PyXtractSharedExtension): # Make lib{name}.so link to {name}.so from distutils.file_util import copy_file... | |
print realpath, ext_path, lib_filename | ext.install_shared_link = (lib_filename, self.get_ext_filename(ext.name)) | def build_extension(self, ext): if isinstance(ext, LibStatic): self.build_static(ext) elif isinstance(ext, PyXtractExtension): self.build_pyxtract(ext) else: build_ext.build_extension(self, ext) if isinstance(ext, PyXtractSharedExtension): # Make lib{name}.so link to {name}.so from distutils.file_util import copy_file... |
class install_shared(install_lib): def run(self): install_lib.run(self) if sys.platform == "linux2": for ext in self.distribution.ext_modules: if isinstance(ext, PyXtractSharedExtension): try: lib_name, path = ext.install_shared_link lib_name = os.path.join(sys.prefix, "lib", lib_name) lib_link = os.path.join(self.inst... | def get_ext_fullpath(self, ext_name): """Returns the path of the filename for a given extension. The file is located in `build_lib` or directly in the package (inplace option). """ import string # makes sure the extension name is only using dots all_dots = string.maketrans('/' + os.sep, '..') ext_name = ext_name.trans... | |
libraries=libraries, | libraries=shared_libs, | def get_source_files(path, ext="cpp"): return glob.glob(os.path.join(path, "*." + ext)) |
setup(cmdclass={"build_ext": pyxtract_build_ext}, | setup(cmdclass={"build_ext": pyxtract_build_ext, "install_lib": install_shared}, | def get_source_files(path, ext="cpp"): return glob.glob(os.path.join(path, "*." + ext)) |
"Environment :: Console", | def get_source_files(path, ext="cpp"): return glob.glob(os.path.join(path, "*." + ext)) | |
self.itemView.resizeColumnToContents(i) | self.itemView.resizeColumnToContents(section) | def toogleHidden(bool, section=i): view.setSectionHidden(section, not bool) if bool: if self.itemView: self.itemView.resizeColumnToContents(i) else: view.resizeSection(i, max(view.sectionSizeHint(i), 10)) |
view.resizeSection(i, max(view.sectionSizeHint(i), 10)) | view.resizeSection(section, max(view.sectionSizeHint(section), 10)) | def toogleHidden(bool, section=i): view.setSectionHidden(section, not bool) if bool: if self.itemView: self.itemView.resizeColumnToContents(i) else: view.resizeSection(i, max(view.sectionSizeHint(i), 10)) |
self.connect(action, SIGNAL("toggled(bool)"), lambda bool, section=i: view.setSectionHidden(section, not bool)) | def toogleHidden(bool, section=i): view.setSectionHidden(section, not bool) if bool: if self.itemView: self.itemView.resizeColumnToContents(i) else: view.resizeSection(i, max(view.sectionSizeHint(i), 10)) | |
def QListWidget_py_iter(self): for i in range(self.count()): yield self.item(i) QListWidget.py_iter = QListWidget_py_iter | def lineEditFilter(widget, master, value, *arg, **args): callback = args.get("callback", None) args["callback"] = None # we will have our own callback handler args["baseClass"] = LineEditFilter le = lineEdit(widget, master, value, *arg, **args) le.__dict__.update(args) le.callback = callback le.focusOutEvent(No... | |
items = [self.listbox.item(i) for i in range(self.listbox.count())] if not items: return | self.listboxItems = [] return | def setAllListItems(self, items = None): if not items: items = [self.listbox.item(i) for i in range(self.listbox.count())] if not items: return if type(items[0]) == str: # if items contain strings self.listboxItems = [(item, QListWidgetItem(item)) for item in items] else: # if it... |
if not self.listbox: return | if self.listbox is None: return | def updateListBoxItems(self, callCallback = 1): if not self.listbox: return last = self.getText() tuples = self.listboxItems if not self.caseSensitive: tuples = [(text.lower(), item) for (text, item) in tuples] last = last.lower() |
tuples = self.listboxItems if not self.caseSensitive: tuples = [(text.lower(), item) for (text, item) in tuples] last = last.lower() | def updateListBoxItems(self, callCallback = 1): if not self.listbox: return last = self.getText() tuples = self.listboxItems if not self.caseSensitive: tuples = [(text.lower(), item) for (text, item) in tuples] last = last.lower() | |
try: | if self.caseSensitive: | def updateListBoxItems(self, callCallback = 1): if not self.listbox: return last = self.getText() tuples = self.listboxItems if not self.caseSensitive: tuples = [(text.lower(), item) for (text, item) in tuples] last = last.lower() |
tuples = [(text, QListWidgetItem(item)) for (text, item) in tuples if pattern.match(text)] except: tuples = [(t, QListWidgetItem(i)) for (t,i) in self.listboxItems] else: if self.matchAnywhere: tuples = [(text, QListWidgetItem(item)) for (text, item) in tuples if last in text] else: tuples = [(text, ... | else: pattern = re.compile(last, re.IGNORECASE) for item in self.listbox.py_iter(): text = str(item.text()) if not self.caseSensitive: text = text.lower() if self.useRE: try: test = pattern.match(text) except Exception, ex: print ex test = True else: if self.matchAnywhere: test = last in text else: test = text.startsw... | def updateListBoxItems(self, callCallback = 1): if not self.listbox: return last = self.getText() tuples = self.listboxItems if not self.caseSensitive: tuples = [(text.lower(), item) for (text, item) in tuples] last = last.lower() |
font = font.toPyObject() | font = QFont(font) | def linkRect(self, option, index): style = self.parent().style() text = self.displayText(index.data(Qt.DisplayRole), QLocale.system()) textRect = style.subElementRect(QStyle.SE_ItemViewItemText, option) margin = style.pixelMetric(QStyle.PM_FocusFrameHMargin, option) + 1 textRect = textRect.adjusted(margin, 0, -margin, ... |
painter.setFont(font.toPyObject()) | painter.setFont(QFont(font)) | def paint(self, painter, option, index): if index.data(LinkRole).isValid(): style = qApp.style() style.drawPrimitive(QStyle.PE_PanelItemViewRow, option, painter) style.drawPrimitive(QStyle.PE_PanelItemViewItem, option, painter) text = self.displayText(index.data(Qt.DisplayRole), QLocale.system()) textRect = style.subEl... |
self.reportButton = OWGUI.button(bottom, self, "&Report", self.reportAndFinish, addToLayout=0) | self.reportButton = OWGUI.button(bottom, self, "&Report", self.reportAndFinish, addToLayout=0, debuggingEnabled=0) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "AssociationRulesViewer", wantMainArea=0, noReport=True) |
self.saveButton.setEnabled(len(self.selectedRules) > 0) | def updateRuleList(self): self.selectedRules = sum(sum((row[self.sel_colmin : self.sel_colmax+1] for row in self.ingrid[self.sel_rowmin : self.sel_rowmax+1]), []), []) self.displayRules() self.updateConfSupp() self.saveButton.setEnabled(len(self.selectedRules) > 0) | |
if attr.varType == orange.VarTypes.Discrete and False: return lambda val: OWColorPalette.ColorPaletteHSV(self.map.examples.domain[attr].values)[val] | if attr.varType == orange.VarTypes.Discrete: index = self.map.examples.domain.index(attr) vals = [n.vector[index] for n in self.map.map] minval, maxval = min(vals), max(vals) print minval, maxval return lambda val: OWColorPalette.ColorPaletteBW()[min(max(1 - (val - minval) / (maxval - minval or 1), 0.0), 1.0)] | def colorSchema(attr): if attr is None: return lambda val: QColor(Qt.white) elif type(attr) == int: attr = self.map.examples.domain[attr] if attr.varType == orange.VarTypes.Discrete and False: return lambda val: OWColorPalette.ColorPaletteHSV(self.map.examples.domain[attr].values)[val] else: index = self.map.examples.... |
vals = arr[:,index] minval, maxval = min(vals), max(vals) return lambda val: self._histogramColorSchema(1 - (val - minval) / (maxval - minval or 1)) | if index == arr.shape[1]: vals = c else: vals = arr[:,index] minval, maxval = numpy.min(vals), numpy.max(vals) def f(val): return self._histogramColorSchema((val - minval) / (maxval - minval or 1)) return f | def colorSchema(attr): if attr is None: return lambda val: QColor(Qt.white) elif type(attr) == int: attr = self.map.examples.domain[attr] if attr.varType == orange.VarTypes.Discrete: return schema else: index = self.map.examples.domain.index(attr) arr, c, w = self.histogramData.toNumpyMA() vals = arr[:,index] minval, ... |
self.componentLegendItem = None self.histLegendItem = None | def __init__(self, parent=None): QGraphicsWidget.__init__(self, parent) self.setLayout(QGraphicsLinearLayout()) self.legendLayout = QGraphicsLinearLayout(Qt.Vertical) self.layout().addItem(self.legendLayout) | |
if self.legendLayout.count() > 0: item = self.legendLayout.itemAt(0) item.scene().removeItem(item) self.legendLayout.removeAt(0) | if self.componentLegendItem is not None: self.scene().removeItem(self.componentLegendItem) self.componentLegendItem = None | def setComponentPlane(self, attr): self.componentPlane = attr self.somItem.setComponentPlane(attr) if self.legendLayout.count() > 0: item = self.legendLayout.itemAt(0) item.scene().removeItem(item) self.legendLayout.removeAt(0) if attr is not None: self.legendItem = LegendItem(attr, parent=self) self.legendItem.setOrie... |
self.legendItem = LegendItem(attr, parent=self) self.legendItem.setOrientation(Qt.Vertical) self.legendLayout.addItem(self.legendItem) self.legendItem.setScale(self.somItem.componentRange(attr)) | self.componentLegendItem = LegendItem(attr, parent=self) self.componentLegendItem.setOrientation(Qt.Vertical) self.legendLayout.insertItem(0, self.componentLegendItem) self.componentLegendItem.setScale(self.somItem.componentRange(attr)) | def setComponentPlane(self, attr): self.componentPlane = attr self.somItem.setComponentPlane(attr) if self.legendLayout.count() > 0: item = self.legendLayout.itemAt(0) item.scene().removeItem(item) self.legendLayout.removeAt(0) if attr is not None: self.legendItem = LegendItem(attr, parent=self) self.legendItem.setOrie... |
if getattr(self, "histLegendItem", None) is not None: | if self.histLegendItem is not None: | def setHistogramConstructor(self, constructor): self.histogramConstructor = constructor self.somItem.setHistogramConstructor(constructor) if getattr(self, "histLegendItem", None) is not None: self.scene().removeItem(self.histLegendItem) self.histLegendItem = None if constructor and getattr(constructor, "legendItemConst... |
self.data = data for item in self.somWidgets(): item.setHistogramData(data) | if data is not self.histogramData: self.histogramData = data for item in self.somWidgets(): item.setHistogramData(data) | def setHistogramData(self, data): self.data = data for item in self.somWidgets(): item.setHistogramData(data) |
for item in self.somWidgets(): item.setHistogramConstructor(constructor) | if self.histogramConstructor is not constructor: self.histogramConstructor = constructor for item in self.somWidgets(): item.setHistogramConstructor(constructor) | def setHistogramConstructor(self, constructor): for item in self.somWidgets(): item.setHistogramConstructor(constructor) |
for item in self.somWidgets(): item.setHistogramColorSchema(schema) def setGridMode(self, mode): return for item in self.somWidgets(): item.setGridMode(mode) def setColorSchema(self, schema): for item in self.somWidgets(): item.setColorSchema(schema) def setComponentPlane(self, attr): self.clear() self.somWidget = S... | if schema is not self.histogramColorSchema: self.histogramColorSchema = schema for item in self.somWidgets(): item.setHistogramColorSchema(schema) def setComponentColorSchema(self, schema): if schema is not self.componentColorSchema: self.componentColorSchema = schema for item in self.somWidgets(): item.setComponentCo... | def setHistogramColorSchema(self, schema): for item in self.somWidgets(): item.setHistogramColorSchema(schema) |
self.selectionRectItem.setRect(self.selectionManager.lastSelectionRect()) | if self.selectionRectItem: self.selectionRectItem.setRect(self.selectionManager.lastSelectionRect()) | def mouseMoveEvent(self, event): if event.buttons() & Qt.LeftButton: self.selectionManager.update(event) self.selectionRectItem.setRect(self.selectionManager.lastSelectionRect()) |
if self.drawMode in [0 ,2]: self.scene.setComponentPlane(self.component if self.drawMode == 2 else None) | self.error(0) if self.drawMode == 0: self.scene.setComponentPlane(None) elif self.drawMode == 2: self.scene.setComponentPlane(self.component) | def setMode(self): self.componentCombo.setEnabled(self.drawMode == 2) if not self.somMap: return if self.drawMode in [0 ,2]: self.scene.setComponentPlane(self.component if self.drawMode == 2 else None) elif self.drawMode == 1: self.scene.setUMatrix() if self.histogram: self.setHistogram() self.updateToolTips() self.upd... |
attr = self.somMap.examples.domain.variables[self.attribute] | def setHistogram(self): if self.somMap and self.histogram: if self.inputSet and self.examples is not None and self.examples.domain == self.somMap.examples.domain: self.scene.setHistogramData(self.examples) else: self.scene.setHistogramData(self.somMap.examples) attr = self.somMap.examples.domain.variables[self.attribu... | |
schema = ColorPalette([(255, 0, 0), (0, 255, 0)]) if self.contHistMode == 1 else None | schema = ColorPalette([(0, 255, 0), (255, 0, 0)]) if self.contHistMode == 1 else None | def setHistogram(self): if self.somMap and self.histogram: if self.inputSet and self.examples is not None and self.examples.domain == self.somMap.examples.domain: self.scene.setHistogramData(self.examples) else: self.scene.setHistogramData(self.somMap.examples) attr = self.somMap.examples.domain.variables[self.attribu... |
self.scene.component = 0 | def setSom(self, somMap=None): self.closeContext() self.somMap = somMap if not somMap: self.clear() return self.componentCombo.clear() self.attributeCombo.clear() self.targetValue = 0 self.scene.component = 0 self.attribute = 0 for v in somMap.examples.domain.attributes: self.componentCombo.addItem(v.name) for v in so... | |
for widget in self.scene.somWidgets(): for node in widget.somItem.nodes(): node.setSelected(not node.isSelected()) | self._invertingSelection = True try: for widget in self.scene.somWidgets(): for node in widget.somItem.nodes(): node.setSelected(not node.isSelected()) finally: del self._invertingSelection self.commitIf() | def invertSelection(self): for widget in self.scene.somWidgets(): for node in widget.somItem.nodes(): node.setSelected(not node.isSelected()) |
if self.commitOnChange: | if self.commitOnChange and not getattr(self, "_invertingSelection", False): | def commitIf(self): if self.commitOnChange: self.commit() else: self.selectionChanged = True |
data = orange.ExampleTable("../../doc/datasets/iris.tab") | data = orange.ExampleTable("../../doc/datasets/housing.tab") | def saveGraph(self): sizeDlg = OWChooseImageSizeDlg(self.scene) sizeDlg.exec_() |
return cls | return cls.RedirectContext() | def setredirect(cls, redirect): cls.redirect = staticmethod(redirect) return cls |
cls.redirect = None | def __exit__(cls, exc_type, exc_value, traceback): cls.redirect = None cls.lock.release() return False | |
"yield", "break", "continue", "raise", "or", "and", "True", "False", "pass"] | "yield", "break", "continue", "raise", "or", "and", "True", "False", "pass", "from", "as"] | def __init__(self, parent=None): self.keywordFormat = QTextCharFormat() self.keywordFormat.setForeground(QBrush(Qt.blue)) self.keywordFormat.setFontWeight(QFont.Bold) self.stringFormat = QTextCharFormat() self.stringFormat.setForeground(QBrush(Qt.green)) self.stringFormat.setFontWeight(QFont.Bold) self.defFormat = QTex... |
(QRegExp(r'".*"'), self.stringFormat)] | (QRegExp(r'".*"'), self.stringFormat), (QRegExp(r" | def __init__(self, parent=None): self.keywordFormat = QTextCharFormat() self.keywordFormat.setForeground(QBrush(Qt.blue)) self.keywordFormat.setFontWeight(QFont.Bold) self.stringFormat = QTextCharFormat() self.stringFormat.setForeground(QBrush(Qt.green)) self.stringFormat.setFontWeight(QFont.Bold) self.defFormat = QTex... |
cursor.movePosition(QTextCursor.End) | cursor.movePosition(QTextCursor.End, QTextCursor.MoveAnchor) | def write(self, data): cursor = QTextCursor(self.document()) cursor.movePosition(QTextCursor.End) cursor.insertText(data) self.ensureCursorVisible() |
self.text.setFont(QFont("Monospace")) | self.text.document().setDefaultFont(QFont("Monaco")) | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, 'Python Script') self.inputs = [("inExampleTable", ExampleTable, self.setExampleTable), ("inDistanceMatrix", orange.SymMatrix, self.setDistanceMatrix), ("inNetwork", orngNetwork.Network, self.setNetwork), ("inLearner", ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.