{
    "file_diffs": [
        {
            "old_file_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\nfrom Orange.widgets.utils.state_summary import format_summary_details,\\\n    format_multiple_summaries\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    resizing_enabled = 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        summary, details, kwargs = self.info.NoInput, \"\", {}\n\n        if self.data or self.reference:\n            summary = f\"{self.info.format_number(n_data)}, \" \\\n                      f\"{self.info.format_number(n_refs)}\"\n            details = format_multiple_summaries([\n                (\"Data\", self.data),\n                (\"Reference\", self.reference)\n            ])\n            kwargs = {\"format\": Qt.RichText}\n        self.info.set_input_summary(summary, details, **kwargs)\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._set_input_summary()\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\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            summary, details = len(neighbors), format_summary_details(neighbors)\n            self.info.set_output_summary(summary, details)\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",
            "new_file_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\nfrom Orange.widgets.utils.state_summary import format_summary_details,\\\n    format_multiple_summaries\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    resizing_enabled = 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        summary, details, kwargs = self.info.NoInput, \"\", {}\n\n        if self.data or self.reference:\n            summary = f\"{self.info.format_number(n_data)}, \" \\\n                      f\"{self.info.format_number(n_refs)}\"\n            details = format_multiple_summaries([\n                (\"Data\", self.data),\n                (\"Reference\", self.reference)\n            ])\n            kwargs = {\"format\": Qt.RichText}\n        self.info.set_input_summary(summary, details, **kwargs)\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._set_input_summary()\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\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            summary, details = len(neighbors), format_summary_details(neighbors)\n            self.info.set_output_summary(summary, details)\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.ids = data.ids[indices]\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",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owneighbors.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "574566ae9",
                "new_commit_hash": "9b4d0375e",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/owneighbors.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/owneighbors.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 182,
                            "length": 6
                        },
                        "new_range": {
                            "start": 182,
                            "length": 7
                        },
                        "section": "class OWNeighbors(OWWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        if data.domain.metas:",
                                "type": "context"
                            },
                            {
                                "content": "            data_metas = np.hstack((data.metas[indices], data_metas))",
                                "type": "context"
                            },
                            {
                                "content": "        neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)",
                                "type": "context"
                            },
                            {
                                "content": "        neighbors.ids = data.ids[indices]",
                                "type": "added"
                            },
                            {
                                "content": "        neighbors.attributes = self.data.attributes",
                                "type": "context"
                            },
                            {
                                "content": "        return neighbors",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owneighbors.py",
                            "type": "method",
                            "name": "OWNeighbors._data_with_similarity",
                            "content": "class 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    resizing_enabled = 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        summary, details, kwargs = self.info.NoInput, \"\", {}\n\n        if self.data or self.reference:\n            summary = f\"{self.info.format_number(n_data)}, \" \\\n                      f\"{self.info.format_number(n_refs)}\"\n            details = format_multiple_summaries([\n                (\"Data\", self.data),\n                (\"Reference\", self.reference)\n            ])\n            kwargs = {\"format\": Qt.RichText}\n        self.info.set_input_summary(summary, details, **kwargs)\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._set_input_summary()\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\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            summary, details = len(neighbors), format_summary_details(neighbors)\n            self.info.set_output_summary(summary, details)\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.ids = data.ids[indices]\n        neighbors.attributes = self.data.attributes\n        return neighbors",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 176,
                            "end_lineno": 187,
                            "parent": {
                                "file_name": "Orange/widgets/data/owneighbors.py",
                                "type": "class",
                                "name": "OWNeighbors",
                                "content": "class 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    resizing_enabled = 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        summary, details, kwargs = self.info.NoInput, \"\", {}\n\n        if self.data or self.reference:\n            summary = f\"{self.info.format_number(n_data)}, \" \\\n                      f\"{self.info.format_number(n_refs)}\"\n            details = format_multiple_summaries([\n                (\"Data\", self.data),\n                (\"Reference\", self.reference)\n            ])\n            kwargs = {\"format\": Qt.RichText}\n        self.info.set_input_summary(summary, details, **kwargs)\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._set_input_summary()\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\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            summary, details = len(neighbors), format_summary_details(neighbors)\n            self.info.set_output_summary(summary, details)\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.ids = data.ids[indices]\n        neighbors.attributes = self.data.attributes\n        return neighbors",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 30,
                                "end_lineno": 187,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/owneighbors.py",
                            "type": "class",
                            "name": "OWNeighbors",
                            "content": "class 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    resizing_enabled = 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        summary, details, kwargs = self.info.NoInput, \"\", {}\n\n        if self.data or self.reference:\n            summary = f\"{self.info.format_number(n_data)}, \" \\\n                      f\"{self.info.format_number(n_refs)}\"\n            details = format_multiple_summaries([\n                (\"Data\", self.data),\n                (\"Reference\", self.reference)\n            ])\n            kwargs = {\"format\": Qt.RichText}\n        self.info.set_input_summary(summary, details, **kwargs)\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._set_input_summary()\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\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            summary, details = len(neighbors), format_summary_details(neighbors)\n            self.info.set_output_summary(summary, details)\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.ids = data.ids[indices]\n        neighbors.attributes = self.data.attributes\n        return neighbors",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 30,
                            "end_lineno": 187,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "#pylint: disable=missing-docstring,protected-access,unsubscriptable-object\nimport unittest\nfrom unittest.mock import Mock\n\nimport numpy as np\n\nfrom Orange.data import Table, Domain, ContinuousVariable\nfrom Orange.widgets.data.owneighbors import OWNeighbors, METRICS\nfrom Orange.widgets.tests.base import WidgetTest, ParameterMapping\nfrom Orange.widgets.utils.state_summary import format_summary_details, \\\n    format_multiple_summaries\n\n\nclass TestOWNeighbors(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWNeighbors,\n                                         stored_settings={\"auto_apply\": False})\n        self.iris = Table(\"iris\")\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.data, None)\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data after disconnecting data on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n        self.send_signal(widget.Inputs.data, None)\n        self.assertEqual(widget.data, None)\n\n    def test_input_reference(self):\n        \"\"\"Check widget's reference with reference on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.reference, None)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n\n    def test_input_reference_disconnect(self):\n        \"\"\"Check reference after disconnecting reference on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n        self.send_signal(widget.Inputs.reference, None)\n        self.assertEqual(widget.reference, None)\n        widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris[:10])\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n\n    def test_settings(self):\n        \"\"\"Check neighbors for various distance metrics\"\"\"\n        widget = self.widget\n        settings = [\n            ParameterMapping(\"\", widget.controls.distance_index, METRICS),\n            ParameterMapping(\"\", widget.controls.n_neighbors)]\n        for setting in settings:\n            for val in setting.values:\n                self.send_signal(widget.Inputs.data, self.iris)\n                self.send_signal(widget.Inputs.reference, self.iris[:10])\n                setting.set_value(val)\n                widget.apply_button.button.click()\n                if METRICS[widget.distance_index][0] != \"Jaccard\" \\\n                        and widget.n_neighbors != 0:\n                    self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_exclude_reference(self):\n        \"\"\"Check neighbors when reference is excluded\"\"\"\n        widget = self.widget\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        self.widget.exclude_reference = True\n        widget.apply_button.button.click()\n        neighbors = self.get_output(widget.Outputs.data)\n        for inst in reference:\n            self.assertNotIn(inst, neighbors)\n\n    def test_include_reference(self):\n        \"\"\"Check neighbors when reference is included\"\"\"\n        widget = self.widget\n        widget.controls.exclude_reference.setChecked(False)\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        for inst in reference:\n            self.assertIn(inst, neighbors)\n\n    def test_similarity(self):\n        widget = self.widget\n        reference = self.iris[:10]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        self.assertEqual(self.iris.domain.attributes,\n                         neighbors.domain.attributes)\n        self.assertEqual(self.iris.domain.class_vars,\n                         neighbors.domain.class_vars)\n        self.assertIn(\"distance\", neighbors.domain)\n        self.assertTrue(all(100 >= ins[\"distance\"] >= 0 for ins in neighbors))\n\n    def test_missing_values(self):\n        widget = self.widget\n        data = Table(\"iris\")\n        reference = data[:3]\n        data.X[0:10, 0] = np.nan\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, reference)\n        data_list = [(\"Data\", data), (\"Reference\", reference)]\n        summary, details = \"150, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        data_list = [(\"Data\", None), (\"Reference\", reference)]\n        summary, details = \"0, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        self.assertEqual(info._StateInfo__input_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_compute_distances_apply_called(self):\n        \"\"\"Check compute distances and apply are called when receiving signal\"\"\"\n        widget = self.widget\n        cdist = widget.compute_distances = Mock()\n        apply = widget.unconditional_apply = Mock()\n        self.widget.auto_apply = False\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signal(widget.Inputs.reference, data[:10])\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signals([(widget.Inputs.data, data),\n                           (widget.Inputs.reference, data[:10])])\n        self.assertEqual(cdist.call_count, 1)\n        self.assertEqual(apply.call_count, 1)\n\n    def test_compute_distances_calls_distance(self):\n        widget = self.widget\n        widget.distance_index = 2\n        dists = np.random.random((5, 10))\n        distance = Mock(return_value=dists)\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, refs)])\n            # false positive, pylint: disable=unsubscriptable-object\n            d1, d2 = distance.call_args[0]\n            np.testing.assert_almost_equal(d1.X, data.X)\n            np.testing.assert_almost_equal(d2.X, refs.X)\n            # false positive, pylint: disable=no-member\n            np.testing.assert_almost_equal(widget.distances, dists.min(axis=1))\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_distances_distance_no_data(self):\n        widget = self.widget\n        distance = Mock()\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signal(widget.Inputs.data, data)\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, None),\n                               (widget.Inputs.reference, refs)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n\n            data, refs = data[:0], data[:0]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_indices_with_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = False\n        widget.n_neighbors = 3\n        self.assertEqual(sorted(widget._compute_indices()), [1, 3, 7])\n\n        widget.n_neighbors = 1\n        self.assertIn(list(widget._compute_indices()), ([3], [7]))\n\n        widget.n_neighbors = 5\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 5)\n        self.assertTrue({1, 3, 7} < ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 13\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 14\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12])\n\n    def test_compute_indices_without_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = True\n        widget.n_neighbors = 5\n        self.assertEqual(sorted(widget._compute_indices()), [1, 5, 8, 9, 10])\n\n        widget.n_neighbors = 1\n        self.assertEqual(list(widget._compute_indices()), [1])\n\n        widget.n_neighbors = 3\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 3)\n        self.assertIn(1, ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 11\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 10\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 12])\n\n    def test_data_with_similarity(self):\n        widget = self.widget\n        indices = np.array([5, 10, 15, 100])\n\n        data = Table(\"iris\")\n        widget.data = data\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(neighbours.metas.shape, (4, 1))\n        np.testing.assert_almost_equal(\n            neighbours.metas.flatten(), indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data.X[indices])\n\n        domain = data.domain\n        domain2 = Domain([domain[2]], domain.class_var, metas=domain[:2])\n        data2 = data.transform(domain2)\n        widget.data = data2\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(len(neighbours.domain.metas), 3)\n        self.assertEqual(neighbours.metas.shape, (4, 3))\n        np.testing.assert_almost_equal(\n            neighbours.get_column_view(\"distance\")[0], indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data2.X[indices])\n\n    def test_apply(self):\n        widget = self.widget\n        widget.auto_apply = True\n        data = Table(\"iris\")\n        indices = np.array([5, 10, 15, 100])\n\n        widget._compute_indices = lambda: \\\n            indices if widget.distances is not None else None\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n        neigh = self.get_output(widget.Outputs.data)\n        np.testing.assert_almost_equal(neigh.X, data.X[indices])\n        np.testing.assert_almost_equal(\n            neigh.metas.flatten(), widget.distances[indices])\n\n    def test_all_equal_ref(self):\n        widget = self.widget\n        widget.auto_apply = True\n\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n\n        orig_distances = widget.distances\n        widget.distances = np.zeros(len(data), dtype=float)\n        widget.apply()\n        self.assertTrue(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNone(self.get_output(widget.Outputs.data))\n\n        widget.distances = orig_distances\n        widget.apply()\n        self.assertFalse(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNotNone(self.get_output(widget.Outputs.data))\n\n    def test_different_domains(self):\n        \"\"\"\n        Test weather widget show error when data and a reference have different\n        domains.\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\")])\n        domain_ref = Domain([ContinuousVariable(\"b\")])\n        data = Table(domain, np.random.rand(2, len(domain)))\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # no error if one or both of the signals is missing\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # same domain - no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # one attribute different attribute name\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        # different number of attributes\n        domain_ref = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")])\n        reference = Table(domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # error disappears when data is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # error disappears when reference is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n    def test_different_metas(self):\n        \"\"\"\n        Test weather widget do not show error when data and a reference have\n        domain that differ only in metas\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                        metas=[ContinuousVariable(\"c\")])\n        data = Table(\n            domain, np.random.rand(15, len(domain.attributes)),\n            metas=np.random.rand(15, len(domain.metas)))\n\n        # same domain with same metas no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different metas no error\n        domain_ref = Domain(domain.attributes,\n                            metas=[ContinuousVariable(\"d\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different order - no error\n        domain_ref = Domain(domain.attributes[::-1])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different number of metas no error\n        domain_ref = Domain(\n            domain.attributes,\n            metas=[ContinuousVariable(\"d\"), ContinuousVariable(\"e\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # different domain with same metas - error shown\n        domain_ref = Domain(domain.attributes + (ContinuousVariable(\"e\"),),\n                            metas=[ContinuousVariable(\"c\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertIsNone(output)\n\n    def test_different_domains_same_names(self):\n        \"\"\"\n        Here we create two domains with same names of attributes - the case\n        with image-analytics (two embeddings). Widget must not show the\n        error in this case.\n        \"\"\"\n        w = self.widget\n        domain1 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"c\")])\n        domain2 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"d\")])\n        data = Table(\n            domain1, np.random.rand(15, len(domain1.attributes)),\n            metas=np.random.rand(15, len(domain1.metas)))\n        ref = Table(\n            domain2, np.random.rand(2, len(domain2.attributes)),\n            metas=np.random.rand(2, len(domain2.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, ref)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "#pylint: disable=missing-docstring,protected-access,unsubscriptable-object\nimport unittest\nfrom unittest.mock import Mock\n\nimport numpy as np\n\nfrom Orange.data import Table, Domain, ContinuousVariable\nfrom Orange.widgets.data.owneighbors import OWNeighbors, METRICS\nfrom Orange.widgets.tests.base import WidgetTest, ParameterMapping\nfrom Orange.widgets.utils.state_summary import format_summary_details, \\\n    format_multiple_summaries\n\n\nclass TestOWNeighbors(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWNeighbors,\n                                         stored_settings={\"auto_apply\": False})\n        self.iris = Table(\"iris\")\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.data, None)\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data after disconnecting data on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n        self.send_signal(widget.Inputs.data, None)\n        self.assertEqual(widget.data, None)\n\n    def test_input_reference(self):\n        \"\"\"Check widget's reference with reference on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.reference, None)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n\n    def test_input_reference_disconnect(self):\n        \"\"\"Check reference after disconnecting reference on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n        self.send_signal(widget.Inputs.reference, None)\n        self.assertEqual(widget.reference, None)\n        widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signals(((widget.Inputs.data, self.iris),\n                           (widget.Inputs.reference, self.iris[:10])))\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n        self.assertTrue(all([i in self.iris.ids for i in\n                             self.get_output(widget.Outputs.data).ids])\n                        )\n\n    def test_settings(self):\n        \"\"\"Check neighbors for various distance metrics\"\"\"\n        widget = self.widget\n        settings = [\n            ParameterMapping(\"\", widget.controls.distance_index, METRICS),\n            ParameterMapping(\"\", widget.controls.n_neighbors)]\n        for setting in settings:\n            for val in setting.values:\n                self.send_signal(widget.Inputs.data, self.iris)\n                self.send_signal(widget.Inputs.reference, self.iris[:10])\n                setting.set_value(val)\n                widget.apply_button.button.click()\n                if METRICS[widget.distance_index][0] != \"Jaccard\" \\\n                        and widget.n_neighbors != 0:\n                    self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_exclude_reference(self):\n        \"\"\"Check neighbors when reference is excluded\"\"\"\n        widget = self.widget\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        self.widget.exclude_reference = True\n        widget.apply_button.button.click()\n        neighbors = self.get_output(widget.Outputs.data)\n        for inst in reference:\n            self.assertNotIn(inst, neighbors)\n\n    def test_include_reference(self):\n        \"\"\"Check neighbors when reference is included\"\"\"\n        widget = self.widget\n        widget.controls.exclude_reference.setChecked(False)\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        for inst in reference:\n            self.assertIn(inst, neighbors)\n\n    def test_similarity(self):\n        widget = self.widget\n        reference = self.iris[:10]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        self.assertEqual(self.iris.domain.attributes,\n                         neighbors.domain.attributes)\n        self.assertEqual(self.iris.domain.class_vars,\n                         neighbors.domain.class_vars)\n        self.assertIn(\"distance\", neighbors.domain)\n        self.assertTrue(all(100 >= ins[\"distance\"] >= 0 for ins in neighbors))\n\n    def test_missing_values(self):\n        widget = self.widget\n        data = Table(\"iris\")\n        reference = data[:3]\n        data.X[0:10, 0] = np.nan\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, reference)\n        data_list = [(\"Data\", data), (\"Reference\", reference)]\n        summary, details = \"150, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        data_list = [(\"Data\", None), (\"Reference\", reference)]\n        summary, details = \"0, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        self.assertEqual(info._StateInfo__input_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_compute_distances_apply_called(self):\n        \"\"\"Check compute distances and apply are called when receiving signal\"\"\"\n        widget = self.widget\n        cdist = widget.compute_distances = Mock()\n        apply = widget.unconditional_apply = Mock()\n        self.widget.auto_apply = False\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signal(widget.Inputs.reference, data[:10])\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signals([(widget.Inputs.data, data),\n                           (widget.Inputs.reference, data[:10])])\n        self.assertEqual(cdist.call_count, 1)\n        self.assertEqual(apply.call_count, 1)\n\n    def test_compute_distances_calls_distance(self):\n        widget = self.widget\n        widget.distance_index = 2\n        dists = np.random.random((5, 10))\n        distance = Mock(return_value=dists)\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, refs)])\n            # false positive, pylint: disable=unsubscriptable-object\n            d1, d2 = distance.call_args[0]\n            np.testing.assert_almost_equal(d1.X, data.X)\n            np.testing.assert_almost_equal(d2.X, refs.X)\n            # false positive, pylint: disable=no-member\n            np.testing.assert_almost_equal(widget.distances, dists.min(axis=1))\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_distances_distance_no_data(self):\n        widget = self.widget\n        distance = Mock()\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signal(widget.Inputs.data, data)\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, None),\n                               (widget.Inputs.reference, refs)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n\n            data, refs = data[:0], data[:0]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_indices_with_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = False\n        widget.n_neighbors = 3\n        self.assertEqual(sorted(widget._compute_indices()), [1, 3, 7])\n\n        widget.n_neighbors = 1\n        self.assertIn(list(widget._compute_indices()), ([3], [7]))\n\n        widget.n_neighbors = 5\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 5)\n        self.assertTrue({1, 3, 7} < ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 13\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 14\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12])\n\n    def test_compute_indices_without_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = True\n        widget.n_neighbors = 5\n        self.assertEqual(sorted(widget._compute_indices()), [1, 5, 8, 9, 10])\n\n        widget.n_neighbors = 1\n        self.assertEqual(list(widget._compute_indices()), [1])\n\n        widget.n_neighbors = 3\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 3)\n        self.assertIn(1, ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 11\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 10\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 12])\n\n    def test_data_with_similarity(self):\n        widget = self.widget\n        indices = np.array([5, 10, 15, 100])\n\n        data = Table(\"iris\")\n        widget.data = data\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(neighbours.metas.shape, (4, 1))\n        np.testing.assert_almost_equal(\n            neighbours.metas.flatten(), indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data.X[indices])\n\n        domain = data.domain\n        domain2 = Domain([domain[2]], domain.class_var, metas=domain[:2])\n        data2 = data.transform(domain2)\n        widget.data = data2\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(len(neighbours.domain.metas), 3)\n        self.assertEqual(neighbours.metas.shape, (4, 3))\n        np.testing.assert_almost_equal(\n            neighbours.get_column_view(\"distance\")[0], indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data2.X[indices])\n\n    def test_apply(self):\n        widget = self.widget\n        widget.auto_apply = True\n        data = Table(\"iris\")\n        indices = np.array([5, 10, 15, 100])\n\n        widget._compute_indices = lambda: \\\n            indices if widget.distances is not None else None\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n        neigh = self.get_output(widget.Outputs.data)\n        np.testing.assert_almost_equal(neigh.X, data.X[indices])\n        np.testing.assert_almost_equal(\n            neigh.metas.flatten(), widget.distances[indices])\n\n    def test_all_equal_ref(self):\n        widget = self.widget\n        widget.auto_apply = True\n\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n\n        orig_distances = widget.distances\n        widget.distances = np.zeros(len(data), dtype=float)\n        widget.apply()\n        self.assertTrue(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNone(self.get_output(widget.Outputs.data))\n\n        widget.distances = orig_distances\n        widget.apply()\n        self.assertFalse(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNotNone(self.get_output(widget.Outputs.data))\n\n    def test_different_domains(self):\n        \"\"\"\n        Test weather widget show error when data and a reference have different\n        domains.\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\")])\n        domain_ref = Domain([ContinuousVariable(\"b\")])\n        data = Table(domain, np.random.rand(2, len(domain)))\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # no error if one or both of the signals is missing\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # same domain - no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # one attribute different attribute name\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        # different number of attributes\n        domain_ref = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")])\n        reference = Table(domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # error disappears when data is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # error disappears when reference is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n    def test_different_metas(self):\n        \"\"\"\n        Test weather widget do not show error when data and a reference have\n        domain that differ only in metas\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                        metas=[ContinuousVariable(\"c\")])\n        data = Table(\n            domain, np.random.rand(15, len(domain.attributes)),\n            metas=np.random.rand(15, len(domain.metas)))\n\n        # same domain with same metas no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different metas no error\n        domain_ref = Domain(domain.attributes,\n                            metas=[ContinuousVariable(\"d\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different order - no error\n        domain_ref = Domain(domain.attributes[::-1])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different number of metas no error\n        domain_ref = Domain(\n            domain.attributes,\n            metas=[ContinuousVariable(\"d\"), ContinuousVariable(\"e\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # different domain with same metas - error shown\n        domain_ref = Domain(domain.attributes + (ContinuousVariable(\"e\"),),\n                            metas=[ContinuousVariable(\"c\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertIsNone(output)\n\n    def test_different_domains_same_names(self):\n        \"\"\"\n        Here we create two domains with same names of attributes - the case\n        with image-analytics (two embeddings). Widget must not show the\n        error in this case.\n        \"\"\"\n        w = self.widget\n        domain1 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"c\")])\n        domain2 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"d\")])\n        data = Table(\n            domain1, np.random.rand(15, len(domain1.attributes)),\n            metas=np.random.rand(15, len(domain1.metas)))\n        ref = Table(\n            domain2, np.random.rand(2, len(domain2.attributes)),\n            metas=np.random.rand(2, len(domain2.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, ref)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/tests/test_owneighbors.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "e8615ddf3",
                "new_commit_hash": "fc71ecdaf",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/tests/test_owneighbors.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/tests/test_owneighbors.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 54,
                            "length": 11
                        },
                        "new_range": {
                            "start": 54,
                            "length": 14
                        },
                        "section": "class TestOWNeighbors(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        \"\"\"Check if neighbors are on the output after apply\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        widget = self.widget",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNone(self.get_output(\"Neighbors\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.send_signal(widget.Inputs.data, self.iris)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.send_signal(widget.Inputs.reference, self.iris[:10])",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.send_signals(((widget.Inputs.data, self.iris),",
                                "type": "added"
                            },
                            {
                                "content": "                           (widget.Inputs.reference, self.iris[:10])))",
                                "type": "added"
                            },
                            {
                                "content": "        widget.apply_button.button.click()",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNotNone(self.get_output(\"Neighbors\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertTrue(all([i in self.iris.ids for i in",
                                "type": "added"
                            },
                            {
                                "content": "                             self.get_output(widget.Outputs.data).ids])",
                                "type": "added"
                            },
                            {
                                "content": "                        )",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_settings(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"Check neighbors for various distance metrics\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owneighbors.py",
                            "type": "method",
                            "name": "TestOWNeighbors.test_output_neighbors",
                            "content": "class TestOWNeighbors(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWNeighbors,\n                                         stored_settings={\"auto_apply\": False})\n        self.iris = Table(\"iris\")\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.data, None)\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data after disconnecting data on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n        self.send_signal(widget.Inputs.data, None)\n        self.assertEqual(widget.data, None)\n\n    def test_input_reference(self):\n        \"\"\"Check widget's reference with reference on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.reference, None)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n\n    def test_input_reference_disconnect(self):\n        \"\"\"Check reference after disconnecting reference on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n        self.send_signal(widget.Inputs.reference, None)\n        self.assertEqual(widget.reference, None)\n        widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris[:10])\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n\n    def test_settings(self):\n        \"\"\"Check neighbors for various distance metrics\"\"\"\n        widget = self.widget\n        settings = [\n            ParameterMapping(\"\", widget.controls.distance_index, METRICS),\n            ParameterMapping(\"\", widget.controls.n_neighbors)]\n        for setting in settings:\n            for val in setting.values:\n                self.send_signal(widget.Inputs.data, self.iris)\n                self.send_signal(widget.Inputs.reference, self.iris[:10])\n                setting.set_value(val)\n                widget.apply_button.button.click()\n                if METRICS[widget.distance_index][0] != \"Jaccard\" \\\n                        and widget.n_neighbors != 0:\n                    self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_exclude_reference(self):\n        \"\"\"Check neighbors when reference is excluded\"\"\"\n        widget = self.widget\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        self.widget.exclude_reference = True\n        widget.apply_button.button.click()\n        neighbors = self.get_output(widget.Outputs.data)\n        for inst in reference:\n            self.assertNotIn(inst, neighbors)\n\n    def test_include_reference(self):\n        \"\"\"Check neighbors when reference is included\"\"\"\n        widget = self.widget\n        widget.controls.exclude_reference.setChecked(False)\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        for inst in reference:\n            self.assertIn(inst, neighbors)\n\n    def test_similarity(self):\n        widget = self.widget\n        reference = self.iris[:10]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        self.assertEqual(self.iris.domain.attributes,\n                         neighbors.domain.attributes)\n        self.assertEqual(self.iris.domain.class_vars,\n                         neighbors.domain.class_vars)\n        self.assertIn(\"distance\", neighbors.domain)\n        self.assertTrue(all(100 >= ins[\"distance\"] >= 0 for ins in neighbors))\n\n    def test_missing_values(self):\n        widget = self.widget\n        data = Table(\"iris\")\n        reference = data[:3]\n        data.X[0:10, 0] = np.nan\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, reference)\n        data_list = [(\"Data\", data), (\"Reference\", reference)]\n        summary, details = \"150, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        data_list = [(\"Data\", None), (\"Reference\", reference)]\n        summary, details = \"0, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        self.assertEqual(info._StateInfo__input_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_compute_distances_apply_called(self):\n        \"\"\"Check compute distances and apply are called when receiving signal\"\"\"\n        widget = self.widget\n        cdist = widget.compute_distances = Mock()\n        apply = widget.unconditional_apply = Mock()\n        self.widget.auto_apply = False\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signal(widget.Inputs.reference, data[:10])\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signals([(widget.Inputs.data, data),\n                           (widget.Inputs.reference, data[:10])])\n        self.assertEqual(cdist.call_count, 1)\n        self.assertEqual(apply.call_count, 1)\n\n    def test_compute_distances_calls_distance(self):\n        widget = self.widget\n        widget.distance_index = 2\n        dists = np.random.random((5, 10))\n        distance = Mock(return_value=dists)\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, refs)])\n            # false positive, pylint: disable=unsubscriptable-object\n            d1, d2 = distance.call_args[0]\n            np.testing.assert_almost_equal(d1.X, data.X)\n            np.testing.assert_almost_equal(d2.X, refs.X)\n            # false positive, pylint: disable=no-member\n            np.testing.assert_almost_equal(widget.distances, dists.min(axis=1))\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_distances_distance_no_data(self):\n        widget = self.widget\n        distance = Mock()\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signal(widget.Inputs.data, data)\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, None),\n                               (widget.Inputs.reference, refs)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n\n            data, refs = data[:0], data[:0]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_indices_with_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = False\n        widget.n_neighbors = 3\n        self.assertEqual(sorted(widget._compute_indices()), [1, 3, 7])\n\n        widget.n_neighbors = 1\n        self.assertIn(list(widget._compute_indices()), ([3], [7]))\n\n        widget.n_neighbors = 5\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 5)\n        self.assertTrue({1, 3, 7} < ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 13\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 14\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12])\n\n    def test_compute_indices_without_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = True\n        widget.n_neighbors = 5\n        self.assertEqual(sorted(widget._compute_indices()), [1, 5, 8, 9, 10])\n\n        widget.n_neighbors = 1\n        self.assertEqual(list(widget._compute_indices()), [1])\n\n        widget.n_neighbors = 3\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 3)\n        self.assertIn(1, ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 11\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 10\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 12])\n\n    def test_data_with_similarity(self):\n        widget = self.widget\n        indices = np.array([5, 10, 15, 100])\n\n        data = Table(\"iris\")\n        widget.data = data\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(neighbours.metas.shape, (4, 1))\n        np.testing.assert_almost_equal(\n            neighbours.metas.flatten(), indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data.X[indices])\n\n        domain = data.domain\n        domain2 = Domain([domain[2]], domain.class_var, metas=domain[:2])\n        data2 = data.transform(domain2)\n        widget.data = data2\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(len(neighbours.domain.metas), 3)\n        self.assertEqual(neighbours.metas.shape, (4, 3))\n        np.testing.assert_almost_equal(\n            neighbours.get_column_view(\"distance\")[0], indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data2.X[indices])\n\n    def test_apply(self):\n        widget = self.widget\n        widget.auto_apply = True\n        data = Table(\"iris\")\n        indices = np.array([5, 10, 15, 100])\n\n        widget._compute_indices = lambda: \\\n            indices if widget.distances is not None else None\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n        neigh = self.get_output(widget.Outputs.data)\n        np.testing.assert_almost_equal(neigh.X, data.X[indices])\n        np.testing.assert_almost_equal(\n            neigh.metas.flatten(), widget.distances[indices])\n\n    def test_all_equal_ref(self):\n        widget = self.widget\n        widget.auto_apply = True\n\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n\n        orig_distances = widget.distances\n        widget.distances = np.zeros(len(data), dtype=float)\n        widget.apply()\n        self.assertTrue(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNone(self.get_output(widget.Outputs.data))\n\n        widget.distances = orig_distances\n        widget.apply()\n        self.assertFalse(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNotNone(self.get_output(widget.Outputs.data))\n\n    def test_different_domains(self):\n        \"\"\"\n        Test weather widget show error when data and a reference have different\n        domains.\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\")])\n        domain_ref = Domain([ContinuousVariable(\"b\")])\n        data = Table(domain, np.random.rand(2, len(domain)))\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # no error if one or both of the signals is missing\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # same domain - no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # one attribute different attribute name\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        # different number of attributes\n        domain_ref = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")])\n        reference = Table(domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # error disappears when data is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # error disappears when reference is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n    def test_different_metas(self):\n        \"\"\"\n        Test weather widget do not show error when data and a reference have\n        domain that differ only in metas\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                        metas=[ContinuousVariable(\"c\")])\n        data = Table(\n            domain, np.random.rand(15, len(domain.attributes)),\n            metas=np.random.rand(15, len(domain.metas)))\n\n        # same domain with same metas no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different metas no error\n        domain_ref = Domain(domain.attributes,\n                            metas=[ContinuousVariable(\"d\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different order - no error\n        domain_ref = Domain(domain.attributes[::-1])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different number of metas no error\n        domain_ref = Domain(\n            domain.attributes,\n            metas=[ContinuousVariable(\"d\"), ContinuousVariable(\"e\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # different domain with same metas - error shown\n        domain_ref = Domain(domain.attributes + (ContinuousVariable(\"e\"),),\n                            metas=[ContinuousVariable(\"c\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertIsNone(output)\n\n    def test_different_domains_same_names(self):\n        \"\"\"\n        Here we create two domains with same names of attributes - the case\n        with image-analytics (two embeddings). Widget must not show the\n        error in this case.\n        \"\"\"\n        w = self.widget\n        domain1 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"c\")])\n        domain2 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"d\")])\n        data = Table(\n            domain1, np.random.rand(15, len(domain1.attributes)),\n            metas=np.random.rand(15, len(domain1.metas)))\n        ref = Table(\n            domain2, np.random.rand(2, len(domain2.attributes)),\n            metas=np.random.rand(2, len(domain2.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, ref)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 53,
                            "end_lineno": 61,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owneighbors.py",
                                "type": "class",
                                "name": "TestOWNeighbors",
                                "content": "class TestOWNeighbors(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWNeighbors,\n                                         stored_settings={\"auto_apply\": False})\n        self.iris = Table(\"iris\")\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.data, None)\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data after disconnecting data on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n        self.send_signal(widget.Inputs.data, None)\n        self.assertEqual(widget.data, None)\n\n    def test_input_reference(self):\n        \"\"\"Check widget's reference with reference on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.reference, None)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n\n    def test_input_reference_disconnect(self):\n        \"\"\"Check reference after disconnecting reference on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n        self.send_signal(widget.Inputs.reference, None)\n        self.assertEqual(widget.reference, None)\n        widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris[:10])\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n\n    def test_settings(self):\n        \"\"\"Check neighbors for various distance metrics\"\"\"\n        widget = self.widget\n        settings = [\n            ParameterMapping(\"\", widget.controls.distance_index, METRICS),\n            ParameterMapping(\"\", widget.controls.n_neighbors)]\n        for setting in settings:\n            for val in setting.values:\n                self.send_signal(widget.Inputs.data, self.iris)\n                self.send_signal(widget.Inputs.reference, self.iris[:10])\n                setting.set_value(val)\n                widget.apply_button.button.click()\n                if METRICS[widget.distance_index][0] != \"Jaccard\" \\\n                        and widget.n_neighbors != 0:\n                    self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_exclude_reference(self):\n        \"\"\"Check neighbors when reference is excluded\"\"\"\n        widget = self.widget\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        self.widget.exclude_reference = True\n        widget.apply_button.button.click()\n        neighbors = self.get_output(widget.Outputs.data)\n        for inst in reference:\n            self.assertNotIn(inst, neighbors)\n\n    def test_include_reference(self):\n        \"\"\"Check neighbors when reference is included\"\"\"\n        widget = self.widget\n        widget.controls.exclude_reference.setChecked(False)\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        for inst in reference:\n            self.assertIn(inst, neighbors)\n\n    def test_similarity(self):\n        widget = self.widget\n        reference = self.iris[:10]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        self.assertEqual(self.iris.domain.attributes,\n                         neighbors.domain.attributes)\n        self.assertEqual(self.iris.domain.class_vars,\n                         neighbors.domain.class_vars)\n        self.assertIn(\"distance\", neighbors.domain)\n        self.assertTrue(all(100 >= ins[\"distance\"] >= 0 for ins in neighbors))\n\n    def test_missing_values(self):\n        widget = self.widget\n        data = Table(\"iris\")\n        reference = data[:3]\n        data.X[0:10, 0] = np.nan\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, reference)\n        data_list = [(\"Data\", data), (\"Reference\", reference)]\n        summary, details = \"150, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        data_list = [(\"Data\", None), (\"Reference\", reference)]\n        summary, details = \"0, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        self.assertEqual(info._StateInfo__input_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_compute_distances_apply_called(self):\n        \"\"\"Check compute distances and apply are called when receiving signal\"\"\"\n        widget = self.widget\n        cdist = widget.compute_distances = Mock()\n        apply = widget.unconditional_apply = Mock()\n        self.widget.auto_apply = False\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signal(widget.Inputs.reference, data[:10])\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signals([(widget.Inputs.data, data),\n                           (widget.Inputs.reference, data[:10])])\n        self.assertEqual(cdist.call_count, 1)\n        self.assertEqual(apply.call_count, 1)\n\n    def test_compute_distances_calls_distance(self):\n        widget = self.widget\n        widget.distance_index = 2\n        dists = np.random.random((5, 10))\n        distance = Mock(return_value=dists)\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, refs)])\n            # false positive, pylint: disable=unsubscriptable-object\n            d1, d2 = distance.call_args[0]\n            np.testing.assert_almost_equal(d1.X, data.X)\n            np.testing.assert_almost_equal(d2.X, refs.X)\n            # false positive, pylint: disable=no-member\n            np.testing.assert_almost_equal(widget.distances, dists.min(axis=1))\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_distances_distance_no_data(self):\n        widget = self.widget\n        distance = Mock()\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signal(widget.Inputs.data, data)\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, None),\n                               (widget.Inputs.reference, refs)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n\n            data, refs = data[:0], data[:0]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_indices_with_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = False\n        widget.n_neighbors = 3\n        self.assertEqual(sorted(widget._compute_indices()), [1, 3, 7])\n\n        widget.n_neighbors = 1\n        self.assertIn(list(widget._compute_indices()), ([3], [7]))\n\n        widget.n_neighbors = 5\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 5)\n        self.assertTrue({1, 3, 7} < ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 13\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 14\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12])\n\n    def test_compute_indices_without_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = True\n        widget.n_neighbors = 5\n        self.assertEqual(sorted(widget._compute_indices()), [1, 5, 8, 9, 10])\n\n        widget.n_neighbors = 1\n        self.assertEqual(list(widget._compute_indices()), [1])\n\n        widget.n_neighbors = 3\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 3)\n        self.assertIn(1, ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 11\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 10\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 12])\n\n    def test_data_with_similarity(self):\n        widget = self.widget\n        indices = np.array([5, 10, 15, 100])\n\n        data = Table(\"iris\")\n        widget.data = data\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(neighbours.metas.shape, (4, 1))\n        np.testing.assert_almost_equal(\n            neighbours.metas.flatten(), indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data.X[indices])\n\n        domain = data.domain\n        domain2 = Domain([domain[2]], domain.class_var, metas=domain[:2])\n        data2 = data.transform(domain2)\n        widget.data = data2\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(len(neighbours.domain.metas), 3)\n        self.assertEqual(neighbours.metas.shape, (4, 3))\n        np.testing.assert_almost_equal(\n            neighbours.get_column_view(\"distance\")[0], indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data2.X[indices])\n\n    def test_apply(self):\n        widget = self.widget\n        widget.auto_apply = True\n        data = Table(\"iris\")\n        indices = np.array([5, 10, 15, 100])\n\n        widget._compute_indices = lambda: \\\n            indices if widget.distances is not None else None\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n        neigh = self.get_output(widget.Outputs.data)\n        np.testing.assert_almost_equal(neigh.X, data.X[indices])\n        np.testing.assert_almost_equal(\n            neigh.metas.flatten(), widget.distances[indices])\n\n    def test_all_equal_ref(self):\n        widget = self.widget\n        widget.auto_apply = True\n\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n\n        orig_distances = widget.distances\n        widget.distances = np.zeros(len(data), dtype=float)\n        widget.apply()\n        self.assertTrue(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNone(self.get_output(widget.Outputs.data))\n\n        widget.distances = orig_distances\n        widget.apply()\n        self.assertFalse(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNotNone(self.get_output(widget.Outputs.data))\n\n    def test_different_domains(self):\n        \"\"\"\n        Test weather widget show error when data and a reference have different\n        domains.\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\")])\n        domain_ref = Domain([ContinuousVariable(\"b\")])\n        data = Table(domain, np.random.rand(2, len(domain)))\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # no error if one or both of the signals is missing\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # same domain - no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # one attribute different attribute name\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        # different number of attributes\n        domain_ref = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")])\n        reference = Table(domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # error disappears when data is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # error disappears when reference is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n    def test_different_metas(self):\n        \"\"\"\n        Test weather widget do not show error when data and a reference have\n        domain that differ only in metas\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                        metas=[ContinuousVariable(\"c\")])\n        data = Table(\n            domain, np.random.rand(15, len(domain.attributes)),\n            metas=np.random.rand(15, len(domain.metas)))\n\n        # same domain with same metas no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different metas no error\n        domain_ref = Domain(domain.attributes,\n                            metas=[ContinuousVariable(\"d\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different order - no error\n        domain_ref = Domain(domain.attributes[::-1])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different number of metas no error\n        domain_ref = Domain(\n            domain.attributes,\n            metas=[ContinuousVariable(\"d\"), ContinuousVariable(\"e\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # different domain with same metas - error shown\n        domain_ref = Domain(domain.attributes + (ContinuousVariable(\"e\"),),\n                            metas=[ContinuousVariable(\"c\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertIsNone(output)\n\n    def test_different_domains_same_names(self):\n        \"\"\"\n        Here we create two domains with same names of attributes - the case\n        with image-analytics (two embeddings). Widget must not show the\n        error in this case.\n        \"\"\"\n        w = self.widget\n        domain1 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"c\")])\n        domain2 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"d\")])\n        data = Table(\n            domain1, np.random.rand(15, len(domain1.attributes)),\n            metas=np.random.rand(15, len(domain1.metas)))\n        ref = Table(\n            domain2, np.random.rand(2, len(domain2.attributes)),\n            metas=np.random.rand(2, len(domain2.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, ref)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 14,
                                "end_lineno": 514,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owneighbors.py",
                            "type": "class",
                            "name": "TestOWNeighbors",
                            "content": "class TestOWNeighbors(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWNeighbors,\n                                         stored_settings={\"auto_apply\": False})\n        self.iris = Table(\"iris\")\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.data, None)\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data after disconnecting data on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n        self.send_signal(widget.Inputs.data, None)\n        self.assertEqual(widget.data, None)\n\n    def test_input_reference(self):\n        \"\"\"Check widget's reference with reference on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.reference, None)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n\n    def test_input_reference_disconnect(self):\n        \"\"\"Check reference after disconnecting reference on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n        self.send_signal(widget.Inputs.reference, None)\n        self.assertEqual(widget.reference, None)\n        widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris[:10])\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n\n    def test_settings(self):\n        \"\"\"Check neighbors for various distance metrics\"\"\"\n        widget = self.widget\n        settings = [\n            ParameterMapping(\"\", widget.controls.distance_index, METRICS),\n            ParameterMapping(\"\", widget.controls.n_neighbors)]\n        for setting in settings:\n            for val in setting.values:\n                self.send_signal(widget.Inputs.data, self.iris)\n                self.send_signal(widget.Inputs.reference, self.iris[:10])\n                setting.set_value(val)\n                widget.apply_button.button.click()\n                if METRICS[widget.distance_index][0] != \"Jaccard\" \\\n                        and widget.n_neighbors != 0:\n                    self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_exclude_reference(self):\n        \"\"\"Check neighbors when reference is excluded\"\"\"\n        widget = self.widget\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        self.widget.exclude_reference = True\n        widget.apply_button.button.click()\n        neighbors = self.get_output(widget.Outputs.data)\n        for inst in reference:\n            self.assertNotIn(inst, neighbors)\n\n    def test_include_reference(self):\n        \"\"\"Check neighbors when reference is included\"\"\"\n        widget = self.widget\n        widget.controls.exclude_reference.setChecked(False)\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        for inst in reference:\n            self.assertIn(inst, neighbors)\n\n    def test_similarity(self):\n        widget = self.widget\n        reference = self.iris[:10]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        self.assertEqual(self.iris.domain.attributes,\n                         neighbors.domain.attributes)\n        self.assertEqual(self.iris.domain.class_vars,\n                         neighbors.domain.class_vars)\n        self.assertIn(\"distance\", neighbors.domain)\n        self.assertTrue(all(100 >= ins[\"distance\"] >= 0 for ins in neighbors))\n\n    def test_missing_values(self):\n        widget = self.widget\n        data = Table(\"iris\")\n        reference = data[:3]\n        data.X[0:10, 0] = np.nan\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, reference)\n        data_list = [(\"Data\", data), (\"Reference\", reference)]\n        summary, details = \"150, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        data_list = [(\"Data\", None), (\"Reference\", reference)]\n        summary, details = \"0, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        self.assertEqual(info._StateInfo__input_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_compute_distances_apply_called(self):\n        \"\"\"Check compute distances and apply are called when receiving signal\"\"\"\n        widget = self.widget\n        cdist = widget.compute_distances = Mock()\n        apply = widget.unconditional_apply = Mock()\n        self.widget.auto_apply = False\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signal(widget.Inputs.reference, data[:10])\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signals([(widget.Inputs.data, data),\n                           (widget.Inputs.reference, data[:10])])\n        self.assertEqual(cdist.call_count, 1)\n        self.assertEqual(apply.call_count, 1)\n\n    def test_compute_distances_calls_distance(self):\n        widget = self.widget\n        widget.distance_index = 2\n        dists = np.random.random((5, 10))\n        distance = Mock(return_value=dists)\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, refs)])\n            # false positive, pylint: disable=unsubscriptable-object\n            d1, d2 = distance.call_args[0]\n            np.testing.assert_almost_equal(d1.X, data.X)\n            np.testing.assert_almost_equal(d2.X, refs.X)\n            # false positive, pylint: disable=no-member\n            np.testing.assert_almost_equal(widget.distances, dists.min(axis=1))\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_distances_distance_no_data(self):\n        widget = self.widget\n        distance = Mock()\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signal(widget.Inputs.data, data)\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, None),\n                               (widget.Inputs.reference, refs)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n\n            data, refs = data[:0], data[:0]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_indices_with_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = False\n        widget.n_neighbors = 3\n        self.assertEqual(sorted(widget._compute_indices()), [1, 3, 7])\n\n        widget.n_neighbors = 1\n        self.assertIn(list(widget._compute_indices()), ([3], [7]))\n\n        widget.n_neighbors = 5\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 5)\n        self.assertTrue({1, 3, 7} < ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 13\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 14\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12])\n\n    def test_compute_indices_without_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = True\n        widget.n_neighbors = 5\n        self.assertEqual(sorted(widget._compute_indices()), [1, 5, 8, 9, 10])\n\n        widget.n_neighbors = 1\n        self.assertEqual(list(widget._compute_indices()), [1])\n\n        widget.n_neighbors = 3\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 3)\n        self.assertIn(1, ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 11\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 10\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 12])\n\n    def test_data_with_similarity(self):\n        widget = self.widget\n        indices = np.array([5, 10, 15, 100])\n\n        data = Table(\"iris\")\n        widget.data = data\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(neighbours.metas.shape, (4, 1))\n        np.testing.assert_almost_equal(\n            neighbours.metas.flatten(), indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data.X[indices])\n\n        domain = data.domain\n        domain2 = Domain([domain[2]], domain.class_var, metas=domain[:2])\n        data2 = data.transform(domain2)\n        widget.data = data2\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(len(neighbours.domain.metas), 3)\n        self.assertEqual(neighbours.metas.shape, (4, 3))\n        np.testing.assert_almost_equal(\n            neighbours.get_column_view(\"distance\")[0], indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data2.X[indices])\n\n    def test_apply(self):\n        widget = self.widget\n        widget.auto_apply = True\n        data = Table(\"iris\")\n        indices = np.array([5, 10, 15, 100])\n\n        widget._compute_indices = lambda: \\\n            indices if widget.distances is not None else None\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n        neigh = self.get_output(widget.Outputs.data)\n        np.testing.assert_almost_equal(neigh.X, data.X[indices])\n        np.testing.assert_almost_equal(\n            neigh.metas.flatten(), widget.distances[indices])\n\n    def test_all_equal_ref(self):\n        widget = self.widget\n        widget.auto_apply = True\n\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n\n        orig_distances = widget.distances\n        widget.distances = np.zeros(len(data), dtype=float)\n        widget.apply()\n        self.assertTrue(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNone(self.get_output(widget.Outputs.data))\n\n        widget.distances = orig_distances\n        widget.apply()\n        self.assertFalse(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNotNone(self.get_output(widget.Outputs.data))\n\n    def test_different_domains(self):\n        \"\"\"\n        Test weather widget show error when data and a reference have different\n        domains.\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\")])\n        domain_ref = Domain([ContinuousVariable(\"b\")])\n        data = Table(domain, np.random.rand(2, len(domain)))\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # no error if one or both of the signals is missing\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # same domain - no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # one attribute different attribute name\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        # different number of attributes\n        domain_ref = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")])\n        reference = Table(domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # error disappears when data is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # error disappears when reference is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n    def test_different_metas(self):\n        \"\"\"\n        Test weather widget do not show error when data and a reference have\n        domain that differ only in metas\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                        metas=[ContinuousVariable(\"c\")])\n        data = Table(\n            domain, np.random.rand(15, len(domain.attributes)),\n            metas=np.random.rand(15, len(domain.metas)))\n\n        # same domain with same metas no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different metas no error\n        domain_ref = Domain(domain.attributes,\n                            metas=[ContinuousVariable(\"d\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different order - no error\n        domain_ref = Domain(domain.attributes[::-1])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different number of metas no error\n        domain_ref = Domain(\n            domain.attributes,\n            metas=[ContinuousVariable(\"d\"), ContinuousVariable(\"e\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # different domain with same metas - error shown\n        domain_ref = Domain(domain.attributes + (ContinuousVariable(\"e\"),),\n                            metas=[ContinuousVariable(\"c\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertIsNone(output)\n\n    def test_different_domains_same_names(self):\n        \"\"\"\n        Here we create two domains with same names of attributes - the case\n        with image-analytics (two embeddings). Widget must not show the\n        error in this case.\n        \"\"\"\n        w = self.widget\n        domain1 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"c\")])\n        domain2 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"d\")])\n        data = Table(\n            domain1, np.random.rand(15, len(domain1.attributes)),\n            metas=np.random.rand(15, len(domain1.metas)))\n        ref = Table(\n            domain2, np.random.rand(2, len(domain2.attributes)),\n            metas=np.random.rand(2, len(domain2.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, ref)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 14,
                            "end_lineno": 514,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "4467fb9e92458535134d55c593f698dfff2fadfd^",
    "new_commit_hash": "4467fb9e92458535134d55c593f698dfff2fadfd",
    "commit_message": "Merge pull request #5006 from ajdapretnar/neighbor-subset\n\nOWNeighbors: copy original ids to neighbor output",
    "commit_date": "2020-09-25T16:39:44+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "4467fb9e92458535134d55c593f698dfff2fadfd",
    "test_file_codes": [
        "#pylint: disable=missing-docstring,protected-access,unsubscriptable-object\nimport unittest\nfrom unittest.mock import Mock\n\nimport numpy as np\n\nfrom Orange.data import Table, Domain, ContinuousVariable\nfrom Orange.widgets.data.owneighbors import OWNeighbors, METRICS\nfrom Orange.widgets.tests.base import WidgetTest, ParameterMapping\nfrom Orange.widgets.utils.state_summary import format_summary_details, \\\n    format_multiple_summaries\n\n\nclass TestOWNeighbors(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWNeighbors,\n                                         stored_settings={\"auto_apply\": False})\n        self.iris = Table(\"iris\")\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.data, None)\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data after disconnecting data on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.assertEqual(widget.data, self.iris)\n        self.send_signal(widget.Inputs.data, None)\n        self.assertEqual(widget.data, None)\n\n    def test_input_reference(self):\n        \"\"\"Check widget's reference with reference on the input\"\"\"\n        widget = self.widget\n        self.assertEqual(widget.reference, None)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n\n    def test_input_reference_disconnect(self):\n        \"\"\"Check reference after disconnecting reference on the input\"\"\"\n        widget = self.widget\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, self.iris)\n        self.assertEqual(widget.reference, self.iris)\n        self.send_signal(widget.Inputs.reference, None)\n        self.assertEqual(widget.reference, None)\n        widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signals(((widget.Inputs.data, self.iris),\n                           (widget.Inputs.reference, self.iris[:10])))\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n        self.assertTrue(all([i in self.iris.ids for i in\n                             self.get_output(widget.Outputs.data).ids])\n                        )\n\n    def test_settings(self):\n        \"\"\"Check neighbors for various distance metrics\"\"\"\n        widget = self.widget\n        settings = [\n            ParameterMapping(\"\", widget.controls.distance_index, METRICS),\n            ParameterMapping(\"\", widget.controls.n_neighbors)]\n        for setting in settings:\n            for val in setting.values:\n                self.send_signal(widget.Inputs.data, self.iris)\n                self.send_signal(widget.Inputs.reference, self.iris[:10])\n                setting.set_value(val)\n                widget.apply_button.button.click()\n                if METRICS[widget.distance_index][0] != \"Jaccard\" \\\n                        and widget.n_neighbors != 0:\n                    self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_exclude_reference(self):\n        \"\"\"Check neighbors when reference is excluded\"\"\"\n        widget = self.widget\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        self.widget.exclude_reference = True\n        widget.apply_button.button.click()\n        neighbors = self.get_output(widget.Outputs.data)\n        for inst in reference:\n            self.assertNotIn(inst, neighbors)\n\n    def test_include_reference(self):\n        \"\"\"Check neighbors when reference is included\"\"\"\n        widget = self.widget\n        widget.controls.exclude_reference.setChecked(False)\n        reference = self.iris[:5]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        for inst in reference:\n            self.assertIn(inst, neighbors)\n\n    def test_similarity(self):\n        widget = self.widget\n        reference = self.iris[:10]\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        neighbors = self.get_output(\"Neighbors\")\n        self.assertEqual(self.iris.domain.attributes,\n                         neighbors.domain.attributes)\n        self.assertEqual(self.iris.domain.class_vars,\n                         neighbors.domain.class_vars)\n        self.assertIn(\"distance\", neighbors.domain)\n        self.assertTrue(all(100 >= ins[\"distance\"] >= 0 for ins in neighbors))\n\n    def test_missing_values(self):\n        widget = self.widget\n        data = Table(\"iris\")\n        reference = data[:3]\n        data.X[0:10, 0] = np.nan\n        self.send_signal(widget.Inputs.data, self.iris)\n        self.send_signal(widget.Inputs.reference, reference)\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, reference)\n        data_list = [(\"Data\", data), (\"Reference\", reference)]\n        summary, details = \"150, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        data_list = [(\"Data\", None), (\"Reference\", reference)]\n        summary, details = \"0, 5\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        self.assertEqual(info._StateInfo__input_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertEqual(info._StateInfo__output_summary.brief, \"\")\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_compute_distances_apply_called(self):\n        \"\"\"Check compute distances and apply are called when receiving signal\"\"\"\n        widget = self.widget\n        cdist = widget.compute_distances = Mock()\n        apply = widget.unconditional_apply = Mock()\n        self.widget.auto_apply = False\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signal(widget.Inputs.reference, data[:10])\n        cdist.assert_called()\n        apply.assert_called()\n        cdist.reset_mock()\n        apply.reset_mock()\n\n        self.send_signals([(widget.Inputs.data, data),\n                           (widget.Inputs.reference, data[:10])])\n        self.assertEqual(cdist.call_count, 1)\n        self.assertEqual(apply.call_count, 1)\n\n    def test_compute_distances_calls_distance(self):\n        widget = self.widget\n        widget.distance_index = 2\n        dists = np.random.random((5, 10))\n        distance = Mock(return_value=dists)\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, refs)])\n            # false positive, pylint: disable=unsubscriptable-object\n            d1, d2 = distance.call_args[0]\n            np.testing.assert_almost_equal(d1.X, data.X)\n            np.testing.assert_almost_equal(d2.X, refs.X)\n            # false positive, pylint: disable=no-member\n            np.testing.assert_almost_equal(widget.distances, dists.min(axis=1))\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_distances_distance_no_data(self):\n        widget = self.widget\n        distance = Mock()\n        try:\n            orig_metrics = METRICS[widget.distance_index]\n            METRICS[widget.distance_index] = (\"foo\", distance)\n            data = Table(\"iris\")\n            data, refs = data[:10], data[-5:]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signal(widget.Inputs.data, data)\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, None),\n                               (widget.Inputs.reference, refs)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n\n            data, refs = data[:0], data[:0]\n            self.send_signals([(widget.Inputs.data, data),\n                               (widget.Inputs.reference, None)])\n            distance.assert_not_called()\n            self.assertIsNone(widget.distances)\n        finally:\n            METRICS[widget.distance_index] = orig_metrics\n\n    def test_compute_indices_with_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = False\n        widget.n_neighbors = 3\n        self.assertEqual(sorted(widget._compute_indices()), [1, 3, 7])\n\n        widget.n_neighbors = 1\n        self.assertIn(list(widget._compute_indices()), ([3], [7]))\n\n        widget.n_neighbors = 5\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 5)\n        self.assertTrue({1, 3, 7} < ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 13\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 14\n        self.assertEqual(sorted(widget._compute_indices()), list(range(13)))\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12])\n\n    def test_compute_indices_without_reference(self):\n        widget = self.widget\n        # Indices for easier reading: 0  1  2  3  4  5  6  7  8  9 10 11 12\n        widget.distances = np.array([4., 1, 7, 0, 5, 2, 4, 0, 2, 2, 2, 9, 8])\n\n        widget.exclude_reference = True\n        widget.n_neighbors = 5\n        self.assertEqual(sorted(widget._compute_indices()), [1, 5, 8, 9, 10])\n\n        widget.n_neighbors = 1\n        self.assertEqual(list(widget._compute_indices()), [1])\n\n        widget.n_neighbors = 3\n        ind = set(widget._compute_indices())\n        self.assertEqual(len(ind), 3)\n        self.assertIn(1, ind)\n        self.assertTrue(len({5, 8, 9, 10} & ind) == 2)\n\n        widget.n_neighbors = 100\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 11\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 12\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 11, 12])\n\n        widget.n_neighbors = 10\n        self.assertEqual(\n            sorted(widget._compute_indices()),\n            [0, 1, 2, 4, 5, 6, 8, 9, 10, 12])\n\n    def test_data_with_similarity(self):\n        widget = self.widget\n        indices = np.array([5, 10, 15, 100])\n\n        data = Table(\"iris\")\n        widget.data = data\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(neighbours.metas.shape, (4, 1))\n        np.testing.assert_almost_equal(\n            neighbours.metas.flatten(), indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data.X[indices])\n\n        domain = data.domain\n        domain2 = Domain([domain[2]], domain.class_var, metas=domain[:2])\n        data2 = data.transform(domain2)\n        widget.data = data2\n\n        widget.distances = np.arange(1000, 1150).astype(float)\n        neighbours = widget._data_with_similarity(indices)\n        self.assertEqual(len(neighbours.domain.metas), 3)\n        self.assertEqual(neighbours.metas.shape, (4, 3))\n        np.testing.assert_almost_equal(\n            neighbours.get_column_view(\"distance\")[0], indices + 1000)\n        np.testing.assert_almost_equal(neighbours.X, data2.X[indices])\n\n    def test_apply(self):\n        widget = self.widget\n        widget.auto_apply = True\n        data = Table(\"iris\")\n        indices = np.array([5, 10, 15, 100])\n\n        widget._compute_indices = lambda: \\\n            indices if widget.distances is not None else None\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n        neigh = self.get_output(widget.Outputs.data)\n        np.testing.assert_almost_equal(neigh.X, data.X[indices])\n        np.testing.assert_almost_equal(\n            neigh.metas.flatten(), widget.distances[indices])\n\n    def test_all_equal_ref(self):\n        widget = self.widget\n        widget.auto_apply = True\n\n        data = Table(\"iris\")\n        self.send_signal(widget.Inputs.data, data)\n        self.send_signal(widget.Inputs.reference, data[42:43])\n\n        orig_distances = widget.distances\n        widget.distances = np.zeros(len(data), dtype=float)\n        widget.apply()\n        self.assertTrue(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNone(self.get_output(widget.Outputs.data))\n\n        widget.distances = orig_distances\n        widget.apply()\n        self.assertFalse(widget.Warning.all_data_as_reference.is_shown())\n        self.assertIsNotNone(self.get_output(widget.Outputs.data))\n\n    def test_different_domains(self):\n        \"\"\"\n        Test weather widget show error when data and a reference have different\n        domains.\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\")])\n        domain_ref = Domain([ContinuousVariable(\"b\")])\n        data = Table(domain, np.random.rand(2, len(domain)))\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # no error if one or both of the signals is missing\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # same domain - no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # one attribute different attribute name\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        # different number of attributes\n        domain_ref = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")])\n        reference = Table(domain_ref, np.random.rand(1, len(domain_ref)))\n\n        # error disappears when data is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.data, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n        # error disappears when reference is set to None\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n\n        self.send_signal(w.Inputs.reference, None)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n\n    def test_different_metas(self):\n        \"\"\"\n        Test weather widget do not show error when data and a reference have\n        domain that differ only in metas\n        \"\"\"\n        w = self.widget\n\n        domain = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                        metas=[ContinuousVariable(\"c\")])\n        data = Table(\n            domain, np.random.rand(15, len(domain.attributes)),\n            metas=np.random.rand(15, len(domain.metas)))\n\n        # same domain with same metas no error\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, data[:1])\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different metas no error\n        domain_ref = Domain(domain.attributes,\n                            metas=[ContinuousVariable(\"d\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different order - no error\n        domain_ref = Domain(domain.attributes[::-1])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # same domain with different number of metas no error\n        domain_ref = Domain(\n            domain.attributes,\n            metas=[ContinuousVariable(\"d\"), ContinuousVariable(\"e\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n        # different domain with same metas - error shown\n        domain_ref = Domain(domain.attributes + (ContinuousVariable(\"e\"),),\n                            metas=[ContinuousVariable(\"c\")])\n        reference = Table(\n            domain_ref, np.random.rand(1, len(domain_ref.attributes)),\n            metas=np.random.rand(1, len(domain_ref.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, reference)\n        self.assertTrue(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertIsNone(output)\n\n    def test_different_domains_same_names(self):\n        \"\"\"\n        Here we create two domains with same names of attributes - the case\n        with image-analytics (two embeddings). Widget must not show the\n        error in this case.\n        \"\"\"\n        w = self.widget\n        domain1 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"c\")])\n        domain2 = Domain([ContinuousVariable(\"a\"), ContinuousVariable(\"b\")],\n                         metas=[ContinuousVariable(\"d\")])\n        data = Table(\n            domain1, np.random.rand(15, len(domain1.attributes)),\n            metas=np.random.rand(15, len(domain1.metas)))\n        ref = Table(\n            domain2, np.random.rand(2, len(domain2.attributes)),\n            metas=np.random.rand(2, len(domain2.metas)))\n        self.send_signal(w.Inputs.data, data)\n        self.send_signal(w.Inputs.reference, ref)\n        self.assertFalse(w.Error.diff_domains.is_shown())\n        output = self.get_output(w.Outputs.data)\n        self.assertEqual(10, len(output))\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpfm9xap37/tmp\ncreating /tmp/tmpfm9xap37/tmp/tmpfm9xap37\ncompile options: '-MMD -MF /tmp/tmpfm9xap37/file.c.d -c'\ncc: /tmp/tmpfm9xap37/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp7ga5fg81/tmp\ncreating /tmp/tmp7ga5fg81/tmp/tmp7ga5fg81\ncompile options: '-MMD -MF /tmp/tmp7ga5fg81/file.c.d -c'\ncc: /tmp/tmp7ga5fg81/file.c\ncustomize UnixCCompiler using build_ext\nbuilding 'Orange.classification._simple_tree' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_simple_tree.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._tree_scorers' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_tree_scorers.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_valuecount.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_contingency.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_io.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_variable.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/distance/_distance.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/preprocess/_discretize.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/preprocess/_relieff.cpp\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/projection/_som.c\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/widgets/utils/_grid_density.cpp\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\nrunning develop\nrunning build_scripts\nrunning egg_info\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncreating Orange3.egg-info\nwriting Orange3.egg-info/PKG-INFO\nwriting dependency_links to Orange3.egg-info/dependency_links.txt\nwriting entry points to Orange3.egg-info/entry_points.txt\nwriting requirements to Orange3.egg-info/requires.txt\nwriting top-level names to Orange3.egg-info/top_level.txt\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpi5vdrfbw/tmp\ncreating /tmp/tmpi5vdrfbw/tmp/tmpi5vdrfbw\ncompile options: '-MMD -MF /tmp/tmpi5vdrfbw/file.c.d -c'\ncc: /tmp/tmpi5vdrfbw/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmptknzdctw/tmp\ncreating /tmp/tmptknzdctw/tmp/tmptknzdctw\ncompile options: '-MMD -MF /tmp/tmptknzdctw/file.c.d -c'\ncc: /tmp/tmptknzdctw/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.27.0.dev0+4467fb9 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd\nProcessing dependencies for Orange3==3.27.0.dev0+4467fb9\nSearching for XlsxWriter==3.2.0\nBest match: XlsxWriter 3.2.0\nAdding XlsxWriter 3.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for httpx==0.14.3\nBest match: httpx 0.14.3\nAdding httpx 0.14.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for chardet==3.0.4\nBest match: chardet 3.0.4\nAdding chardet 3.0.4 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.10.2\nBest match: httpcore 0.10.2\nAdding httpcore 0.10.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for h11==0.9.0\nBest match: h11 0.9.0\nAdding h11 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.27.0.dev0+4467fb9\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 63ms\nPrepared 18 packages in 23ms\nInstalled 18 packages in 127ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 53 packages in 322ms\nInstalled 47 packages in 750ms\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==3.0.4\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.9.0\n + httpcore==0.10.2\n + httpx==0.14.3\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 39 packages in 115ms\nInstalled 13 packages in 358ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 3ms\nInstalled 2 packages in 20ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 13ms\nAudited 2 packages in 24ms\nOrange/classification/_simple_tree.c: In function ‘gain_ratio_c’:\nOrange/classification/_simple_tree.c:63:9: warning: implicit declaration of function ‘qsort_r’; did you mean ‘qsort’? [-Wimplicit-function-declaration]\n   63 |         qsort_r(base, nel, size, compar, thunk)\n      |         ^~~~~~~\nOrange/classification/_simple_tree.c:147:9: note: in expansion of macro ‘QSORT_R_FUNC’\n  147 |         QSORT_R_FUNC(examples, size, sizeof(struct Example), (void*) &compar_attr, compar_examples);\n      |         ^~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:3115:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3115 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4619:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4619 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5396:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5396 |           for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5517:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5517 |           __pyx_t_27 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5523:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5523 |           __pyx_t_27 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7051:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7051 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7741:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7741 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7801:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7801 |               __pyx_t_17 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_18 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/data/_io.c: In function ‘__pyx_pf_6Orange_4data_3_io_sparse_read_float.constprop’:\nOrange/data/_io.c:3881:24: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3881 |           __pyx_v_decs = (__pyx_v_decs / 10.0);\n      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:4070:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4070 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:480:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  480 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1301:7: note: ‘__pyx_v_attr_index’ was declared here\n 1301 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:2935:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2935 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:627:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_5update_hex’:\nOrange/projection/_som.c:3655:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3655 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3654:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3654 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:4547:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4547 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4114:7: note: ‘__pyx_v_win_y’ was declared here\n 4114 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4536:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4536 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4113:7: note: ‘__pyx_v_win_x’ was declared here\n 4113 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_8update_sparse.constprop’:\nOrange/projection/_som.c:4746:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4746 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4745:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4745 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3141:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3141 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:2964:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2964 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2665:7: note: ‘__pyx_v_win_y’ was declared here\n 2665 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:2953:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2953 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2664:7: note: ‘__pyx_v_win_x’ was declared here\n 2664 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_10update_sparse_hex.constprop’:\nOrange/projection/_som.c:5515:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5515 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5514:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5514 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.\n  EasyInstallDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd/.venv/lib/python3.7/site-packages/setuptools/command/egg_info.py:628: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.\nPlease extend command classes from setuptools instead of distutils.\n  SetuptoolsDeprecationWarning\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd\ncollected 28 items\n\nr2e_tests/test_1.py sss........................F                         [100%]\n\n=================================== FAILURES ===================================\n_________________________ TestOWNeighbors.test_summary _________________________\n\nself = <r2e_tests.test_1.TestOWNeighbors testMethod=test_summary>\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n    \n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n>       self.assertEqual(info._StateInfo__output_summary.brief, \"\")\nE       AssertionError: '-' != ''\nE       - -\nE       +\n\nr2e_tests/test_1.py:141: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_all_equal_ref\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_apply\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_distances_apply_called\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_distances_calls_distance\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_distances_distance_no_data\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_indices_with_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_indices_without_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_data_with_similarity\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_different_domains\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_different_domains_same_names\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_different_metas\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_exclude_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_image_export\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_include_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_data\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_data_disconnect\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_reference_disconnect\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_missing_values\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_output_neighbors\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_settings\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_similarity\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nFAILED r2e_tests/test_1.py::TestOWNeighbors::test_summary - AssertionError: '...\n=================== 1 failed, 24 passed, 3 skipped in 4.56s ====================\nWidgets left: 0    Max widgets: 1375 \n\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_4467fb9e92458535134d55c593f698dfff2fadfd\ncollected 28 items\n\nr2e_tests/test_1.py sss.....................F..F                         [100%]\n\n=================================== FAILURES ===================================\n____________________ TestOWNeighbors.test_output_neighbors _____________________\n\nself = <r2e_tests.test_1.TestOWNeighbors testMethod=test_output_neighbors>\n\n    def test_output_neighbors(self):\n        \"\"\"Check if neighbors are on the output after apply\"\"\"\n        widget = self.widget\n        self.assertIsNone(self.get_output(\"Neighbors\"))\n        self.send_signals(((widget.Inputs.data, self.iris),\n                           (widget.Inputs.reference, self.iris[:10])))\n        widget.apply_button.button.click()\n        self.assertIsNotNone(self.get_output(\"Neighbors\"))\n        self.assertIsInstance(self.get_output(\"Neighbors\"), Table)\n        self.assertTrue(all([i in self.iris.ids for i in\n>                            self.get_output(widget.Outputs.data).ids])\n                        )\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:63: AssertionError\n_________________________ TestOWNeighbors.test_summary _________________________\n\nself = <r2e_tests.test_1.TestOWNeighbors testMethod=test_summary>\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        data, reference = Table(\"iris\"), Table(\"iris\")[:5]\n        no_input, no_output = \"No data on input\", \"No data on output\"\n    \n        self.send_signal(self.widget.Inputs.data, data)\n        data_list = [(\"Data\", data), (\"Reference\", None)]\n        summary, details = \"150, 0\", format_multiple_summaries(data_list)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n>       self.assertEqual(info._StateInfo__output_summary.brief, \"\")\nE       AssertionError: '-' != ''\nE       - -\nE       +\n\nr2e_tests/test_1.py:141: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_all_equal_ref\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_apply\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_distances_apply_called\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_distances_calls_distance\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_distances_distance_no_data\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_indices_with_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_compute_indices_without_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_data_with_similarity\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_different_domains\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_different_domains_same_names\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_different_metas\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_exclude_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_image_export\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_include_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_data\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_data_disconnect\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_reference\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_input_reference_disconnect\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_missing_values\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_settings\nPASSED r2e_tests/test_1.py::TestOWNeighbors::test_similarity\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nFAILED r2e_tests/test_1.py::TestOWNeighbors::test_output_neighbors - Assertio...\nFAILED r2e_tests/test_1.py::TestOWNeighbors::test_summary - AssertionError: '...\n=================== 2 failed, 23 passed, 3 skipped in 3.36s ====================\nWidgets left: 0    Max widgets: 1375 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owneighbors.py Orange/widgets/data/tests/test_owneighbors.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** OWNeighbors Widget Does Not Include Original IDs in Neighbor Output

**Description:**
When using the OWNeighbors widget, the neighbor output is expected to retain the original IDs from the input data. However, currently, the widget fails to copy these IDs correctly. This leads to discrepancies where some neighbor entries do not have corresponding original IDs, causing confusion and potential issues in downstream processing.

**Example:**
```python
# Setup the widget and input data
widget = create_widget(OWNeighbors)
iris_data = Table('iris')
reference_data = iris_data[:10]

# Send signals to the widget
widget.send_signal(widget.Inputs.data, iris_data)
widget.send_signal(widget.Inputs.reference, reference_data)
widget.apply()

# Retrieve the neighbors output
neighbors = widget.get_output("Neighbors")

# Verify that all neighbor IDs are present in the original data IDs
all_ids_present = all(neighbor_id in iris_data.ids for neighbor_id in neighbors.ids)
print("All neighbor IDs are present:", all_ids_present)
```
*In this example, the `all_ids_present` check fails, indicating that some neighbor IDs are missing from the original data.*

**Expected Behavior:**
All neighbor entries in the output should have their `ids` attribute correctly copied from the original input data. This ensures that each neighbor can be reliably traced back to its corresponding original data point.

**Actual Behavior:**
The neighbor output lacks some or all of the original IDs, resulting in `neighbors.ids` not fully matching `iris_data.ids`. This causes assertions or checks that rely on these IDs to fail, as the connection between neighbors and the original data points is broken.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/widgets/data/owneighbors.py
import numpy as np

from AnyQt.QtCore import Qt

from Orange.data import Table, Domain, ContinuousVariable
from Orange.data.util import get_unique_names
from Orange.preprocess import RemoveNaNColumns, Impute
from Orange import distance
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.signals import Input, Output
from Orange.widgets.widget import OWWidget, Msg
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.utils.state_summary import format_summary_details,\
    format_multiple_summaries

METRICS = [
    ("Euclidean", distance.Euclidean),
    ("Manhattan", distance.Manhattan),
    ("Mahalanobis", distance.Mahalanobis),
    ("Cosine", distance.Cosine),
    ("Jaccard", distance.Jaccard),
    ("Spearman", distance.SpearmanR),
    ("Absolute Spearman", distance.SpearmanRAbsolute),
    ("Pearson", distance.PearsonR),
    ("Absolute Pearson", distance.PearsonRAbsolute),
]


class OWNeighbors(OWWidget):
    name = "Neighbors"
    description = "Compute nearest neighbors in data according to reference."
    icon = "icons/Neighbors.svg"

    replaces = ["orangecontrib.prototypes.widgets.owneighbours.OWNeighbours"]

    class Inputs:
        data = Input("Data", Table)
        reference = Input("Reference", Table)

    class Outputs:
        data = Output("Neighbors", Table)

    class Warning(OWWidget.Warning):
        all_data_as_reference = \
            Msg("Every data instance is same as some reference")

    class Error(OWWidget.Error):
        diff_domains = Msg("Data and reference have different features")

    n_neighbors: int
    distance_index: int

    n_neighbors = Setting(10)
    distance_index = Setting(0)
    exclude_reference = Setting(True)
    auto_apply = Setting(True)

    want_main_area = False
    resizing_enabled = False
    buttons_area_orientation = Qt.Vertical

    def __init__(self):
        super().__init__()

        self.data = None
        self.reference = None
        self.distances = None

        box = gui.vBox(self.controlArea, box=True)
        gui.comboBox(
            box, self, "distance_index", orientation=Qt.Horizontal,
            label="Distance: ", items=[d[0] for d in METRICS],
            callback=self.recompute)
        gui.spin(
            box, self, "n_neighbors", label="Number of neighbors:",
            step=1, spinType=int, minv=0, maxv=100,
            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
            callback=lambda: self.apply())
        gui.checkBox(
            box, self, "exclude_reference",
            label="Exclude rows (equal to) references",
            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
            callback=lambda: self.apply())

        self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)
        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
        summary, details, kwargs = self.info.NoInput, "", {}

        if self.data or self.reference:
            summary = f"{self.info.format_number(n_data)}, " \
                      f"{self.info.format_number(n_refs)}"
            details = format_multiple_summaries([
                ("Data", self.data),
                ("Reference", self.reference)
            ])
            kwargs = {"format": Qt.RichText}
        self.info.set_input_summary(summary, details, **kwargs)

    @Inputs.data
    def set_data(self, data):
        self.data = data

    @Inputs.reference
    def set_ref(self, refs):
        self.reference = refs

    def handleNewSignals(self):
        self.compute_distances()
        self._set_input_summary()
        self.unconditional_apply()

    def recompute(self):
        self.compute_distances()
        self.apply()

    def compute_distances(self):
        self.Error.diff_domains.clear()
        if not self.data or not self.reference:
            self.distances = None
            return
        if set(self.reference.domain.attributes) != \
                set(self.data.domain.attributes):
            self.Error.diff_domains()
            self.distances = None
            return

        metric = METRICS[self.distance_index][1]
        n_ref = len(self.reference)

        # comparing only attributes, no metas and class-vars
        new_domain = Domain(self.data.domain.attributes)
        reference = self.reference.transform(new_domain)
        data = self.data.transform(new_domain)

        all_data = Table.concatenate([reference, data], 0)
        pp_all_data = Impute()(RemoveNaNColumns()(all_data))
        pp_reference, pp_data = pp_all_data[:n_ref], pp_all_data[n_ref:]
        self.distances = metric(pp_data, pp_reference).min(axis=1)

    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)
            summary, details = len(neighbors), format_summary_details(neighbors)
            self.info.set_output_summary(summary, details)
        self.Outputs.data.send(neighbors)

    def _compute_indices(self):
        self.Warning.all_data_as_reference.clear()
        dist = self.distances
        if dist is None:
            return None
        if self.exclude_reference:
            non_ref = dist > 1e-5
            skip = len(dist) - non_ref.sum()
            up_to = min(self.n_neighbors + skip, len(dist))
            if skip >= up_to:
                self.Warning.all_data_as_reference()
                return None
            indices = np.argpartition(dist, up_to - 1)[:up_to]
            return indices[non_ref[indices]]
        else:
            up_to = min(self.n_neighbors, len(dist))
            return np.argpartition(dist, up_to - 1)[:up_to]

    def _data_with_similarity(self, indices):
        data = self.data
        varname = get_unique_names(data.domain, "distance")
        metas = data.domain.metas + (ContinuousVariable(varname), )
        domain = Domain(data.domain.attributes, data.domain.class_vars, metas)
        data_metas = self.distances[indices].reshape((-1, 1))
        if data.domain.metas:
            data_metas = np.hstack((data.metas[indices], data_metas))
        neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)
        neighbors.attributes = self.data.attributes
        return neighbors


if __name__ == "__main__":  # pragma: no cover
    iris = Table("iris.tab")
    WidgetPreview(OWNeighbors).run(
        set_data=iris,
        set_ref=iris[:1])

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]
**Title:** OWNeighbors Widget Does Not Include Original IDs in Neighbor Output

**Description:**
When using the OWNeighbors widget, the neighbor output is expected to retain the original IDs from the input data. However, currently, the widget fails to copy these IDs correctly. This leads to discrepancies where some neighbor entries do not have corresponding original IDs, causing confusion and potential issues in downstream processing.

**Example:**
```python
# Setup the widget and input data
widget = create_widget(OWNeighbors)
iris_data = Table('iris')
reference_data = iris_data[:10]

# Send signals to the widget
widget.send_signal(widget.Inputs.data, iris_data)
widget.send_signal(widget.Inputs.reference, reference_data)
widget.apply()

# Retrieve the neighbors output
neighbors = widget.get_output("Neighbors")

# Verify that all neighbor IDs are present in the original data IDs
all_ids_present = all(neighbor_id in iris_data.ids for neighbor_id in neighbors.ids)
print("All neighbor IDs are present:", all_ids_present)
```
*In this example, the `all_ids_present` check fails, indicating that some neighbor IDs are missing from the original data.*

**Expected Behavior:**
All neighbor entries in the output should have their `ids` attribute correctly copied from the original input data. This ensures that each neighbor can be reliably traced back to its corresponding original data point.

**Actual Behavior:**
The neighbor output lacks some or all of the original IDs, resulting in `neighbors.ids` not fully matching `iris_data.ids`. This causes assertions or checks that rely on these IDs to fail, as the connection between neighbors and the original data points is broken.

[/ISSUE]
{
    "TestOWNeighbors.test_all_equal_ref": "PASSED",
    "TestOWNeighbors.test_apply": "PASSED",
    "TestOWNeighbors.test_compute_distances_apply_called": "PASSED",
    "TestOWNeighbors.test_compute_distances_calls_distance": "PASSED",
    "TestOWNeighbors.test_compute_distances_distance_no_data": "PASSED",
    "TestOWNeighbors.test_compute_indices_with_reference": "PASSED",
    "TestOWNeighbors.test_compute_indices_without_reference": "PASSED",
    "TestOWNeighbors.test_data_with_similarity": "PASSED",
    "TestOWNeighbors.test_different_domains": "PASSED",
    "TestOWNeighbors.test_different_domains_same_names": "PASSED",
    "TestOWNeighbors.test_different_metas": "PASSED",
    "TestOWNeighbors.test_exclude_reference": "PASSED",
    "TestOWNeighbors.test_image_export": "PASSED",
    "TestOWNeighbors.test_include_reference": "PASSED",
    "TestOWNeighbors.test_input_data": "PASSED",
    "TestOWNeighbors.test_input_data_disconnect": "PASSED",
    "TestOWNeighbors.test_input_reference": "PASSED",
    "TestOWNeighbors.test_input_reference_disconnect": "PASSED",
    "TestOWNeighbors.test_minimum_size": "PASSED",
    "TestOWNeighbors.test_missing_values": "PASSED",
    "TestOWNeighbors.test_msg_base_class": "PASSED",
    "TestOWNeighbors.test_output_neighbors": "PASSED",
    "TestOWNeighbors.test_settings": "PASSED",
    "TestOWNeighbors.test_similarity": "PASSED",
    "TestOWNeighbors.test_summary": "FAILED"
}
diff --git a/Orange/widgets/data/owneighbors.py b/Orange/widgets/data/owneighbors.py
index 574566ae9..9b4d0375e 100644
--- a/Orange/widgets/data/owneighbors.py
+++ b/Orange/widgets/data/owneighbors.py
@@ -182,6 +182,7 @@ class OWNeighbors(OWWidget):
         if data.domain.metas:
             data_metas = np.hstack((data.metas[indices], data_metas))
         neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)
+        neighbors.ids = data.ids[indices]
         neighbors.attributes = self.data.attributes
         return neighbors
 

{"Orange/widgets/data/owneighbors.py": "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\nfrom Orange.widgets.utils.state_summary import format_summary_details,\\\n    format_multiple_summaries\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    resizing_enabled = 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        summary, details, kwargs = self.info.NoInput, \"\", {}\n\n        if self.data or self.reference:\n            summary = f\"{self.info.format_number(n_data)}, \" \\\n                      f\"{self.info.format_number(n_refs)}\"\n            details = format_multiple_summaries([\n                (\"Data\", self.data),\n                (\"Reference\", self.reference)\n            ])\n            kwargs = {\"format\": Qt.RichText}\n        self.info.set_input_summary(summary, details, **kwargs)\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._set_input_summary()\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\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            summary, details = len(neighbors), format_summary_details(neighbors)\n            self.info.set_output_summary(summary, details)\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"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** OWNeighbors Widget Does Not Include Original IDs in Neighbor Output

**Description:**
When using the OWNeighbors widget, the neighbor output is expected to retain the original IDs from the input data. However, currently, the widget fails to copy these IDs correctly. This leads to discrepancies where some neighbor entries do not have corresponding original IDs, causing confusion and potential issues in downstream processing.

**Example:**
```python
# Setup the widget and input data
widget = create_widget(OWNeighbors)
iris_data = Table('iris')
reference_data = iris_data[:10]

# Send signals to the widget
widget.send_signal(widget.Inputs.data, iris_data)
widget.send_signal(widget.Inputs.reference, reference_data)
widget.apply()

# Retrieve the neighbors output
neighbors = widget.get_output("Neighbors")

# Verify that all neighbor IDs are present in the original data IDs
all_ids_present = all(neighbor_id in iris_data.ids for neighbor_id in neighbors.ids)
print("All neighbor IDs are present:", all_ids_present)
```
*In this example, the `all_ids_present` check fails, indicating that some neighbor IDs are missing from the original data.*

**Expected Behavior:**
All neighbor entries in the output should have their `ids` attribute correctly copied from the original input data. This ensures that each neighbor can be reliably traced back to its corresponding original data point.

**Actual Behavior:**
The neighbor output lacks some or all of the original IDs, resulting in `neighbors.ids` not fully matching `iris_data.ids`. This causes assertions or checks that rely on these IDs to fail, as the connection between neighbors and the original data points is broken.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/widgets/data/owneighbors.py
import numpy as np

from AnyQt.QtCore import Qt

from Orange.data import Table, Domain, ContinuousVariable
from Orange.data.util import get_unique_names
from Orange.preprocess import RemoveNaNColumns, Impute
from Orange import distance
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.signals import Input, Output
from Orange.widgets.widget import OWWidget, Msg
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.utils.state_summary import format_summary_details,\
    format_multiple_summaries

METRICS = [
    ("Euclidean", distance.Euclidean),
    ("Manhattan", distance.Manhattan),
    ("Mahalanobis", distance.Mahalanobis),
    ("Cosine", distance.Cosine),
    ("Jaccard", distance.Jaccard),
    ("Spearman", distance.SpearmanR),
    ("Absolute Spearman", distance.SpearmanRAbsolute),
    ("Pearson", distance.PearsonR),
    ("Absolute Pearson", distance.PearsonRAbsolute),
]


class OWNeighbors(OWWidget):
    name = "Neighbors"
    description = "Compute nearest neighbors in data according to reference."
    icon = "icons/Neighbors.svg"

    replaces = ["orangecontrib.prototypes.widgets.owneighbours.OWNeighbours"]

    class Inputs:
        data = Input("Data", Table)
        reference = Input("Reference", Table)

    class Outputs:
        data = Output("Neighbors", Table)

    class Warning(OWWidget.Warning):
        all_data_as_reference = \
            Msg("Every data instance is same as some reference")

    class Error(OWWidget.Error):
        diff_domains = Msg("Data and reference have different features")

    n_neighbors: int
    distance_index: int

    n_neighbors = Setting(10)
    distance_index = Setting(0)
    exclude_reference = Setting(True)
    auto_apply = Setting(True)

    want_main_area = False
    resizing_enabled = False
    buttons_area_orientation = Qt.Vertical

    def __init__(self):
        super().__init__()

        self.data = None
        self.reference = None
        self.distances = None

        box = gui.vBox(self.controlArea, box=True)
        gui.comboBox(
            box, self, "distance_index", orientation=Qt.Horizontal,
            label="Distance: ", items=[d[0] for d in METRICS],
            callback=self.recompute)
        gui.spin(
            box, self, "n_neighbors", label="Number of neighbors:",
            step=1, spinType=int, minv=0, maxv=100,
            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
            callback=lambda: self.apply())
        gui.checkBox(
            box, self, "exclude_reference",
            label="Exclude rows (equal to) references",
            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
            callback=lambda: self.apply())

        self.apply_button = gui.auto_apply(self.controlArea, self, commit=self.apply)
        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
        summary, details, kwargs = self.info.NoInput, "", {}

        if self.data or self.reference:
            summary = f"{self.info.format_number(n_data)}, " \
                      f"{self.info.format_number(n_refs)}"
            details = format_multiple_summaries([
                ("Data", self.data),
                ("Reference", self.reference)
            ])
            kwargs = {"format": Qt.RichText}
        self.info.set_input_summary(summary, details, **kwargs)

    @Inputs.data
    def set_data(self, data):
        self.data = data

    @Inputs.reference
    def set_ref(self, refs):
        self.reference = refs

    def handleNewSignals(self):
        self.compute_distances()
        self._set_input_summary()
        self.unconditional_apply()

    def recompute(self):
        self.compute_distances()
        self.apply()

    def compute_distances(self):
        self.Error.diff_domains.clear()
        if not self.data or not self.reference:
            self.distances = None
            return
        if set(self.reference.domain.attributes) != \
                set(self.data.domain.attributes):
            self.Error.diff_domains()
            self.distances = None
            return

        metric = METRICS[self.distance_index][1]
        n_ref = len(self.reference)

        # comparing only attributes, no metas and class-vars
        new_domain = Domain(self.data.domain.attributes)
        reference = self.reference.transform(new_domain)
        data = self.data.transform(new_domain)

        all_data = Table.concatenate([reference, data], 0)
        pp_all_data = Impute()(RemoveNaNColumns()(all_data))
        pp_reference, pp_data = pp_all_data[:n_ref], pp_all_data[n_ref:]
        self.distances = metric(pp_data, pp_reference).min(axis=1)

    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)
            summary, details = len(neighbors), format_summary_details(neighbors)
            self.info.set_output_summary(summary, details)
        self.Outputs.data.send(neighbors)

    def _compute_indices(self):
        self.Warning.all_data_as_reference.clear()
        dist = self.distances
        if dist is None:
            return None
        if self.exclude_reference:
            non_ref = dist > 1e-5
            skip = len(dist) - non_ref.sum()
            up_to = min(self.n_neighbors + skip, len(dist))
            if skip >= up_to:
                self.Warning.all_data_as_reference()
                return None
            indices = np.argpartition(dist, up_to - 1)[:up_to]
            return indices[non_ref[indices]]
        else:
            up_to = min(self.n_neighbors, len(dist))
            return np.argpartition(dist, up_to - 1)[:up_to]

    def _data_with_similarity(self, indices):
        data = self.data
        varname = get_unique_names(data.domain, "distance")
        metas = data.domain.metas + (ContinuousVariable(varname), )
        domain = Domain(data.domain.attributes, data.domain.class_vars, metas)
        data_metas = self.distances[indices].reshape((-1, 1))
        if data.domain.metas:
            data_metas = np.hstack((data.metas[indices], data_metas))
        neighbors = Table(domain, data.X[indices], data.Y[indices], data_metas)
        neighbors.attributes = self.data.attributes
        return neighbors


if __name__ == "__main__":  # pragma: no cover
    iris = Table("iris.tab")
    WidgetPreview(OWNeighbors).run(
        set_data=iris,
        set_ref=iris[:1])

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user