We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Neighbors: remove Info box and display data info in status bar
Follow an example where the change of this widget was already reported in [the blog](https://orange.biolab.si/blog/2019/3/8/the-changing-status-bar/). Change the documentation accordingly.

![changing-status-bar](https://user-images.githubusercontent.com/726604/67082844-3a7c6800-f19a-11e9-8ba4-f89c6ed7ab7e.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `Orange/widgets/data/owneighbors.py`
Content:
```
1 import numpy as np
2 
3 from AnyQt.QtCore import Qt
4 
5 from Orange.data import Table, Domain, ContinuousVariable
6 from Orange.data.util import get_unique_names
7 from Orange.preprocess import RemoveNaNColumns, Impute
8 from Orange import distance
9 from Orange.widgets import gui
10 from Orange.widgets.settings import Setting
11 from Orange.widgets.utils.signals import Input, Output
12 from Orange.widgets.widget import OWWidget, Msg
13 from Orange.widgets.utils.widgetpreview import WidgetPreview
14 
15 METRICS = [
16     ("Euclidean", distance.Euclidean),
17     ("Manhattan", distance.Manhattan),
18     ("Mahalanobis", distance.Mahalanobis),
19     ("Cosine", distance.Cosine),
20     ("Jaccard", distance.Jaccard),
21     ("Spearman", distance.SpearmanR),
22     ("Absolute Spearman", distance.SpearmanRAbsolute),
23     ("Pearson", distance.PearsonR),
24     ("Absolute Pearson", distance.PearsonRAbsolute),
25 ]
26 
27 
28 class OWNeighbors(OWWidget):
29     name = "Neighbors"
30     description = "Compute nearest neighbors in data according to reference."
31     icon = "icons/Neighbors.svg"
32 
33     replaces = ["orangecontrib.prototypes.widgets.owneighbours.OWNeighbours"]
34 
35     class Inputs:
36         data = Input("Data", Table)
37         reference = Input("Reference", Table)
38 
39     class Outputs:
40         data = Output("Neighbors", Table)
41 
42     class Warning(OWWidget.Warning):
43         all_data_as_reference = \
44             Msg("Every data instance is same as some reference")
45 
46     class Error(OWWidget.Error):
47         diff_domains = Msg("Data and reference have different features")
48 
49     n_neighbors: int
50     distance_index: int
51 
52     n_neighbors = Setting(10)
53     distance_index = Setting(0)
54     exclude_reference = Setting(True)
55     auto_apply = Setting(True)
56 
57     want_main_area = False
58     buttons_area_orientation = Qt.Vertical
59 
60     def __init__(self):
61         super().__init__()
62 
63         self.data = None
64         self.reference = None
65         self.distances = None
66 
67         box = gui.vBox(self.controlArea, "Info")
68         self.data_info_label = gui.widgetLabel(box, "")
69         self.reference_info_label = gui.widgetLabel(box, "")
70         self._set_label_text("data")
71         self._set_label_text("reference")
72 
73         box = gui.vBox(self.controlArea, box=True)
74         gui.comboBox(
75             box, self, "distance_index", orientation=Qt.Horizontal,
76             label="Distance: ", items=[d[0] for d in METRICS],
77             callback=self.recompute)
78         gui.spin(
79             box, self, "n_neighbors", label="Number of neighbors:",
80             step=1, spinType=int, minv=0, maxv=100,
81             # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
82             callback=lambda: self.apply())
83         gui.checkBox(
84             box, self, "exclude_reference",
85             label="Exclude rows (equal to) references",
86             # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
87             callback=lambda: self.apply())
88 
89         self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)
90 
91     def _set_label_text(self, name):
92         data = getattr(self, name)
93         label = getattr(self, f"{name}_info_label")
94         if data is None:
95             label.setText(f"No {name} instances")
96         else:
97             pl = "s" if data else ""
98             label.setText(f"{len(data)} {name} instance{pl} on input.")
99 
100     @Inputs.data
101     def set_data(self, data):
102         self.data = data
103         self._set_label_text("data")
104 
105     @Inputs.reference
106     def set_ref(self, refs):
107         self.reference = refs
108         self._set_label_text("reference")
109 
110     def handleNewSignals(self):
111         self.compute_distances()
112         self.unconditional_apply()
113 
114     def recompute(self):
115         self.compute_distances()
116         self.apply()
117 
118     def compute_distances(self):
119         self.Error.diff_domains.clear()
120         if not self.data or not self.reference:
121             self.distances = None
122             return
123         if set(self.reference.domain.attributes) != \
124                 set(self.data.domain.attributes):
125             self.Error.diff_domains()
126             self.distances = None
127             return
128 
129         metric = METRICS[self.distance_index][1]
130         n_ref = len(self.reference)
131 
132         # comparing only attributes, no metas and class-vars
133         new_domain = Domain(self.data.domain.attributes)
134         reference = self.reference.transform(new_domain)
135         data = self.data.transform(new_domain)
136 
137         all_data = Table.concatenate([reference, data], 0)
138         pp_all_data = Impute()(RemoveNaNColumns()(all_data))
139         pp_reference, pp_data = pp_all_data[:n_ref], pp_all_data[n_ref:]
140         self.distances = metric(pp_data, pp_reference).min(axis=1)
141 
142     def apply(self):
143         indices = self._compute_indices()
144         if indices is None:
145             neighbors = None
146         else:
147             neighbors = self._data_with_similarity(indices)
148         self.Outputs.data.send(neighbors)
149 
150     def _compute_indices(self):
151         self.Warning.all_data_as_reference.clear()
152         dist = self.distances
153         if dist is None:
154             return None
155         if self.exclude_reference:
156             non_ref = dist > 1e-5
157             skip = len(dist) - non_ref.sum()
158             up_to = min(self.n_neighbors + skip, len(dist))
159             if skip >= up_to:
160                 self.Warning.all_data_as_reference()
161                 return None
162             indices = np.argpartition(dist, up_to - 1)[:up_to]
163             return indices[non_ref[indices]]
164         else:
165             up_to = min(self.n_neighbors, len(dist))
166             return np.argpartition(dist, up_to - 1)[:up_to]
167 
168     def _data_with_similarity(self, indices):
169         data = self.data
170         varname = get_unique_names(data.domain, "distance")
171         metas = data.domain.metas + (ContinuousVariable(varname), )
172         domain = Domain(data.domain.attributes, data.domain.class_vars, metas)
173         data_metas = self.distances[indices].reshape((-1, 1))
174         if data.domain.metas:
175             data_metas = np.hstack((data.metas[indices], data_metas))
176         neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)
177         neighbors.attributes = self.data.attributes
178         return neighbors
179 
180 
181 if __name__ == "__main__":  # pragma: no cover
182     iris = Table("iris.tab")
183     WidgetPreview(OWNeighbors).run(
184         set_data=iris,
185         set_ref=iris[:1])
186
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/Orange/widgets/data/owneighbors.py b/Orange/widgets/data/owneighbors.py
--- a/Orange/widgets/data/owneighbors.py
+++ b/Orange/widgets/data/owneighbors.py
@@ -64,12 +64,6 @@
         self.reference = None
         self.distances = None
 
-        box = gui.vBox(self.controlArea, "Info")
-        self.data_info_label = gui.widgetLabel(box, "")
-        self.reference_info_label = gui.widgetLabel(box, "")
-        self._set_label_text("data")
-        self._set_label_text("reference")
-
         box = gui.vBox(self.controlArea, box=True)
         gui.comboBox(
             box, self, "distance_index", orientation=Qt.Horizontal,
@@ -87,29 +81,33 @@
             callback=lambda: self.apply())
 
         self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)
-
-    def _set_label_text(self, name):
-        data = getattr(self, name)
-        label = getattr(self, f"{name}_info_label")
-        if data is None:
-            label.setText(f"No {name} instances")
+        self.info.set_input_summary(self.info.NoInput)
+        self.info.set_output_summary(self.info.NoOutput)
+
+    def _set_input_summary(self):
+        n_data = len(self.data) if self.data else 0
+        n_refs = len(self.reference) if self.reference else 0
+
+        if n_data or n_refs:
+            details = \
+                f"{n_data if n_data else 'No'} data instance(s) on input\n" \
+                f"{n_refs if n_refs else 'No'} reference instance(s) on input "
+            self.info.set_input_summary(f"{n_data} | {n_refs} ", details)
         else:
-            pl = "s" if data else ""
-            label.setText(f"{len(data)} {name} instance{pl} on input.")
+            self.info.set_input_summary(self.info.NoInput)
 
     @Inputs.data
     def set_data(self, data):
         self.data = data
-        self._set_label_text("data")
 
     @Inputs.reference
     def set_ref(self, refs):
         self.reference = refs
-        self._set_label_text("reference")
 
     def handleNewSignals(self):
         self.compute_distances()
         self.unconditional_apply()
+        self._set_input_summary()
 
     def recompute(self):
         self.compute_distances()
@@ -141,10 +139,13 @@
 
     def apply(self):
         indices = self._compute_indices()
+
         if indices is None:
             neighbors = None
+            self.info.set_output_summary(self.info.NoOutput)
         else:
             neighbors = self._data_with_similarity(indices)
+            self.info.set_output_summary(str(len(neighbors)))
         self.Outputs.data.send(neighbors)
 
     def _compute_indices(self):

{"golden_diff": "diff --git a/Orange/widgets/data/owneighbors.py b/Orange/widgets/data/owneighbors.py\n--- a/Orange/widgets/data/owneighbors.py\n+++ b/Orange/widgets/data/owneighbors.py\n@@ -64,12 +64,6 @@\n         self.reference = None\n         self.distances = None\n \n-        box = gui.vBox(self.controlArea, \"Info\")\n-        self.data_info_label = gui.widgetLabel(box, \"\")\n-        self.reference_info_label = gui.widgetLabel(box, \"\")\n-        self._set_label_text(\"data\")\n-        self._set_label_text(\"reference\")\n-\n         box = gui.vBox(self.controlArea, box=True)\n         gui.comboBox(\n             box, self, \"distance_index\", orientation=Qt.Horizontal,\n@@ -87,29 +81,33 @@\n             callback=lambda: self.apply())\n \n         self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)\n-\n-    def _set_label_text(self, name):\n-        data = getattr(self, name)\n-        label = getattr(self, f\"{name}_info_label\")\n-        if data is None:\n-            label.setText(f\"No {name} instances\")\n+        self.info.set_input_summary(self.info.NoInput)\n+        self.info.set_output_summary(self.info.NoOutput)\n+\n+    def _set_input_summary(self):\n+        n_data = len(self.data) if self.data else 0\n+        n_refs = len(self.reference) if self.reference else 0\n+\n+        if n_data or n_refs:\n+            details = \\\n+                f\"{n_data if n_data else 'No'} data instance(s) on input\\n\" \\\n+                f\"{n_refs if n_refs else 'No'} reference instance(s) on input \"\n+            self.info.set_input_summary(f\"{n_data} | {n_refs} \", details)\n         else:\n-            pl = \"s\" if data else \"\"\n-            label.setText(f\"{len(data)} {name} instance{pl} on input.\")\n+            self.info.set_input_summary(self.info.NoInput)\n \n     @Inputs.data\n     def set_data(self, data):\n         self.data = data\n-        self._set_label_text(\"data\")\n \n     @Inputs.reference\n     def set_ref(self, refs):\n         self.reference = refs\n-        self._set_label_text(\"reference\")\n \n     def handleNewSignals(self):\n         self.compute_distances()\n         self.unconditional_apply()\n+        self._set_input_summary()\n \n     def recompute(self):\n         self.compute_distances()\n@@ -141,10 +139,13 @@\n \n     def apply(self):\n         indices = self._compute_indices()\n+\n         if indices is None:\n             neighbors = None\n+            self.info.set_output_summary(self.info.NoOutput)\n         else:\n             neighbors = self._data_with_similarity(indices)\n+            self.info.set_output_summary(str(len(neighbors)))\n         self.Outputs.data.send(neighbors)\n \n     def _compute_indices(self):\n", "issue": "Neighbors: remove Info box and display data info in status bar\nFollow an example where the change of this widget was already reported in [the blog](https://orange.biolab.si/blog/2019/3/8/the-changing-status-bar/). Change the documentation accordingly.\r\n\r\n![changing-status-bar](https://user-images.githubusercontent.com/726604/67082844-3a7c6800-f19a-11e9-8ba4-f89c6ed7ab7e.png)\r\n\n", "before_files": [{"content": "import numpy as np\n\nfrom AnyQt.QtCore import Qt\n\nfrom Orange.data import Table, Domain, ContinuousVariable\nfrom Orange.data.util import get_unique_names\nfrom Orange.preprocess import RemoveNaNColumns, Impute\nfrom Orange import distance\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.signals import Input, Output\nfrom Orange.widgets.widget import OWWidget, Msg\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\n\nMETRICS = [\n    (\"Euclidean\", distance.Euclidean),\n    (\"Manhattan\", distance.Manhattan),\n    (\"Mahalanobis\", distance.Mahalanobis),\n    (\"Cosine\", distance.Cosine),\n    (\"Jaccard\", distance.Jaccard),\n    (\"Spearman\", distance.SpearmanR),\n    (\"Absolute Spearman\", distance.SpearmanRAbsolute),\n    (\"Pearson\", distance.PearsonR),\n    (\"Absolute Pearson\", distance.PearsonRAbsolute),\n]\n\n\nclass OWNeighbors(OWWidget):\n    name = \"Neighbors\"\n    description = \"Compute nearest neighbors in data according to reference.\"\n    icon = \"icons/Neighbors.svg\"\n\n    replaces = [\"orangecontrib.prototypes.widgets.owneighbours.OWNeighbours\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Neighbors\", Table)\n\n    class Warning(OWWidget.Warning):\n        all_data_as_reference = \\\n            Msg(\"Every data instance is same as some reference\")\n\n    class Error(OWWidget.Error):\n        diff_domains = Msg(\"Data and reference have different features\")\n\n    n_neighbors: int\n    distance_index: int\n\n    n_neighbors = Setting(10)\n    distance_index = Setting(0)\n    exclude_reference = Setting(True)\n    auto_apply = Setting(True)\n\n    want_main_area = False\n    buttons_area_orientation = Qt.Vertical\n\n    def __init__(self):\n        super().__init__()\n\n        self.data = None\n        self.reference = None\n        self.distances = None\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.data_info_label = gui.widgetLabel(box, \"\")\n        self.reference_info_label = gui.widgetLabel(box, \"\")\n        self._set_label_text(\"data\")\n        self._set_label_text(\"reference\")\n\n        box = gui.vBox(self.controlArea, box=True)\n        gui.comboBox(\n            box, self, \"distance_index\", orientation=Qt.Horizontal,\n            label=\"Distance: \", items=[d[0] for d in METRICS],\n            callback=self.recompute)\n        gui.spin(\n            box, self, \"n_neighbors\", label=\"Number of neighbors:\",\n            step=1, spinType=int, minv=0, maxv=100,\n            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda\n            callback=lambda: self.apply())\n        gui.checkBox(\n            box, self, \"exclude_reference\",\n            label=\"Exclude rows (equal to) references\",\n            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda\n            callback=lambda: self.apply())\n\n        self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)\n\n    def _set_label_text(self, name):\n        data = getattr(self, name)\n        label = getattr(self, f\"{name}_info_label\")\n        if data is None:\n            label.setText(f\"No {name} instances\")\n        else:\n            pl = \"s\" if data else \"\"\n            label.setText(f\"{len(data)} {name} instance{pl} on input.\")\n\n    @Inputs.data\n    def set_data(self, data):\n        self.data = data\n        self._set_label_text(\"data\")\n\n    @Inputs.reference\n    def set_ref(self, refs):\n        self.reference = refs\n        self._set_label_text(\"reference\")\n\n    def handleNewSignals(self):\n        self.compute_distances()\n        self.unconditional_apply()\n\n    def recompute(self):\n        self.compute_distances()\n        self.apply()\n\n    def compute_distances(self):\n        self.Error.diff_domains.clear()\n        if not self.data or not self.reference:\n            self.distances = None\n            return\n        if set(self.reference.domain.attributes) != \\\n                set(self.data.domain.attributes):\n            self.Error.diff_domains()\n            self.distances = None\n            return\n\n        metric = METRICS[self.distance_index][1]\n        n_ref = len(self.reference)\n\n        # comparing only attributes, no metas and class-vars\n        new_domain = Domain(self.data.domain.attributes)\n        reference = self.reference.transform(new_domain)\n        data = self.data.transform(new_domain)\n\n        all_data = Table.concatenate([reference, data], 0)\n        pp_all_data = Impute()(RemoveNaNColumns()(all_data))\n        pp_reference, pp_data = pp_all_data[:n_ref], pp_all_data[n_ref:]\n        self.distances = metric(pp_data, pp_reference).min(axis=1)\n\n    def apply(self):\n        indices = self._compute_indices()\n        if indices is None:\n            neighbors = None\n        else:\n            neighbors = self._data_with_similarity(indices)\n        self.Outputs.data.send(neighbors)\n\n    def _compute_indices(self):\n        self.Warning.all_data_as_reference.clear()\n        dist = self.distances\n        if dist is None:\n            return None\n        if self.exclude_reference:\n            non_ref = dist > 1e-5\n            skip = len(dist) - non_ref.sum()\n            up_to = min(self.n_neighbors + skip, len(dist))\n            if skip >= up_to:\n                self.Warning.all_data_as_reference()\n                return None\n            indices = np.argpartition(dist, up_to - 1)[:up_to]\n            return indices[non_ref[indices]]\n        else:\n            up_to = min(self.n_neighbors, len(dist))\n            return np.argpartition(dist, up_to - 1)[:up_to]\n\n    def _data_with_similarity(self, indices):\n        data = self.data\n        varname = get_unique_names(data.domain, \"distance\")\n        metas = data.domain.metas + (ContinuousVariable(varname), )\n        domain = Domain(data.domain.attributes, data.domain.class_vars, metas)\n        data_metas = self.distances[indices].reshape((-1, 1))\n        if data.domain.metas:\n            data_metas = np.hstack((data.metas[indices], data_metas))\n        neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)\n        neighbors.attributes = self.data.attributes\n        return neighbors\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    iris = Table(\"iris.tab\")\n    WidgetPreview(OWNeighbors).run(\n        set_data=iris,\n        set_ref=iris[:1])\n", "path": "Orange/widgets/data/owneighbors.py"}], "after_files": [{"content": "import numpy as np\n\nfrom AnyQt.QtCore import Qt\n\nfrom Orange.data import Table, Domain, ContinuousVariable\nfrom Orange.data.util import get_unique_names\nfrom Orange.preprocess import RemoveNaNColumns, Impute\nfrom Orange import distance\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.signals import Input, Output\nfrom Orange.widgets.widget import OWWidget, Msg\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\n\nMETRICS = [\n    (\"Euclidean\", distance.Euclidean),\n    (\"Manhattan\", distance.Manhattan),\n    (\"Mahalanobis\", distance.Mahalanobis),\n    (\"Cosine\", distance.Cosine),\n    (\"Jaccard\", distance.Jaccard),\n    (\"Spearman\", distance.SpearmanR),\n    (\"Absolute Spearman\", distance.SpearmanRAbsolute),\n    (\"Pearson\", distance.PearsonR),\n    (\"Absolute Pearson\", distance.PearsonRAbsolute),\n]\n\n\nclass OWNeighbors(OWWidget):\n    name = \"Neighbors\"\n    description = \"Compute nearest neighbors in data according to reference.\"\n    icon = \"icons/Neighbors.svg\"\n\n    replaces = [\"orangecontrib.prototypes.widgets.owneighbours.OWNeighbours\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Neighbors\", Table)\n\n    class Warning(OWWidget.Warning):\n        all_data_as_reference = \\\n            Msg(\"Every data instance is same as some reference\")\n\n    class Error(OWWidget.Error):\n        diff_domains = Msg(\"Data and reference have different features\")\n\n    n_neighbors: int\n    distance_index: int\n\n    n_neighbors = Setting(10)\n    distance_index = Setting(0)\n    exclude_reference = Setting(True)\n    auto_apply = Setting(True)\n\n    want_main_area = False\n    buttons_area_orientation = Qt.Vertical\n\n    def __init__(self):\n        super().__init__()\n\n        self.data = None\n        self.reference = None\n        self.distances = None\n\n        box = gui.vBox(self.controlArea, box=True)\n        gui.comboBox(\n            box, self, \"distance_index\", orientation=Qt.Horizontal,\n            label=\"Distance: \", items=[d[0] for d in METRICS],\n            callback=self.recompute)\n        gui.spin(\n            box, self, \"n_neighbors\", label=\"Number of neighbors:\",\n            step=1, spinType=int, minv=0, maxv=100,\n            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda\n            callback=lambda: self.apply())\n        gui.checkBox(\n            box, self, \"exclude_reference\",\n            label=\"Exclude rows (equal to) references\",\n            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda\n            callback=lambda: self.apply())\n\n        self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)\n        self.info.set_input_summary(self.info.NoInput)\n        self.info.set_output_summary(self.info.NoOutput)\n\n    def _set_input_summary(self):\n        n_data = len(self.data) if self.data else 0\n        n_refs = len(self.reference) if self.reference else 0\n\n        if n_data or n_refs:\n            details = \\\n                f\"{n_data if n_data else 'No'} data instance(s) on input\\n\" \\\n                f\"{n_refs if n_refs else 'No'} reference instance(s) on input \"\n            self.info.set_input_summary(f\"{n_data} | {n_refs} \", details)\n        else:\n            self.info.set_input_summary(self.info.NoInput)\n\n    @Inputs.data\n    def set_data(self, data):\n        self.data = data\n\n    @Inputs.reference\n    def set_ref(self, refs):\n        self.reference = refs\n\n    def handleNewSignals(self):\n        self.compute_distances()\n        self.unconditional_apply()\n        self._set_input_summary()\n\n    def recompute(self):\n        self.compute_distances()\n        self.apply()\n\n    def compute_distances(self):\n        self.Error.diff_domains.clear()\n        if not self.data or not self.reference:\n            self.distances = None\n            return\n        if set(self.reference.domain.attributes) != \\\n                set(self.data.domain.attributes):\n            self.Error.diff_domains()\n            self.distances = None\n            return\n\n        metric = METRICS[self.distance_index][1]\n        n_ref = len(self.reference)\n\n        # comparing only attributes, no metas and class-vars\n        new_domain = Domain(self.data.domain.attributes)\n        reference = self.reference.transform(new_domain)\n        data = self.data.transform(new_domain)\n\n        all_data = Table.concatenate([reference, data], 0)\n        pp_all_data = Impute()(RemoveNaNColumns()(all_data))\n        pp_reference, pp_data = pp_all_data[:n_ref], pp_all_data[n_ref:]\n        self.distances = metric(pp_data, pp_reference).min(axis=1)\n\n    def apply(self):\n        indices = self._compute_indices()\n\n        if indices is None:\n            neighbors = None\n            self.info.set_output_summary(self.info.NoOutput)\n        else:\n            neighbors = self._data_with_similarity(indices)\n            self.info.set_output_summary(str(len(neighbors)))\n        self.Outputs.data.send(neighbors)\n\n    def _compute_indices(self):\n        self.Warning.all_data_as_reference.clear()\n        dist = self.distances\n        if dist is None:\n            return None\n        if self.exclude_reference:\n            non_ref = dist > 1e-5\n            skip = len(dist) - non_ref.sum()\n            up_to = min(self.n_neighbors + skip, len(dist))\n            if skip >= up_to:\n                self.Warning.all_data_as_reference()\n                return None\n            indices = np.argpartition(dist, up_to - 1)[:up_to]\n            return indices[non_ref[indices]]\n        else:\n            up_to = min(self.n_neighbors, len(dist))\n            return np.argpartition(dist, up_to - 1)[:up_to]\n\n    def _data_with_similarity(self, indices):\n        data = self.data\n        varname = get_unique_names(data.domain, \"distance\")\n        metas = data.domain.metas + (ContinuousVariable(varname), )\n        domain = Domain(data.domain.attributes, data.domain.class_vars, metas)\n        data_metas = self.distances[indices].reshape((-1, 1))\n        if data.domain.metas:\n            data_metas = np.hstack((data.metas[indices], data_metas))\n        neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)\n        neighbors.attributes = self.data.attributes\n        return neighbors\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    iris = Table(\"iris.tab\")\n    WidgetPreview(OWNeighbors).run(\n        set_data=iris,\n        set_ref=iris[:1])\n", "path": "Orange/widgets/data/owneighbors.py"}]}