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

Issue:
File: conversion to string destroys datetime
**Describe the bug**
File widget does not convert datetime to string appropriately.

**To Reproduce**
File (open any dataset with datetime)
Convert datetime into text.
Observe the result in Data Table.

**Orange version:**
3.23.dev

**Expected behavior**
String version of 2010-01-01 should be '2010-01-01' not its float value.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/utils/domaineditor.py b/Orange/widgets/utils/domaineditor.py
--- a/Orange/widgets/utils/domaineditor.py
+++ b/Orange/widgets/utils/domaineditor.py
@@ -313,7 +313,7 @@ def numbers_are_round(var, col_data):
                 col_data = self._to_column(col_data, is_sparse)
             elif tpe == StringVariable:
                 var = tpe.make(name)
-                if type(orig_var) == DiscreteVariable:
+                if type(orig_var) in [DiscreteVariable, TimeVariable]:
                     col_data = [orig_var.repr_val(x) if not np.isnan(x) else ""
                                 for x in self._iter_vals(col_data)]
                 elif type(orig_var) == ContinuousVariable:


Test patch:
Repository: biolab/orange3

Issue:
VizRank allows for manual changing of features in Sieve despite Features input
**Describe the bug**

Certainly clearly described in the title. :)

**To Reproduce**

Connect Sieve to File and run Vizrank. Do not close the VizRank dialog afterwards.

Connect File -> Correlations -> Sieve, so that Correlations are used to set the features in Sieve. This connection disables the combo boxes for setting the features in Sieve. A naughty user can howere still change the features in Sieve by clicking on VizRank.

**Expected behavior**

Fix if it's trivial. Close this issue if not. It's an unimportant glitch, not a bug.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owsieve.py b/Orange/widgets/visualize/owsieve.py
--- a/Orange/widgets/visualize/owsieve.py
+++ b/Orange/widgets/visualize/owsieve.py
@@ -254,6 +254,7 @@ def resolve_shown_attributes(self):
         """
         self.warning()
         self.attr_box.setEnabled(True)
+        self.vizrank.setEnabled(True)
         if not self.input_features:  # None or empty
             return
         features = [f for f in self.input_features if f in self.domain_model]
@@ -264,6 +265,7 @@ def resolve_shown_attributes(self):
         old_attrs = self.attr_x, self.attr_y
         self.attr_x, self.attr_y = [f for f in (features * 2)[:2]]
         self.attr_box.setEnabled(False)
+        self.vizrank.setEnabled(False)
         if (self.attr_x, self.attr_y) != old_attrs:
             self.selection = set()
             self.update_graph()


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owsieve.py b/Orange/widgets/visualize/tests/test_owsieve.py
--- a/Orange/widgets/visualize/tests/test_owsieve.py
+++ b/Orange/widgets/visualize/tests/test_owsieve.py
@@ -15,6 +15,7 @@
 from Orange.widgets.visualize.owsieve import OWSieveDiagram
 from Orange.widgets.visualize.owsieve import ChiSqStats
 from Orange.widgets.visualize.owsieve import Discretize
+from Orange.widgets.widget import AttributeList
 
 
 class TestOWSieveDiagram(WidgetTest, WidgetOutputsTestMixin):
@@ -165,6 +166,17 @@ def test_vizrank_receives_manual_change(self, on_manual_change):
         self.assertEqual(call_args[0].name, data.domain[2].name)
         self.assertEqual(call_args[1].name, data.domain[1].name)
 
+    def test_input_features(self):
+        self.assertTrue(self.widget.attr_box.isEnabled())
+        self.send_signal(self.widget.Inputs.data, self.iris)
+        self.send_signal(self.widget.Inputs.features,
+                         AttributeList(self.iris.domain.attributes))
+        self.assertFalse(self.widget.attr_box.isEnabled())
+        self.assertFalse(self.widget.vizrank.isEnabled())
+        self.send_signal(self.widget.Inputs.features, None)
+        self.assertTrue(self.widget.attr_box.isEnabled())
+        self.assertTrue(self.widget.vizrank.isEnabled())
+
 
 if __name__ == "__main__":
     unittest.main()
Repository: biolab/orange3

Issue:
OWFile: elide or hide url if too long
**Describe the bug**
File remembers settings. So when an url is really long, the widgets is resized to fit the url. This results in huge windows.

**To Reproduce**
Steps to reproduce the behavior:
1. Open File.
2. Enter the following url in the url field: https://raw.githubusercontent.com/SteffiPeTaffy/machineLearningAZ/master/Machine%20Learning%20A-Z%20Template%20Folder/Part%204%20-%20Clustering/Section%2025%20-%20Hierarchical%20Clustering/Mall_Customers.csv
3. Save the workflow or just close Orange.
4. Open Orange and open the File widget again.

**Orange version:**
3.23.1

**Expected behavior**
File widget is of normal size.

**Screenshots**
<img width="1549" alt="Screen Shot 2019-10-14 at 10 11 23" src="https://user-images.githubusercontent.com/12524972/66990832-3af7fe80-f0c7-11e9-8560-09f18ff2b9f3.png">




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
@@ -206,7 +206,7 @@ def __init__(self):
         url_model.wrap(self.recent_urls)
         url_combo.setLineEdit(LineEditSelectOnFocus())
         url_combo.setModel(url_model)
-        url_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)
+        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)
         url_combo.setEditable(True)
         url_combo.setInsertPolicy(url_combo.InsertAtTop)
         url_edit = url_combo.lineEdit()


Test patch:
Repository: biolab/orange3

Issue:
OWSOM: crash on single column
**Describe the bug**
SOM crashes when given data with a single column.

**To Reproduce**
Steps to reproduce the behavior:
1. File (iris)
2. Select Columns (remove all but one attribute=
3. Connect to SOM.

**Expected behavior**
A warning appears.


Discussion:

Resolving patch:
diff --git a/Orange/projection/som.py b/Orange/projection/som.py
--- a/Orange/projection/som.py
+++ b/Orange/projection/som.py
@@ -50,7 +50,7 @@ def update(decay):
                 f(self.weights, x,
                   sigma / decay, learning_rate / decay)
 
-        if self.pca_init and not sp.issparse(x):
+        if self.pca_init and not sp.issparse(x) and x.shape[1] > 1:
             self.init_weights_pca(x)
         else:
             self.init_weights_random(x)
diff --git a/Orange/widgets/unsupervised/owsom.py b/Orange/widgets/unsupervised/owsom.py
--- a/Orange/widgets/unsupervised/owsom.py
+++ b/Orange/widgets/unsupervised/owsom.py
@@ -211,6 +211,7 @@ class Warning(OWWidget.Warning):
             Msg("Some data instances have undefined value of '{}'.")
         missing_values = \
             Msg("{} data instance{} with undefined value(s) {} not shown.")
+        single_attribute = Msg("Data contains a single numeric column.")
 
     class Error(OWWidget.Error):
         no_numeric_variables = Msg("Data contains no numeric columns.")
@@ -299,6 +300,8 @@ def set_data(self, data):
         def prepare_data():
             if len(cont_attrs) < len(attrs):
                 self.Warning.ignoring_disc_variables()
+            if len(cont_attrs) == 1:
+                self.Warning.single_attribute()
             x = Table.from_table(Domain(cont_attrs), data).X
             if sp.issparse(x):
                 self.data = data


Test patch:
diff --git a/Orange/widgets/unsupervised/tests/test_owsom.py b/Orange/widgets/unsupervised/tests/test_owsom.py
--- a/Orange/widgets/unsupervised/tests/test_owsom.py
+++ b/Orange/widgets/unsupervised/tests/test_owsom.py
@@ -65,6 +65,14 @@ def test_requires_continuous(self):
         self.assertFalse(widget.Warning.ignoring_disc_variables.is_shown())
         self.assertEqual(widget.cont_x.shape, (150, 4))
 
+    def test_single_attribute(self):
+        widget = self.widget
+        self.send_signal(widget.Inputs.data, self.iris)
+        self.assertFalse(widget.Warning.single_attribute.is_shown())
+        iris = self.iris[:, 0]
+        self.send_signal(widget.Inputs.data, iris)
+        self.assertTrue(widget.Warning.single_attribute.is_shown())
+
     def test_missing_all_data(self):
         widget = self.widget
Repository: biolab/orange3

Issue:
Self-Organizing Map crashes when clicking main area without any data connected to the widget
**Describe the bug**
When clicking on the main area in SOM widget, the following error is shown:
```
-------------------------- AttributeError Exception ---------------------------
Traceback (most recent call last):
  File "/home/matej/Documents/orange3/Orange/widgets/unsupervised/owsom.py", line 427, in on_selection_change
    self.selection = np.zeros(self.grid_cells.T.shape, dtype=np.int16)
AttributeError: 'NoneType' object has no attribute 'T'
-------------------------------------------------------------------------------
```

**To Reproduce**
1. Open up the SOM widget (don't connect anything to it)
2. Click on the area where the visualization is supposed to be.

**Orange version:**
3.24.0

**Expected behavior**
No crash.

**Operating system:**
Linux, Ubuntu 18.04



Discussion:

Resolving patch:
diff --git a/Orange/widgets/unsupervised/owsom.py b/Orange/widgets/unsupervised/owsom.py
--- a/Orange/widgets/unsupervised/owsom.py
+++ b/Orange/widgets/unsupervised/owsom.py
@@ -423,6 +423,8 @@ def clear_selection(self):
         self.redraw_selection()
 
     def on_selection_change(self, selection, action=SomView.SelectionSet):
+        if self.data is None:  # clicks on empty canvas
+            return
         if self.selection is None:
             self.selection = np.zeros(self.grid_cells.T.shape, dtype=np.int16)
         if action == SomView.SelectionSet:


Test patch:
diff --git a/Orange/widgets/unsupervised/tests/test_owsom.py b/Orange/widgets/unsupervised/tests/test_owsom.py
--- a/Orange/widgets/unsupervised/tests/test_owsom.py
+++ b/Orange/widgets/unsupervised/tests/test_owsom.py
@@ -42,6 +42,7 @@ def setUp(self):
 
     def tearDown(self):
         self.widget.onDeleteWidget()
+        super().tearDown()
 
     def test_requires_continuous(self):
         widget = self.widget
@@ -500,6 +501,12 @@ def selm(*cells):
         widget.on_selection_change(selm((0, 0)), SomView.SelectionNewGroup)
         np.testing.assert_equal(widget.selection, m)
 
+    @_patch_recompute_som
+    def test_on_selection_change_on_empty(self):
+        """Test clicks on empty scene, when no data"""
+        widget = self.widget
+        widget.on_selection_change([])
+
     @_patch_recompute_som
     def test_output(self):
         widget = self.widget
Repository: biolab/orange3

Issue:
Preprocess feature selection crashes when there are no features
**Describe the bug**
When data with no features is fed into *Preprocess* with *Select Relevant Features*, it crashes.

**To Reproduce**
* Take any dataset;
* use *Select Columns* to remove all features;
* feed it into *Preprocess* and choose *Select Relevant Features*.

**Orange version:**
3.23.1

**Expected behavior**
The widget should fail gracefully.

**Screenshots**
![preprocess-error](https://user-images.githubusercontent.com/7646525/69060784-4157fe00-0a18-11ea-96bd-75f9e24f42b6.png)

**Operating system:**
Linux 5.3.10-arch1-1




Discussion:

Resolving patch:
diff --git a/Orange/preprocess/fss.py b/Orange/preprocess/fss.py
--- a/Orange/preprocess/fss.py
+++ b/Orange/preprocess/fss.py
@@ -91,8 +91,9 @@ def __call__(self, data):
         return data.transform(domain)
 
     def score_only_nice_features(self, data, method):
+        # dtype must be defined because array can be empty
         mask = np.array([isinstance(a, method.feature_type)
-                         for a in data.domain.attributes])
+                         for a in data.domain.attributes], dtype=np.bool)
         features = [f for f in data.domain.attributes
                     if isinstance(f, method.feature_type)]
         scores = [method(data, f) for f in features]


Test patch:
diff --git a/Orange/preprocess/tests/test_fss.py b/Orange/preprocess/tests/test_fss.py
new file mode 100644
--- /dev/null
+++ b/Orange/preprocess/tests/test_fss.py
@@ -0,0 +1,36 @@
+import unittest
+from unittest.mock import Mock
+
+import numpy as np
+
+from Orange.data import Domain, Table, DiscreteVariable, ContinuousVariable
+from Orange.preprocess import fss
+
+
+class SelectBestFeaturesTest(unittest.TestCase):
+    def test_no_nice_features(self):
+        method = Mock()
+        method.feature_type = DiscreteVariable
+        selector = fss.SelectBestFeatures(method, 5)
+
+        domain = Domain([])
+        data = Table.from_numpy(domain, np.zeros((100, 0)))
+        selection = selector.score_only_nice_features(data, method)
+        self.assertEqual(selection.size, 0)
+        method.assert_not_called()
+
+        domain = Domain([ContinuousVariable("x")])
+        data = Table.from_numpy(domain, np.zeros((100, 1)))
+        selector.decreasing = True
+        selection = selector.score_only_nice_features(data, method)
+        np.testing.assert_equal(selection, [float('-inf')])
+        method.assert_not_called()
+
+        selector.decreasing = False
+        selection = selector.score_only_nice_features(data, method)
+        np.testing.assert_equal(selection, [float('inf')])
+        method.assert_not_called()
+
+
+if __name__ == "__main__":
+    unittest.main()
Repository: biolab/orange3

Issue:
Feature statistics colour scale
Orange 2.23, linux
When colouring by a feature in Feature statistics the colour scale of last bin is off (eg. same as at the left side of histogram). This does not happen in scatter plot. 
 Example: colouring by petal length in Orange iris dataset - look at histogram of same feature.

![Screenshot from 2019-11-15 15-42-29](https://user-images.githubusercontent.com/47607471/68951841-22126400-07bf-11ea-9f24-b5f8488e291d.png)


Discussion:
The problem is here: https://github.com/biolab/orange3/blob/master/Orange/widgets/data/utils/histogram.py#L373,

```
biny = self.y[mask[bin_idx]]
if np.isfinite(biny).any():
    mean = ut.nanmean(biny) / ut.nanmax(self.y)
else:
    mean = 0  # bin is empty, color does not matter
```

If I changed mean = 0 to mean = 1, the color changes. The bin is not empty although

Resolving patch:
diff --git a/Orange/widgets/data/utils/histogram.py b/Orange/widgets/data/utils/histogram.py
--- a/Orange/widgets/data/utils/histogram.py
+++ b/Orange/widgets/data/utils/histogram.py
@@ -359,9 +359,7 @@ def _get_colors(self):
 
             bins = np.arange(self.n_bins)[:, np.newaxis]
             edges = self.edges if self.attribute.is_discrete else self.edges[1:-1]
-            # Need to digitize on `right` here so the samples will be assigned
-            # to the correct bin for coloring
-            bin_indices = ut.digitize(self.x, bins=edges, right=True)
+            bin_indices = ut.digitize(self.x, bins=edges)
             mask = bin_indices == bins
 
             colors = []


Test patch:
Repository: biolab/orange3

Issue:
MDS: place labels over similarity lines
**Describe the bug**
Similarity lines are over instance labels.

**To Reproduce**
Steps to reproduce the behavior:
1. File (zoo)
2. MDS (Show similar pairs)

**Orange version:**
3.24.dev

**Expected behavior**
Similarity lines should be under the labels.

**Screenshots**
![mds](https://user-images.githubusercontent.com/12524972/69039620-8c5c1c00-09ec-11ea-8b4b-107ec6909c1f.png)


**Operating system:**
OSX

**Additional context**
If possible, some 'label jittering' or smart placement would be nice for such visualizations. But that is just a bonus.


Discussion:

Resolving patch:
diff --git a/Orange/widgets/unsupervised/owmds.py b/Orange/widgets/unsupervised/owmds.py
--- a/Orange/widgets/unsupervised/owmds.py
+++ b/Orange/widgets/unsupervised/owmds.py
@@ -145,6 +145,7 @@ def update_pairs(self, reconnect):
             emb_x_pairs.ravel(), emb_y_pairs.ravel(),
             pen=pg.mkPen(0.8, width=2, cosmetic=True),
             connect="pairs", antialias=True)
+        self.pairs_curve.setZValue(-1)
         self.plot_widget.addItem(self.pairs_curve)
 
 


Test patch:
Repository: biolab/orange3

Issue:
Removing variables with `'hidden': True` from Variable list in a box plot
When I use a bag of words on text data, it outputs a table with many features that represent words. Later, when I want to observe my t-SNE selection in the box plot, BOW features are in the Variable list, which prevents me to see other features. BOW features have `'hidden': True` attribute, which means we are already hiding them from Scatter plot but not in Box Plot. Should we also implement that in Box Plot?


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
@@ -299,14 +299,14 @@ def reset_attrs(self):
         self.attrs[:] = [
             var for var in chain(
                 domain.class_vars, domain.metas, domain.attributes)
-            if var.is_primitive()]
+            if var.is_primitive() and not var.attributes.get("hidden", False)]
 
     def reset_groups(self):
         domain = self.dataset.domain
         self.group_vars[:] = [None] + [
             var for var in chain(
                 domain.class_vars, domain.metas, domain.attributes)
-            if var.is_discrete]
+            if var.is_discrete and not var.attributes.get("hidden", False)]
 
     # noinspection PyTypeChecker
     @Inputs.data


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owboxplot.py b/Orange/widgets/visualize/tests/test_owboxplot.py
--- a/Orange/widgets/visualize/tests/test_owboxplot.py
+++ b/Orange/widgets/visualize/tests/test_owboxplot.py
@@ -47,6 +47,15 @@ def test_input_data(self):
         self.assertTrue(self.widget.display_box.isHidden())
         self.assertFalse(self.widget.stretching_box.isHidden())
 
+    def test_dont_show_hidden_attrs(self):
+        """Check widget's data"""
+        iris = Table("iris")
+        iris.domain["iris"].attributes["hidden"] = True
+        iris.domain["petal length"].attributes["hidden"] = True
+        self.send_signal(self.widget.Inputs.data, iris)
+        self.assertEqual(len(self.widget.attrs), 3)
+        self.assertEqual(len(self.widget.group_vars), 1)
+
     def test_primitive_metas(self):
         new_domain = Domain(attributes=[], class_vars=[], metas=(
             self.data.domain.attributes + self.data.domain.class_vars))
Repository: biolab/orange3

Issue:
Data Table widget not saving selection
Data table does not save all selected data and always resets to no data selected upon the reopening of the workflow.


Discussion:
@iva-c I cannot reproduce this issue. What version of Orange do you use? I remember it was an issue but it must be fixed now.
I haven't managed to reproduce it either, I guess I called it too early. So, I'm closing this issue.
Came acorss a workflow where this happens. It happens when I select all data using top left corner.
[human_osteoarthritis.zip](https://github.com/biolab/orange3/files/3851621/human_osteoarthritis.zip)

Orange version: 3.22
OS: W10
I was able to reproduce the issue on macOS too (Orange version 3.23.1, master).
What I found out is that when data comes from PCA (either components or transformed data) the selection is not saved. Here is the simplified workflow that shows the issue.

[human_osteoarthritis – kopija.ows.zip](https://github.com/biolab/orange3/files/3904846/human_osteoarthritis.kopija.ows.zip)

Resolving patch:
diff --git a/Orange/widgets/data/owtable.py b/Orange/widgets/data/owtable.py
--- a/Orange/widgets/data/owtable.py
+++ b/Orange/widgets/data/owtable.py
@@ -519,20 +519,17 @@ def update(_):
             if current is not None:
                 # pylint: disable=protected-access
                 self.set_info(current._input_slot.summary)
-        else:
-            self.__pending_selected_rows = None
-            self.__pending_selected_cols = None
 
         self.tabs.tabBar().setVisible(self.tabs.count() > 1)
         self.openContext(data)
 
-        if self.__pending_selected_rows is not None:
+        if data and self.__pending_selected_rows is not None:
             self.selected_rows = self.__pending_selected_rows
             self.__pending_selected_rows = None
         else:
             self.selected_rows = []
 
-        if self.__pending_selected_cols is not None:
+        if data and self.__pending_selected_cols is not None:
             self.selected_cols = self.__pending_selected_cols
             self.__pending_selected_cols = None
         else:


Test patch:
diff --git a/Orange/widgets/data/tests/test_owtable.py b/Orange/widgets/data/tests/test_owtable.py
--- a/Orange/widgets/data/tests/test_owtable.py
+++ b/Orange/widgets/data/tests/test_owtable.py
@@ -66,6 +66,15 @@ def test_unconditional_commit_on_new_signal(self):
             self.send_signal(self.widget.Inputs.data, self.data)
             commit.assert_called()
 
+    def test_pending_selection(self):
+        widget = self.create_widget(OWDataTable, stored_settings=dict(
+            selected_rows=[5, 6, 7, 8, 9],
+            selected_cols=list(range(len(self.data.domain)))))
+        self.send_signal(widget.Inputs.data, None, 1)
+        self.send_signal(widget.Inputs.data, self.data, 1)
+        output = self.get_output(widget.Outputs.selected_data)
+        self.assertEqual(5, len(output))
+
 
 if __name__ == "__main__":
     unittest.main()
Repository: biolab/orange3

Issue:
Rank: Crash when saving a workflow
**Describe the bug**
Orange crashes when saving a workflow containing a rank widget.

**To Reproduce**
1. Place File (load Iris dataset) on the canvas
2. Connect it to Rank widget
3. Save the workflow
4. See error

**Orange version:**
Master

**Expected behavior**
Save the workflow with rank widget without crashing.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Operating system:**
OSX



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
@@ -464,8 +464,8 @@ def updateScores(self):
 
     def on_select(self):
         # Save indices of attributes in the original, unsorted domain
-        self.selected_rows = self.ranksModel.mapToSourceRows([
-            i.row() for i in self.ranksView.selectionModel().selectedRows(0)])
+        self.selected_rows = list(self.ranksModel.mapToSourceRows([
+            i.row() for i in self.ranksView.selectionModel().selectedRows(0)]))
         self.commit()
 
     def setSelectionMethod(self, method):


Test patch:
Repository: biolab/orange3

Issue:
Reading Excel files takes ages
**Describe the bug**
The reading of even simple Excel files takes minutes instead of seconds.

**To Reproduce**
Download https://datasets.biolab.si/core/telecom-customer-churn.xlsx
Open the file in File widget

**Orange version:**
3.24.0 (dmg, Mac)

**Operating system:**
OSX


Discussion:

Resolving patch:
diff --git a/Orange/data/io.py b/Orange/data/io.py
--- a/Orange/data/io.py
+++ b/Orange/data/io.py
@@ -1069,9 +1069,10 @@ def str_(x):
             return str(x) if x is not None else ""
 
         sheet = self._get_active_sheet()
-        cells = ([str_(sheet.cell(row, col).value)
-                  for col in range(sheet.min_column, sheet.max_column + 1)]
-                 for row in range(sheet.min_row, sheet.max_row + 1))
+        min_col = sheet.min_column
+        max_col = sheet.max_column
+        cells = ([str_(cell.value) for cell in row[min_col - 1: max_col]]
+                 for row in sheet.iter_rows(sheet.min_row, sheet.max_row + 1))
         return filter(any, cells)
 
     def _get_active_sheet(self) -> openpyxl.worksheet.worksheet.Worksheet:


Test patch: