internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: biolab/orange3

Issue:
SVM 2 class prediction changed from version 3.3.12 to 3.4.0
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Orange version
 3.4.0

##### Expected behavior
Float value for 2 class prediction by SVM


##### Actual behavior
SVM returns 0 or 1 (behavior like OneClass prediction)
Not possible to do meaningful  ROC analysis

##### Steps to reproduce the behavior



##### Additional info (worksheets, data, screenshots, ...)





Discussion:

Resolving patch:
diff --git a/Orange/widgets/model/owsvm.py b/Orange/widgets/model/owsvm.py
--- a/Orange/widgets/model/owsvm.py
+++ b/Orange/widgets/model/owsvm.py
@@ -199,6 +199,7 @@ def create_learner(self):
             'degree': self.degree,
             'gamma': self.gamma or self._default_gamma,
             'coef0': self.coef0,
+            'probability': True,
             'tol': self.tol,
             'max_iter': self.max_iter if self.limit_iter else -1,
             'preprocessors': self.preprocessors


Test patch:
Repository: biolab/orange3

Issue:
Scatter Plot: can't label with Corpus
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.5.dev

##### Expected behavior
Use labels from corpora.


##### Actual behavior
Scatter Plot crashes with: 'variable' not in domain.


##### Steps to reproduce the behavior
Corpus (bookexcertps) - Scatter Plot (label with text).


##### Additional info (worksheets, data, screenshots, ...)
Traceback (most recent call last):
  File "/Users/ajda/orange/orange3/Orange/data/domain.py", line 282, in index
    return self._indices[var]
KeyError: StringVariable(name='text')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ajda/orange/orange3/Orange/widgets/gui.py", line 2258, in __call__
    self.func(**kwds)
  File "/Users/ajda/orange/orange3/Orange/widgets/visualize/owscatterplotgraph.py", line 947, in update_labels
    label_column = self.data.get_column_view(self.attr_label)[0]
  File "/Users/ajda/orange/orange3/Orange/data/table.py", line 1095, in get_column_view
    index = self.domain.index(index)
  File "/Users/ajda/orange/orange3/Orange/data/domain.py", line 284, in index
    raise ValueError("'%s' is not in domain" % var)
ValueError: 'text' is not in domain




Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py
--- a/Orange/widgets/visualize/owscatterplotgraph.py
+++ b/Orange/widgets/visualize/owscatterplotgraph.py
@@ -935,6 +935,11 @@ def create_labels(self):
             ti.setPos(x, y)
             self.labels.append(ti)
 
+    def _create_label_column(self):
+        if self.attr_label in self.data.domain:
+            return self.data.get_column_view(self.attr_label)[0]
+        return self.master.data.get_column_view(self.attr_label)[0]
+
     def update_labels(self):
         if self.attr_label is None or \
                 self.label_only_selected and self.selection is None:
@@ -944,7 +949,7 @@ def update_labels(self):
         self.assure_attribute_present(self.attr_label)
         if not self.labels:
             self.create_labels()
-        label_column = self.data.get_column_view(self.attr_label)[0]
+        label_column = self._create_label_column()
         formatter = self.attr_label.str_val
         label_data = map(formatter, label_column)
         black = pg.mkColor(0, 0, 0)


Test patch:
Repository: biolab/orange3

Issue:
OWColor Doesn't Recognize Changes to DiscreteVariable's Values
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.5.0.dev0+971a83a

##### Expected behavior
Changes to DiscreteVariable's set of values are considered by Color widget.

##### Actual behavior
OWColor doesn't recognize new values in DiscreteVariable's domain. It uses the old context with the old set of values.


##### Steps to reproduce the behavior
Load `titanic`, in select rows select only statuses `first` and `second`, pass them through PurgeDomain and next into the Color widget. In the PurgeDomain tick `Remove unused feature values` and observe Color widget. The list of values for `status` should change, but it doesn't.


##### Additional info (worksheets, data, screenshots, ...)
![screen shot 2017-06-05 at 15 25 38](https://cloud.githubusercontent.com/assets/713026/26785563/5e903a46-4a03-11e7-9ee6-48c3c9cb6093.png)



Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owcolor.py b/Orange/widgets/data/owcolor.py
--- a/Orange/widgets/data/owcolor.py
+++ b/Orange/widgets/data/owcolor.py
@@ -286,7 +286,8 @@ class OWColor(widget.OWWidget):
     inputs = [("Data", Orange.data.Table, "set_data")]
     outputs = [("Data", Orange.data.Table)]
 
-    settingsHandler = settings.PerfectDomainContextHandler()
+    settingsHandler = settings.PerfectDomainContextHandler(
+        match_values=settings.PerfectDomainContextHandler.MATCH_VALUES_ALL)
     disc_data = settings.ContextSetting([])
     cont_data = settings.ContextSetting([])
     color_settings = settings.Setting(None)


Test patch:
Repository: biolab/orange3

Issue:
OWColors Widget Doesn't Propagate Changes
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.5.0.dev0+971a83a


##### Expected behavior
After one changes some colors, the changes should be propageted to say ScatterPlot.


##### Actual behavior
Changes of colors are not propagated.


##### Steps to reproduce the behavior
Load `iris`, pass it though Color widget and then to ScatterPlot


##### Additional info (worksheets, data, screenshots, ...)
![screen shot 2017-06-05 at 17 03 45](https://cloud.githubusercontent.com/assets/713026/26789558/f52d9b1c-4a10-11e7-8703-355acbd4c055.png)






Discussion:
This seems to be the result of the changes introduced in #2285 (https://github.com/biolab/orange3/pull/2285/commits/eb6c1ba230c61fa861535d876a6318c718722762#diff-7f80eb6604120f8c819ff0b490c6f330).

Resolving patch:
diff --git a/Orange/data/table.py b/Orange/data/table.py
--- a/Orange/data/table.py
+++ b/Orange/data/table.py
@@ -349,7 +349,10 @@ def match_type(x):
                     if cached:
                         return cached
                 if domain == source.domain:
-                    return cls.from_table_rows(source, row_indices)
+                    table = cls.from_table_rows(source, row_indices)
+                    # assure resulting domain is the instance passed on input
+                    table.domain = domain
+                    return table
 
                 if isinstance(row_indices, slice):
                     start, stop, stride = row_indices.indices(source.X.shape[0])


Test patch:
diff --git a/Orange/tests/test_table.py b/Orange/tests/test_table.py
--- a/Orange/tests/test_table.py
+++ b/Orange/tests/test_table.py
@@ -1,15 +1,16 @@
 # Test methods with long descriptive names can omit docstrings
 # pylint: disable=missing-docstring
 
+import copy
 import os
+import random
 import unittest
 from itertools import chain
 from math import isnan
-import random
-
 from unittest.mock import Mock, MagicMock, patch
-import scipy.sparse as sp
+
 import numpy as np
+import scipy.sparse as sp
 
 from Orange import data
 from Orange.data import (filter, Unknown, Variable, Table, DiscreteVariable,
@@ -1735,6 +1736,12 @@ class MyTableClass(data.Table):
         self.assertIsNot(table, new_table)
         self.assertIs(new_table.domain, new_domain)
 
+    def test_transform_same_domain(self):
+        iris = data.Table("iris")
+        new_domain = copy.copy(iris.domain)
+        new_data = iris.transform(new_domain)
+        self.assertIs(new_data.domain, new_domain)
+
     def test_can_copy_table(self):
         new_table = data.Table.from_table(self.domain, self.table)
         self.assert_table_with_filter_matches(new_table, self.table)
Repository: biolab/orange3

Issue:
Distributions: show probabilities upon selection
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.5.dev

##### Expected behavior
When selecting Show probabilities the probability line(s) are immediately displayed.


##### Actual behavior
The lines are not immediately displayed. One needs to switch the visualization to see probabilities. Re-drawing the plot should be run upon selection.


##### Steps to reproduce the behavior
File - Distributions. Press Show probabilities.


##### Additional info (worksheets, data, screenshots, ...)





Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owdistributions.py b/Orange/widgets/visualize/owdistributions.py
--- a/Orange/widgets/visualize/owdistributions.py
+++ b/Orange/widgets/visualize/owdistributions.py
@@ -220,6 +220,8 @@ def set_data(self, data):
         self.clear()
         self.warning()
         self.data = data
+        self.distributions = None
+        self.contingencies = None
         if self.data is not None:
             if not self.data:
                 self.warning("Empty input data cannot be visualized")
@@ -332,7 +334,7 @@ def help_event(self, ev):
     def display_distribution(self):
         dist = self.distributions
         var = self.var
-        if not len(dist):
+        if dist is None or not len(dist):
             return
         self.plot.clear()
         self.plot_prob.clear()
@@ -371,8 +373,6 @@ def display_distribution(self):
                 self.tooltip_items.append((self.plot, item))
 
     def _on_relative_freq_changed(self):
-        if not self.distributions:
-            return
         self.set_left_axis_name()
         if self.cvar and self.cvar.is_discrete:
             self.display_contingency()
@@ -386,7 +386,7 @@ def display_contingency(self):
         """
         cont = self.contingencies
         var, cvar = self.var, self.cvar
-        if not len(cont):
+        if cont is None or not len(cont):
             return
         self.plot.clear()
         self.plot_prob.clear()


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owdistributions.py b/Orange/widgets/visualize/tests/test_owdistributions.py
--- a/Orange/widgets/visualize/tests/test_owdistributions.py
+++ b/Orange/widgets/visualize/tests/test_owdistributions.py
@@ -73,6 +73,13 @@ def test_no_distributions(self):
         Do not fail when there is no data and when sb clicks
         "Show relative frequencies".
         GH-2383
+        GH-2428
         """
         self.send_signal(self.widget.Inputs.data, None)
         self.widget.cb_rel_freq.click()
+        self.send_signal(self.widget.Inputs.data, self.data)
+        self.widget.cb_rel_freq.setChecked(False)
+        self.widget.cb_rel_freq.click()
+        self.send_signal(self.widget.Inputs.data, None)
+        self.widget.cb_rel_freq.setChecked(True)
+        self.widget.cb_rel_freq.click()
Repository: biolab/orange3

Issue:
Mosaic: Doesn't clear when data is disconnected
##### Orange version
3.5.0.dev0+942877a


##### Expected behavior
Mosaic clears its state when the input data is disconnected and reverts to what it looked like on first open.


##### Actual behavior
The data is not cleared and the display doesn't update at all


##### Steps to reproduce the behavior
1. Add Mosaic widget to canvas
2. Connect File with some data to Mosaic
3. Open Mosaic (plot is drawn)
4. Disconnect File from Mosaic (_plot doesn't update_)


##### Additional info (worksheets, data, screenshots, ...)
![](https://i.gyazo.com/7edda695c6eafa160eef4fdac37b6c06.png)




Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owmosaic.py b/Orange/widgets/visualize/owmosaic.py
--- a/Orange/widgets/visualize/owmosaic.py
+++ b/Orange/widgets/visualize/owmosaic.py
@@ -384,6 +384,7 @@ def init_combos(self, data):
         for combo in self.attr_combos:
             combo.clear()
         if data is None:
+            self.color_model.set_domain(None)
             return
         for combo in self.attr_combos[1:]:
             combo.addItem("(None)")
@@ -440,6 +441,8 @@ def set_data(self, data):
             and len(self.data.domain.attributes) >= 1)
 
         if self.data is None:
+            self.discrete_data = None
+            self.init_combos(None)
             return
 
         self.color_model.set_domain(self.data.domain)


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owmosaic.py b/Orange/widgets/visualize/tests/test_owmosaic.py
--- a/Orange/widgets/visualize/tests/test_owmosaic.py
+++ b/Orange/widgets/visualize/tests/test_owmosaic.py
@@ -77,6 +77,25 @@ def test_keyerror(self):
         data = data[0:1]
         self.send_signal(self.widget.Inputs.data, data)
 
+    def test_combos_and_mosaic(self):
+        """
+        Text in combos is wiped away when there is no data and mosaic disappears as well.
+        GH-2459
+        GH-2462
+        """
+        def assertCount(cb_color, cb_attr, areas):
+            self.assertEqual(len(self.widget.areas), areas)
+            self.assertEqual(self.widget.cb_attr_color.count(), cb_color)
+            for i, combo in enumerate(self.widget.attr_combos):
+                self.assertEqual(combo.count(), cb_attr[i])
+
+        data = Table("iris")
+        assertCount(1, [0, 0, 0, 0], 0)
+        self.send_signal(self.widget.Inputs.data, data)
+        assertCount(6, [5, 6, 6, 6], 16)
+        self.send_signal(self.widget.Inputs.data, None)
+        assertCount(1, [0, 0, 0, 0], 0)
+
 # Derive from WidgetTest to simplify creation of the Mosaic widget, although
 # we are actually testing the MosaicVizRank dialog and not the widget
Repository: biolab/orange3

Issue:
Scatter Plot Graph: shapes legend does not show proper shapes
##### Orange version
master


##### Expected behavior
Shapes shown in the legend are the same as those used in the plot.


##### Actual behavior
![screenshot_20170721_101139](https://user-images.githubusercontent.com/22157215/28454910-3b020f0a-6dfd-11e7-8333-75fff57babd2.png)



##### Steps to reproduce the behavior
See screenshot above.


##### Additional info (worksheets, data, screenshots, ...)





Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py
--- a/Orange/widgets/visualize/owscatterplotgraph.py
+++ b/Orange/widgets/visualize/owscatterplotgraph.py
@@ -1064,12 +1064,11 @@ def make_shape_legend(self):
         if not self.legend:
             self.create_legend()
         shape_var = self.domain[shape_index]
-        color = self.plot_widget.palette().color(OWPalette.Data)
-        pen = QPen(color.darker(self.DarkerValue))
+        color = QColor(0, 0, 0)
         color.setAlpha(self.alpha_value)
         for i, value in enumerate(shape_var.values):
             self.legend.addItem(
-                ScatterPlotItem(pen=pen, brush=color, size=10,
+                ScatterPlotItem(pen=color, brush=color, size=10,
                                 symbol=self.CurveSymbols[i]), escape(value))
 
     def zoom_button_clicked(self):


Test patch:
Repository: biolab/orange3

Issue:
Scatter Plot: control area expands
##### Orange version
last version and many previous ones


##### Expected behavior
Control area should not expand when hiding it, showing it again and the maximizing the Scatter Plot window.


##### Actual behavior
See below.


##### Steps to reproduce the behavior
![screenshot_20170810_100345](https://user-images.githubusercontent.com/22157215/29160729-ba4a75c0-7db3-11e7-9085-d9827e7ae62c.png)

Hiding the control area:

![screenshot_20170810_100408](https://user-images.githubusercontent.com/22157215/29160732-be19f270-7db3-11e7-8bf3-ab92f83e4ea5.png)

Showing it again and expanding the window:
![screenshot_20170810_100432](https://user-images.githubusercontent.com/22157215/29160724-b491bf9e-7db3-11e7-9e77-a73abc18a949.png)



Discussion:

Resolving patch:
diff --git a/Orange/widgets/widget.py b/Orange/widgets/widget.py
--- a/Orange/widgets/widget.py
+++ b/Orange/widgets/widget.py
@@ -256,7 +256,7 @@ def mouseReleaseEvent(self, event):
                 """Resize on left button"""
                 if event.button() == Qt.LeftButton:
                     splitter = self.splitter()
-                    splitter.setSizes([int(splitter.sizes()[0] == 0), 1000])
+                    splitter.setSizes([int(splitter.sizes()[0] == 0), 100000])
                 super().mouseReleaseEvent(event)
 
             def mouseMoveEvent(self, event):


Test patch:
Repository: biolab/orange3

Issue:
Tree ignores preprocessors
##### Orange version
3.5.0

##### Expected behavior
Tree should use defined (connected) preprocessors.

##### Actual behavior
It seems to ignore them.

##### Steps to reproduce the behavior
Adding a preprocessor that randomizes the class values results in the same classification accuracy as without.

##### Additional info (worksheets, data, screenshots, ...)
![tree](https://user-images.githubusercontent.com/919223/30205915-b5ab835e-948a-11e7-9854-25bec0203ac6.png)




Discussion:

Resolving patch:
diff --git a/Orange/classification/tree.py b/Orange/classification/tree.py
--- a/Orange/classification/tree.py
+++ b/Orange/classification/tree.py
@@ -58,8 +58,8 @@ class TreeLearner(Learner):
     def __init__(
             self, *args, binarize=False, max_depth=None,
             min_samples_leaf=1, min_samples_split=2, sufficient_majority=0.95,
-            **kwargs):
-        super().__init__(*args, **kwargs)
+            preprocessors=None, **kwargs):
+        super().__init__(preprocessors=preprocessors)
         self.params = {}
         self.binarize = self.params['binarize'] = binarize
         self.min_samples_leaf = self.params['min_samples_leaf'] = min_samples_leaf


Test patch:
diff --git a/Orange/tests/test_tree.py b/Orange/tests/test_tree.py
--- a/Orange/tests/test_tree.py
+++ b/Orange/tests/test_tree.py
@@ -2,17 +2,18 @@
 # pylint: disable=missing-docstring
 
 import unittest
+from unittest.mock import Mock
 
 import numpy as np
 import sklearn.tree as skl_tree
 from sklearn.tree._tree import TREE_LEAF
 
 from Orange.data import Table
-from Orange.classification import SklTreeLearner
+from Orange.classification import SklTreeLearner, TreeLearner
 from Orange.regression import SklTreeRegressionLearner
 
 
-class TestTreeLearner(unittest.TestCase):
+class TestSklTreeLearner(unittest.TestCase):
     def test_classification(self):
         table = Table('iris')
         learn = SklTreeLearner()
@@ -28,6 +29,16 @@ def test_regression(self):
         self.assertTrue(np.all(table.Y.flatten() == pred))
 
 
+class TestTreeLearner(unittest.TestCase):
+    def test_uses_preprocessors(self):
+        iris = Table('iris')
+        mock_preprocessor = Mock(return_value=iris)
+
+        tree = TreeLearner(preprocessors=[mock_preprocessor])
+        tree(iris)
+        mock_preprocessor.assert_called_with(iris)
+
+
 class TestDecisionTreeClassifier(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
Repository: biolab/orange3

Issue:
Scatter Plot: Wrong labelling for 'Label only selected points'
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.5.dev

##### Expected behavior
When 'Label only selected points' is selected, selected data point gets labelled.


##### Actual behavior
Label is wrong - another data point is labelled, not the one selected.


##### Steps to reproduce the behavior
Happens when a subset is displayed on a Scatter Plot. See screenshots for details.


##### Additional info (worksheets, data, screenshots, ...)
<img width="402" alt="screen shot 2017-09-13 at 11 31 22" src="https://user-images.githubusercontent.com/12524972/30370198-2845c02e-9877-11e7-8e6a-ef81cef55091.png">

<img width="1157" alt="screen shot 2017-09-13 at 11 28 49" src="https://user-images.githubusercontent.com/12524972/30370392-bc0d7644-9877-11e7-9168-0736e2e6afab.png">





Discussion:
By selected in the screenshot I actually mean labelled. Duh.

Resolving patch:
diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py
--- a/Orange/widgets/visualize/owscatterplotgraph.py
+++ b/Orange/widgets/visualize/owscatterplotgraph.py
@@ -962,9 +962,10 @@ def update_labels(self):
         formatter = self.attr_label.str_val
         label_data = map(formatter, label_column)
         black = pg.mkColor(0, 0, 0)
+        selection = self.selection[self.valid_data] if self.selection is not None else []
         if self.label_only_selected:
             for label, text, selected \
-                    in zip(self.labels, label_data, self.selection):
+                    in zip(self.labels, label_data, selection):
                 label.setText(text if selected else "", black)
         else:
             for label, text in zip(self.labels, label_data):


Test patch:
Repository: biolab/orange3

Issue:
Names of models are not saved as settings
1. Put logistic regression on the canvas.
2. Edit its name
3. Save the schema
4. Close canvas
5. Open Orange and load the schema

The logistic regression name is reverted back to Logistic regression.

--------

The base class for learners sets `self.learner_name = self.name` in `__init__`, where `self.name` is the widgets class attribute `name`, which is set later in the derived classes. So `learner_name = Setting(name)` or `learner_name = Setting(OWWidget.name)` won't work since the name is only defined later. Having `learner_name = Setting("")` would require some magic.

`OWBaseLearner` already has a meta class. This may be the point where the setting can be properly initialized since the `name` is already set then.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/utils/owlearnerwidget.py b/Orange/widgets/utils/owlearnerwidget.py
--- a/Orange/widgets/utils/owlearnerwidget.py
+++ b/Orange/widgets/utils/owlearnerwidget.py
@@ -67,6 +67,7 @@ class OWBaseLearner(OWWidget, metaclass=OWBaseLearnerMeta):
     LEARNER = None
     supports_sparse = True
 
+    learner_name = Setting(None, schema_only=True)
     want_main_area = False
     resizing_enabled = False
     auto_apply = Setting(True)
@@ -96,7 +97,8 @@ def __init__(self):
         self.data = None
         self.valid_data = False
         self.learner = None
-        self.learner_name = self.name
+        if self.learner_name is None:
+            self.learner_name = self.name
         self.model = None
         self.preprocessors = None
         self.outdated_settings = False


Test patch:
diff --git a/Orange/widgets/utils/tests/test_owlearnerwidget.py b/Orange/widgets/utils/tests/test_owlearnerwidget.py
--- a/Orange/widgets/utils/tests/test_owlearnerwidget.py
+++ b/Orange/widgets/utils/tests/test_owlearnerwidget.py
@@ -96,3 +96,16 @@ class WidgetA(OWBaseLearner):
         self.assertIn(WidgetA.Inputs.data.name, inputs)
         self.assertIn(WidgetA.Inputs.preprocessor.name, inputs)
         self.assertIn("A", inputs)
+
+    def test_persists_learner_name_in_settings(self):
+        class WidgetA(OWBaseLearner):
+            name = "A"
+            LEARNER = KNNLearner
+
+        w1 = self.create_widget(WidgetA)
+        self.assertEqual(w1.learner_name, "A")
+        w1.learner_name = "MyWidget"
+
+        settings = w1.settingsHandler.pack_data(w1)
+        w2 = self.create_widget(WidgetA, settings)
+        self.assertEqual(w2.learner_name, w1.learner_name)