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

Issue:
Feature Constructor: Handle features with special symbols
- [ ] **What's wrong?**
 The Feature Constructor widget can not handle features with `µ` letter in their names.

- [ ] **How can we reproduce the problem?** 
Run [test.zip](https://github.com/biolab/orange3/files/6074250/test.zip)

- [ ] **What's your environment?**
<!-- To find your Orange version, see "Help → About → Version" or `Orange.version.full_version` in code -->
- Operating system: macOS Catalina
- Orange version: master
- How you installed Orange: from source



Discussion:
In the ast returned by `ast.parse`, a different unicode code point is used for µ (181 is replaced by 956). Python's parser appears to use NFKC normalization.

```python
In[31]: descriptor.expression
Out[31]: 'µ'
In[32]: ord(descriptor.expression)
Out[32]: 181
In[33]: exp_ast = ast.parse(descriptor.expression, mode="eval")
In[34]: freev = unique(freevars(exp_ast, []))
In[35]: ord(freev[0])
Out[35]: 956
```

Resolving patch:
diff --git a/Orange/widgets/data/owfeatureconstructor.py b/Orange/widgets/data/owfeatureconstructor.py
--- a/Orange/widgets/data/owfeatureconstructor.py
+++ b/Orange/widgets/data/owfeatureconstructor.py
@@ -14,6 +14,7 @@
 import logging
 import ast
 import types
+import unicodedata
 
 from traceback import format_exception_only
 from collections import namedtuple, OrderedDict
@@ -917,7 +918,8 @@ def bind_variable(descriptor, env, data):
 
     exp_ast = ast.parse(descriptor.expression, mode="eval")
     freev = unique(freevars(exp_ast, []))
-    variables = {sanitized_name(v.name): v for v in env}
+    variables = {unicodedata.normalize("NFKC", sanitized_name(v.name)): v
+                 for v in env}
     source_vars = [(name, variables[name]) for name in freev
                    if name in variables]
 


Test patch:
diff --git a/Orange/widgets/data/tests/test_owfeatureconstructor.py b/Orange/widgets/data/tests/test_owfeatureconstructor.py
--- a/Orange/widgets/data/tests/test_owfeatureconstructor.py
+++ b/Orange/widgets/data/tests/test_owfeatureconstructor.py
@@ -133,6 +133,22 @@ def test_construct_numeric_names():
         np.testing.assert_array_equal(ndata.X[:, 0],
                                       data.X[:, :2].sum(axis=1))
 
+    @staticmethod
+    def test_unicode_normalization():
+        micro = "\u00b5"
+        domain = Domain([ContinuousVariable(micro)])
+        name = 'Micro Variable'
+        expression = micro
+        desc = PyListModel(
+            [ContinuousDescriptor(name=name, expression=expression,
+                                  number_of_decimals=2)]
+        )
+        data = Table.from_numpy(domain, np.arange(5).reshape(5, 1))
+        data = data.transform(Domain(data.domain.attributes,
+                                     [],
+                                     construct_variables(desc, data)))
+        np.testing.assert_equal(data.X, data.metas)
+
 
 class TestTools(unittest.TestCase):
     def test_free_vars(self):
Repository: biolab/orange3

Issue:
RadViz: Score Plots doesn't update visualization
<!-- 
Thanks for taking the time to report a bug!
If you're raising an issue about an add-on (i.e., installed via Options > Add-ons), raise an issue in the relevant add-on's issue tracker instead. See: https://github.com/biolab?q=orange3
To fix the bug, we need to be able to reproduce it. Please answer the following questions to the best of your ability.
-->


- [ ] **What's wrong?**
<!-- Be specific, clear, and concise. Include screenshots if relevant. -->
<!-- If you're getting an error message, copy it, and enclose it with three backticks (```). -->
RadViz's Score Plots doesn't update visualization with the highest ranked attributes. This is unlike in Scatter Plot, which does it on-the-fly.




- [ ] **How can we reproduce the problem?** 
<!-- Upload a zip with the .ows file and data. -->
<!-- Describe the steps (open this widget, click there, then add this...) -->
File (zoo) - RadViz (Score Plots) - visualization is not updated. One has to click the top-ranked combination.




- [ ] **What's your environment?**
<!-- To find your Orange version, see "Help → About → Version" or `Orange.version.full_version` in code -->
- Operating system: OSX
- Orange version: 3.28.dev
- How you installed Orange: git



Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owradviz.py b/Orange/widgets/visualize/owradviz.py
--- a/Orange/widgets/visualize/owradviz.py
+++ b/Orange/widgets/visualize/owradviz.py
@@ -139,6 +139,9 @@ def check_preconditions(self):
                                          len(master.model_selected)))
         return True
 
+    def on_selection_changed(self, selected, _):
+        self.on_row_clicked(selected.indexes()[0])
+
     def on_row_clicked(self, index):
         self.selectionChanged.emit(index.data(self._AttrRole))
 


Test patch:
diff --git a/Orange/widgets/visualize/tests/test_owradviz.py b/Orange/widgets/visualize/tests/test_owradviz.py
--- a/Orange/widgets/visualize/tests/test_owradviz.py
+++ b/Orange/widgets/visualize/tests/test_owradviz.py
@@ -1,5 +1,6 @@
 # Test methods with long descriptive names can omit docstrings
 # pylint: disable=missing-docstring
+import unittest
 from unittest.mock import Mock
 import numpy as np
 
@@ -129,3 +130,17 @@ def test_invalidated_model_selected(self):
         self.widget.setup_plot.reset_mock()
         self.send_signal(self.widget.Inputs.data, self.data)
         self.widget.setup_plot.assert_called_once()
+
+    def test_score_plots_feature_update(self):
+        self.send_signal(self.widget.Inputs.data, self.data)
+        selected_vars = set(self.widget.selected_vars)
+        output1 = self.get_output(self.widget.Outputs.components)
+        self.widget.vizrank.toggle()
+        self.process_events(until=lambda: not self.widget.vizrank.keep_running)
+        self.assertNotEqual(selected_vars, set(self.widget.selected_vars))
+        output2 = self.get_output(self.widget.Outputs.components)
+        self.assertNotEqual(output1, output2)
+
+
+if __name__ == "__main__":
+    unittest.main()
Repository: biolab/orange3

Issue:
Aggregate Columns: Crash on dataset change
<!-- 
Thanks for taking the time to report a bug!
If you're raising an issue about an add-on (i.e., installed via Options > Add-ons), raise an issue in the relevant add-on's issue tracker instead. See: https://github.com/biolab?q=orange3
To fix the bug, we need to be able to reproduce it. Please answer the following questions to the best of your ability.
-->

- [ ] **What's wrong?**
<!-- Be specific, clear, and concise. Include screenshots if relevant. -->
<!-- If you're getting an error message, copy it, and enclose it with three backticks (```). -->
The widget crashes when input changes and some columns have been selected.



- [ ] **How can we reproduce the problem?** 
<!-- Upload a zip with the .ows file and data. -->
<!-- Describe the steps (open this widget, click there, then add this...) -->
File(`iris`) -> Aggregate Columns (select `sepal length`) -> Change dataset to `housing` -> `ValueError: 'sepal length' is not in domain`



Discussion:

Resolving patch:
diff --git a/Orange/widgets/data/owaggregatecolumns.py b/Orange/widgets/data/owaggregatecolumns.py
--- a/Orange/widgets/data/owaggregatecolumns.py
+++ b/Orange/widgets/data/owaggregatecolumns.py
@@ -76,16 +76,15 @@ def __init__(self):
     @Inputs.data
     def set_data(self, data: Table = None):
         self.closeContext()
+        self.variables.clear()
         self.data = data
         if self.data:
             self.variable_model.set_domain(data.domain)
             self.info.set_input_summary(len(self.data),
                                         format_summary_details(self.data))
-            self.variables.clear()
             self.openContext(data)
         else:
             self.variable_model.set_domain(None)
-            self.variables.clear()
             self.info.set_input_summary(self.info.NoInput)
         self.unconditional_commit()
 


Test patch:
diff --git a/Orange/widgets/data/tests/test_owaggregatecolumns.py b/Orange/widgets/data/tests/test_owaggregatecolumns.py
--- a/Orange/widgets/data/tests/test_owaggregatecolumns.py
+++ b/Orange/widgets/data/tests/test_owaggregatecolumns.py
@@ -155,6 +155,19 @@ def test_contexts(self):
         self.send_signal(self.widget.Inputs.data, self.data1)
         self.assertEqual(self.widget.variables, saved)
 
+    def test_selection_in_context(self):
+        widget = self.widget
+
+        self.send_signal(widget.Inputs.data, self.data1)
+        self.widget.variables[:] = self.data1.domain.variables[1:3]
+
+        self.send_signal(widget.Inputs.data, self.data2)
+        self.assertEqual(widget.variables, [])
+
+        self.send_signal(widget.Inputs.data, self.data1)
+        self.assertSequenceEqual(self.widget.variables[:],
+                                 self.data1.domain.variables[1:3])
+
     def test_report(self):
         self.widget.send_report()
Repository: biolab/orange3

Issue:
PCA widget not adding the last component
**What's wrong?**
PCA widget does not return the last component even though selected in the widget. More specifically it doesn't work for drag and dropping the vertical line but it does work in the components input field.

**How can we reproduce the problem?** 
File with iris dataset -> PCA -> Data Table
Move the vertical line in PCA and observed the output in Data Table.


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
@@ -203,9 +203,7 @@ def _setup_plot(self):
 
     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):
+                or self.ncomponents == 0:
             return
 
         self.ncomponents = components


Test patch:
Repository: biolab/orange3

Issue:
Distance Matrix: crash on numeric meta
**What's wrong?**
Distance Matrix crashes when using certain attributes as labels.


**How can we reproduce the problem?** 
Datasets (HDI) - Select Columns (put _Life expectancy_ under metas) - Distances - Distance Matrix. Use _Life expectancy_ as Label.


**What's your environment?**
- Operating system: OSX
- Orange version: 3.30.1
- How you installed Orange: git



Discussion:

Resolving patch:
diff --git a/Orange/widgets/unsupervised/owdistancematrix.py b/Orange/widgets/unsupervised/owdistancematrix.py
--- a/Orange/widgets/unsupervised/owdistancematrix.py
+++ b/Orange/widgets/unsupervised/owdistancematrix.py
@@ -49,6 +49,9 @@ def set_labels(self, labels, variable=None, values=None):
         self.values = values
         if self.values is not None and not isinstance(self.variable,
                                                       StringVariable):
+            # Meta variables can be of type np.object
+            if values.dtype is not float:
+                values = values.astype(float)
             self.label_colors = variable.palette.values_to_qcolors(values)
         else:
             self.label_colors = None


Test patch:
diff --git a/Orange/widgets/unsupervised/tests/test_owdistancematrix.py b/Orange/widgets/unsupervised/tests/test_owdistancematrix.py
--- a/Orange/widgets/unsupervised/tests/test_owdistancematrix.py
+++ b/Orange/widgets/unsupervised/tests/test_owdistancematrix.py
@@ -9,7 +9,7 @@
 
 from orangewidget.tests.base import GuiTest
 
-from Orange.data import Table
+from Orange.data import Table, Domain, ContinuousVariable, StringVariable
 from Orange.distance import Euclidean
 from Orange.widgets.tests.base import WidgetTest
 from Orange.widgets.unsupervised.owdistancematrix import OWDistanceMatrix, \
@@ -57,6 +57,22 @@ def test_labels(self):
         ac.activated.emit(idx)
         self.assertIsNone(self.widget.tablemodel.label_colors)
 
+    def test_num_meta_labels(self):
+        x, y = (ContinuousVariable(c) for c in "xy")
+        s = StringVariable("s")
+        data = Table.from_list(
+            Domain([x], [], [y, s]),
+            [[0, 1, "a"],
+             [1, np.nan, "b"]]
+        )
+        distances = Euclidean(data)
+        self.widget.set_distances(distances)
+        ac = self.widget.annot_combo
+        idx = ac.model().indexOf(y)
+        ac.setCurrentIndex(idx)
+        ac.activated.emit(idx)
+        self.assertEqual(self.widget.tablemodel.labels, ["1", "?"])
+
 
 class TestDelegates(GuiTest):
     def test_delegate(self):
Repository: biolab/orange3

Issue:
Scatter Plot: 'Show color regions' not working
<!-- 
Thanks for taking the time to report a bug!
If you're raising an issue about an add-on (i.e., installed via Options > Add-ons), raise an issue in the relevant add-on's issue tracker instead. See: https://github.com/biolab?q=orange3
To fix the bug, we need to be able to reproduce it. Please answer the following questions to the best of your ability.
-->


**What's wrong?**
<!-- Be specific, clear, and concise. Include screenshots if relevant. -->
<!-- If you're getting an error message, copy it, and enclose it with three backticks (```). -->
In some cases `Show color regions` does not display the color regions.

**How can we reproduce the problem?** 
<!-- Upload a zip with the .ows file and data. -->
<!-- Describe the steps (open this widget, click there, then add this...) -->
File (housing) -> Scatter Plot -> set color attribute to `MEDV` and click `Show color regions` (regions are not shown):

![image](https://user-images.githubusercontent.com/11465003/136741312-fbf0b475-1f12-4ad4-a4b9-5e2d8eddecc4.png)

For `INDUS` the regions are shown:
![image](https://user-images.githubusercontent.com/11465003/136741351-cc71f48c-6c1e-46a3-a07d-fb4d3fa132d3.png)



**What's your environment?**
<!-- To find your Orange version, see "Help → About → Version" or `Orange.version.full_version` in code -->
- Operating system: macOS Catalina
- Orange version: master
- How you installed Orange: pip



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
@@ -1176,8 +1176,9 @@ def update_density(self):
             if c_data is None:
                 return
             visible_c_data = self._filter_visible(c_data)
-            mask = np.bitwise_and(np.isfinite(visible_c_data),
-                                  visible_c_data < MAX_COLORS - 1)
+            mask = np.isfinite(visible_c_data)
+            if not self.master.is_continuous_color():
+                mask = np.bitwise_and(mask, visible_c_data < MAX_COLORS - 1)
             pens = self.scatterplot_item.data['pen']
             rgb_data = [
                 pen.color().getRgb()[:3] if pen is not None else (255, 255, 255)


Test patch:
Repository: biolab/orange3

Issue:
Orange.statistics.util.py: improper computation of missing meta values
1. Metas are always read as dtype=object. Try to read them as float64 if possible (numeric, categorical, datetime).
2. If dtype=object (at least one string meta variable), compute better statistics for primitive variables.

Example no1:
Datasets (Forest Fires) - Data Table.
One meta column has TRUE/FALSE values, which are read as bool. I don't this FALSE should be treated as missing.
Also - strange things happen. If I remove a random attribute with Select Columns, not touching the metas at all, Data Table correctly reports there are no missing values in metas.

Example no2:
Datasets (Poker Hand) - Data Table.
The single meta column has values train/test, which are read as categorical. The value that gets assigned a 0 is treated as missing.



Discussion:

Resolving patch:
diff --git a/Orange/statistics/util.py b/Orange/statistics/util.py
--- a/Orange/statistics/util.py
+++ b/Orange/statistics/util.py
@@ -9,6 +9,7 @@
 
 import bottleneck as bn
 import numpy as np
+import pandas
 import scipy.stats.stats
 from scipy import sparse as sp
 
@@ -373,8 +374,7 @@ def weighted_mean():
             X.shape[0] - non_zero,
             non_zero))
     else:
-        X_str = X.astype(str)
-        nans = ((X_str == "nan") | (X_str == "")).sum(axis=0) \
+        nans = (pandas.isnull(X).sum(axis=0) + (X == "").sum(axis=0)) \
             if X.size else np.zeros(X.shape[1])
         return np.column_stack((
             np.tile(np.inf, X.shape[1]),


Test patch:
diff --git a/Orange/tests/test_statistics.py b/Orange/tests/test_statistics.py
--- a/Orange/tests/test_statistics.py
+++ b/Orange/tests/test_statistics.py
@@ -1,4 +1,5 @@
 # pylint: disable=no-self-use
+import time
 import unittest
 import warnings
 from itertools import chain
@@ -145,6 +146,28 @@ def test_stats_non_numeric(self):
                                            [np.inf, -np.inf, 0, 0, 2, 1],
                                            [np.inf, -np.inf, 0, 0, 0, 3]])
 
+    def test_stats_long_string_mem_use(self):
+        X = np.full((1000, 1000), "a", dtype=object)
+        t = time.time()
+        stats(X)
+        t_a = time.time() - t  # time for an array with constant-len strings
+
+        # Add one very long string
+        X[0, 0] = "a"*2000
+
+        # The implementation of stats() in Orange 3.30.2 used .astype("str")
+        # internally. X.astype("str") would take ~1000x the memory as X,
+        # because its type would be "<U1000" (the length of the longest string).
+        # That is about 7.5 GiB of memory on a 64-bit Linux system
+
+        # Because it is hard to measure CPU, we here measure time as
+        # memory allocation of such big tables takes time. On Marko's
+        # Linux system .astype("str") took ~3 seconds.
+        t = time.time()
+        stats(X)
+        t_b = time.time() - t
+        self.assertLess(t_b, 2*t_a + 0.1)  # some grace period
+
     def test_nanmin_nanmax(self):
         warnings.filterwarnings("ignore", r".*All-NaN slice encountered.*")
         for X in self.data:
Repository: biolab/orange3

Issue:
Plot Data squashing data outside the fixed range
**What's wrong?**
When using the brush in the Paint Data widget points get randomly plotted inside the set radius. When plotting near the [0, 1] edge points that would fall outside are moved on the edge to fit inside the range. This is not good as you destroy the randomness of the data. 

![Screenshot from 2021-11-24 15-12-30](https://user-images.githubusercontent.com/13180057/143254464-fa90df64-798b-4bd6-8482-7c23c823d1d1.png)

**What's your proposed solution?**
I would like it to either not modify the points that fall outside or just don't use those. 

**What's your environment?**
<!-- To find your Orange version, see "Help → About → Version" or `Orange.version.full_version` in code -->
- Operating system: Ubuntu 20.04
- Orange version: 3.30.2
- How you installed Orange: pip



Discussion:
I can't reproduce this and I don't see how it could happen. Paint data applies the following scaling:

```python
def scale(values, min=0, max=1):
    """Return values scaled to [min, max]"""
    if len(values) == 0:
        return np.array([])
    minval = np.float_(bn.nanmin(values))
    ptp = bn.nanmax(values) - minval
    if ptp == 0:
        return np.clip(values, min, max)
    return (-minval + values) / ptp * (max - min) + min
```

Note that clipping is applied only when `nanmax(values)` equals `nanmin(values)`, so it would set all data to 0 or 1, which clearly doesn't happen in your case.

Can you upload the data that you feed into the Paint widget?
I haven't read your issue properly. Please ignore the previous comment.

Resolving patch:
diff --git a/Orange/widgets/data/owpaintdata.py b/Orange/widgets/data/owpaintdata.py
--- a/Orange/widgets/data/owpaintdata.py
+++ b/Orange/widgets/data/owpaintdata.py
@@ -1214,7 +1214,10 @@ def _add_command(self, cmd):
             data = create_data(cmd.pos.x(), cmd.pos.y(),
                                self.brushRadius / 1000,
                                int(1 + self.density / 20), cmd.rstate)
-            self._add_command(Append([QPointF(*p) for p in zip(*data.T)]))
+            data = data[(np.min(data, axis=1) >= 0)
+                        & (np.max(data, axis=1) <= 1), :]
+            if data.size:
+                self._add_command(Append([QPointF(*p) for p in zip(*data.T)]))
         elif isinstance(cmd, Jitter):
             point = np.array([cmd.pos.x(), cmd.pos.y()])
             delta = - apply_jitter(self.__buffer[:, :2], point,


Test patch:
Repository: biolab/orange3

Issue:
Color regions change when setting opacity of points
<!--
This is an issue template. Please fill in the relevant details in the
sections below.
-->

##### Geo version
<!-- From menu _Options→Add-ons→Orange3-Geo_ or code `orangecontrib.geo.version.full_version` -->
0.2.8

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.27.dev

##### Expected behavior
Color regions stay the same irrespective of point opacity. Or at least are as opaque as the points.


##### Actual behavior
Color regions randomly change when changing point opacity.


##### Steps to reproduce the behavior
Datasets (Philadelphia Crime) - Geo Map.
Color points. Set Color regions. Then drag the slider for opacity.


##### Additional info (worksheets, data, screenshots, ...)




Discussion:
You can also observe this effect in scatterplot. If the number of points is above 1000, `class_density_image` takes 1000 points, sampled uniformly from a grid of buckets (see `Orange.widget.utils.classdensity.grid_sample`).

Resolving patch:
diff --git a/Orange/widgets/utils/classdensity.py b/Orange/widgets/utils/classdensity.py
--- a/Orange/widgets/utils/classdensity.py
+++ b/Orange/widgets/utils/classdensity.py
@@ -59,6 +59,7 @@ def compute_density(x_grid, y_grid, x_data, y_data, rgb_data):
 
 # sample k data points from a uniformly spaced g*g grid of buckets
 def grid_sample(x_data, y_data, k=1000, g=10):
+    rgen = np.random.RandomState(0)
     n = len(x_data)
     min_x, max_x = min(x_data), max(x_data)
     min_y, max_y = min(y_data), max(y_data)
@@ -70,12 +71,12 @@ def grid_sample(x_data, y_data, k=1000, g=10):
         grid[y][x].append(i)
     for y in range(g):
         for x in range(g):
-            np.random.shuffle(grid[y][x])
+            rgen.shuffle(grid[y][x])
     sample = []
     while len(sample) < k:
         for y in range(g):
             for x in range(g):
                 if len(grid[y][x]) != 0:
                     sample.append(grid[y][x].pop())
-    np.random.shuffle(sample)
+    rgen.shuffle(sample)
     return sample[:k]


Test patch: