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

Issue:
OWLinePlot: legible axis labels
Follow up from #2110.

Current status of Line Plot widget. Labels overlap on x and the final attribute name, if long, falls out of view.
<img width="826" alt="Screen Shot 2019-04-12 at 11 06 58" src="https://user-images.githubusercontent.com/12524972/56025847-3ff08580-5d13-11e9-8eb8-268ca4965351.png">

Proposed solution: elide labels and enforce minimum widget width. If there are hundreds of attributes (gene expressions), show every n-th.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owlineplot.py b/Orange/widgets/visualize/owlineplot.py
--- a/Orange/widgets/visualize/owlineplot.py
+++ b/Orange/widgets/visualize/owlineplot.py
@@ -91,6 +91,18 @@ class LinePlotStyle:
     MEAN_DARK_FACTOR = 110
 
 
+class LinePlotAxisItem(pg.AxisItem):
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self._ticks = {}
+
+    def set_ticks(self, ticks):
+        self._ticks = dict(enumerate(ticks, 1)) if ticks else {}
+
+    def tickStrings(self, values, scale, spacing):
+        return [self._ticks.get(v * scale, "") for v in values]
+
+
 class LinePlotViewBox(ViewBox):
     selection_changed = Signal(np.ndarray)
 
@@ -172,8 +184,10 @@ def reset(self):
 
 class LinePlotGraph(pg.PlotWidget):
     def __init__(self, parent):
+        self.bottom_axis = LinePlotAxisItem(orientation="bottom")
         super().__init__(parent, viewBox=LinePlotViewBox(),
-                         background="w", enableMenu=False)
+                         background="w", enableMenu=False,
+                         axisItems={"bottom": self.bottom_axis})
         self.view_box = self.getViewBox()
         self.selection = set()
         self.legend = self._create_legend(((1, 0), (1, 0)))
@@ -213,7 +227,7 @@ def reset(self):
         self.selection = set()
         self.view_box.reset()
         self.clear()
-        self.getAxis('bottom').setTicks(None)
+        self.getAxis('bottom').set_ticks(None)
         self.legend.hide()
 
     def select_button_clicked(self):
@@ -593,8 +607,8 @@ def setup_plot(self):
         if self.data is None:
             return
 
-        ticks = [[(i, a.name) for i, a in enumerate(self.graph_variables, 1)]]
-        self.graph.getAxis('bottom').setTicks(ticks)
+        ticks = [a.name for a in self.graph_variables]
+        self.graph.getAxis("bottom").set_ticks(ticks)
         self.plot_groups()
         self.apply_selection()
         self.graph.view_box.enableAutoRange()


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owlineplot.py b/Orange/widgets/visualize/tests/test_owlineplot.py
--- a/Orange/widgets/visualize/tests/test_owlineplot.py
+++ b/Orange/widgets/visualize/tests/test_owlineplot.py
@@ -290,3 +290,7 @@ def test_lines_intersection(self):
                           for i in range(y.shape[1])])
         i = line_intersects_profiles(a, b, table)
         np.testing.assert_array_equal(np.array([False, True, True, True]), i)
+
+
+if __name__ == "__main__":
+    unittest.main()
Repository: biolab/orange3

Issue:
OWMosaicDisplay: legible axis labels
Follow up from #2110.

Current status of Mosaic Display widget. The widget discretizes to 4 values, which normally results in nice visualizations. Only when it doesn't - values are very small or discrete variables has many and/or long labels.
<img width="668" alt="Screen Shot 2019-04-12 at 10 43 19" src="https://user-images.githubusercontent.com/12524972/56024268-f2264e00-5d0f-11e9-9414-803d80efe078.png">

I propose we elide the label that goes over the width of its own field. If field smaller than some width, hide the label.



Discussion:
Also fix showing of datetime variable. Currently, datetime is converted to float (which in the background it definitely should), but it should be displayed to the user as datetime.

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
@@ -665,15 +665,24 @@ def draw_text(side, attr, x0_x1, y0_y1,
             for i, val in enumerate(values):
                 if distributiondict[val] != 0:
                     perc = counts[i] / float(total)
-                    xs = [x0 + currpos + width * 0.5 * perc,
+                    rwidth = width * perc
+                    xs = [x0 + currpos + rwidth / 2,
                           x0 - self.ATTR_VAL_OFFSET,
-                          x0 + currpos + width * perc * 0.5,
+                          x0 + currpos + rwidth / 2,
                           x1 + self.ATTR_VAL_OFFSET]
                     ys = [y1 + self.ATTR_VAL_OFFSET,
                           y0 + currpos + height * 0.5 * perc,
                           y0 - self.ATTR_VAL_OFFSET,
                           y0 + currpos + height * 0.5 * perc]
-                    CanvasText(self.canvas, val, xs[side], ys[side], align)
+
+                    text = CanvasText(
+                        self.canvas, val, xs[side], ys[side], align)
+                    if side == 0 and text.boundingRect().width() > rwidth:
+                        text.setToolTip(val)
+                        while val and text.boundingRect().width() > rwidth:
+                            val = val[:-1]
+                            text.setPlainText(val + "...")
+                            text.setPos(xs[0], ys[0])
                     space = height if side % 2 else width
                     currpos += perc * space + spacing * (total_attrs - side)
 


Test patch:
Repository: biolab/orange3

Issue:
OWLinearProjection: legible axis labels
Follow up on #2110.

Current widget status. Linear Projection is hard to 'destroy'. But if one has a really, really large number of attributes, it is possible. I suggest limiting the number of attributes that can be displayed to, say, 20. If feature names are reaaaaaaaaallllly long, elide them at... dunno, 20 chars.
<img width="1132" alt="Screen Shot 2019-04-12 at 11 21 29" src="https://user-images.githubusercontent.com/12524972/56026790-336d2c80-5d15-11e9-981b-27d794067ffa.png">


Discussion:
Same as #3744: we need to define the gui for this.
@robertcv, you solved this for Radviz in #3744. Would you, as an expert, do the same here?

Resolving patch:
diff --git a/Orange/widgets/visualize/owlinearprojection.py b/Orange/widgets/visualize/owlinearprojection.py
--- a/Orange/widgets/visualize/owlinearprojection.py
+++ b/Orange/widgets/visualize/owlinearprojection.py
@@ -35,6 +35,9 @@
 from Orange.widgets.widget import Msg
 
 
+MAX_LABEL_LEN = 20
+
+
 class LinearProjectionVizRank(VizRankDialog, OWComponent):
     captionTitle = "Score Plots"
     n_attrs = Setting(3)
@@ -215,7 +218,11 @@ def update_anchors(self):
         if self.anchor_items is None:
             self.anchor_items = []
             for point, label in zip(points, labels):
-                anchor = AnchorItem(line=QLineF(0, 0, *point), text=label)
+                anchor = AnchorItem(line=QLineF(0, 0, *point))
+                anchor._label.setToolTip(f"<b>{label}</b>")
+                label = label[:MAX_LABEL_LEN - 3] + "..." if len(label) > MAX_LABEL_LEN else label
+                anchor.setText(label)
+
                 visible = self.always_show_axes or np.linalg.norm(point) > r
                 anchor.setVisible(visible)
                 anchor.setPen(pg.mkPen((100, 100, 100)))


Test patch:
Repository: biolab/orange3

Issue:
Rank Widget - Select best ranked attributes
<!--
This is an issue template. Please fill in the relevant details in the
sections below.

Wrap code and verbatim terminal window output into triple backticks, see:
https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code

If you're raising an issue about an add-on (e.g. installed via
Options > Add-ons), raise an issue on the relevant add-on's issue
tracker instead. See: https://github.com/biolab?q=orange3
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.22

##### Change request
When one species the number of best ranked attributes, the counter stops at 100. It would be nice if the counter could go higher (say, 999).

Also, a numerical threshold for the importance would also be convenient.




Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owrank.py b/Orange/widgets/data/owrank.py
--- a/Orange/widgets/data/owrank.py
+++ b/Orange/widgets/data/owrank.py
@@ -278,7 +278,7 @@ def button(text, buttonid, toolTip=None):
         b3 = button(self.tr("Manual"), OWRank.SelectManual)
         b4 = button(self.tr("Best ranked:"), OWRank.SelectNBest)
 
-        s = gui.spin(selMethBox, self, "nSelected", 1, 100,
+        s = gui.spin(selMethBox, self, "nSelected", 1, 999,
                      callback=lambda: self.setSelectionMethod(OWRank.SelectNBest))
 
         grid.addWidget(b1, 0, 0)


Test patch:
Repository: biolab/orange3

Issue:
Heat Map: Row clustering fails on class value with a single instance
**Describe the bug**
Heat Map crashes with
`ValueError: The number of observations cannot be determined on an empty distance matrix.`

**To Reproduce**
Steps to reproduce the behavior:
File (load test data from below) - Heat Map (Cluster Rows).

**Orange version:**
3.23.dev

**Expected behavior**
Heat Map doesn't crash.

**Additional context**
Test data.

c1 | c2
-- | --
1 | 6
2 | 5





Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owheatmap.py b/Orange/widgets/visualize/owheatmap.py
--- a/Orange/widgets/visualize/owheatmap.py
+++ b/Orange/widgets/visualize/owheatmap.py
@@ -318,11 +318,11 @@ def __new__(cls, title, indices, sortindices, cluster=None,
                                cluster, cluster_ordered)
 
     @property
-    def is_empty(self):
+    def can_cluster(self):
         if isinstance(self.indices, slice):
-            return (self.indices.stop - self.indices.start) == 0
+            return (self.indices.stop - self.indices.start) > 1
         else:
-            return len(self.indices) == 0
+            return len(self.indices) > 1
 
     @property
     def cluster_ord(self):
@@ -794,7 +794,7 @@ def cluster_rows(self, data, parts):
             else:
                 cluster_ord = None
 
-            if not row.is_empty:
+            if row.can_cluster:
                 need_dist = cluster is None or cluster_ord is None
                 if need_dist:
                     subset = data[row.indices]


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owheatmap.py b/Orange/widgets/visualize/tests/test_owheatmap.py
--- a/Orange/widgets/visualize/tests/test_owheatmap.py
+++ b/Orange/widgets/visualize/tests/test_owheatmap.py
@@ -5,7 +5,7 @@
 import numpy as np
 from sklearn.exceptions import ConvergenceWarning
 
-from Orange.data import Table, Domain, ContinuousVariable
+from Orange.data import Table, Domain, ContinuousVariable, DiscreteVariable
 from Orange.preprocess import Continuize
 from Orange.widgets.visualize.owheatmap import OWHeatMap
 from Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin, datasets
@@ -168,3 +168,10 @@ def test_use_enough_colors(self):
             colors[r] = c.red(), c.green(), c.blue()
         unique_colors = len(np.unique(colors, axis=0))
         self.assertLessEqual(len(data)*self.widget.threshold_low, unique_colors)
+
+    def test_cls_with_single_instance(self):
+        table = Table(Domain([ContinuousVariable("c1")],
+                             [DiscreteVariable("c2", values=["a", "b"])]),
+                      np.array([[1], [2], [3]]), np.array([[0], [0], [1]]))
+        self.send_signal(self.widget.Inputs.data, table)
+        self.widget.row_check.setChecked(True)
Repository: biolab/orange3

Issue:
Box Plot: wrong plotting of quantiles
**Describe the bug**
Quantiles not always correctly plotted.

**To Reproduce**
Steps to reproduce the behavior:
File (iris) - Box Plot.

**Orange version:**
3.23.dev

**Expected behavior**
Iris setosas report on quantile values just like virginicas and versicolors.

**Actual behavior**
One of the quantiles not plotted. The 0.3 value is misplaced (not under quantile). There is no box.

**Screenshots**
![iris](https://user-images.githubusercontent.com/12524972/63356626-66c96300-c368-11e9-9694-fc417aa5d1bd.png)


Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owboxplot.py b/Orange/widgets/visualize/owboxplot.py
--- a/Orange/widgets/visualize/owboxplot.py
+++ b/Orange/widgets/visualize/owboxplot.py
@@ -957,10 +957,13 @@ def line(x0, y0, x1, y1, *args):
         var_line = line(stat.mean - stat.dev, 0, stat.mean + stat.dev, 0)
         var_line.setPen(self._pen_paramet)
         box.extend([whisker1, whisker2, vert_line, mean_line, var_line])
-        if stat.q25 is not None and stat.q75 is not None:
+        if stat.q25 is not None or stat.q75 is not None:
+            # if any of them is None it means that its value is equal to median
+            box_from = stat.q25 or stat.median
+            box_to = stat.q75 or stat.median
             mbox = FilterGraphicsRectItem(
-                stat.conditions, stat.q25 * scale_x, -height / 2,
-                (stat.q75 - stat.q25) * scale_x, height)
+                stat.conditions, box_from * scale_x, -height / 2,
+                (box_to - box_from) * scale_x, height)
             mbox.setBrush(self._box_brush)
             mbox.setPen(QPen(Qt.NoPen))
             mbox.setZValue(-200)


Test patch:
Repository: biolab/orange3

Issue:
Regarding the number of iterations functionality in Orange
I have a query regarding the number of iterations functionality in Orange, which is available with several widgets.

For instance, in the neural networks widget, the maximum number of iterations is currently 10000. However, I often come across problems where it takes more than 10000 iterations for a problem to converge.

Is there a way to increase the number of iterations to for instance 1000000?



Discussion:
You can change the number here:
https://github.com/biolab/orange3/blob/master/Orange/widgets/model/owneuralnetwork.py#L138

We do not wish to change the maximum number in Orange, but you can do it locally.
Sorry, I though we explicitly decided against increasing MaxIter in NN, but this was not so.
https://github.com/biolab/orange3/issues/2935

Still, for this to work, we would have to enable progress bar and interruption of the process.
Thanks for your response ajdapretnar; much appreciated. 

My knowledge of programming is almost non-existent, but will try to change the code locally as suggested. Could you kindly tell me where can I find this file? Will I need to do any other changes to the code locally or just changing the number works?
We decided to increase this.

Resolving patch:
diff --git a/Orange/widgets/model/owneuralnetwork.py b/Orange/widgets/model/owneuralnetwork.py
--- a/Orange/widgets/model/owneuralnetwork.py
+++ b/Orange/widgets/model/owneuralnetwork.py
@@ -135,7 +135,7 @@ def add_main_layout(self):
         form.addRow(
             "Maximal number of iterations:",
             gui.spin(
-                None, self, "max_iterations", 10, 10000, step=10,
+                None, self, "max_iterations", 10, 1000000, step=10,
                 label="Max iterations:", orientation=Qt.Horizontal,
                 alignment=Qt.AlignRight, callback=self.settings_changed))
 


Test patch:
Repository: biolab/orange3

Issue:
Prediction: scores for regression are wrong and are different from Test & Score
**Describe the bug**
Predictions widget displays wrong RMSE.

**To Reproduce**
Paint the data, select the columns to place y as a target, use linear regression for prediction. Feed Predictions with the training data. Choose L2 regularization. With increasing L2 regularization, RMSE should increase. Instead, RMSE decreases and with increased regularization converges to zero. R2 is not shown.

Minor: the table with results is resizes upon any change of the input.

**Orange version:**
3.23.0

**Expected behavior**
The widget should display scores that are equal to those displayed in Test & Score under appropriate setting (e.g., test on train data for Test & Score).

**Screenshots**
<img width="1291" alt="predictions-different-from-test-score" src="https://user-images.githubusercontent.com/726604/65071310-269fd500-d954-11e9-97cb-2b114b743837.png">


**Operating system:**
Windows, OSX or Linux? Which version?

**Additional context**
Add any other context about the problem here.



Discussion:

Resolving patch:
diff --git a/Orange/widgets/evaluate/owpredictions.py b/Orange/widgets/evaluate/owpredictions.py
--- a/Orange/widgets/evaluate/owpredictions.py
+++ b/Orange/widgets/evaluate/owpredictions.py
@@ -305,7 +305,7 @@ def _update_scores(self):
             name = learner_name(pred.predictor)
             head = QStandardItem(name)
             #            head.setData(key, Qt.UserRole)
-            row = [head]
+            row = [head, QStandardItem("N/A"), QStandardItem("N/A")]
             results = self.predictors[inputid].results
             if isinstance(results, str):
                 head.setToolTip(results)


Test patch:
Repository: biolab/orange3

Issue:
Information on data import / loading, File widget
As discussed earlier the data loading in Orange can be hard to perform - when opening the File widget or File documentation there is no information on possibilities to open other file formats (distance file, networks, etc.) with add-ons. 
A popup in File widget could be added, explaining that other file formats might be opened with add-ons. Alternatively, a button could be added that says "Other file formats", displaying the above message on request.



Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owfile.py b/Orange/widgets/data/owfile.py
--- a/Orange/widgets/data/owfile.py
+++ b/Orange/widgets/data/owfile.py
@@ -133,6 +133,18 @@ class Error(widget.OWWidget.Error):
     class NoFileSelected:
         pass
 
+    UserAdviceMessages = [
+        widget.Message(
+            "Use CSV File Import widget for advanced options "
+            "for comma-separated files",
+            "use-csv-file-import"),
+        widget.Message(
+            "This widget loads only tabular data. Use other widgets to load "
+            "other data types like models, distance matrices and networks.",
+            "other-data-types"
+        )
+    ]
+
     def __init__(self):
         super().__init__()
         RecentPathsWComboMixin.__init__(self)


Test patch:
Repository: biolab/orange3

Issue:
PCA: Apply automatically does not work when changing the threshold by moving a bar in the scree diagram
**Describe the bug**
When Apply automatically is on in the PCA widget, moving the vertical threshold bar with a mouse in the scree plot should update the output data. It does not.

**To Reproduce**
File (say, Iris) -> PCA -> Data Table
make sure Apply Automatically is clicked
now move the bar
no change in the Data Table

**Orange version:**
3.23.0

**Expected behavior**
In the PCA widget, changing the number of components by moving the "threshold bar" in the scree diagram with a mouse should apply this setting and output a new data set when "Apply automatically" is set on.



Discussion:

Resolving patch:
diff --git a/Orange/widgets/unsupervised/owpca.py b/Orange/widgets/unsupervised/owpca.py
--- a/Orange/widgets/unsupervised/owpca.py
+++ b/Orange/widgets/unsupervised/owpca.py
@@ -199,18 +199,19 @@ def _setup_plot(self):
         self._update_axis()
 
     def _on_cut_changed(self, components):
+        if components == self.ncomponents \
+                or self.ncomponents == 0 \
+                or self._pca is not None \
+                and components == len(self._variance_ratio):
+            return
 
-        if not (self.ncomponents == 0 and
-                components == len(self._variance_ratio)):
-            self.ncomponents = components
-
+        self.ncomponents = components
         if self._pca is not None:
             var = self._cumulative[components - 1]
             if numpy.isfinite(var):
                 self.variance_covered = int(var * 100)
 
-        if components != self._nselected_components():
-            self._invalidate_selection()
+        self._invalidate_selection()
 
     def _update_selection_component_spin(self):
         # cut changed by "ncomponents" spin.


Test patch:
diff --git a/Orange/widgets/unsupervised/tests/test_owpca.py b/Orange/widgets/unsupervised/tests/test_owpca.py
--- a/Orange/widgets/unsupervised/tests/test_owpca.py
+++ b/Orange/widgets/unsupervised/tests/test_owpca.py
@@ -1,6 +1,7 @@
 # Test methods with long descriptive names can omit docstrings
-# pylint: disable=missing-docstring
-from unittest.mock import patch
+# pylint: disable=missing-docstring, protected-access
+import unittest
+from unittest.mock import patch, Mock
 
 import numpy as np
 
@@ -203,3 +204,22 @@ def test_do_not_mask_features(self):
         self.widget.set_data(data)
         ndata = Table("iris.tab")
         self.assertEqual(data.domain[0], ndata.domain[0])
+
+    def test_on_cut_changed(self):
+        widget = self.widget
+        widget.ncomponents = 2
+        invalidate = widget._invalidate_selection = Mock()
+        widget._on_cut_changed(2)
+        invalidate.assert_not_called()
+        widget._on_cut_changed(3)
+        invalidate.assert_called()
+
+        widget.ncomponents = 0  # Take all components
+        invalidate.reset_mock()
+        widget._on_cut_changed(1)
+        invalidate.assert_not_called()
+        self.assertEqual(widget.ncomponents, 0)
+
+
+if __name__ == "__main__":
+    unittest.main()
Repository: biolab/orange3

Issue:
Test&Score: rows not equally aligned
**Describe the bug**

In test and score widget the name of the method is aligned at the bottom of the row and values are aligned at the top. See the screenshot

**To Reproduce**
Steps to reproduce the behavior:
1. In the file widget select Iris dataset
2. Connect the file widget to Test&Score widget
3. Connect Logistic regression to Test&Score widget
4. Observe the alignment of the row

**Orange version:**
3.24.dev

**Expected behavior**
The complete row should be equally aligned.

**Screenshots**
![Screenshot 2019-10-10 17 56 08](https://user-images.githubusercontent.com/6421558/66585897-faa8f580-eb87-11e9-9091-82b5b6c73aee.png)


**Operating system:**
Mac OS




Discussion:

Resolving patch:
diff --git a/Orange/widgets/evaluate/owtestlearners.py b/Orange/widgets/evaluate/owtestlearners.py
--- a/Orange/widgets/evaluate/owtestlearners.py
+++ b/Orange/widgets/evaluate/owtestlearners.py
@@ -501,10 +501,10 @@ def update_stats_model(self):
             results = slot.results
             if results is not None and results.success:
                 train = QStandardItem("{:.3f}".format(results.value.train_time))
-                train.setTextAlignment(Qt.AlignRight)
+                train.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
                 train.setData(key, Qt.UserRole)
                 test = QStandardItem("{:.3f}".format(results.value.test_time))
-                test.setTextAlignment(Qt.AlignRight)
+                test.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
                 test.setData(key, Qt.UserRole)
                 row = [head, train, test]
             else:
@@ -541,7 +541,7 @@ def update_stats_model(self):
             if stats is not None:
                 for stat, scorer in zip(stats, self.scorers):
                     item = QStandardItem()
-                    item.setTextAlignment(Qt.AlignRight)
+                    item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
                     if stat.success:
                         item.setData(float(stat.value[0]), Qt.DisplayRole)
                     else:


Test patch: