{
    "file_diffs": [
        {
            "old_file_content": "\"\"\"\nLinear Projection widget\n------------------------\n\"\"\"\n\nfrom itertools import islice, permutations, chain\nfrom math import factorial\n\nimport numpy as np\n\nfrom sklearn.neighbors import NearestNeighbors\nfrom sklearn.metrics import r2_score\n\nfrom AnyQt.QtGui import QStandardItem, QPalette\nfrom AnyQt.QtCore import Qt, QRectF, QLineF, pyqtSignal as Signal\n\nimport pyqtgraph as pg\n\nfrom Orange.data import Table, Domain\nfrom Orange.preprocess import Normalize\nfrom Orange.preprocess.score import ReliefF, RReliefF\nfrom Orange.projection import PCA, LDA, LinearProjector\nfrom Orange.util import Enum\nfrom Orange.widgets import gui, report\nfrom Orange.widgets.gui import OWComponent\nfrom Orange.widgets.settings import Setting, ContextSetting, SettingProvider\nfrom Orange.widgets.utils.plot import variables_selection\nfrom Orange.widgets.utils.plot.owplotgui import VariableSelectionModel\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.visualize.utils import VizRankDialog\nfrom Orange.widgets.visualize.utils.component import OWGraphWithAnchors\nfrom Orange.widgets.visualize.utils.plotutils import AnchorItem\nfrom Orange.widgets.visualize.utils.widget import OWAnchorProjectionWidget\nfrom Orange.widgets.widget import Msg\n\n\nMAX_LABEL_LEN = 20\n\n\nclass LinearProjectionVizRank(VizRankDialog, OWComponent):\n    captionTitle = \"Score Plots\"\n    n_attrs = Setting(3)\n    minK = 10\n\n    attrsSelected = Signal([])\n    _AttrRole = next(gui.OrangeUserRole)\n\n    def __init__(self, master):\n        # Add the spin box for a number of attributes to take into account.\n        VizRankDialog.__init__(self, master)\n        OWComponent.__init__(self, master)\n\n        box = gui.hBox(self)\n        max_n_attrs = len(master.model_selected)\n        self.n_attrs_spin = gui.spin(\n            box, self, \"n_attrs\", 3, max_n_attrs, label=\"Number of variables: \",\n            controlWidth=50, alignment=Qt.AlignRight, callback=self._n_attrs_changed)\n        gui.rubber(box)\n        self.last_run_n_attrs = None\n        self.attr_color = master.attr_color\n        self.attrs = []\n\n    def initialize(self):\n        super().initialize()\n        self.attr_color = self.master.attr_color\n\n    def before_running(self):\n        \"\"\"\n        Disable the spin for number of attributes before running and\n        enable afterwards. Also, if the number of attributes is different than\n        in the last run, reset the saved state (if it was paused).\n        \"\"\"\n        if self.n_attrs != self.last_run_n_attrs:\n            self.saved_state = None\n            self.saved_progress = 0\n        if self.saved_state is None:\n            self.scores = []\n            self.rank_model.clear()\n        self.last_run_n_attrs = self.n_attrs\n        self.n_attrs_spin.setDisabled(True)\n\n    def stopped(self):\n        self.n_attrs_spin.setDisabled(False)\n\n    def check_preconditions(self):\n        master = self.master\n        if not super().check_preconditions():\n            return False\n        elif not master.btn_vizrank.isEnabled():\n            return False\n        n_cont_var = len([v for v in master.continuous_variables\n                          if v is not master.attr_color])\n        self.n_attrs_spin.setMaximum(n_cont_var)\n        return True\n\n    def state_count(self):\n        n_all_attrs = len(self.attrs)\n        if not n_all_attrs:\n            return 0\n        n_attrs = self.n_attrs\n        return factorial(n_all_attrs) // (2 * factorial(n_all_attrs - n_attrs) * n_attrs)\n\n    def iterate_states(self, state):\n        if state is None:  # on the first call, compute order\n            self.attrs = self._score_heuristic()\n            state = list(range(self.n_attrs))\n        else:\n            state = list(state)\n\n        def combinations(n, s):\n            while True:\n                yield s\n                for up, _ in enumerate(s):\n                    s[up] += 1\n                    if up + 1 == len(s) or s[up] < s[up + 1]:\n                        break\n                    s[up] = up\n                if s[-1] == n:\n                    break\n\n        for c in combinations(len(self.attrs), state):\n            for p in islice(permutations(c[1:]), factorial(len(c) - 1) // 2):\n                yield (c[0], ) + p\n\n    def compute_score(self, state):\n        master = self.master\n        data = master.data\n        domain = Domain([self.attrs[i] for i in state], data.domain.class_vars)\n        projection = master.projector(data.transform(domain))\n        ec = projection(data).X\n        y = column_data(data, self.attr_color, dtype=float)\n        if ec.shape[0] < self.minK:\n            return None\n        n_neighbors = min(self.minK, len(ec) - 1)\n        knn = NearestNeighbors(n_neighbors=n_neighbors).fit(ec)\n        ind = knn.kneighbors(return_distance=False)\n        # pylint: disable=invalid-unary-operand-type\n        if self.attr_color.is_discrete:\n            return -np.sum(y[ind] == y.reshape(-1, 1)) / n_neighbors / len(y)\n        return -r2_score(y, np.mean(y[ind], axis=1)) * (len(y) / len(data))\n\n    def bar_length(self, score):\n        return max(0, -score)\n\n    def _score_heuristic(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        domain = self.master.data.domain\n        attr_color = self.master.attr_color\n        domain = Domain(\n            attributes=[v for v in chain(domain.variables, domain.metas)\n                        if v.is_continuous and v is not attr_color],\n            class_vars=attr_color\n        )\n        data = self.master.data.transform(domain).copy()\n        with data.unlocked():\n            data.X = normalized(data.X)\n        relief = ReliefF if attr_color.is_discrete else RReliefF\n        weights = relief(n_iterations=100, k_nearest=self.minK)(data)\n        results = sorted(zip(weights, domain.attributes), key=lambda x: (-x[0], x[1].name))\n        return [attr for _, attr in results]\n\n    def row_for_state(self, score, state):\n        attrs = [self.attrs[i] for i in state]\n        item = QStandardItem(\", \".join(a.name for a in attrs))\n        item.setData(attrs, self._AttrRole)\n        return [item]\n\n    def on_selection_changed(self, selected, deselected):\n        if not selected.indexes():\n            return\n        attrs = selected.indexes()[0].data(self._AttrRole)\n        self.selectionChanged.emit([attrs])\n\n    def _n_attrs_changed(self):\n        if self.n_attrs != self.last_run_n_attrs or self.saved_state is None:\n            self.button.setText(\"Start\")\n        else:\n            self.button.setText(\"Continue\")\n        self.button.setEnabled(self.check_preconditions())\n\n\nclass OWLinProjGraph(OWGraphWithAnchors):\n    hide_radius = Setting(0)\n\n    @property\n    def always_show_axes(self):\n        return self.master.placement == Placement.Circular\n\n    @property\n    def scaled_radius(self):\n        return self.hide_radius / 100 + 1e-5\n\n    def update_radius(self):\n        self.update_circle()\n        self.update_anchors()\n\n    def set_view_box_range(self):\n        def min_max(a, b):\n            return (min(np.amin(a), np.amin(b), -1.05),\n                    max(np.amax(a), np.amax(b), 1.05))\n\n        points, _ = self.master.get_anchors()\n        coords = self.master.get_coordinates_data()\n        if points is None or coords is None:\n            return\n\n        min_x, max_x = min_max(points[:, 0], coords[0])\n        min_y, max_y = min_max(points[:, 1], coords[1])\n        rect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y)\n        self.view_box.setRange(rect, padding=0.025)\n\n    def update_anchors(self):\n        points, labels = self.master.get_anchors()\n        if points is None:\n            return\n        r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))\n        if self.anchor_items is None:\n            self.anchor_items = []\n            for point, label in zip(points, labels):\n                anchor = AnchorItem(line=QLineF(0, 0, *point))\n                anchor._label.setToolTip(f\"<b>{label}</b>\")\n                label = label[:MAX_LABEL_LEN - 3] + \"...\" if len(label) > MAX_LABEL_LEN else label\n                anchor.setText(label)\n                anchor.setFont(self.parameter_setter.anchor_font)\n\n                visible = self.always_show_axes or np.linalg.norm(point) > r\n                anchor.setVisible(visible)\n                anchor.setPen(pg.mkPen((100, 100, 100)))\n                self.plot_widget.addItem(anchor)\n                self.anchor_items.append(anchor)\n        else:\n            for anchor, point, label in zip(self.anchor_items, points, labels):\n                anchor.setLine(QLineF(0, 0, *point))\n                visible = self.always_show_axes or np.linalg.norm(point) > r\n                anchor.setVisible(visible)\n                anchor.setFont(self.parameter_setter.anchor_font)\n\n    def update_circle(self):\n        super().update_circle()\n\n        if self.always_show_axes:\n            self.plot_widget.removeItem(self.circle_item)\n            self.circle_item = None\n\n        if self.circle_item is not None:\n            points, _ = self.master.get_anchors()\n            if points is None:\n                return\n\n            r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))\n            self.circle_item.setRect(QRectF(-r, -r, 2 * r, 2 * r))\n            color = self.plot_widget.palette().color(QPalette.Disabled, QPalette.Text)\n            pen = pg.mkPen(color, width=1, cosmetic=True)\n            self.circle_item.setPen(pen)\n\n\nPlacement = Enum(\"Placement\", dict(Circular=0, LDA=1, PCA=2), type=int,\n                 qualname=\"Placement\")\n\n\nclass OWLinearProjection(OWAnchorProjectionWidget):\n    name = \"Linear Projection\"\n    description = \"A multi-axis projection of data onto \" \\\n                  \"a two-dimensional plane.\"\n    icon = \"icons/LinearProjection.svg\"\n    priority = 240\n    keywords = []\n\n    Projection_name = {Placement.Circular: \"Circular Placement\",\n                       Placement.LDA: \"Linear Discriminant Analysis\",\n                       Placement.PCA: \"Principal Component Analysis\"}\n\n    settings_version = 6\n\n    placement = Setting(Placement.Circular)\n    selected_vars = ContextSetting([])\n    vizrank = SettingProvider(LinearProjectionVizRank)\n    GRAPH_CLASS = OWLinProjGraph\n    graph = SettingProvider(OWLinProjGraph)\n\n    class Error(OWAnchorProjectionWidget.Error):\n        no_cont_features = Msg(\"Plotting requires numeric features\")\n\n    def _add_controls(self):\n        box = gui.vBox(self.controlArea, box=\"Features\")\n        self._add_controls_variables(box)\n        self._add_controls_placement(box)\n        super()._add_controls()\n        self.gui.add_control(\n            self._effects_box, gui.hSlider, \"Hide radius:\", master=self.graph,\n            value=\"hide_radius\", minValue=0, maxValue=100, step=10,\n            createLabel=False, callback=self.__radius_slider_changed\n        )\n\n    def _add_controls_variables(self, box):\n        self.model_selected = VariableSelectionModel(self.selected_vars)\n        variables_selection(box, self, self.model_selected)\n        self.model_selected.selection_changed.connect(\n            self.__model_selected_changed)\n        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(\n            None, self, \"Suggest Features\", self.__vizrank_set_attrs)\n        box.layout().addWidget(self.btn_vizrank)\n\n    def _add_controls_placement(self, box):\n        self.radio_placement = gui.radioButtonsInBox(\n            box, self, \"placement\",\n            btnLabels=[self.Projection_name[x] for x in Placement],\n            callback=self.__placement_radio_changed\n        )\n\n    def _add_buttons(self):\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def continuous_variables(self):\n        if self.data is None or self.data.domain is None:\n            return []\n        dom = self.data.domain\n        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]\n\n    @property\n    def effective_variables(self):\n        return self.selected_vars\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables))\n\n    def __vizrank_set_attrs(self, attrs):\n        if not attrs:\n            return\n        self.selected_vars[:] = attrs\n        # Ugly, but the alternative is to have yet another signal to which\n        # the view will have to connect\n        self.model_selected.selection_changed.emit()\n\n    def __model_selected_changed(self):\n        self.projection = None\n        self._check_options()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __placement_radio_changed(self):\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n        self.projection = self.projector = None\n        self._init_vizrank()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __radius_slider_changed(self):\n        self.graph.update_radius()\n\n    def colors_changed(self):\n        super().colors_changed()\n        self._init_vizrank()\n\n    @OWAnchorProjectionWidget.Inputs.data\n    def set_data(self, data):\n        super().set_data(data)\n        self._check_options()\n        self._init_vizrank()\n        self.init_projection()\n\n    def _check_options(self):\n        buttons = self.radio_placement.buttons\n        for btn in buttons:\n            btn.setEnabled(True)\n\n        if self.data is not None:\n            has_discrete_class = self.data.domain.has_discrete_class\n            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:\n                buttons[Placement.LDA].setEnabled(False)\n                if self.placement == Placement.LDA:\n                    self.placement = Placement.Circular\n\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n\n    def _init_vizrank(self):\n        is_enabled, msg = False, \"\"\n        if self.data is None:\n            msg = \"There is no data.\"\n        elif self.attr_color is None:\n            msg = \"Color variable has to be selected\"\n        elif self.attr_color.is_continuous and \\\n                self.placement == Placement.LDA:\n            msg = \"Suggest Features does not work for Linear \" \\\n                  \"Discriminant Analysis Projection when \" \\\n                  \"continuous color variable is selected.\"\n        elif len([v for v in self.continuous_variables\n                  if v is not self.attr_color]) < 3:\n            msg = \"Not enough available continuous variables\"\n        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:\n            msg = \"Not enough valid data instances\"\n        else:\n            is_enabled = not np.isnan(self.data.get_column_view(\n                self.attr_color)[0].astype(float)).all()\n        self.btn_vizrank.setToolTip(msg)\n        self.btn_vizrank.setEnabled(is_enabled)\n        if is_enabled:\n            self.vizrank.initialize()\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if not len(self.continuous_variables):\n                error(self.Error.no_cont_features)\n\n    def init_attr_values(self):\n        super().init_attr_values()\n        self.selected_vars[:] = self.continuous_variables[:3]\n        self.model_selected[:] = self.continuous_variables\n\n    def init_projection(self):\n        if self.placement == Placement.Circular:\n            self.projector = CircularPlacement()\n        elif self.placement == Placement.LDA:\n            self.projector = LDA(solver=\"eigen\", n_components=2)\n        elif self.placement == Placement.PCA:\n            self.projector = PCA(n_components=2)\n            self.projector.component = 2\n            self.projector.preprocessors = PCA.preprocessors + [Normalize()]\n\n        super().init_projection()\n\n    def get_coordinates_data(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        embedding = self.get_embedding()\n        if embedding is None:\n            return None, None\n        norm_emb = normalized(embedding[self.valid_data])\n        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \\\n            if embedding.shape[1] == 1 else norm_emb.T\n\n    def _get_send_report_caption(self):\n        def projection_name():\n            return self.Projection_name[self.placement]\n\n        return report.render_items_vert((\n            (\"Projection\", projection_name()),\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    @classmethod\n    def migrate_settings(cls, settings_, version):\n        if version < 2:\n            settings_[\"point_width\"] = settings_[\"point_size\"]\n        if version < 3:\n            settings_graph = {}\n            settings_graph[\"jitter_size\"] = settings_[\"jitter_value\"]\n            settings_graph[\"point_width\"] = settings_[\"point_width\"]\n            settings_graph[\"alpha_value\"] = settings_[\"alpha_value\"]\n            settings_graph[\"class_density\"] = settings_[\"class_density\"]\n            settings_[\"graph\"] = settings_graph\n        if version < 4:\n            if \"radius\" in settings_:\n                settings_[\"graph\"][\"hide_radius\"] = settings_[\"radius\"]\n            if \"selection_indices\" in settings_ and \\\n                    settings_[\"selection_indices\"] is not None:\n                selection = settings_[\"selection_indices\"]\n                settings_[\"selection\"] = [(i, 1) for i, selected in\n                                          enumerate(selection) if selected]\n        if version < 5:\n            if \"placement\" in settings_ and \\\n                    settings_[\"placement\"] not in Placement:\n                settings_[\"placement\"] = Placement.Circular\n\n    @classmethod\n    def migrate_context(cls, context, version):\n        values = context.values\n        if version < 2:\n            domain = context.ordered_domain\n            c_domain = [t for t in context.ordered_domain if t[1] == 2]\n            d_domain = [t for t in context.ordered_domain if t[1] == 1]\n            for d, old_val, new_val in ((domain, \"color_index\", \"attr_color\"),\n                                        (d_domain, \"shape_index\", \"attr_shape\"),\n                                        (c_domain, \"size_index\", \"attr_size\")):\n                index = context.values[old_val][0] - 1\n                values[new_val] = (d[index][0], d[index][1] + 100) \\\n                    if 0 <= index < len(d) else None\n        if version < 3:\n            values[\"graph\"] = {\n                \"attr_color\": values[\"attr_color\"],\n                \"attr_shape\": values[\"attr_shape\"],\n                \"attr_size\": values[\"attr_size\"]\n            }\n        if version == 3:\n            values[\"attr_color\"] = values[\"graph\"][\"attr_color\"]\n            values[\"attr_size\"] = values[\"graph\"][\"attr_size\"]\n            values[\"attr_shape\"] = values[\"graph\"][\"attr_shape\"]\n            values[\"attr_label\"] = values[\"graph\"][\"attr_label\"]\n        if version < 6 and \"selected_vars\" in values:\n            values[\"selected_vars\"] = (values[\"selected_vars\"], -3)\n\n    # for backward compatibility with settings < 6, pull the enum from global\n    # namespace into class\n    Placement = Placement\n\n\ndef column_data(table, var, dtype):\n    dtype = np.dtype(dtype)\n    col, copy = table.get_column_view(var)\n    if not isinstance(col.dtype.type, np.inexact):\n        col = col.astype(float)\n        copy = True\n    if dtype != col.dtype:\n        col = col.astype(dtype)\n        copy = True\n\n    if not copy:\n        col = col.copy()\n    return col\n\n\nclass CircularPlacement(LinearProjector):\n    def get_components(self, X, Y):\n        # Return circular axes for linear projection\n        n_axes = X.shape[1]\n        if n_axes == 1:\n            axes_angle = [0]\n        elif n_axes == 2:\n            axes_angle = [0, np.pi / 2]\n        else:\n            axes_angle = np.linspace(0, 2 * np.pi, n_axes,\n                                     endpoint=False)\n        return np.vstack((np.cos(axes_angle), np.sin(axes_angle)))\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    iris = Table(\"iris\")\n    WidgetPreview(OWLinearProjection).run(set_data=iris,\n                                          set_subset_data=iris[::10])\n",
            "new_file_content": "\"\"\"\nLinear Projection widget\n------------------------\n\"\"\"\n\nfrom itertools import islice, permutations, chain\nfrom math import factorial\n\nimport numpy as np\n\nfrom sklearn.neighbors import NearestNeighbors\nfrom sklearn.metrics import r2_score\n\nfrom AnyQt.QtGui import QStandardItem, QPalette\nfrom AnyQt.QtCore import Qt, QRectF, QLineF, pyqtSignal as Signal\n\nimport pyqtgraph as pg\n\nfrom Orange.data import Table, Domain\nfrom Orange.preprocess import Normalize\nfrom Orange.preprocess.score import ReliefF, RReliefF\nfrom Orange.projection import PCA, LDA, LinearProjector\nfrom Orange.util import Enum\nfrom Orange.widgets import gui, report\nfrom Orange.widgets.gui import OWComponent\nfrom Orange.widgets.settings import Setting, ContextSetting, SettingProvider\nfrom Orange.widgets.utils.plot import variables_selection\nfrom Orange.widgets.utils.plot.owplotgui import VariableSelectionModel\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.visualize.utils import VizRankDialog\nfrom Orange.widgets.visualize.utils.component import OWGraphWithAnchors\nfrom Orange.widgets.visualize.utils.plotutils import AnchorItem\nfrom Orange.widgets.visualize.utils.widget import OWAnchorProjectionWidget\nfrom Orange.widgets.widget import Msg\n\n\nMAX_LABEL_LEN = 20\n\n\nclass LinearProjectionVizRank(VizRankDialog, OWComponent):\n    captionTitle = \"Score Plots\"\n    n_attrs = Setting(3)\n    minK = 10\n\n    attrsSelected = Signal([])\n    _AttrRole = next(gui.OrangeUserRole)\n\n    def __init__(self, master):\n        # Add the spin box for a number of attributes to take into account.\n        VizRankDialog.__init__(self, master)\n        OWComponent.__init__(self, master)\n\n        box = gui.hBox(self)\n        max_n_attrs = len(master.model_selected)\n        self.n_attrs_spin = gui.spin(\n            box, self, \"n_attrs\", 3, max_n_attrs, label=\"Number of variables: \",\n            controlWidth=50, alignment=Qt.AlignRight, callback=self._n_attrs_changed)\n        gui.rubber(box)\n        self.last_run_n_attrs = None\n        self.attr_color = master.attr_color\n        self.attrs = []\n\n    def initialize(self):\n        super().initialize()\n        self.attr_color = self.master.attr_color\n\n    def before_running(self):\n        \"\"\"\n        Disable the spin for number of attributes before running and\n        enable afterwards. Also, if the number of attributes is different than\n        in the last run, reset the saved state (if it was paused).\n        \"\"\"\n        if self.n_attrs != self.last_run_n_attrs:\n            self.saved_state = None\n            self.saved_progress = 0\n        if self.saved_state is None:\n            self.scores = []\n            self.rank_model.clear()\n        self.last_run_n_attrs = self.n_attrs\n        self.n_attrs_spin.setDisabled(True)\n\n    def stopped(self):\n        self.n_attrs_spin.setDisabled(False)\n\n    def check_preconditions(self):\n        master = self.master\n        if not super().check_preconditions():\n            return False\n        elif not master.btn_vizrank.isEnabled():\n            return False\n        n_cont_var = len([v for v in master.continuous_variables\n                          if v is not master.attr_color])\n        self.n_attrs_spin.setMaximum(n_cont_var)\n        return True\n\n    def state_count(self):\n        n_all_attrs = len(self.attrs)\n        if not n_all_attrs:\n            return 0\n        n_attrs = self.n_attrs\n        return factorial(n_all_attrs) // (2 * factorial(n_all_attrs - n_attrs) * n_attrs)\n\n    def iterate_states(self, state):\n        if state is None:  # on the first call, compute order\n            self.attrs = self._score_heuristic()\n            state = list(range(self.n_attrs))\n        else:\n            state = list(state)\n\n        def combinations(n, s):\n            while True:\n                yield s\n                for up, _ in enumerate(s):\n                    s[up] += 1\n                    if up + 1 == len(s) or s[up] < s[up + 1]:\n                        break\n                    s[up] = up\n                if s[-1] == n:\n                    break\n\n        for c in combinations(len(self.attrs), state):\n            for p in islice(permutations(c[1:]), factorial(len(c) - 1) // 2):\n                yield (c[0], ) + p\n\n    def compute_score(self, state):\n        master = self.master\n        data = master.data\n        domain = Domain([self.attrs[i] for i in state], data.domain.class_vars)\n        projection = master.projector(data.transform(domain))\n        ec = projection(data).X\n        y = column_data(data, self.attr_color, dtype=float)\n        if ec.shape[0] < self.minK:\n            return None\n        n_neighbors = min(self.minK, len(ec) - 1)\n        knn = NearestNeighbors(n_neighbors=n_neighbors).fit(ec)\n        ind = knn.kneighbors(return_distance=False)\n        # pylint: disable=invalid-unary-operand-type\n        if self.attr_color.is_discrete:\n            return -np.sum(y[ind] == y.reshape(-1, 1)) / n_neighbors / len(y)\n        return -r2_score(y, np.mean(y[ind], axis=1)) * (len(y) / len(data))\n\n    def bar_length(self, score):\n        return max(0, -score)\n\n    def _score_heuristic(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        domain = self.master.data.domain\n        attr_color = self.master.attr_color\n        domain = Domain(\n            attributes=[v for v in chain(domain.variables, domain.metas)\n                        if v.is_continuous and v is not attr_color],\n            class_vars=attr_color\n        )\n        data = self.master.data.transform(domain).copy()\n        with data.unlocked():\n            data.X = normalized(data.X)\n        relief = ReliefF if attr_color.is_discrete else RReliefF\n        weights = relief(n_iterations=100, k_nearest=self.minK)(data)\n        results = sorted(zip(weights, domain.attributes), key=lambda x: (-x[0], x[1].name))\n        return [attr for _, attr in results]\n\n    def row_for_state(self, score, state):\n        attrs = [self.attrs[i] for i in state]\n        item = QStandardItem(\", \".join(a.name for a in attrs))\n        item.setData(attrs, self._AttrRole)\n        return [item]\n\n    def on_selection_changed(self, selected, deselected):\n        if not selected.indexes():\n            return\n        attrs = selected.indexes()[0].data(self._AttrRole)\n        self.selectionChanged.emit([attrs])\n\n    def _n_attrs_changed(self):\n        if self.n_attrs != self.last_run_n_attrs or self.saved_state is None:\n            self.button.setText(\"Start\")\n        else:\n            self.button.setText(\"Continue\")\n        self.button.setEnabled(self.check_preconditions())\n\n\nclass OWLinProjGraph(OWGraphWithAnchors):\n    hide_radius = Setting(0)\n\n    @property\n    def always_show_axes(self):\n        return self.master.placement == Placement.Circular\n\n    @property\n    def scaled_radius(self):\n        return self.hide_radius / 100 + 1e-5\n\n    def update_radius(self):\n        self.update_circle()\n        self.update_anchors()\n\n    def set_view_box_range(self):\n        def min_max(a, b):\n            return (min(np.amin(a), np.amin(b), -1.05),\n                    max(np.amax(a), np.amax(b), 1.05))\n\n        points, _ = self.master.get_anchors()\n        coords = self.master.get_coordinates_data()\n        if points is None or coords is None:\n            return\n\n        min_x, max_x = min_max(points[:, 0], coords[0])\n        min_y, max_y = min_max(points[:, 1], coords[1])\n        rect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y)\n        self.view_box.setRange(rect, padding=0.025)\n\n    def update_anchors(self):\n        points, labels = self.master.get_anchors()\n        if points is None:\n            return\n        r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))\n        if self.anchor_items is None:\n            self.anchor_items = []\n            for point, label in zip(points, labels):\n                anchor = AnchorItem(line=QLineF(0, 0, *point))\n                anchor._label.setToolTip(f\"<b>{label}</b>\")\n                label = label[:MAX_LABEL_LEN - 3] + \"...\" if len(label) > MAX_LABEL_LEN else label\n                anchor.setText(label)\n                anchor.setFont(self.parameter_setter.anchor_font)\n\n                visible = self.always_show_axes or np.linalg.norm(point) > r\n                anchor.setVisible(visible)\n                anchor.setPen(pg.mkPen((100, 100, 100)))\n                self.plot_widget.addItem(anchor)\n                self.anchor_items.append(anchor)\n        else:\n            for anchor, point, label in zip(self.anchor_items, points, labels):\n                anchor.setLine(QLineF(0, 0, *point))\n                visible = self.always_show_axes or np.linalg.norm(point) > r\n                anchor.setVisible(visible)\n                anchor.setFont(self.parameter_setter.anchor_font)\n\n    def update_circle(self):\n        super().update_circle()\n\n        if self.always_show_axes:\n            self.plot_widget.removeItem(self.circle_item)\n            self.circle_item = None\n\n        if self.circle_item is not None:\n            points, _ = self.master.get_anchors()\n            if points is None:\n                return\n\n            r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))\n            self.circle_item.setRect(QRectF(-r, -r, 2 * r, 2 * r))\n            color = self.plot_widget.palette().color(QPalette.Disabled, QPalette.Text)\n            pen = pg.mkPen(color, width=1, cosmetic=True)\n            self.circle_item.setPen(pen)\n\n\nPlacement = Enum(\"Placement\", dict(Circular=0, LDA=1, PCA=2), type=int,\n                 qualname=\"Placement\")\n\n\nclass OWLinearProjection(OWAnchorProjectionWidget):\n    name = \"Linear Projection\"\n    description = \"A multi-axis projection of data onto \" \\\n                  \"a two-dimensional plane.\"\n    icon = \"icons/LinearProjection.svg\"\n    priority = 240\n    keywords = []\n\n    Projection_name = {Placement.Circular: \"Circular Placement\",\n                       Placement.LDA: \"Linear Discriminant Analysis\",\n                       Placement.PCA: \"Principal Component Analysis\"}\n\n    settings_version = 6\n\n    placement = Setting(Placement.Circular)\n    selected_vars = ContextSetting([])\n    vizrank = SettingProvider(LinearProjectionVizRank)\n    GRAPH_CLASS = OWLinProjGraph\n    graph = SettingProvider(OWLinProjGraph)\n\n    class Error(OWAnchorProjectionWidget.Error):\n        no_cont_features = Msg(\"Plotting requires numeric features\")\n\n    def _add_controls(self):\n        box = gui.vBox(self.controlArea, box=\"Features\")\n        self._add_controls_variables(box)\n        self._add_controls_placement(box)\n        super()._add_controls()\n        self.gui.add_control(\n            self._effects_box, gui.hSlider, \"Hide radius:\", master=self.graph,\n            value=\"hide_radius\", minValue=0, maxValue=100, step=10,\n            createLabel=False, callback=self.__radius_slider_changed\n        )\n\n    def _add_controls_variables(self, box):\n        self.model_selected = VariableSelectionModel(self.selected_vars)\n        variables_selection(box, self, self.model_selected)\n        self.model_selected.selection_changed.connect(\n            self.__model_selected_changed)\n        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(\n            None, self, \"Suggest Features\", self.__vizrank_set_attrs)\n        box.layout().addWidget(self.btn_vizrank)\n\n    def _add_controls_placement(self, box):\n        self.radio_placement = gui.radioButtonsInBox(\n            box, self, \"placement\",\n            btnLabels=[self.Projection_name[x] for x in Placement],\n            callback=self.__placement_radio_changed\n        )\n\n    def _add_buttons(self):\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def continuous_variables(self):\n        if self.data is None or self.data.domain is None:\n            return []\n        dom = self.data.domain\n        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]\n\n    @property\n    def effective_variables(self):\n        return self.selected_vars\n\n    @property\n    def effective_data(self):\n        cvs = None\n        if self.placement == Placement.LDA:\n            cvs = self.data.domain.class_vars\n        return self.data.transform(Domain(self.effective_variables, cvs))\n\n    def __vizrank_set_attrs(self, attrs):\n        if not attrs:\n            return\n        self.selected_vars[:] = attrs\n        # Ugly, but the alternative is to have yet another signal to which\n        # the view will have to connect\n        self.model_selected.selection_changed.emit()\n\n    def __model_selected_changed(self):\n        self.projection = None\n        self._check_options()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __placement_radio_changed(self):\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n        self.projection = self.projector = None\n        self._init_vizrank()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __radius_slider_changed(self):\n        self.graph.update_radius()\n\n    def colors_changed(self):\n        super().colors_changed()\n        self._init_vizrank()\n\n    @OWAnchorProjectionWidget.Inputs.data\n    def set_data(self, data):\n        super().set_data(data)\n        self._check_options()\n        self._init_vizrank()\n        self.init_projection()\n\n    def _check_options(self):\n        buttons = self.radio_placement.buttons\n        for btn in buttons:\n            btn.setEnabled(True)\n\n        if self.data is not None:\n            has_discrete_class = self.data.domain.has_discrete_class\n            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:\n                buttons[Placement.LDA].setEnabled(False)\n                if self.placement == Placement.LDA:\n                    self.placement = Placement.Circular\n\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n\n    def _init_vizrank(self):\n        is_enabled, msg = False, \"\"\n        if self.data is None:\n            msg = \"There is no data.\"\n        elif self.attr_color is None:\n            msg = \"Color variable has to be selected\"\n        elif self.attr_color.is_continuous and \\\n                self.placement == Placement.LDA:\n            msg = \"Suggest Features does not work for Linear \" \\\n                  \"Discriminant Analysis Projection when \" \\\n                  \"continuous color variable is selected.\"\n        elif len([v for v in self.continuous_variables\n                  if v is not self.attr_color]) < 3:\n            msg = \"Not enough available continuous variables\"\n        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:\n            msg = \"Not enough valid data instances\"\n        else:\n            is_enabled = not np.isnan(self.data.get_column_view(\n                self.attr_color)[0].astype(float)).all()\n        self.btn_vizrank.setToolTip(msg)\n        self.btn_vizrank.setEnabled(is_enabled)\n        if is_enabled:\n            self.vizrank.initialize()\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if not len(self.continuous_variables):\n                error(self.Error.no_cont_features)\n\n    def init_attr_values(self):\n        super().init_attr_values()\n        self.selected_vars[:] = self.continuous_variables[:3]\n        self.model_selected[:] = self.continuous_variables\n\n    def init_projection(self):\n        if self.placement == Placement.Circular:\n            self.projector = CircularPlacement()\n        elif self.placement == Placement.LDA:\n            self.projector = LDA(solver=\"eigen\", n_components=2)\n        elif self.placement == Placement.PCA:\n            self.projector = PCA(n_components=2)\n            self.projector.component = 2\n            self.projector.preprocessors = PCA.preprocessors + [Normalize()]\n\n        super().init_projection()\n\n    def get_coordinates_data(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        embedding = self.get_embedding()\n        if embedding is None:\n            return None, None\n        norm_emb = normalized(embedding[self.valid_data])\n        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \\\n            if embedding.shape[1] == 1 else norm_emb.T\n\n    def _get_send_report_caption(self):\n        def projection_name():\n            return self.Projection_name[self.placement]\n\n        return report.render_items_vert((\n            (\"Projection\", projection_name()),\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    @classmethod\n    def migrate_settings(cls, settings_, version):\n        if version < 2:\n            settings_[\"point_width\"] = settings_[\"point_size\"]\n        if version < 3:\n            settings_graph = {}\n            settings_graph[\"jitter_size\"] = settings_[\"jitter_value\"]\n            settings_graph[\"point_width\"] = settings_[\"point_width\"]\n            settings_graph[\"alpha_value\"] = settings_[\"alpha_value\"]\n            settings_graph[\"class_density\"] = settings_[\"class_density\"]\n            settings_[\"graph\"] = settings_graph\n        if version < 4:\n            if \"radius\" in settings_:\n                settings_[\"graph\"][\"hide_radius\"] = settings_[\"radius\"]\n            if \"selection_indices\" in settings_ and \\\n                    settings_[\"selection_indices\"] is not None:\n                selection = settings_[\"selection_indices\"]\n                settings_[\"selection\"] = [(i, 1) for i, selected in\n                                          enumerate(selection) if selected]\n        if version < 5:\n            if \"placement\" in settings_ and \\\n                    settings_[\"placement\"] not in Placement:\n                settings_[\"placement\"] = Placement.Circular\n\n    @classmethod\n    def migrate_context(cls, context, version):\n        values = context.values\n        if version < 2:\n            domain = context.ordered_domain\n            c_domain = [t for t in context.ordered_domain if t[1] == 2]\n            d_domain = [t for t in context.ordered_domain if t[1] == 1]\n            for d, old_val, new_val in ((domain, \"color_index\", \"attr_color\"),\n                                        (d_domain, \"shape_index\", \"attr_shape\"),\n                                        (c_domain, \"size_index\", \"attr_size\")):\n                index = context.values[old_val][0] - 1\n                values[new_val] = (d[index][0], d[index][1] + 100) \\\n                    if 0 <= index < len(d) else None\n        if version < 3:\n            values[\"graph\"] = {\n                \"attr_color\": values[\"attr_color\"],\n                \"attr_shape\": values[\"attr_shape\"],\n                \"attr_size\": values[\"attr_size\"]\n            }\n        if version == 3:\n            values[\"attr_color\"] = values[\"graph\"][\"attr_color\"]\n            values[\"attr_size\"] = values[\"graph\"][\"attr_size\"]\n            values[\"attr_shape\"] = values[\"graph\"][\"attr_shape\"]\n            values[\"attr_label\"] = values[\"graph\"][\"attr_label\"]\n        if version < 6 and \"selected_vars\" in values:\n            values[\"selected_vars\"] = (values[\"selected_vars\"], -3)\n\n    # for backward compatibility with settings < 6, pull the enum from global\n    # namespace into class\n    Placement = Placement\n\n\ndef column_data(table, var, dtype):\n    dtype = np.dtype(dtype)\n    col, copy = table.get_column_view(var)\n    if not isinstance(col.dtype.type, np.inexact):\n        col = col.astype(float)\n        copy = True\n    if dtype != col.dtype:\n        col = col.astype(dtype)\n        copy = True\n\n    if not copy:\n        col = col.copy()\n    return col\n\n\nclass CircularPlacement(LinearProjector):\n    def get_components(self, X, Y):\n        # Return circular axes for linear projection\n        n_axes = X.shape[1]\n        if n_axes == 1:\n            axes_angle = [0]\n        elif n_axes == 2:\n            axes_angle = [0, np.pi / 2]\n        else:\n            axes_angle = np.linspace(0, 2 * np.pi, n_axes,\n                                     endpoint=False)\n        return np.vstack((np.cos(axes_angle), np.sin(axes_angle)))\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    iris = Table(\"iris\")\n    WidgetPreview(OWLinearProjection).run(set_data=iris,\n                                          set_subset_data=iris[::10])\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/visualize/owlinearprojection.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "8baa07524",
                "new_commit_hash": "1e6498f76",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/visualize/owlinearprojection.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/visualize/owlinearprojection.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 329,
                            "length": 7
                        },
                        "new_range": {
                            "start": 329,
                            "length": 10
                        },
                        "section": "class OWLinearProjection(OWAnchorProjectionWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @property",
                                "type": "context"
                            },
                            {
                                "content": "    def effective_data(self):",
                                "type": "context"
                            },
                            {
                                "content": "        return self.data.transform(Domain(self.effective_variables))",
                                "type": "deleted"
                            },
                            {
                                "content": "        cvs = None",
                                "type": "added"
                            },
                            {
                                "content": "        if self.placement == Placement.LDA:",
                                "type": "added"
                            },
                            {
                                "content": "            cvs = self.data.domain.class_vars",
                                "type": "added"
                            },
                            {
                                "content": "        return self.data.transform(Domain(self.effective_variables, cvs))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __vizrank_set_attrs(self, attrs):",
                                "type": "context"
                            },
                            {
                                "content": "        if not attrs:",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/visualize/owlinearprojection.py",
                            "type": "class",
                            "name": "OWLinearProjection",
                            "content": "class OWLinearProjection(OWAnchorProjectionWidget):\n    name = \"Linear Projection\"\n    description = \"A multi-axis projection of data onto \" \\\n                  \"a two-dimensional plane.\"\n    icon = \"icons/LinearProjection.svg\"\n    priority = 240\n    keywords = []\n\n    Projection_name = {Placement.Circular: \"Circular Placement\",\n                       Placement.LDA: \"Linear Discriminant Analysis\",\n                       Placement.PCA: \"Principal Component Analysis\"}\n\n    settings_version = 6\n\n    placement = Setting(Placement.Circular)\n    selected_vars = ContextSetting([])\n    vizrank = SettingProvider(LinearProjectionVizRank)\n    GRAPH_CLASS = OWLinProjGraph\n    graph = SettingProvider(OWLinProjGraph)\n\n    class Error(OWAnchorProjectionWidget.Error):\n        no_cont_features = Msg(\"Plotting requires numeric features\")\n\n    def _add_controls(self):\n        box = gui.vBox(self.controlArea, box=\"Features\")\n        self._add_controls_variables(box)\n        self._add_controls_placement(box)\n        super()._add_controls()\n        self.gui.add_control(\n            self._effects_box, gui.hSlider, \"Hide radius:\", master=self.graph,\n            value=\"hide_radius\", minValue=0, maxValue=100, step=10,\n            createLabel=False, callback=self.__radius_slider_changed\n        )\n\n    def _add_controls_variables(self, box):\n        self.model_selected = VariableSelectionModel(self.selected_vars)\n        variables_selection(box, self, self.model_selected)\n        self.model_selected.selection_changed.connect(\n            self.__model_selected_changed)\n        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(\n            None, self, \"Suggest Features\", self.__vizrank_set_attrs)\n        box.layout().addWidget(self.btn_vizrank)\n\n    def _add_controls_placement(self, box):\n        self.radio_placement = gui.radioButtonsInBox(\n            box, self, \"placement\",\n            btnLabels=[self.Projection_name[x] for x in Placement],\n            callback=self.__placement_radio_changed\n        )\n\n    def _add_buttons(self):\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def continuous_variables(self):\n        if self.data is None or self.data.domain is None:\n            return []\n        dom = self.data.domain\n        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]\n\n    @property\n    def effective_variables(self):\n        return self.selected_vars\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables))\n\n    def __vizrank_set_attrs(self, attrs):\n        if not attrs:\n            return\n        self.selected_vars[:] = attrs\n        # Ugly, but the alternative is to have yet another signal to which\n        # the view will have to connect\n        self.model_selected.selection_changed.emit()\n\n    def __model_selected_changed(self):\n        self.projection = None\n        self._check_options()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __placement_radio_changed(self):\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n        self.projection = self.projector = None\n        self._init_vizrank()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __radius_slider_changed(self):\n        self.graph.update_radius()\n\n    def colors_changed(self):\n        super().colors_changed()\n        self._init_vizrank()\n\n    @OWAnchorProjectionWidget.Inputs.data\n    def set_data(self, data):\n        super().set_data(data)\n        self._check_options()\n        self._init_vizrank()\n        self.init_projection()\n\n    def _check_options(self):\n        buttons = self.radio_placement.buttons\n        for btn in buttons:\n            btn.setEnabled(True)\n\n        if self.data is not None:\n            has_discrete_class = self.data.domain.has_discrete_class\n            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:\n                buttons[Placement.LDA].setEnabled(False)\n                if self.placement == Placement.LDA:\n                    self.placement = Placement.Circular\n\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n\n    def _init_vizrank(self):\n        is_enabled, msg = False, \"\"\n        if self.data is None:\n            msg = \"There is no data.\"\n        elif self.attr_color is None:\n            msg = \"Color variable has to be selected\"\n        elif self.attr_color.is_continuous and \\\n                self.placement == Placement.LDA:\n            msg = \"Suggest Features does not work for Linear \" \\\n                  \"Discriminant Analysis Projection when \" \\\n                  \"continuous color variable is selected.\"\n        elif len([v for v in self.continuous_variables\n                  if v is not self.attr_color]) < 3:\n            msg = \"Not enough available continuous variables\"\n        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:\n            msg = \"Not enough valid data instances\"\n        else:\n            is_enabled = not np.isnan(self.data.get_column_view(\n                self.attr_color)[0].astype(float)).all()\n        self.btn_vizrank.setToolTip(msg)\n        self.btn_vizrank.setEnabled(is_enabled)\n        if is_enabled:\n            self.vizrank.initialize()\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if not len(self.continuous_variables):\n                error(self.Error.no_cont_features)\n\n    def init_attr_values(self):\n        super().init_attr_values()\n        self.selected_vars[:] = self.continuous_variables[:3]\n        self.model_selected[:] = self.continuous_variables\n\n    def init_projection(self):\n        if self.placement == Placement.Circular:\n            self.projector = CircularPlacement()\n        elif self.placement == Placement.LDA:\n            self.projector = LDA(solver=\"eigen\", n_components=2)\n        elif self.placement == Placement.PCA:\n            self.projector = PCA(n_components=2)\n            self.projector.component = 2\n            self.projector.preprocessors = PCA.preprocessors + [Normalize()]\n\n        super().init_projection()\n\n    def get_coordinates_data(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        embedding = self.get_embedding()\n        if embedding is None:\n            return None, None\n        norm_emb = normalized(embedding[self.valid_data])\n        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \\\n            if embedding.shape[1] == 1 else norm_emb.T\n\n    def _get_send_report_caption(self):\n        def projection_name():\n            return self.Projection_name[self.placement]\n\n        return report.render_items_vert((\n            (\"Projection\", projection_name()),\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    @classmethod\n    def migrate_settings(cls, settings_, version):\n        if version < 2:\n            settings_[\"point_width\"] = settings_[\"point_size\"]\n        if version < 3:\n            settings_graph = {}\n            settings_graph[\"jitter_size\"] = settings_[\"jitter_value\"]\n            settings_graph[\"point_width\"] = settings_[\"point_width\"]\n            settings_graph[\"alpha_value\"] = settings_[\"alpha_value\"]\n            settings_graph[\"class_density\"] = settings_[\"class_density\"]\n            settings_[\"graph\"] = settings_graph\n        if version < 4:\n            if \"radius\" in settings_:\n                settings_[\"graph\"][\"hide_radius\"] = settings_[\"radius\"]\n            if \"selection_indices\" in settings_ and \\\n                    settings_[\"selection_indices\"] is not None:\n                selection = settings_[\"selection_indices\"]\n                settings_[\"selection\"] = [(i, 1) for i, selected in\n                                          enumerate(selection) if selected]\n        if version < 5:\n            if \"placement\" in settings_ and \\\n                    settings_[\"placement\"] not in Placement:\n                settings_[\"placement\"] = Placement.Circular\n\n    @classmethod\n    def migrate_context(cls, context, version):\n        values = context.values\n        if version < 2:\n            domain = context.ordered_domain\n            c_domain = [t for t in context.ordered_domain if t[1] == 2]\n            d_domain = [t for t in context.ordered_domain if t[1] == 1]\n            for d, old_val, new_val in ((domain, \"color_index\", \"attr_color\"),\n                                        (d_domain, \"shape_index\", \"attr_shape\"),\n                                        (c_domain, \"size_index\", \"attr_size\")):\n                index = context.values[old_val][0] - 1\n                values[new_val] = (d[index][0], d[index][1] + 100) \\\n                    if 0 <= index < len(d) else None\n        if version < 3:\n            values[\"graph\"] = {\n                \"attr_color\": values[\"attr_color\"],\n                \"attr_shape\": values[\"attr_shape\"],\n                \"attr_size\": values[\"attr_size\"]\n            }\n        if version == 3:\n            values[\"attr_color\"] = values[\"graph\"][\"attr_color\"]\n            values[\"attr_size\"] = values[\"graph\"][\"attr_size\"]\n            values[\"attr_shape\"] = values[\"graph\"][\"attr_shape\"]\n            values[\"attr_label\"] = values[\"graph\"][\"attr_label\"]\n        if version < 6 and \"selected_vars\" in values:\n            values[\"selected_vars\"] = (values[\"selected_vars\"], -3)\n\n    # for backward compatibility with settings < 6, pull the enum from global\n    # namespace into class\n    Placement = Placement",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 265,
                            "end_lineno": 517,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/visualize/owlinearprojection.py",
                            "type": "method",
                            "name": "OWLinearProjection.effective_data",
                            "content": "class OWLinearProjection(OWAnchorProjectionWidget):\n    name = \"Linear Projection\"\n    description = \"A multi-axis projection of data onto \" \\\n                  \"a two-dimensional plane.\"\n    icon = \"icons/LinearProjection.svg\"\n    priority = 240\n    keywords = []\n\n    Projection_name = {Placement.Circular: \"Circular Placement\",\n                       Placement.LDA: \"Linear Discriminant Analysis\",\n                       Placement.PCA: \"Principal Component Analysis\"}\n\n    settings_version = 6\n\n    placement = Setting(Placement.Circular)\n    selected_vars = ContextSetting([])\n    vizrank = SettingProvider(LinearProjectionVizRank)\n    GRAPH_CLASS = OWLinProjGraph\n    graph = SettingProvider(OWLinProjGraph)\n\n    class Error(OWAnchorProjectionWidget.Error):\n        no_cont_features = Msg(\"Plotting requires numeric features\")\n\n    def _add_controls(self):\n        box = gui.vBox(self.controlArea, box=\"Features\")\n        self._add_controls_variables(box)\n        self._add_controls_placement(box)\n        super()._add_controls()\n        self.gui.add_control(\n            self._effects_box, gui.hSlider, \"Hide radius:\", master=self.graph,\n            value=\"hide_radius\", minValue=0, maxValue=100, step=10,\n            createLabel=False, callback=self.__radius_slider_changed\n        )\n\n    def _add_controls_variables(self, box):\n        self.model_selected = VariableSelectionModel(self.selected_vars)\n        variables_selection(box, self, self.model_selected)\n        self.model_selected.selection_changed.connect(\n            self.__model_selected_changed)\n        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(\n            None, self, \"Suggest Features\", self.__vizrank_set_attrs)\n        box.layout().addWidget(self.btn_vizrank)\n\n    def _add_controls_placement(self, box):\n        self.radio_placement = gui.radioButtonsInBox(\n            box, self, \"placement\",\n            btnLabels=[self.Projection_name[x] for x in Placement],\n            callback=self.__placement_radio_changed\n        )\n\n    def _add_buttons(self):\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def continuous_variables(self):\n        if self.data is None or self.data.domain is None:\n            return []\n        dom = self.data.domain\n        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]\n\n    @property\n    def effective_variables(self):\n        return self.selected_vars\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables))\n\n    def __vizrank_set_attrs(self, attrs):\n        if not attrs:\n            return\n        self.selected_vars[:] = attrs\n        # Ugly, but the alternative is to have yet another signal to which\n        # the view will have to connect\n        self.model_selected.selection_changed.emit()\n\n    def __model_selected_changed(self):\n        self.projection = None\n        self._check_options()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __placement_radio_changed(self):\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n        self.projection = self.projector = None\n        self._init_vizrank()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __radius_slider_changed(self):\n        self.graph.update_radius()\n\n    def colors_changed(self):\n        super().colors_changed()\n        self._init_vizrank()\n\n    @OWAnchorProjectionWidget.Inputs.data\n    def set_data(self, data):\n        super().set_data(data)\n        self._check_options()\n        self._init_vizrank()\n        self.init_projection()\n\n    def _check_options(self):\n        buttons = self.radio_placement.buttons\n        for btn in buttons:\n            btn.setEnabled(True)\n\n        if self.data is not None:\n            has_discrete_class = self.data.domain.has_discrete_class\n            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:\n                buttons[Placement.LDA].setEnabled(False)\n                if self.placement == Placement.LDA:\n                    self.placement = Placement.Circular\n\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n\n    def _init_vizrank(self):\n        is_enabled, msg = False, \"\"\n        if self.data is None:\n            msg = \"There is no data.\"\n        elif self.attr_color is None:\n            msg = \"Color variable has to be selected\"\n        elif self.attr_color.is_continuous and \\\n                self.placement == Placement.LDA:\n            msg = \"Suggest Features does not work for Linear \" \\\n                  \"Discriminant Analysis Projection when \" \\\n                  \"continuous color variable is selected.\"\n        elif len([v for v in self.continuous_variables\n                  if v is not self.attr_color]) < 3:\n            msg = \"Not enough available continuous variables\"\n        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:\n            msg = \"Not enough valid data instances\"\n        else:\n            is_enabled = not np.isnan(self.data.get_column_view(\n                self.attr_color)[0].astype(float)).all()\n        self.btn_vizrank.setToolTip(msg)\n        self.btn_vizrank.setEnabled(is_enabled)\n        if is_enabled:\n            self.vizrank.initialize()\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if not len(self.continuous_variables):\n                error(self.Error.no_cont_features)\n\n    def init_attr_values(self):\n        super().init_attr_values()\n        self.selected_vars[:] = self.continuous_variables[:3]\n        self.model_selected[:] = self.continuous_variables\n\n    def init_projection(self):\n        if self.placement == Placement.Circular:\n            self.projector = CircularPlacement()\n        elif self.placement == Placement.LDA:\n            self.projector = LDA(solver=\"eigen\", n_components=2)\n        elif self.placement == Placement.PCA:\n            self.projector = PCA(n_components=2)\n            self.projector.component = 2\n            self.projector.preprocessors = PCA.preprocessors + [Normalize()]\n\n        super().init_projection()\n\n    def get_coordinates_data(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        embedding = self.get_embedding()\n        if embedding is None:\n            return None, None\n        norm_emb = normalized(embedding[self.valid_data])\n        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \\\n            if embedding.shape[1] == 1 else norm_emb.T\n\n    def _get_send_report_caption(self):\n        def projection_name():\n            return self.Projection_name[self.placement]\n\n        return report.render_items_vert((\n            (\"Projection\", projection_name()),\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    @classmethod\n    def migrate_settings(cls, settings_, version):\n        if version < 2:\n            settings_[\"point_width\"] = settings_[\"point_size\"]\n        if version < 3:\n            settings_graph = {}\n            settings_graph[\"jitter_size\"] = settings_[\"jitter_value\"]\n            settings_graph[\"point_width\"] = settings_[\"point_width\"]\n            settings_graph[\"alpha_value\"] = settings_[\"alpha_value\"]\n            settings_graph[\"class_density\"] = settings_[\"class_density\"]\n            settings_[\"graph\"] = settings_graph\n        if version < 4:\n            if \"radius\" in settings_:\n                settings_[\"graph\"][\"hide_radius\"] = settings_[\"radius\"]\n            if \"selection_indices\" in settings_ and \\\n                    settings_[\"selection_indices\"] is not None:\n                selection = settings_[\"selection_indices\"]\n                settings_[\"selection\"] = [(i, 1) for i, selected in\n                                          enumerate(selection) if selected]\n        if version < 5:\n            if \"placement\" in settings_ and \\\n                    settings_[\"placement\"] not in Placement:\n                settings_[\"placement\"] = Placement.Circular\n\n    @classmethod\n    def migrate_context(cls, context, version):\n        values = context.values\n        if version < 2:\n            domain = context.ordered_domain\n            c_domain = [t for t in context.ordered_domain if t[1] == 2]\n            d_domain = [t for t in context.ordered_domain if t[1] == 1]\n            for d, old_val, new_val in ((domain, \"color_index\", \"attr_color\"),\n                                        (d_domain, \"shape_index\", \"attr_shape\"),\n                                        (c_domain, \"size_index\", \"attr_size\")):\n                index = context.values[old_val][0] - 1\n                values[new_val] = (d[index][0], d[index][1] + 100) \\\n                    if 0 <= index < len(d) else None\n        if version < 3:\n            values[\"graph\"] = {\n                \"attr_color\": values[\"attr_color\"],\n                \"attr_shape\": values[\"attr_shape\"],\n                \"attr_size\": values[\"attr_size\"]\n            }\n        if version == 3:\n            values[\"attr_color\"] = values[\"graph\"][\"attr_color\"]\n            values[\"attr_size\"] = values[\"graph\"][\"attr_size\"]\n            values[\"attr_shape\"] = values[\"graph\"][\"attr_shape\"]\n            values[\"attr_label\"] = values[\"graph\"][\"attr_label\"]\n        if version < 6 and \"selected_vars\" in values:\n            values[\"selected_vars\"] = (values[\"selected_vars\"], -3)\n\n    # for backward compatibility with settings < 6, pull the enum from global\n    # namespace into class\n    Placement = Placement",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 331,
                            "end_lineno": 332,
                            "parent": {
                                "file_name": "Orange/widgets/visualize/owlinearprojection.py",
                                "type": "class",
                                "name": "OWLinearProjection",
                                "content": "class OWLinearProjection(OWAnchorProjectionWidget):\n    name = \"Linear Projection\"\n    description = \"A multi-axis projection of data onto \" \\\n                  \"a two-dimensional plane.\"\n    icon = \"icons/LinearProjection.svg\"\n    priority = 240\n    keywords = []\n\n    Projection_name = {Placement.Circular: \"Circular Placement\",\n                       Placement.LDA: \"Linear Discriminant Analysis\",\n                       Placement.PCA: \"Principal Component Analysis\"}\n\n    settings_version = 6\n\n    placement = Setting(Placement.Circular)\n    selected_vars = ContextSetting([])\n    vizrank = SettingProvider(LinearProjectionVizRank)\n    GRAPH_CLASS = OWLinProjGraph\n    graph = SettingProvider(OWLinProjGraph)\n\n    class Error(OWAnchorProjectionWidget.Error):\n        no_cont_features = Msg(\"Plotting requires numeric features\")\n\n    def _add_controls(self):\n        box = gui.vBox(self.controlArea, box=\"Features\")\n        self._add_controls_variables(box)\n        self._add_controls_placement(box)\n        super()._add_controls()\n        self.gui.add_control(\n            self._effects_box, gui.hSlider, \"Hide radius:\", master=self.graph,\n            value=\"hide_radius\", minValue=0, maxValue=100, step=10,\n            createLabel=False, callback=self.__radius_slider_changed\n        )\n\n    def _add_controls_variables(self, box):\n        self.model_selected = VariableSelectionModel(self.selected_vars)\n        variables_selection(box, self, self.model_selected)\n        self.model_selected.selection_changed.connect(\n            self.__model_selected_changed)\n        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(\n            None, self, \"Suggest Features\", self.__vizrank_set_attrs)\n        box.layout().addWidget(self.btn_vizrank)\n\n    def _add_controls_placement(self, box):\n        self.radio_placement = gui.radioButtonsInBox(\n            box, self, \"placement\",\n            btnLabels=[self.Projection_name[x] for x in Placement],\n            callback=self.__placement_radio_changed\n        )\n\n    def _add_buttons(self):\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def continuous_variables(self):\n        if self.data is None or self.data.domain is None:\n            return []\n        dom = self.data.domain\n        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]\n\n    @property\n    def effective_variables(self):\n        return self.selected_vars\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables))\n\n    def __vizrank_set_attrs(self, attrs):\n        if not attrs:\n            return\n        self.selected_vars[:] = attrs\n        # Ugly, but the alternative is to have yet another signal to which\n        # the view will have to connect\n        self.model_selected.selection_changed.emit()\n\n    def __model_selected_changed(self):\n        self.projection = None\n        self._check_options()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __placement_radio_changed(self):\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n        self.projection = self.projector = None\n        self._init_vizrank()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __radius_slider_changed(self):\n        self.graph.update_radius()\n\n    def colors_changed(self):\n        super().colors_changed()\n        self._init_vizrank()\n\n    @OWAnchorProjectionWidget.Inputs.data\n    def set_data(self, data):\n        super().set_data(data)\n        self._check_options()\n        self._init_vizrank()\n        self.init_projection()\n\n    def _check_options(self):\n        buttons = self.radio_placement.buttons\n        for btn in buttons:\n            btn.setEnabled(True)\n\n        if self.data is not None:\n            has_discrete_class = self.data.domain.has_discrete_class\n            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:\n                buttons[Placement.LDA].setEnabled(False)\n                if self.placement == Placement.LDA:\n                    self.placement = Placement.Circular\n\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n\n    def _init_vizrank(self):\n        is_enabled, msg = False, \"\"\n        if self.data is None:\n            msg = \"There is no data.\"\n        elif self.attr_color is None:\n            msg = \"Color variable has to be selected\"\n        elif self.attr_color.is_continuous and \\\n                self.placement == Placement.LDA:\n            msg = \"Suggest Features does not work for Linear \" \\\n                  \"Discriminant Analysis Projection when \" \\\n                  \"continuous color variable is selected.\"\n        elif len([v for v in self.continuous_variables\n                  if v is not self.attr_color]) < 3:\n            msg = \"Not enough available continuous variables\"\n        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:\n            msg = \"Not enough valid data instances\"\n        else:\n            is_enabled = not np.isnan(self.data.get_column_view(\n                self.attr_color)[0].astype(float)).all()\n        self.btn_vizrank.setToolTip(msg)\n        self.btn_vizrank.setEnabled(is_enabled)\n        if is_enabled:\n            self.vizrank.initialize()\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if not len(self.continuous_variables):\n                error(self.Error.no_cont_features)\n\n    def init_attr_values(self):\n        super().init_attr_values()\n        self.selected_vars[:] = self.continuous_variables[:3]\n        self.model_selected[:] = self.continuous_variables\n\n    def init_projection(self):\n        if self.placement == Placement.Circular:\n            self.projector = CircularPlacement()\n        elif self.placement == Placement.LDA:\n            self.projector = LDA(solver=\"eigen\", n_components=2)\n        elif self.placement == Placement.PCA:\n            self.projector = PCA(n_components=2)\n            self.projector.component = 2\n            self.projector.preprocessors = PCA.preprocessors + [Normalize()]\n\n        super().init_projection()\n\n    def get_coordinates_data(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        embedding = self.get_embedding()\n        if embedding is None:\n            return None, None\n        norm_emb = normalized(embedding[self.valid_data])\n        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \\\n            if embedding.shape[1] == 1 else norm_emb.T\n\n    def _get_send_report_caption(self):\n        def projection_name():\n            return self.Projection_name[self.placement]\n\n        return report.render_items_vert((\n            (\"Projection\", projection_name()),\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    @classmethod\n    def migrate_settings(cls, settings_, version):\n        if version < 2:\n            settings_[\"point_width\"] = settings_[\"point_size\"]\n        if version < 3:\n            settings_graph = {}\n            settings_graph[\"jitter_size\"] = settings_[\"jitter_value\"]\n            settings_graph[\"point_width\"] = settings_[\"point_width\"]\n            settings_graph[\"alpha_value\"] = settings_[\"alpha_value\"]\n            settings_graph[\"class_density\"] = settings_[\"class_density\"]\n            settings_[\"graph\"] = settings_graph\n        if version < 4:\n            if \"radius\" in settings_:\n                settings_[\"graph\"][\"hide_radius\"] = settings_[\"radius\"]\n            if \"selection_indices\" in settings_ and \\\n                    settings_[\"selection_indices\"] is not None:\n                selection = settings_[\"selection_indices\"]\n                settings_[\"selection\"] = [(i, 1) for i, selected in\n                                          enumerate(selection) if selected]\n        if version < 5:\n            if \"placement\" in settings_ and \\\n                    settings_[\"placement\"] not in Placement:\n                settings_[\"placement\"] = Placement.Circular\n\n    @classmethod\n    def migrate_context(cls, context, version):\n        values = context.values\n        if version < 2:\n            domain = context.ordered_domain\n            c_domain = [t for t in context.ordered_domain if t[1] == 2]\n            d_domain = [t for t in context.ordered_domain if t[1] == 1]\n            for d, old_val, new_val in ((domain, \"color_index\", \"attr_color\"),\n                                        (d_domain, \"shape_index\", \"attr_shape\"),\n                                        (c_domain, \"size_index\", \"attr_size\")):\n                index = context.values[old_val][0] - 1\n                values[new_val] = (d[index][0], d[index][1] + 100) \\\n                    if 0 <= index < len(d) else None\n        if version < 3:\n            values[\"graph\"] = {\n                \"attr_color\": values[\"attr_color\"],\n                \"attr_shape\": values[\"attr_shape\"],\n                \"attr_size\": values[\"attr_size\"]\n            }\n        if version == 3:\n            values[\"attr_color\"] = values[\"graph\"][\"attr_color\"]\n            values[\"attr_size\"] = values[\"graph\"][\"attr_size\"]\n            values[\"attr_shape\"] = values[\"graph\"][\"attr_shape\"]\n            values[\"attr_label\"] = values[\"graph\"][\"attr_label\"]\n        if version < 6 and \"selected_vars\" in values:\n            values[\"selected_vars\"] = (values[\"selected_vars\"], -3)\n\n    # for backward compatibility with settings < 6, pull the enum from global\n    # namespace into class\n    Placement = Placement",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 265,
                                "end_lineno": 517,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom unittest.mock import Mock\nimport numpy as np\n\nfrom AnyQt.QtCore import QItemSelectionModel\n\nfrom Orange.data import Table, Domain, DiscreteVariable, ContinuousVariable\nfrom Orange.widgets.settings import Context\nfrom Orange.widgets.tests.base import (\n    WidgetTest, WidgetOutputsTestMixin, datasets,\n    AnchorProjectionWidgetTestMixin\n)\nfrom Orange.widgets.tests.utils import simulate\nfrom Orange.widgets.visualize.owlinearprojection import (\n    OWLinearProjection, LinearProjectionVizRank, Placement\n)\nfrom Orange.widgets.visualize.utils import run_vizrank\n\n\nclass TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,\n                             WidgetOutputsTestMixin):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data\n        cls.same_input_output_domain = False\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)  # type: OWLinearProjection\n\n    def test_nan_plot(self):\n        data = datasets.missing_data_1()\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n            data.Y[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.data_subset, data[2:3])\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n    def test_buttons(self):\n        for btn in self.widget.radio_placement.buttons[:3]:\n            self.send_signal(self.widget.Inputs.data, self.data)\n            self.assertTrue(btn.isEnabled())\n            btn.click()\n\n    def test_btn_vizrank(self):\n        def check_vizrank(data):\n            self.send_signal(self.widget.Inputs.data, data)\n            if data is not None and data.domain.class_var in \\\n                    self.widget.controls.attr_color.model():\n                self.widget.attr_color = data.domain.class_var\n            if self.widget.btn_vizrank.isEnabled():\n                vizrank = LinearProjectionVizRank(self.widget)\n                states = [state for state in vizrank.iterate_states(None)]\n                self.assertIsNotNone(vizrank.compute_score(states[0]))\n\n        check_vizrank(self.data)\n        check_vizrank(self.data[:, :3])\n        check_vizrank(None)\n        for ds in datasets.datasets():\n            check_vizrank(ds)\n\n    def test_bad_data(self):\n        w = self.widget\n        data = Table(\"iris\")[:20]\n        domain = data.domain\n        domain = Domain(\n            attributes=domain.attributes[:4], class_vars=DiscreteVariable(\"class\", values=(\"a\", )))\n        data = Table.from_numpy(domain=domain, X=data.X, Y=data.Y)\n        self.assertTrue(w.radio_placement.buttons[1].isEnabled())\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.radio_placement.buttons[1].isEnabled())\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))\n        self.assertFalse(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n\n    def test_data_no_cont_features(self):\n        data = Table(\"titanic\")\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertTrue(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n\n    def test_radius(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.widget.controls.graph.hide_radius.setValue(5)\n\n    def test_invalid_data(self):\n        def assertErrorShown(data, is_shown):\n            self.send_signal(self.widget.Inputs.data, data)\n            self.assertEqual(is_shown, self.widget.Error.no_valid_data.is_shown())\n\n        data = Table(\"iris\")[::30].copy()\n        with data.unlocked():\n            data[:, 0] = np.nan\n        for data, is_shown in zip([None, data, Table(\"iris\")[:30]], [False, True, False]):\n            assertErrorShown(data, is_shown)\n\n    def test_migrate_settings_from_version_1(self):\n        # Settings from Orange 3.4.0\n        settings = {\n            '__version__': 1,\n            'alpha_value': 255,\n            'auto_commit': True,\n            'class_density': False,\n            'context_settings': [\n                Context(attributes={'iris': 1,\n                                    'petal length': 2, 'petal width': 2,\n                                    'sepal length': 2, 'sepal width': 2},\n                        metas={},\n                        ordered_domain=[('sepal length', 2),\n                                        ('sepal width', 2),\n                                        ('petal length', 2),\n                                        ('petal width', 2),\n                                        ('iris', 1)],\n                        time=1504865133.098991,\n                        values={'__version__': 1,\n                                'color_index': (5, -2),\n                                'shape_index': (1, -2),\n                                'size_index': (1, -2),\n                                'variable_state': ({}, -2)})],\n            'jitter_value': 0,\n            'legend_anchor': ((1, 0), (1, 0)),\n            'point_size': 8,\n            'savedWidgetGeometry': None\n        }\n        w = self.create_widget(OWLinearProjection, stored_settings=settings)\n        iris = Table(\"iris\")\n        self.send_signal(w.Inputs.data, iris, widget=w)\n        self.assertEqual(w.graph.point_width, 8)\n        self.assertEqual(w.attr_color, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_shape, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_size, iris.domain[\"sepal length\"])\n\n    def test_set_radius_no_data(self):\n        \"\"\"\n        Widget should not crash when there is no data and radius slider is moved.\n        \"\"\"\n        w = self.widget\n        self.send_signal(w.Inputs.data, None)\n        w.controls.graph.hide_radius.setSliderPosition(3)\n\n    def test_invalidated_model_selected(self):\n        model = self.widget.model_selected\n\n        self.widget.setup_plot = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.widget.selected_vars[:] = self.data.domain[2:3]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data[:, 2:])\n        self.widget.setup_plot.assert_not_called()\n\n        self.widget.selected_vars[:] = [self.data.domain[3]]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n    def test_two_classes_dataset(self):\n        self.widget.radio_placement.buttons[1].click()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertFalse(self.widget.radio_placement.buttons[1].isEnabled())\n\n    def test_unique_name(self):\n        data = Table(\"iris\")\n        new = ContinuousVariable(\"C-y\")\n        d = Table.from_numpy(Domain(list(data.domain.attributes[:3])+[new],\n                                    class_vars=data.domain.class_vars), data.X,\n                             data.Y)\n        self.send_signal(self.widget.Inputs.data, d)\n        output = self.get_output(self.widget.Outputs.annotated_data)\n        metas = [\"C-x (1)\", \"C-y (1)\", \"Selected\"]\n        self.assertEqual([meta.name for meta in output.domain.metas], metas)\n\n\nclass LinProjVizRankTests(WidgetTest):\n    \"\"\"\n    Linear Projection VizRank tests are mostly done without threading.\n    This is because threads created with module coverage are not traced.\n    \"\"\"\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.data = Table(\"iris\")\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)\n        self.vizrank = self.widget.vizrank\n\n    def test_discrete_class(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        run_vizrank(self.vizrank.compute_score,\n                    self.vizrank.iterate_states, None,\n                    [], 0, self.vizrank.state_count(), Mock())\n\n    def test_continuous_class(self):\n        data = Table(\"housing\")[::100]\n        self.send_signal(self.widget.Inputs.data, data)\n        run_vizrank(self.vizrank.compute_score,\n                    self.vizrank.iterate_states, None,\n                    [], 0, self.vizrank.state_count(), Mock())\n\n    def test_set_attrs(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        prev_selected = self.widget.selected_vars[:]\n        c1 = self.get_output(self.widget.Outputs.components)\n        self.vizrank.toggle()\n        self.process_events(until=lambda: not self.vizrank.keep_running)\n        self.assertEqual(len(self.vizrank.scores), self.vizrank.state_count())\n        self.vizrank.rank_table.selectionModel().select(\n            self.vizrank.rank_model.item(0, 0).index(),\n            QItemSelectionModel.ClearAndSelect\n        )\n        self.assertNotEqual(self.widget.selected_vars, prev_selected)\n        c2 = self.get_output(self.widget.Outputs.components)\n        self.assertNotEqual(c1.domain.attributes, c2.domain.attributes)\n\n\nif __name__ == \"__main__\":\n    import unittest\n    unittest.main()\n",
            "new_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom unittest.mock import Mock\nimport numpy as np\n\nfrom AnyQt.QtCore import QItemSelectionModel\n\nfrom Orange.data import Table, Domain, DiscreteVariable, ContinuousVariable\nfrom Orange.widgets.settings import Context\nfrom Orange.widgets.tests.base import (\n    WidgetTest, WidgetOutputsTestMixin, datasets,\n    AnchorProjectionWidgetTestMixin\n)\nfrom Orange.widgets.tests.utils import simulate\nfrom Orange.widgets.visualize.owlinearprojection import (\n    OWLinearProjection, LinearProjectionVizRank, Placement\n)\nfrom Orange.widgets.visualize.utils import run_vizrank\n\n\nclass TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,\n                             WidgetOutputsTestMixin):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data\n        cls.same_input_output_domain = False\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)  # type: OWLinearProjection\n\n    def test_nan_plot(self):\n        data = datasets.missing_data_1()\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n            data.Y[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.data_subset, data[2:3])\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n    def test_buttons(self):\n        for btn in self.widget.radio_placement.buttons[:3]:\n            self.send_signal(self.widget.Inputs.data, self.data)\n            self.assertTrue(btn.isEnabled())\n            btn.click()\n\n    def test_btn_vizrank(self):\n        def check_vizrank(data):\n            self.send_signal(self.widget.Inputs.data, data)\n            if data is not None and data.domain.class_var in \\\n                    self.widget.controls.attr_color.model():\n                self.widget.attr_color = data.domain.class_var\n            if self.widget.btn_vizrank.isEnabled():\n                vizrank = LinearProjectionVizRank(self.widget)\n                states = [state for state in vizrank.iterate_states(None)]\n                self.assertIsNotNone(vizrank.compute_score(states[0]))\n\n        check_vizrank(self.data)\n        check_vizrank(self.data[:, :3])\n        check_vizrank(None)\n        for ds in datasets.datasets():\n            check_vizrank(ds)\n\n    def test_bad_data(self):\n        w = self.widget\n        data = Table(\"iris\")[:20]\n        domain = data.domain\n        domain = Domain(\n            attributes=domain.attributes[:4], class_vars=DiscreteVariable(\"class\", values=(\"a\", )))\n        data = Table.from_numpy(domain=domain, X=data.X, Y=data.Y)\n        self.assertTrue(w.radio_placement.buttons[1].isEnabled())\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.radio_placement.buttons[1].isEnabled())\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        output = self.get_output(self.widget.Outputs.components)\n        self.assertTrue(output and len(output) == 2)\n        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))\n        self.assertFalse(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n\n    def test_data_no_cont_features(self):\n        data = Table(\"titanic\")\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertTrue(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n\n    def test_radius(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.widget.controls.graph.hide_radius.setValue(5)\n\n    def test_invalid_data(self):\n        def assertErrorShown(data, is_shown):\n            self.send_signal(self.widget.Inputs.data, data)\n            self.assertEqual(is_shown, self.widget.Error.no_valid_data.is_shown())\n\n        data = Table(\"iris\")[::30].copy()\n        with data.unlocked():\n            data[:, 0] = np.nan\n        for data, is_shown in zip([None, data, Table(\"iris\")[:30]], [False, True, False]):\n            assertErrorShown(data, is_shown)\n\n    def test_migrate_settings_from_version_1(self):\n        # Settings from Orange 3.4.0\n        settings = {\n            '__version__': 1,\n            'alpha_value': 255,\n            'auto_commit': True,\n            'class_density': False,\n            'context_settings': [\n                Context(attributes={'iris': 1,\n                                    'petal length': 2, 'petal width': 2,\n                                    'sepal length': 2, 'sepal width': 2},\n                        metas={},\n                        ordered_domain=[('sepal length', 2),\n                                        ('sepal width', 2),\n                                        ('petal length', 2),\n                                        ('petal width', 2),\n                                        ('iris', 1)],\n                        time=1504865133.098991,\n                        values={'__version__': 1,\n                                'color_index': (5, -2),\n                                'shape_index': (1, -2),\n                                'size_index': (1, -2),\n                                'variable_state': ({}, -2)})],\n            'jitter_value': 0,\n            'legend_anchor': ((1, 0), (1, 0)),\n            'point_size': 8,\n            'savedWidgetGeometry': None\n        }\n        w = self.create_widget(OWLinearProjection, stored_settings=settings)\n        iris = Table(\"iris\")\n        self.send_signal(w.Inputs.data, iris, widget=w)\n        self.assertEqual(w.graph.point_width, 8)\n        self.assertEqual(w.attr_color, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_shape, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_size, iris.domain[\"sepal length\"])\n\n    def test_set_radius_no_data(self):\n        \"\"\"\n        Widget should not crash when there is no data and radius slider is moved.\n        \"\"\"\n        w = self.widget\n        self.send_signal(w.Inputs.data, None)\n        w.controls.graph.hide_radius.setSliderPosition(3)\n\n    def test_invalidated_model_selected(self):\n        model = self.widget.model_selected\n\n        self.widget.setup_plot = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.widget.selected_vars[:] = self.data.domain[2:3]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data[:, 2:])\n        self.widget.setup_plot.assert_not_called()\n\n        self.widget.selected_vars[:] = [self.data.domain[3]]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n    def test_two_classes_dataset(self):\n        self.widget.radio_placement.buttons[1].click()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertFalse(self.widget.radio_placement.buttons[1].isEnabled())\n\n    def test_unique_name(self):\n        data = Table(\"iris\")\n        new = ContinuousVariable(\"C-y\")\n        d = Table.from_numpy(Domain(list(data.domain.attributes[:3])+[new],\n                                    class_vars=data.domain.class_vars), data.X,\n                             data.Y)\n        self.send_signal(self.widget.Inputs.data, d)\n        output = self.get_output(self.widget.Outputs.annotated_data)\n        metas = [\"C-x (1)\", \"C-y (1)\", \"Selected\"]\n        self.assertEqual([meta.name for meta in output.domain.metas], metas)\n\n\nclass LinProjVizRankTests(WidgetTest):\n    \"\"\"\n    Linear Projection VizRank tests are mostly done without threading.\n    This is because threads created with module coverage are not traced.\n    \"\"\"\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.data = Table(\"iris\")\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)\n        self.vizrank = self.widget.vizrank\n\n    def test_discrete_class(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        run_vizrank(self.vizrank.compute_score,\n                    self.vizrank.iterate_states, None,\n                    [], 0, self.vizrank.state_count(), Mock())\n\n    def test_continuous_class(self):\n        data = Table(\"housing\")[::100]\n        self.send_signal(self.widget.Inputs.data, data)\n        run_vizrank(self.vizrank.compute_score,\n                    self.vizrank.iterate_states, None,\n                    [], 0, self.vizrank.state_count(), Mock())\n\n    def test_set_attrs(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        prev_selected = self.widget.selected_vars[:]\n        c1 = self.get_output(self.widget.Outputs.components)\n        self.vizrank.toggle()\n        self.process_events(until=lambda: not self.vizrank.keep_running)\n        self.assertEqual(len(self.vizrank.scores), self.vizrank.state_count())\n        self.vizrank.rank_table.selectionModel().select(\n            self.vizrank.rank_model.item(0, 0).index(),\n            QItemSelectionModel.ClearAndSelect\n        )\n        self.assertNotEqual(self.widget.selected_vars, prev_selected)\n        c2 = self.get_output(self.widget.Outputs.components)\n        self.assertNotEqual(c1.domain.attributes, c2.domain.attributes)\n\n\nif __name__ == \"__main__\":\n    import unittest\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/visualize/tests/test_owlinearprojection.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "d936a3002",
                "new_commit_hash": "0c60b3da8",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/visualize/tests/test_owlinearprojection.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/visualize/tests/test_owlinearprojection.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 85,
                            "length": 6
                        },
                        "new_range": {
                            "start": 85,
                            "length": 8
                        },
                        "section": "class TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, self.data)",
                                "type": "context"
                            },
                            {
                                "content": "        self.widget.radio_placement.buttons[Placement.LDA].click()",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertTrue(buttons[Placement.LDA].isEnabled())",
                                "type": "context"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.components)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(output and len(output) == 2)",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertFalse(buttons[Placement.LDA].isEnabled())",
                                "type": "context"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, None)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/visualize/tests/test_owlinearprojection.py",
                            "type": "class",
                            "name": "TestOWLinearProjection",
                            "content": "class TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,\n                             WidgetOutputsTestMixin):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data\n        cls.same_input_output_domain = False\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)  # type: OWLinearProjection\n\n    def test_nan_plot(self):\n        data = datasets.missing_data_1()\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n            data.Y[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.data_subset, data[2:3])\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n    def test_buttons(self):\n        for btn in self.widget.radio_placement.buttons[:3]:\n            self.send_signal(self.widget.Inputs.data, self.data)\n            self.assertTrue(btn.isEnabled())\n            btn.click()\n\n    def test_btn_vizrank(self):\n        def check_vizrank(data):\n            self.send_signal(self.widget.Inputs.data, data)\n            if data is not None and data.domain.class_var in \\\n                    self.widget.controls.attr_color.model():\n                self.widget.attr_color = data.domain.class_var\n            if self.widget.btn_vizrank.isEnabled():\n                vizrank = LinearProjectionVizRank(self.widget)\n                states = [state for state in vizrank.iterate_states(None)]\n                self.assertIsNotNone(vizrank.compute_score(states[0]))\n\n        check_vizrank(self.data)\n        check_vizrank(self.data[:, :3])\n        check_vizrank(None)\n        for ds in datasets.datasets():\n            check_vizrank(ds)\n\n    def test_bad_data(self):\n        w = self.widget\n        data = Table(\"iris\")[:20]\n        domain = data.domain\n        domain = Domain(\n            attributes=domain.attributes[:4], class_vars=DiscreteVariable(\"class\", values=(\"a\", )))\n        data = Table.from_numpy(domain=domain, X=data.X, Y=data.Y)\n        self.assertTrue(w.radio_placement.buttons[1].isEnabled())\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.radio_placement.buttons[1].isEnabled())\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        output = self.get_output(self.widget.Outputs.components)\n        self.assertTrue(output and len(output) == 2)\n        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))\n        self.assertFalse(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n\n    def test_data_no_cont_features(self):\n        data = Table(\"titanic\")\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertTrue(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n\n    def test_radius(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.widget.controls.graph.hide_radius.setValue(5)\n\n    def test_invalid_data(self):\n        def assertErrorShown(data, is_shown):\n            self.send_signal(self.widget.Inputs.data, data)\n            self.assertEqual(is_shown, self.widget.Error.no_valid_data.is_shown())\n\n        data = Table(\"iris\")[::30].copy()\n        with data.unlocked():\n            data[:, 0] = np.nan\n        for data, is_shown in zip([None, data, Table(\"iris\")[:30]], [False, True, False]):\n            assertErrorShown(data, is_shown)\n\n    def test_migrate_settings_from_version_1(self):\n        # Settings from Orange 3.4.0\n        settings = {\n            '__version__': 1,\n            'alpha_value': 255,\n            'auto_commit': True,\n            'class_density': False,\n            'context_settings': [\n                Context(attributes={'iris': 1,\n                                    'petal length': 2, 'petal width': 2,\n                                    'sepal length': 2, 'sepal width': 2},\n                        metas={},\n                        ordered_domain=[('sepal length', 2),\n                                        ('sepal width', 2),\n                                        ('petal length', 2),\n                                        ('petal width', 2),\n                                        ('iris', 1)],\n                        time=1504865133.098991,\n                        values={'__version__': 1,\n                                'color_index': (5, -2),\n                                'shape_index': (1, -2),\n                                'size_index': (1, -2),\n                                'variable_state': ({}, -2)})],\n            'jitter_value': 0,\n            'legend_anchor': ((1, 0), (1, 0)),\n            'point_size': 8,\n            'savedWidgetGeometry': None\n        }\n        w = self.create_widget(OWLinearProjection, stored_settings=settings)\n        iris = Table(\"iris\")\n        self.send_signal(w.Inputs.data, iris, widget=w)\n        self.assertEqual(w.graph.point_width, 8)\n        self.assertEqual(w.attr_color, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_shape, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_size, iris.domain[\"sepal length\"])\n\n    def test_set_radius_no_data(self):\n        \"\"\"\n        Widget should not crash when there is no data and radius slider is moved.\n        \"\"\"\n        w = self.widget\n        self.send_signal(w.Inputs.data, None)\n        w.controls.graph.hide_radius.setSliderPosition(3)\n\n    def test_invalidated_model_selected(self):\n        model = self.widget.model_selected\n\n        self.widget.setup_plot = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.widget.selected_vars[:] = self.data.domain[2:3]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data[:, 2:])\n        self.widget.setup_plot.assert_not_called()\n\n        self.widget.selected_vars[:] = [self.data.domain[3]]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n    def test_two_classes_dataset(self):\n        self.widget.radio_placement.buttons[1].click()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertFalse(self.widget.radio_placement.buttons[1].isEnabled())\n\n    def test_unique_name(self):\n        data = Table(\"iris\")\n        new = ContinuousVariable(\"C-y\")\n        d = Table.from_numpy(Domain(list(data.domain.attributes[:3])+[new],\n                                    class_vars=data.domain.class_vars), data.X,\n                             data.Y)\n        self.send_signal(self.widget.Inputs.data, d)\n        output = self.get_output(self.widget.Outputs.annotated_data)\n        metas = [\"C-x (1)\", \"C-y (1)\", \"Selected\"]\n        self.assertEqual([meta.name for meta in output.domain.metas], metas)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 21,
                            "end_lineno": 201,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/visualize/tests/test_owlinearprojection.py",
                            "type": "method",
                            "name": "TestOWLinearProjection.test_no_data_for_lda",
                            "content": "class TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,\n                             WidgetOutputsTestMixin):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data\n        cls.same_input_output_domain = False\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)  # type: OWLinearProjection\n\n    def test_nan_plot(self):\n        data = datasets.missing_data_1()\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n            data.Y[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.data_subset, data[2:3])\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n    def test_buttons(self):\n        for btn in self.widget.radio_placement.buttons[:3]:\n            self.send_signal(self.widget.Inputs.data, self.data)\n            self.assertTrue(btn.isEnabled())\n            btn.click()\n\n    def test_btn_vizrank(self):\n        def check_vizrank(data):\n            self.send_signal(self.widget.Inputs.data, data)\n            if data is not None and data.domain.class_var in \\\n                    self.widget.controls.attr_color.model():\n                self.widget.attr_color = data.domain.class_var\n            if self.widget.btn_vizrank.isEnabled():\n                vizrank = LinearProjectionVizRank(self.widget)\n                states = [state for state in vizrank.iterate_states(None)]\n                self.assertIsNotNone(vizrank.compute_score(states[0]))\n\n        check_vizrank(self.data)\n        check_vizrank(self.data[:, :3])\n        check_vizrank(None)\n        for ds in datasets.datasets():\n            check_vizrank(ds)\n\n    def test_bad_data(self):\n        w = self.widget\n        data = Table(\"iris\")[:20]\n        domain = data.domain\n        domain = Domain(\n            attributes=domain.attributes[:4], class_vars=DiscreteVariable(\"class\", values=(\"a\", )))\n        data = Table.from_numpy(domain=domain, X=data.X, Y=data.Y)\n        self.assertTrue(w.radio_placement.buttons[1].isEnabled())\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.radio_placement.buttons[1].isEnabled())\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        output = self.get_output(self.widget.Outputs.components)\n        self.assertTrue(output and len(output) == 2)\n        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))\n        self.assertFalse(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n\n    def test_data_no_cont_features(self):\n        data = Table(\"titanic\")\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertTrue(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n\n    def test_radius(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.widget.controls.graph.hide_radius.setValue(5)\n\n    def test_invalid_data(self):\n        def assertErrorShown(data, is_shown):\n            self.send_signal(self.widget.Inputs.data, data)\n            self.assertEqual(is_shown, self.widget.Error.no_valid_data.is_shown())\n\n        data = Table(\"iris\")[::30].copy()\n        with data.unlocked():\n            data[:, 0] = np.nan\n        for data, is_shown in zip([None, data, Table(\"iris\")[:30]], [False, True, False]):\n            assertErrorShown(data, is_shown)\n\n    def test_migrate_settings_from_version_1(self):\n        # Settings from Orange 3.4.0\n        settings = {\n            '__version__': 1,\n            'alpha_value': 255,\n            'auto_commit': True,\n            'class_density': False,\n            'context_settings': [\n                Context(attributes={'iris': 1,\n                                    'petal length': 2, 'petal width': 2,\n                                    'sepal length': 2, 'sepal width': 2},\n                        metas={},\n                        ordered_domain=[('sepal length', 2),\n                                        ('sepal width', 2),\n                                        ('petal length', 2),\n                                        ('petal width', 2),\n                                        ('iris', 1)],\n                        time=1504865133.098991,\n                        values={'__version__': 1,\n                                'color_index': (5, -2),\n                                'shape_index': (1, -2),\n                                'size_index': (1, -2),\n                                'variable_state': ({}, -2)})],\n            'jitter_value': 0,\n            'legend_anchor': ((1, 0), (1, 0)),\n            'point_size': 8,\n            'savedWidgetGeometry': None\n        }\n        w = self.create_widget(OWLinearProjection, stored_settings=settings)\n        iris = Table(\"iris\")\n        self.send_signal(w.Inputs.data, iris, widget=w)\n        self.assertEqual(w.graph.point_width, 8)\n        self.assertEqual(w.attr_color, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_shape, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_size, iris.domain[\"sepal length\"])\n\n    def test_set_radius_no_data(self):\n        \"\"\"\n        Widget should not crash when there is no data and radius slider is moved.\n        \"\"\"\n        w = self.widget\n        self.send_signal(w.Inputs.data, None)\n        w.controls.graph.hide_radius.setSliderPosition(3)\n\n    def test_invalidated_model_selected(self):\n        model = self.widget.model_selected\n\n        self.widget.setup_plot = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.widget.selected_vars[:] = self.data.domain[2:3]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data[:, 2:])\n        self.widget.setup_plot.assert_not_called()\n\n        self.widget.selected_vars[:] = [self.data.domain[3]]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n    def test_two_classes_dataset(self):\n        self.widget.radio_placement.buttons[1].click()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertFalse(self.widget.radio_placement.buttons[1].isEnabled())\n\n    def test_unique_name(self):\n        data = Table(\"iris\")\n        new = ContinuousVariable(\"C-y\")\n        d = Table.from_numpy(Domain(list(data.domain.attributes[:3])+[new],\n                                    class_vars=data.domain.class_vars), data.X,\n                             data.Y)\n        self.send_signal(self.widget.Inputs.data, d)\n        output = self.get_output(self.widget.Outputs.annotated_data)\n        metas = [\"C-x (1)\", \"C-y (1)\", \"Selected\"]\n        self.assertEqual([meta.name for meta in output.domain.metas], metas)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 83,
                            "end_lineno": 93,
                            "parent": {
                                "file_name": "Orange/widgets/visualize/tests/test_owlinearprojection.py",
                                "type": "class",
                                "name": "TestOWLinearProjection",
                                "content": "class TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,\n                             WidgetOutputsTestMixin):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data\n        cls.same_input_output_domain = False\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)  # type: OWLinearProjection\n\n    def test_nan_plot(self):\n        data = datasets.missing_data_1()\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n            data.Y[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.data_subset, data[2:3])\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n    def test_buttons(self):\n        for btn in self.widget.radio_placement.buttons[:3]:\n            self.send_signal(self.widget.Inputs.data, self.data)\n            self.assertTrue(btn.isEnabled())\n            btn.click()\n\n    def test_btn_vizrank(self):\n        def check_vizrank(data):\n            self.send_signal(self.widget.Inputs.data, data)\n            if data is not None and data.domain.class_var in \\\n                    self.widget.controls.attr_color.model():\n                self.widget.attr_color = data.domain.class_var\n            if self.widget.btn_vizrank.isEnabled():\n                vizrank = LinearProjectionVizRank(self.widget)\n                states = [state for state in vizrank.iterate_states(None)]\n                self.assertIsNotNone(vizrank.compute_score(states[0]))\n\n        check_vizrank(self.data)\n        check_vizrank(self.data[:, :3])\n        check_vizrank(None)\n        for ds in datasets.datasets():\n            check_vizrank(ds)\n\n    def test_bad_data(self):\n        w = self.widget\n        data = Table(\"iris\")[:20]\n        domain = data.domain\n        domain = Domain(\n            attributes=domain.attributes[:4], class_vars=DiscreteVariable(\"class\", values=(\"a\", )))\n        data = Table.from_numpy(domain=domain, X=data.X, Y=data.Y)\n        self.assertTrue(w.radio_placement.buttons[1].isEnabled())\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.radio_placement.buttons[1].isEnabled())\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        output = self.get_output(self.widget.Outputs.components)\n        self.assertTrue(output and len(output) == 2)\n        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))\n        self.assertFalse(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n\n    def test_data_no_cont_features(self):\n        data = Table(\"titanic\")\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertTrue(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n\n    def test_radius(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.widget.controls.graph.hide_radius.setValue(5)\n\n    def test_invalid_data(self):\n        def assertErrorShown(data, is_shown):\n            self.send_signal(self.widget.Inputs.data, data)\n            self.assertEqual(is_shown, self.widget.Error.no_valid_data.is_shown())\n\n        data = Table(\"iris\")[::30].copy()\n        with data.unlocked():\n            data[:, 0] = np.nan\n        for data, is_shown in zip([None, data, Table(\"iris\")[:30]], [False, True, False]):\n            assertErrorShown(data, is_shown)\n\n    def test_migrate_settings_from_version_1(self):\n        # Settings from Orange 3.4.0\n        settings = {\n            '__version__': 1,\n            'alpha_value': 255,\n            'auto_commit': True,\n            'class_density': False,\n            'context_settings': [\n                Context(attributes={'iris': 1,\n                                    'petal length': 2, 'petal width': 2,\n                                    'sepal length': 2, 'sepal width': 2},\n                        metas={},\n                        ordered_domain=[('sepal length', 2),\n                                        ('sepal width', 2),\n                                        ('petal length', 2),\n                                        ('petal width', 2),\n                                        ('iris', 1)],\n                        time=1504865133.098991,\n                        values={'__version__': 1,\n                                'color_index': (5, -2),\n                                'shape_index': (1, -2),\n                                'size_index': (1, -2),\n                                'variable_state': ({}, -2)})],\n            'jitter_value': 0,\n            'legend_anchor': ((1, 0), (1, 0)),\n            'point_size': 8,\n            'savedWidgetGeometry': None\n        }\n        w = self.create_widget(OWLinearProjection, stored_settings=settings)\n        iris = Table(\"iris\")\n        self.send_signal(w.Inputs.data, iris, widget=w)\n        self.assertEqual(w.graph.point_width, 8)\n        self.assertEqual(w.attr_color, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_shape, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_size, iris.domain[\"sepal length\"])\n\n    def test_set_radius_no_data(self):\n        \"\"\"\n        Widget should not crash when there is no data and radius slider is moved.\n        \"\"\"\n        w = self.widget\n        self.send_signal(w.Inputs.data, None)\n        w.controls.graph.hide_radius.setSliderPosition(3)\n\n    def test_invalidated_model_selected(self):\n        model = self.widget.model_selected\n\n        self.widget.setup_plot = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.widget.selected_vars[:] = self.data.domain[2:3]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data[:, 2:])\n        self.widget.setup_plot.assert_not_called()\n\n        self.widget.selected_vars[:] = [self.data.domain[3]]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n    def test_two_classes_dataset(self):\n        self.widget.radio_placement.buttons[1].click()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertFalse(self.widget.radio_placement.buttons[1].isEnabled())\n\n    def test_unique_name(self):\n        data = Table(\"iris\")\n        new = ContinuousVariable(\"C-y\")\n        d = Table.from_numpy(Domain(list(data.domain.attributes[:3])+[new],\n                                    class_vars=data.domain.class_vars), data.X,\n                             data.Y)\n        self.send_signal(self.widget.Inputs.data, d)\n        output = self.get_output(self.widget.Outputs.annotated_data)\n        metas = [\"C-x (1)\", \"C-y (1)\", \"Selected\"]\n        self.assertEqual([meta.name for meta in output.domain.metas], metas)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 21,
                                "end_lineno": 201,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "from xml.sax.saxutils import escape\n\nimport numpy as np\n\nfrom AnyQt.QtCore import QSize, Signal, Qt\nfrom AnyQt.QtWidgets import QApplication\n\nfrom orangewidget.utils.visual_settings_dlg import VisualSettingsDialog\n\nfrom Orange.data import (\n    Table, ContinuousVariable, Domain, Variable, StringVariable\n)\nfrom Orange.data.util import get_unique_names, array_equal\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics.util import bincount\n\nfrom Orange.widgets import gui, report\nfrom Orange.widgets.settings import (\n    Setting, ContextSetting, DomainContextHandler, SettingProvider\n)\nfrom Orange.widgets.utils import colorpalettes\nfrom Orange.widgets.utils.annotated_data import (\n    create_annotated_table, ANNOTATED_DATA_SIGNAL_NAME, create_groups_table\n)\nfrom Orange.widgets.utils.plot import OWPlotGUI\nfrom Orange.widgets.utils.sql import check_sql_input\nfrom Orange.widgets.visualize.owscatterplotgraph import (\n    OWScatterPlotBase, MAX_COLORS\n)\nfrom Orange.widgets.visualize.utils.component import OWGraphWithAnchors\nfrom Orange.widgets.widget import OWWidget, Input, Output, Msg\n\n\n# maximum number of shapes (including Other)\nMAX_SHAPES = len(OWScatterPlotBase.CurveSymbols) - 1\n\nMAX_POINTS_IN_TOOLTIP = 5\n\n\nclass OWProjectionWidgetBase(OWWidget, openclass=True):\n    \"\"\"\n    Base widget for widgets that use attribute data to set the colors, labels,\n    shapes and sizes of points.\n\n    The widgets defines settings `attr_color`, `attr_label`, `attr_shape`\n    and `attr_size`, but leaves defining the gui to the derived widgets.\n    These are expected to have controls that manipulate these settings,\n    and the controls are expected to use attribute models.\n\n    The widgets also defines attributes `data` and `valid_data` and expects\n    the derived widgets to use them to store an instances of `data.Table`\n    and a bool `np.ndarray` with indicators of valid (that is, shown)\n    data points.\n    \"\"\"\n    attr_color = ContextSetting(None, required=ContextSetting.OPTIONAL)\n    attr_label = ContextSetting(None, required=ContextSetting.OPTIONAL)\n    attr_shape = ContextSetting(None, required=ContextSetting.OPTIONAL)\n    attr_size = ContextSetting(None, required=ContextSetting.OPTIONAL)\n\n    class Information(OWWidget.Information):\n        missing_size = Msg(\n            \"Points with undefined '{}' are shown in smaller size\")\n        missing_shape = Msg(\n            \"Points with undefined '{}' are shown as crossed circles\")\n\n    def __init__(self):\n        super().__init__()\n        self.data = None\n        self.valid_data = None\n\n    def init_attr_values(self):\n        \"\"\"\n        Set the models for `attr_color`, `attr_shape`, `attr_size` and\n        `attr_label`. All values are set to `None`, except `attr_color`\n        which is set to the class variable if it exists.\n        \"\"\"\n        data = self.data\n        domain = data.domain if data and len(data) else None\n        for attr in (\"attr_color\", \"attr_shape\", \"attr_size\", \"attr_label\"):\n            getattr(self.controls, attr).model().set_domain(domain)\n            setattr(self, attr, None)\n        if domain is not None:\n            self.attr_color = domain.class_var\n\n    def get_coordinates_data(self):\n        \"\"\"A get coordinated method that returns no coordinates.\n\n        Derived classes must override this method.\n        \"\"\"\n        return None, None\n\n    def get_subset_mask(self):\n        \"\"\"\n        Return the bool array indicating the points in the subset\n\n        The base method does nothing and would usually be overridden by\n        a method that returns indicators from the subset signal.\n\n        Do not confuse the subset with selection.\n\n        Returns:\n            (np.ndarray or `None`): a bool array of indicators\n        \"\"\"\n        return None\n\n    def get_column(self, attr, filter_valid=True,\n                   max_categories=None, return_labels=False):\n        \"\"\"\n        Retrieve the data from the given column in the data table\n\n        The method:\n        - densifies sparse data,\n        - converts arrays with dtype object to floats if the attribute is\n          actually primitive,\n        - filters out invalid data (if `filter_valid` is `True`),\n        - merges infrequent (discrete) values into a single value\n          (if `max_categories` is set).\n\n        Tha latter feature is used for shapes and labels, where only a\n        specified number of different values is shown, and others are\n        merged into category 'Other'. In this case, the method may return\n        either the data (e.g. color indices, shape indices) or the list\n        of retained values, followed by `['Other']`.\n\n        Args:\n            attr (:obj:~Orange.data.Variable): the column to extract\n            filter_valid (bool): filter out invalid data (default: `True`)\n            max_categories (int): merge infrequent values (default: `None`);\n                ignored for non-discrete attributes\n            return_labels (bool): return a list of labels instead of data\n                (default: `False`)\n\n        Returns:\n            (np.ndarray): (valid) data from the column, or a list of labels\n        \"\"\"\n        if attr is None:\n            return None\n\n        needs_merging = attr.is_discrete \\\n                        and max_categories is not None \\\n                        and len(attr.values) >= max_categories\n        if return_labels and not needs_merging:\n            assert attr.is_discrete\n            return attr.values\n\n        all_data = self.data.get_column_view(attr)[0]\n        if all_data.dtype == object and attr.is_primitive():\n            all_data = all_data.astype(float)\n        if filter_valid and self.valid_data is not None:\n            all_data = all_data[self.valid_data]\n        if not needs_merging:\n            return all_data\n\n        dist = bincount(all_data, max_val=len(attr.values) - 1)[0]\n        infrequent = np.zeros(len(attr.values), dtype=bool)\n        infrequent[np.argsort(dist)[:-(max_categories-1)]] = True\n        if return_labels:\n            return [value for value, infreq in zip(attr.values, infrequent)\n                    if not infreq] + [\"Other\"]\n        else:\n            result = all_data.copy()\n            freq_vals = [i for i, f in enumerate(infrequent) if not f]\n            for i, infreq in enumerate(infrequent):\n                if infreq:\n                    result[all_data == i] = max_categories - 1\n                else:\n                    result[all_data == i] = freq_vals.index(i)\n            return result\n\n    # Sizes\n    def get_size_data(self):\n        \"\"\"Return the column corresponding to `attr_size`\"\"\"\n        return self.get_column(self.attr_size)\n\n    def impute_sizes(self, size_data):\n        \"\"\"\n        Default imputation for size data\n\n        Let the graph handle it, but add a warning if needed.\n\n        Args:\n            size_data (np.ndarray): scaled points sizes\n        \"\"\"\n        if self.graph.default_impute_sizes(size_data):\n            self.Information.missing_size(self.attr_size)\n        else:\n            self.Information.missing_size.clear()\n\n    def sizes_changed(self):\n        self.graph.update_sizes()\n\n    # Colors\n    def get_color_data(self):\n        \"\"\"Return the column corresponding to color data\"\"\"\n        return self.get_column(self.attr_color, max_categories=MAX_COLORS)\n\n    def get_color_labels(self):\n        \"\"\"\n        Return labels for the color legend\n\n        Returns:\n            (list of str): labels\n        \"\"\"\n        if self.attr_color is None:\n            return None\n        if not self.attr_color.is_discrete:\n            return self.attr_color.str_val\n        return self.get_column(self.attr_color, max_categories=MAX_COLORS,\n                               return_labels=True)\n\n    def is_continuous_color(self):\n        \"\"\"\n        Tells whether the color is continuous\n\n        Returns:\n            (bool):\n        \"\"\"\n        return self.attr_color is not None and self.attr_color.is_continuous\n\n    def get_palette(self):\n        \"\"\"\n        Return a palette suitable for the current `attr_color`\n\n        This method must be overridden if the widget offers coloring that is\n        not based on attribute values.\n        \"\"\"\n        attr = self.attr_color\n        if not attr:\n            return None\n        palette = attr.palette\n        if attr.is_discrete and len(attr.values) >= MAX_COLORS:\n            values = self.get_color_labels()\n            colors = [palette.palette[attr.to_val(value)]\n                      for value in values[:-1]] + [[192, 192, 192]]\n\n            palette = colorpalettes.DiscretePalette.from_colors(colors)\n        return palette\n\n    def can_draw_density(self):\n        \"\"\"\n        Tells whether the current data and settings are suitable for drawing\n        densities\n\n        Returns:\n            (bool):\n        \"\"\"\n        return self.data is not None and self.data.domain is not None and \\\n            len(self.data) > 1 and self.attr_color is not None\n\n    def colors_changed(self):\n        self.graph.update_colors()\n        self._update_opacity_warning()\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    # Labels\n    def get_label_data(self, formatter=None):\n        \"\"\"Return the column corresponding to label data\"\"\"\n        if self.attr_label:\n            label_data = self.get_column(self.attr_label)\n            if formatter is None:\n                formatter = self.attr_label.str_val\n            return np.array([formatter(x) for x in label_data])\n        return None\n\n    def labels_changed(self):\n        self.graph.update_labels()\n\n    # Shapes\n    def get_shape_data(self):\n        \"\"\"\n        Return labels for the shape legend\n\n        Returns:\n            (list of str): labels\n        \"\"\"\n        return self.get_column(self.attr_shape, max_categories=MAX_SHAPES)\n\n    def get_shape_labels(self):\n        return self.get_column(self.attr_shape, max_categories=MAX_SHAPES,\n                               return_labels=True)\n\n    def impute_shapes(self, shape_data, default_symbol):\n        \"\"\"\n        Default imputation for shape data\n\n        Let the graph handle it, but add a warning if needed.\n\n        Args:\n            shape_data (np.ndarray): scaled points sizes\n            default_symbol (str): a string representing the symbol\n        \"\"\"\n        if self.graph.default_impute_shapes(shape_data, default_symbol):\n            self.Information.missing_shape(self.attr_shape)\n        else:\n            self.Information.missing_shape.clear()\n\n    def shapes_changed(self):\n        self.graph.update_shapes()\n\n    # Tooltip\n    def _point_tooltip(self, point_id, skip_attrs=()):\n        def show_part(_point_data, singular, plural, max_shown, _vars):\n            cols = [escape('{} = {}'.format(var.name, _point_data[var]))\n                    for var in _vars[:max_shown + 2]\n                    if _vars == domain.class_vars\n                    or var not in skip_attrs][:max_shown]\n            if not cols:\n                return \"\"\n            n_vars = len(_vars)\n            if n_vars > max_shown:\n                cols[-1] = \"... and {} others\".format(n_vars - max_shown + 1)\n            return \\\n                \"<b>{}</b>:<br/>\".format(singular if n_vars < 2 else plural) \\\n                + \"<br/>\".join(cols)\n\n        domain = self.data.domain\n        parts = ((\"Class\", \"Classes\", 4, domain.class_vars),\n                 (\"Meta\", \"Metas\", 4, domain.metas),\n                 (\"Feature\", \"Features\", 10, domain.attributes))\n\n        point_data = self.data[point_id]\n        return \"<br/>\".join(show_part(point_data, *columns)\n                            for columns in parts)\n\n    def get_tooltip(self, point_ids):\n        \"\"\"\n        Return the tooltip string for the given points\n\n        The method is called by the plot on mouse hover\n\n        Args:\n            point_ids (list): indices into `data`\n\n        Returns:\n            (str):\n        \"\"\"\n        point_ids = \\\n            np.flatnonzero(self.valid_data)[np.asarray(point_ids, dtype=int)]\n        text = \"<hr/>\".join(self._point_tooltip(point_id)\n                            for point_id in point_ids[:MAX_POINTS_IN_TOOLTIP])\n        if len(point_ids) > MAX_POINTS_IN_TOOLTIP:\n            text = \"{} instances<hr/>{}<hr/>...\".format(len(point_ids), text)\n        return text\n\n    def keyPressEvent(self, event):\n        \"\"\"Update the tip about using the modifier keys when selecting\"\"\"\n        super().keyPressEvent(event)\n        self.graph.update_tooltip(event.modifiers())\n\n    def keyReleaseEvent(self, event):\n        \"\"\"Update the tip about using the modifier keys when selecting\"\"\"\n        super().keyReleaseEvent(event)\n        self.graph.update_tooltip(event.modifiers())\n\n\nclass OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):\n    \"\"\"\n    Base widget for widgets that get Data and Data Subset (both\n    Orange.data.Table) on the input, and output Selected Data and Data\n    (both Orange.data.Table).\n\n    Beside that the widget displays data as two-dimensional projection\n    of points.\n    \"\"\"\n    class Inputs:\n        data = Input(\"Data\", Table, default=True)\n        data_subset = Input(\"Data Subset\", Table)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    class Warning(OWProjectionWidgetBase.Warning):\n        too_many_labels = Msg(\n            \"Too many labels to show (zoom in or label only selected)\")\n        subset_not_subset = Msg(\n            \"Subset data contains some instances that do not appear in \"\n            \"input data\")\n        subset_independent = Msg(\n            \"No subset data instances appear in input data\")\n        transparent_subset = Msg(\n            \"Increase opacity if subset is difficult to see\")\n\n    settingsHandler = DomainContextHandler()\n    selection = Setting(None, schema_only=True)\n    visual_settings = Setting({}, schema_only=True)\n    auto_commit = Setting(True)\n\n    GRAPH_CLASS = OWScatterPlotBase\n    graph = SettingProvider(OWScatterPlotBase)\n    graph_name = \"graph.plot_widget.plotItem\"\n    embedding_variables_names = (\"proj-x\", \"proj-y\")\n    buttons_area_orientation = Qt.Vertical\n\n    input_changed = Signal(object)\n    output_changed = Signal(object)\n\n    def __init__(self):\n        super().__init__()\n        self.subset_data = None\n        self.subset_indices = None\n        self.__pending_selection = self.selection\n        self._invalidated = True\n        self._domain_invalidated = True\n        self.setup_gui()\n        VisualSettingsDialog(self, self.graph.parameter_setter.initial_settings)\n\n    # GUI\n    def setup_gui(self):\n        self._add_graph()\n        self._add_controls()\n        self._add_buttons()\n        self.input_changed.emit(None)\n        self.output_changed.emit(None)\n\n    def _add_graph(self):\n        box = gui.vBox(self.mainArea, True, margin=0)\n        self.graph = self.GRAPH_CLASS(self, box)\n        box.layout().addWidget(self.graph.plot_widget)\n        self.graph.too_many_labels.connect(\n            lambda too_many: self.Warning.too_many_labels(shown=too_many))\n\n    def _add_controls(self):\n        self.gui = OWPlotGUI(self)\n        area = self.controlArea\n        self._point_box = self.gui.point_properties_box(area)\n        self._effects_box = self.gui.effects_box(area)\n        self._plot_box = self.gui.plot_properties_box(area)\n\n    def _add_buttons(self):\n        gui.rubber(self.controlArea)\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def effective_variables(self):\n        return self.data.domain.attributes\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas))\n\n    # Input\n    @Inputs.data\n    @check_sql_input\n    def set_data(self, data):\n        data_existed = self.data is not None\n        effective_data = self.effective_data if data_existed else None\n        self.closeContext()\n        self.data = data\n        self.check_data()\n        self.init_attr_values()\n        self.openContext(self.data)\n        self._invalidated = not (\n            data_existed and self.data is not None and\n            array_equal(effective_data.X, self.effective_data.X))\n        self._domain_invalidated = not (\n            data_existed and self.data is not None and\n            effective_data.domain.checksum()\n            == self.effective_data.domain.checksum())\n        if self._invalidated:\n            self.clear()\n            self.input_changed.emit(data)\n        self.enable_controls()\n\n    def check_data(self):\n        self.clear_messages()\n\n    def enable_controls(self):\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    @Inputs.data_subset\n    @check_sql_input\n    def set_subset_data(self, subset):\n        self.subset_data = subset\n\n    def handleNewSignals(self):\n        self._handle_subset_data()\n        if self._invalidated:\n            self._invalidated = False\n            self.setup_plot()\n        else:\n            self.graph.update_point_props()\n        self._update_opacity_warning()\n        self.commit.now()\n\n    def _handle_subset_data(self):\n        self.Warning.subset_independent.clear()\n        self.Warning.subset_not_subset.clear()\n        if self.data is None or self.subset_data is None:\n            self.subset_indices = set()\n        else:\n            self.subset_indices = set(self.subset_data.ids)\n            ids = set(self.data.ids)\n            if not self.subset_indices & ids:\n                self.Warning.subset_independent()\n            elif self.subset_indices - ids:\n                self.Warning.subset_not_subset()\n\n    def _update_opacity_warning(self):\n        self.Warning.transparent_subset(\n            shown=self.subset_indices and self.graph.alpha_value < 128)\n\n    def get_subset_mask(self):\n        if not self.subset_indices:\n            return None\n        valid_data = self.data[self.valid_data]\n        return np.fromiter((ex.id in self.subset_indices for ex in valid_data),\n                           dtype=bool, count=len(valid_data))\n\n    # Plot\n    def get_embedding(self):\n        \"\"\"A get embedding method.\n\n        Derived classes must override this method. The overridden method\n        should return embedding for all data (valid and invalid). Invalid\n        data embedding coordinates should be set to 0 (in some cases to Nan).\n\n        The method should also set self.valid_data.\n\n        Returns:\n            np.array: Array of embedding coordinates with shape\n            len(self.data) x 2\n        \"\"\"\n        raise NotImplementedError\n\n    def get_coordinates_data(self):\n        embedding = self.get_embedding()\n        if embedding is not None and len(embedding[self.valid_data]):\n            return embedding[self.valid_data].T\n        return None, None\n\n    def setup_plot(self):\n        self.graph.reset_graph()\n        self.__pending_selection = self.selection or self.__pending_selection\n        self.apply_selection()\n\n    # Selection\n    def apply_selection(self):\n        pending = self.__pending_selection\n        if self.data is not None and pending is not None and len(pending) \\\n                and max(i for i, _ in pending) < self.graph.n_valid:\n            index_group = np.array(pending).T\n            selection = np.zeros(self.graph.n_valid, dtype=np.uint8)\n            selection[index_group[0]] = index_group[1]\n\n            self.selection = self.__pending_selection\n            self.__pending_selection = None\n            self.graph.selection = selection\n            self.graph.update_selection_colors()\n            if self.graph.label_only_selected:\n                self.graph.update_labels()\n\n    def selection_changed(self):\n        sel = None if self.data and isinstance(self.data, SqlTable) \\\n            else self.graph.selection\n        self.selection = [(i, x) for i, x in enumerate(sel) if x] \\\n            if sel is not None else None\n        self.commit.deferred()\n\n    # Output\n    @gui.deferred\n    def commit(self):\n        self.send_data()\n\n    def send_data(self):\n        group_sel, data, graph = None, self._get_projection_data(), self.graph\n        if graph.selection is not None:\n            group_sel = np.zeros(len(data), dtype=int)\n            group_sel[self.valid_data] = graph.selection\n        selected = self._get_selected_data(\n            data, graph.get_selection(), group_sel)\n        self.output_changed.emit(selected)\n        self.Outputs.selected_data.send(selected)\n        self.Outputs.annotated_data.send(\n            self._get_annotated_data(data, group_sel,\n                                     graph.selection))\n\n    def _get_projection_data(self):\n        if self.data is None or self.embedding_variables_names is None:\n            return self.data\n        variables = self._get_projection_variables()\n        data = self.data.transform(Domain(self.data.domain.attributes,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas + variables))\n        if data.metas.size:\n            with data.unlocked(data.metas):\n                data.metas[:, -2:] = self.get_embedding()\n        return data\n\n    def _get_projection_variables(self):\n        names = get_unique_names(\n            self.data.domain, self.embedding_variables_names)\n        return ContinuousVariable(names[0]), ContinuousVariable(names[1])\n\n    @staticmethod\n    def _get_selected_data(data, selection, group_sel):\n        return create_groups_table(data, group_sel, False, \"Group\") \\\n            if len(selection) else None\n\n    @staticmethod\n    def _get_annotated_data(data, group_sel, graph_sel):\n        if data is None:\n            return None\n        if graph_sel is not None and np.max(graph_sel) > 1:\n            return create_groups_table(data, group_sel)\n        else:\n            if group_sel is None:\n                mask = np.full((len(data), ), False)\n            else:\n                mask = np.nonzero(group_sel)[0]\n            return create_annotated_table(data, mask)\n\n    # Report\n    def send_report(self):\n        if self.data is None:\n            return\n\n        caption = self._get_send_report_caption()\n        self.report_plot()\n        if caption:\n            self.report_caption(caption)\n\n    def _get_send_report_caption(self):\n        return report.render_items_vert((\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    # Customize plot\n    def set_visual_settings(self, key, value):\n        self.graph.parameter_setter.set_parameter(key, value)\n        self.visual_settings[key] = value\n\n    @staticmethod\n    def _get_caption_var_name(var):\n        return var.name if isinstance(var, Variable) else var\n\n    # Misc\n    def sizeHint(self):\n        return QSize(1132, 708)\n\n    def clear(self):\n        self.selection = None\n        self.graph.selection = None\n\n    def onDeleteWidget(self):\n        super().onDeleteWidget()\n        self.graph.plot_widget.getViewBox().deleteLater()\n        self.graph.plot_widget.clear()\n        self.graph.clear()\n\n\nclass OWAnchorProjectionWidget(OWDataProjectionWidget, openclass=True):\n    \"\"\" Base widget for widgets with graphs with anchors. \"\"\"\n    SAMPLE_SIZE = 100\n\n    GRAPH_CLASS = OWGraphWithAnchors\n    graph = SettingProvider(OWGraphWithAnchors)\n\n    class Outputs(OWDataProjectionWidget.Outputs):\n        components = Output(\"Components\", Table)\n\n    class Error(OWDataProjectionWidget.Error):\n        sparse_data = Msg(\"Sparse data is not supported\")\n        no_valid_data = Msg(\"No projection due to no valid data\")\n        no_instances = Msg(\"At least two data instances are required\")\n        proj_error = Msg(\"An error occurred while projecting data.\\n{}\")\n\n    def __init__(self):\n        self.projector = self.projection = None\n        super().__init__()\n        self.graph.view_box.started.connect(self._manual_move_start)\n        self.graph.view_box.moved.connect(self._manual_move)\n        self.graph.view_box.finished.connect(self._manual_move_finish)\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if self.data.is_sparse():\n                error(self.Error.sparse_data)\n            elif len(self.data) < 2:\n                error(self.Error.no_instances)\n            else:\n                if not np.sum(np.all(np.isfinite(self.data.X), axis=1)):\n                    error(self.Error.no_valid_data)\n\n    def init_projection(self):\n        self.projection = None\n        if not self.effective_variables:\n            return\n        try:\n            self.projection = self.projector(self.effective_data)\n        except Exception as ex:  # pylint: disable=broad-except\n            self.Error.proj_error(ex)\n\n    def get_embedding(self):\n        self.valid_data = None\n        if self.data is None or self.projection is None:\n            return None\n        embedding = self.projection(self.data).X\n        self.valid_data = np.all(np.isfinite(embedding), axis=1)\n        return embedding\n\n    def get_anchors(self):\n        if self.projection is None:\n            return None, None\n        components = self.projection.components_\n        if components.shape == (1, 1):\n            components = np.array([[1.], [0.]])\n        return components.T, [a.name for a in self.effective_variables]\n\n    def _manual_move_start(self):\n        self.graph.set_sample_size(self.SAMPLE_SIZE)\n\n    def _manual_move(self, anchor_idx, x, y):\n        self.projection.components_[:, anchor_idx] = [x, y]\n        self.graph.update_coordinates()\n\n    def _manual_move_finish(self, anchor_idx, x, y):\n        self._manual_move(anchor_idx, x, y)\n        self.graph.set_sample_size(None)\n        self.commit.deferred()\n\n    def _get_projection_data(self):\n        if self.data is None or self.projection is None:\n            return None\n        proposed = [a.name for a in self.projection.domain.attributes]\n        names = get_unique_names(self.data.domain, proposed)\n\n        if proposed != names:\n            attributes = tuple([attr.copy(name=name) for name, attr in\n                                zip(names, self.projection.domain.attributes)])\n        else:\n            attributes = self.projection.domain.attributes\n        return self.data.transform(\n            Domain(self.data.domain.attributes,\n                   self.data.domain.class_vars,\n                   self.data.domain.metas + attributes))\n\n    @gui.deferred\n    def commit(self):\n        super().commit()\n        self.send_components()\n\n    def send_components(self):\n        components = None\n        if self.data is not None and self.projection is not None:\n            proposed = [var.name for var in self.effective_variables]\n            comp_name = get_unique_names(proposed, 'component')\n            meta_attrs = [StringVariable(name=comp_name)]\n            domain = Domain(self.effective_variables, metas=meta_attrs)\n            components = Table(domain, self._send_components_x().copy(),\n                               metas=self._send_components_metas())\n            components.name = \"components\"\n        self.Outputs.components.send(components)\n\n    def _send_components_x(self):\n        return self.projection.components_\n\n    def _send_components_metas(self):\n        variable_names = [a.name for a in self.projection.domain.attributes]\n        return np.array(variable_names, dtype=object)[:, None]\n\n    def clear(self):\n        super().clear()\n        self.projector = self.projection = None\n\n\nif __name__ == \"__main__\":\n    class OWProjectionWidgetWithName(OWDataProjectionWidget):\n        name = \"projection\"\n\n        def get_embedding(self):\n            if self.data is None:\n                return None\n            self.valid_data = np.any(np.isfinite(self.data.X), 1)\n            x_data = self.data.X\n            x_data[x_data == np.inf] = np.nan\n            x_data = np.nanmean(x_data[self.valid_data], 1)\n            y_data = np.ones(len(x_data))\n            return np.vstack((x_data, y_data)).T\n\n    app = QApplication([])\n    ow = OWProjectionWidgetWithName()\n    table = Table(\"iris\")\n    ow.set_data(table)\n    ow.set_subset_data(table[::10])\n    ow.handleNewSignals()\n    ow.show()\n    app.exec()\n    ow.saveSettings()\n",
            "new_file_content": "from xml.sax.saxutils import escape\n\nimport numpy as np\n\nfrom AnyQt.QtCore import QSize, Signal, Qt\nfrom AnyQt.QtWidgets import QApplication\n\nfrom orangewidget.utils.visual_settings_dlg import VisualSettingsDialog\n\nfrom Orange.data import (\n    Table, ContinuousVariable, Domain, Variable, StringVariable\n)\nfrom Orange.data.util import get_unique_names, array_equal\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics.util import bincount\n\nfrom Orange.widgets import gui, report\nfrom Orange.widgets.settings import (\n    Setting, ContextSetting, DomainContextHandler, SettingProvider\n)\nfrom Orange.widgets.utils import colorpalettes\nfrom Orange.widgets.utils.annotated_data import (\n    create_annotated_table, ANNOTATED_DATA_SIGNAL_NAME, create_groups_table\n)\nfrom Orange.widgets.utils.plot import OWPlotGUI\nfrom Orange.widgets.utils.sql import check_sql_input\nfrom Orange.widgets.visualize.owscatterplotgraph import (\n    OWScatterPlotBase, MAX_COLORS\n)\nfrom Orange.widgets.visualize.utils.component import OWGraphWithAnchors\nfrom Orange.widgets.widget import OWWidget, Input, Output, Msg\n\n\n# maximum number of shapes (including Other)\nMAX_SHAPES = len(OWScatterPlotBase.CurveSymbols) - 1\n\nMAX_POINTS_IN_TOOLTIP = 5\n\n\nclass OWProjectionWidgetBase(OWWidget, openclass=True):\n    \"\"\"\n    Base widget for widgets that use attribute data to set the colors, labels,\n    shapes and sizes of points.\n\n    The widgets defines settings `attr_color`, `attr_label`, `attr_shape`\n    and `attr_size`, but leaves defining the gui to the derived widgets.\n    These are expected to have controls that manipulate these settings,\n    and the controls are expected to use attribute models.\n\n    The widgets also defines attributes `data` and `valid_data` and expects\n    the derived widgets to use them to store an instances of `data.Table`\n    and a bool `np.ndarray` with indicators of valid (that is, shown)\n    data points.\n    \"\"\"\n    attr_color = ContextSetting(None, required=ContextSetting.OPTIONAL)\n    attr_label = ContextSetting(None, required=ContextSetting.OPTIONAL)\n    attr_shape = ContextSetting(None, required=ContextSetting.OPTIONAL)\n    attr_size = ContextSetting(None, required=ContextSetting.OPTIONAL)\n\n    class Information(OWWidget.Information):\n        missing_size = Msg(\n            \"Points with undefined '{}' are shown in smaller size\")\n        missing_shape = Msg(\n            \"Points with undefined '{}' are shown as crossed circles\")\n\n    def __init__(self):\n        super().__init__()\n        self.data = None\n        self.valid_data = None\n\n    def init_attr_values(self):\n        \"\"\"\n        Set the models for `attr_color`, `attr_shape`, `attr_size` and\n        `attr_label`. All values are set to `None`, except `attr_color`\n        which is set to the class variable if it exists.\n        \"\"\"\n        data = self.data\n        domain = data.domain if data and len(data) else None\n        for attr in (\"attr_color\", \"attr_shape\", \"attr_size\", \"attr_label\"):\n            getattr(self.controls, attr).model().set_domain(domain)\n            setattr(self, attr, None)\n        if domain is not None:\n            self.attr_color = domain.class_var\n\n    def get_coordinates_data(self):\n        \"\"\"A get coordinated method that returns no coordinates.\n\n        Derived classes must override this method.\n        \"\"\"\n        return None, None\n\n    def get_subset_mask(self):\n        \"\"\"\n        Return the bool array indicating the points in the subset\n\n        The base method does nothing and would usually be overridden by\n        a method that returns indicators from the subset signal.\n\n        Do not confuse the subset with selection.\n\n        Returns:\n            (np.ndarray or `None`): a bool array of indicators\n        \"\"\"\n        return None\n\n    def get_column(self, attr, filter_valid=True,\n                   max_categories=None, return_labels=False):\n        \"\"\"\n        Retrieve the data from the given column in the data table\n\n        The method:\n        - densifies sparse data,\n        - converts arrays with dtype object to floats if the attribute is\n          actually primitive,\n        - filters out invalid data (if `filter_valid` is `True`),\n        - merges infrequent (discrete) values into a single value\n          (if `max_categories` is set).\n\n        Tha latter feature is used for shapes and labels, where only a\n        specified number of different values is shown, and others are\n        merged into category 'Other'. In this case, the method may return\n        either the data (e.g. color indices, shape indices) or the list\n        of retained values, followed by `['Other']`.\n\n        Args:\n            attr (:obj:~Orange.data.Variable): the column to extract\n            filter_valid (bool): filter out invalid data (default: `True`)\n            max_categories (int): merge infrequent values (default: `None`);\n                ignored for non-discrete attributes\n            return_labels (bool): return a list of labels instead of data\n                (default: `False`)\n\n        Returns:\n            (np.ndarray): (valid) data from the column, or a list of labels\n        \"\"\"\n        if attr is None:\n            return None\n\n        needs_merging = attr.is_discrete \\\n                        and max_categories is not None \\\n                        and len(attr.values) >= max_categories\n        if return_labels and not needs_merging:\n            assert attr.is_discrete\n            return attr.values\n\n        all_data = self.data.get_column_view(attr)[0]\n        if all_data.dtype == object and attr.is_primitive():\n            all_data = all_data.astype(float)\n        if filter_valid and self.valid_data is not None:\n            all_data = all_data[self.valid_data]\n        if not needs_merging:\n            return all_data\n\n        dist = bincount(all_data, max_val=len(attr.values) - 1)[0]\n        infrequent = np.zeros(len(attr.values), dtype=bool)\n        infrequent[np.argsort(dist)[:-(max_categories-1)]] = True\n        if return_labels:\n            return [value for value, infreq in zip(attr.values, infrequent)\n                    if not infreq] + [\"Other\"]\n        else:\n            result = all_data.copy()\n            freq_vals = [i for i, f in enumerate(infrequent) if not f]\n            for i, infreq in enumerate(infrequent):\n                if infreq:\n                    result[all_data == i] = max_categories - 1\n                else:\n                    result[all_data == i] = freq_vals.index(i)\n            return result\n\n    # Sizes\n    def get_size_data(self):\n        \"\"\"Return the column corresponding to `attr_size`\"\"\"\n        return self.get_column(self.attr_size)\n\n    def impute_sizes(self, size_data):\n        \"\"\"\n        Default imputation for size data\n\n        Let the graph handle it, but add a warning if needed.\n\n        Args:\n            size_data (np.ndarray): scaled points sizes\n        \"\"\"\n        if self.graph.default_impute_sizes(size_data):\n            self.Information.missing_size(self.attr_size)\n        else:\n            self.Information.missing_size.clear()\n\n    def sizes_changed(self):\n        self.graph.update_sizes()\n\n    # Colors\n    def get_color_data(self):\n        \"\"\"Return the column corresponding to color data\"\"\"\n        return self.get_column(self.attr_color, max_categories=MAX_COLORS)\n\n    def get_color_labels(self):\n        \"\"\"\n        Return labels for the color legend\n\n        Returns:\n            (list of str): labels\n        \"\"\"\n        if self.attr_color is None:\n            return None\n        if not self.attr_color.is_discrete:\n            return self.attr_color.str_val\n        return self.get_column(self.attr_color, max_categories=MAX_COLORS,\n                               return_labels=True)\n\n    def is_continuous_color(self):\n        \"\"\"\n        Tells whether the color is continuous\n\n        Returns:\n            (bool):\n        \"\"\"\n        return self.attr_color is not None and self.attr_color.is_continuous\n\n    def get_palette(self):\n        \"\"\"\n        Return a palette suitable for the current `attr_color`\n\n        This method must be overridden if the widget offers coloring that is\n        not based on attribute values.\n        \"\"\"\n        attr = self.attr_color\n        if not attr:\n            return None\n        palette = attr.palette\n        if attr.is_discrete and len(attr.values) >= MAX_COLORS:\n            values = self.get_color_labels()\n            colors = [palette.palette[attr.to_val(value)]\n                      for value in values[:-1]] + [[192, 192, 192]]\n\n            palette = colorpalettes.DiscretePalette.from_colors(colors)\n        return palette\n\n    def can_draw_density(self):\n        \"\"\"\n        Tells whether the current data and settings are suitable for drawing\n        densities\n\n        Returns:\n            (bool):\n        \"\"\"\n        return self.data is not None and self.data.domain is not None and \\\n            len(self.data) > 1 and self.attr_color is not None\n\n    def colors_changed(self):\n        self.graph.update_colors()\n        self._update_opacity_warning()\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    # Labels\n    def get_label_data(self, formatter=None):\n        \"\"\"Return the column corresponding to label data\"\"\"\n        if self.attr_label:\n            label_data = self.get_column(self.attr_label)\n            if formatter is None:\n                formatter = self.attr_label.str_val\n            return np.array([formatter(x) for x in label_data])\n        return None\n\n    def labels_changed(self):\n        self.graph.update_labels()\n\n    # Shapes\n    def get_shape_data(self):\n        \"\"\"\n        Return labels for the shape legend\n\n        Returns:\n            (list of str): labels\n        \"\"\"\n        return self.get_column(self.attr_shape, max_categories=MAX_SHAPES)\n\n    def get_shape_labels(self):\n        return self.get_column(self.attr_shape, max_categories=MAX_SHAPES,\n                               return_labels=True)\n\n    def impute_shapes(self, shape_data, default_symbol):\n        \"\"\"\n        Default imputation for shape data\n\n        Let the graph handle it, but add a warning if needed.\n\n        Args:\n            shape_data (np.ndarray): scaled points sizes\n            default_symbol (str): a string representing the symbol\n        \"\"\"\n        if self.graph.default_impute_shapes(shape_data, default_symbol):\n            self.Information.missing_shape(self.attr_shape)\n        else:\n            self.Information.missing_shape.clear()\n\n    def shapes_changed(self):\n        self.graph.update_shapes()\n\n    # Tooltip\n    def _point_tooltip(self, point_id, skip_attrs=()):\n        def show_part(_point_data, singular, plural, max_shown, _vars):\n            cols = [escape('{} = {}'.format(var.name, _point_data[var]))\n                    for var in _vars[:max_shown + 2]\n                    if _vars == domain.class_vars\n                    or var not in skip_attrs][:max_shown]\n            if not cols:\n                return \"\"\n            n_vars = len(_vars)\n            if n_vars > max_shown:\n                cols[-1] = \"... and {} others\".format(n_vars - max_shown + 1)\n            return \\\n                \"<b>{}</b>:<br/>\".format(singular if n_vars < 2 else plural) \\\n                + \"<br/>\".join(cols)\n\n        domain = self.data.domain\n        parts = ((\"Class\", \"Classes\", 4, domain.class_vars),\n                 (\"Meta\", \"Metas\", 4, domain.metas),\n                 (\"Feature\", \"Features\", 10, domain.attributes))\n\n        point_data = self.data[point_id]\n        return \"<br/>\".join(show_part(point_data, *columns)\n                            for columns in parts)\n\n    def get_tooltip(self, point_ids):\n        \"\"\"\n        Return the tooltip string for the given points\n\n        The method is called by the plot on mouse hover\n\n        Args:\n            point_ids (list): indices into `data`\n\n        Returns:\n            (str):\n        \"\"\"\n        point_ids = \\\n            np.flatnonzero(self.valid_data)[np.asarray(point_ids, dtype=int)]\n        text = \"<hr/>\".join(self._point_tooltip(point_id)\n                            for point_id in point_ids[:MAX_POINTS_IN_TOOLTIP])\n        if len(point_ids) > MAX_POINTS_IN_TOOLTIP:\n            text = \"{} instances<hr/>{}<hr/>...\".format(len(point_ids), text)\n        return text\n\n    def keyPressEvent(self, event):\n        \"\"\"Update the tip about using the modifier keys when selecting\"\"\"\n        super().keyPressEvent(event)\n        self.graph.update_tooltip(event.modifiers())\n\n    def keyReleaseEvent(self, event):\n        \"\"\"Update the tip about using the modifier keys when selecting\"\"\"\n        super().keyReleaseEvent(event)\n        self.graph.update_tooltip(event.modifiers())\n\n\nclass OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):\n    \"\"\"\n    Base widget for widgets that get Data and Data Subset (both\n    Orange.data.Table) on the input, and output Selected Data and Data\n    (both Orange.data.Table).\n\n    Beside that the widget displays data as two-dimensional projection\n    of points.\n    \"\"\"\n    class Inputs:\n        data = Input(\"Data\", Table, default=True)\n        data_subset = Input(\"Data Subset\", Table)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    class Warning(OWProjectionWidgetBase.Warning):\n        too_many_labels = Msg(\n            \"Too many labels to show (zoom in or label only selected)\")\n        subset_not_subset = Msg(\n            \"Subset data contains some instances that do not appear in \"\n            \"input data\")\n        subset_independent = Msg(\n            \"No subset data instances appear in input data\")\n        transparent_subset = Msg(\n            \"Increase opacity if subset is difficult to see\")\n\n    settingsHandler = DomainContextHandler()\n    selection = Setting(None, schema_only=True)\n    visual_settings = Setting({}, schema_only=True)\n    auto_commit = Setting(True)\n\n    GRAPH_CLASS = OWScatterPlotBase\n    graph = SettingProvider(OWScatterPlotBase)\n    graph_name = \"graph.plot_widget.plotItem\"\n    embedding_variables_names = (\"proj-x\", \"proj-y\")\n    buttons_area_orientation = Qt.Vertical\n\n    input_changed = Signal(object)\n    output_changed = Signal(object)\n\n    def __init__(self):\n        super().__init__()\n        self.subset_data = None\n        self.subset_indices = None\n        self.__pending_selection = self.selection\n        self._invalidated = True\n        self._domain_invalidated = True\n        self.setup_gui()\n        VisualSettingsDialog(self, self.graph.parameter_setter.initial_settings)\n\n    # GUI\n    def setup_gui(self):\n        self._add_graph()\n        self._add_controls()\n        self._add_buttons()\n        self.input_changed.emit(None)\n        self.output_changed.emit(None)\n\n    def _add_graph(self):\n        box = gui.vBox(self.mainArea, True, margin=0)\n        self.graph = self.GRAPH_CLASS(self, box)\n        box.layout().addWidget(self.graph.plot_widget)\n        self.graph.too_many_labels.connect(\n            lambda too_many: self.Warning.too_many_labels(shown=too_many))\n\n    def _add_controls(self):\n        self.gui = OWPlotGUI(self)\n        area = self.controlArea\n        self._point_box = self.gui.point_properties_box(area)\n        self._effects_box = self.gui.effects_box(area)\n        self._plot_box = self.gui.plot_properties_box(area)\n\n    def _add_buttons(self):\n        gui.rubber(self.controlArea)\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def effective_variables(self):\n        return self.data.domain.attributes\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas))\n\n    # Input\n    @Inputs.data\n    @check_sql_input\n    def set_data(self, data):\n        data_existed = self.data is not None\n        effective_data = self.effective_data if data_existed else None\n        self.closeContext()\n        self.data = data\n        self.check_data()\n        self.init_attr_values()\n        self.openContext(self.data)\n        self._invalidated = not (\n            data_existed and self.data is not None and\n            array_equal(effective_data.X, self.effective_data.X) and\n            array_equal(effective_data.Y, self.effective_data.Y) and\n            array_equal(effective_data.metas, self.effective_data.metas)\n        )\n        self._domain_invalidated = not (\n            data_existed and self.data is not None and\n            effective_data.domain.checksum()\n            == self.effective_data.domain.checksum())\n        if self._invalidated:\n            self.clear()\n            self.input_changed.emit(data)\n        self.enable_controls()\n\n    def check_data(self):\n        self.clear_messages()\n\n    def enable_controls(self):\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    @Inputs.data_subset\n    @check_sql_input\n    def set_subset_data(self, subset):\n        self.subset_data = subset\n\n    def handleNewSignals(self):\n        self._handle_subset_data()\n        if self._invalidated:\n            self._invalidated = False\n            self.setup_plot()\n        else:\n            self.graph.update_point_props()\n        self._update_opacity_warning()\n        self.commit.now()\n\n    def _handle_subset_data(self):\n        self.Warning.subset_independent.clear()\n        self.Warning.subset_not_subset.clear()\n        if self.data is None or self.subset_data is None:\n            self.subset_indices = set()\n        else:\n            self.subset_indices = set(self.subset_data.ids)\n            ids = set(self.data.ids)\n            if not self.subset_indices & ids:\n                self.Warning.subset_independent()\n            elif self.subset_indices - ids:\n                self.Warning.subset_not_subset()\n\n    def _update_opacity_warning(self):\n        self.Warning.transparent_subset(\n            shown=self.subset_indices and self.graph.alpha_value < 128)\n\n    def get_subset_mask(self):\n        if not self.subset_indices:\n            return None\n        valid_data = self.data[self.valid_data]\n        return np.fromiter((ex.id in self.subset_indices for ex in valid_data),\n                           dtype=bool, count=len(valid_data))\n\n    # Plot\n    def get_embedding(self):\n        \"\"\"A get embedding method.\n\n        Derived classes must override this method. The overridden method\n        should return embedding for all data (valid and invalid). Invalid\n        data embedding coordinates should be set to 0 (in some cases to Nan).\n\n        The method should also set self.valid_data.\n\n        Returns:\n            np.array: Array of embedding coordinates with shape\n            len(self.data) x 2\n        \"\"\"\n        raise NotImplementedError\n\n    def get_coordinates_data(self):\n        embedding = self.get_embedding()\n        if embedding is not None and len(embedding[self.valid_data]):\n            return embedding[self.valid_data].T\n        return None, None\n\n    def setup_plot(self):\n        self.graph.reset_graph()\n        self.__pending_selection = self.selection or self.__pending_selection\n        self.apply_selection()\n\n    # Selection\n    def apply_selection(self):\n        pending = self.__pending_selection\n        if self.data is not None and pending is not None and len(pending) \\\n                and max(i for i, _ in pending) < self.graph.n_valid:\n            index_group = np.array(pending).T\n            selection = np.zeros(self.graph.n_valid, dtype=np.uint8)\n            selection[index_group[0]] = index_group[1]\n\n            self.selection = self.__pending_selection\n            self.__pending_selection = None\n            self.graph.selection = selection\n            self.graph.update_selection_colors()\n            if self.graph.label_only_selected:\n                self.graph.update_labels()\n\n    def selection_changed(self):\n        sel = None if self.data and isinstance(self.data, SqlTable) \\\n            else self.graph.selection\n        self.selection = [(i, x) for i, x in enumerate(sel) if x] \\\n            if sel is not None else None\n        self.commit.deferred()\n\n    # Output\n    @gui.deferred\n    def commit(self):\n        self.send_data()\n\n    def send_data(self):\n        group_sel, data, graph = None, self._get_projection_data(), self.graph\n        if graph.selection is not None:\n            group_sel = np.zeros(len(data), dtype=int)\n            group_sel[self.valid_data] = graph.selection\n        selected = self._get_selected_data(\n            data, graph.get_selection(), group_sel)\n        self.output_changed.emit(selected)\n        self.Outputs.selected_data.send(selected)\n        self.Outputs.annotated_data.send(\n            self._get_annotated_data(data, group_sel,\n                                     graph.selection))\n\n    def _get_projection_data(self):\n        if self.data is None or self.embedding_variables_names is None:\n            return self.data\n        variables = self._get_projection_variables()\n        data = self.data.transform(Domain(self.data.domain.attributes,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas + variables))\n        if data.metas.size:\n            with data.unlocked(data.metas):\n                data.metas[:, -2:] = self.get_embedding()\n        return data\n\n    def _get_projection_variables(self):\n        names = get_unique_names(\n            self.data.domain, self.embedding_variables_names)\n        return ContinuousVariable(names[0]), ContinuousVariable(names[1])\n\n    @staticmethod\n    def _get_selected_data(data, selection, group_sel):\n        return create_groups_table(data, group_sel, False, \"Group\") \\\n            if len(selection) else None\n\n    @staticmethod\n    def _get_annotated_data(data, group_sel, graph_sel):\n        if data is None:\n            return None\n        if graph_sel is not None and np.max(graph_sel) > 1:\n            return create_groups_table(data, group_sel)\n        else:\n            if group_sel is None:\n                mask = np.full((len(data), ), False)\n            else:\n                mask = np.nonzero(group_sel)[0]\n            return create_annotated_table(data, mask)\n\n    # Report\n    def send_report(self):\n        if self.data is None:\n            return\n\n        caption = self._get_send_report_caption()\n        self.report_plot()\n        if caption:\n            self.report_caption(caption)\n\n    def _get_send_report_caption(self):\n        return report.render_items_vert((\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    # Customize plot\n    def set_visual_settings(self, key, value):\n        self.graph.parameter_setter.set_parameter(key, value)\n        self.visual_settings[key] = value\n\n    @staticmethod\n    def _get_caption_var_name(var):\n        return var.name if isinstance(var, Variable) else var\n\n    # Misc\n    def sizeHint(self):\n        return QSize(1132, 708)\n\n    def clear(self):\n        self.selection = None\n        self.graph.selection = None\n\n    def onDeleteWidget(self):\n        super().onDeleteWidget()\n        self.graph.plot_widget.getViewBox().deleteLater()\n        self.graph.plot_widget.clear()\n        self.graph.clear()\n\n\nclass OWAnchorProjectionWidget(OWDataProjectionWidget, openclass=True):\n    \"\"\" Base widget for widgets with graphs with anchors. \"\"\"\n    SAMPLE_SIZE = 100\n\n    GRAPH_CLASS = OWGraphWithAnchors\n    graph = SettingProvider(OWGraphWithAnchors)\n\n    class Outputs(OWDataProjectionWidget.Outputs):\n        components = Output(\"Components\", Table)\n\n    class Error(OWDataProjectionWidget.Error):\n        sparse_data = Msg(\"Sparse data is not supported\")\n        no_valid_data = Msg(\"No projection due to no valid data\")\n        no_instances = Msg(\"At least two data instances are required\")\n        proj_error = Msg(\"An error occurred while projecting data.\\n{}\")\n\n    def __init__(self):\n        self.projector = self.projection = None\n        super().__init__()\n        self.graph.view_box.started.connect(self._manual_move_start)\n        self.graph.view_box.moved.connect(self._manual_move)\n        self.graph.view_box.finished.connect(self._manual_move_finish)\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if self.data.is_sparse():\n                error(self.Error.sparse_data)\n            elif len(self.data) < 2:\n                error(self.Error.no_instances)\n            else:\n                if not np.sum(np.all(np.isfinite(self.data.X), axis=1)):\n                    error(self.Error.no_valid_data)\n\n    def init_projection(self):\n        self.projection = None\n        if not self.effective_variables:\n            return\n        try:\n            self.projection = self.projector(self.effective_data)\n        except Exception as ex:  # pylint: disable=broad-except\n            self.Error.proj_error(ex)\n\n    def get_embedding(self):\n        self.valid_data = None\n        if self.data is None or self.projection is None:\n            return None\n        embedding = self.projection(self.data).X\n        self.valid_data = np.all(np.isfinite(embedding), axis=1)\n        return embedding\n\n    def get_anchors(self):\n        if self.projection is None:\n            return None, None\n        components = self.projection.components_\n        if components.shape == (1, 1):\n            components = np.array([[1.], [0.]])\n        return components.T, [a.name for a in self.effective_variables]\n\n    def _manual_move_start(self):\n        self.graph.set_sample_size(self.SAMPLE_SIZE)\n\n    def _manual_move(self, anchor_idx, x, y):\n        self.projection.components_[:, anchor_idx] = [x, y]\n        self.graph.update_coordinates()\n\n    def _manual_move_finish(self, anchor_idx, x, y):\n        self._manual_move(anchor_idx, x, y)\n        self.graph.set_sample_size(None)\n        self.commit.deferred()\n\n    def _get_projection_data(self):\n        if self.data is None or self.projection is None:\n            return None\n        proposed = [a.name for a in self.projection.domain.attributes]\n        names = get_unique_names(self.data.domain, proposed)\n\n        if proposed != names:\n            attributes = tuple([attr.copy(name=name) for name, attr in\n                                zip(names, self.projection.domain.attributes)])\n        else:\n            attributes = self.projection.domain.attributes\n        return self.data.transform(\n            Domain(self.data.domain.attributes,\n                   self.data.domain.class_vars,\n                   self.data.domain.metas + attributes))\n\n    @gui.deferred\n    def commit(self):\n        super().commit()\n        self.send_components()\n\n    def send_components(self):\n        components = None\n        if self.data is not None and self.projection is not None:\n            proposed = [var.name for var in self.effective_variables]\n            comp_name = get_unique_names(proposed, 'component')\n            meta_attrs = [StringVariable(name=comp_name)]\n            domain = Domain(self.effective_variables, metas=meta_attrs)\n            components = Table(domain, self._send_components_x().copy(),\n                               metas=self._send_components_metas())\n            components.name = \"components\"\n        self.Outputs.components.send(components)\n\n    def _send_components_x(self):\n        return self.projection.components_\n\n    def _send_components_metas(self):\n        variable_names = [a.name for a in self.projection.domain.attributes]\n        return np.array(variable_names, dtype=object)[:, None]\n\n    def clear(self):\n        super().clear()\n        self.projector = self.projection = None\n\n\nif __name__ == \"__main__\":\n    class OWProjectionWidgetWithName(OWDataProjectionWidget):\n        name = \"projection\"\n\n        def get_embedding(self):\n            if self.data is None:\n                return None\n            self.valid_data = np.any(np.isfinite(self.data.X), 1)\n            x_data = self.data.X\n            x_data[x_data == np.inf] = np.nan\n            x_data = np.nanmean(x_data[self.valid_data], 1)\n            y_data = np.ones(len(x_data))\n            return np.vstack((x_data, y_data)).T\n\n    app = QApplication([])\n    ow = OWProjectionWidgetWithName()\n    table = Table(\"iris\")\n    ow.set_data(table)\n    ow.set_subset_data(table[::10])\n    ow.handleNewSignals()\n    ow.show()\n    app.exec()\n    ow.saveSettings()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/visualize/utils/widget.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "924acc179",
                "new_commit_hash": "62ede7c3e",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/visualize/utils/widget.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/visualize/utils/widget.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 455,
                            "length": 7
                        },
                        "new_range": {
                            "start": 455,
                            "length": 10
                        },
                        "section": "class OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.openContext(self.data)",
                                "type": "context"
                            },
                            {
                                "content": "        self._invalidated = not (",
                                "type": "context"
                            },
                            {
                                "content": "            data_existed and self.data is not None and",
                                "type": "context"
                            },
                            {
                                "content": "            array_equal(effective_data.X, self.effective_data.X))",
                                "type": "deleted"
                            },
                            {
                                "content": "            array_equal(effective_data.X, self.effective_data.X) and",
                                "type": "added"
                            },
                            {
                                "content": "            array_equal(effective_data.Y, self.effective_data.Y) and",
                                "type": "added"
                            },
                            {
                                "content": "            array_equal(effective_data.metas, self.effective_data.metas)",
                                "type": "added"
                            },
                            {
                                "content": "        )",
                                "type": "added"
                            },
                            {
                                "content": "        self._domain_invalidated = not (",
                                "type": "context"
                            },
                            {
                                "content": "            data_existed and self.data is not None and",
                                "type": "context"
                            },
                            {
                                "content": "            effective_data.domain.checksum()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/visualize/utils/widget.py",
                            "type": "method",
                            "name": "OWDataProjectionWidget.set_data",
                            "content": "class OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):\n    \"\"\"\n    Base widget for widgets that get Data and Data Subset (both\n    Orange.data.Table) on the input, and output Selected Data and Data\n    (both Orange.data.Table).\n\n    Beside that the widget displays data as two-dimensional projection\n    of points.\n    \"\"\"\n    class Inputs:\n        data = Input(\"Data\", Table, default=True)\n        data_subset = Input(\"Data Subset\", Table)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    class Warning(OWProjectionWidgetBase.Warning):\n        too_many_labels = Msg(\n            \"Too many labels to show (zoom in or label only selected)\")\n        subset_not_subset = Msg(\n            \"Subset data contains some instances that do not appear in \"\n            \"input data\")\n        subset_independent = Msg(\n            \"No subset data instances appear in input data\")\n        transparent_subset = Msg(\n            \"Increase opacity if subset is difficult to see\")\n\n    settingsHandler = DomainContextHandler()\n    selection = Setting(None, schema_only=True)\n    visual_settings = Setting({}, schema_only=True)\n    auto_commit = Setting(True)\n\n    GRAPH_CLASS = OWScatterPlotBase\n    graph = SettingProvider(OWScatterPlotBase)\n    graph_name = \"graph.plot_widget.plotItem\"\n    embedding_variables_names = (\"proj-x\", \"proj-y\")\n    buttons_area_orientation = Qt.Vertical\n\n    input_changed = Signal(object)\n    output_changed = Signal(object)\n\n    def __init__(self):\n        super().__init__()\n        self.subset_data = None\n        self.subset_indices = None\n        self.__pending_selection = self.selection\n        self._invalidated = True\n        self._domain_invalidated = True\n        self.setup_gui()\n        VisualSettingsDialog(self, self.graph.parameter_setter.initial_settings)\n\n    # GUI\n    def setup_gui(self):\n        self._add_graph()\n        self._add_controls()\n        self._add_buttons()\n        self.input_changed.emit(None)\n        self.output_changed.emit(None)\n\n    def _add_graph(self):\n        box = gui.vBox(self.mainArea, True, margin=0)\n        self.graph = self.GRAPH_CLASS(self, box)\n        box.layout().addWidget(self.graph.plot_widget)\n        self.graph.too_many_labels.connect(\n            lambda too_many: self.Warning.too_many_labels(shown=too_many))\n\n    def _add_controls(self):\n        self.gui = OWPlotGUI(self)\n        area = self.controlArea\n        self._point_box = self.gui.point_properties_box(area)\n        self._effects_box = self.gui.effects_box(area)\n        self._plot_box = self.gui.plot_properties_box(area)\n\n    def _add_buttons(self):\n        gui.rubber(self.controlArea)\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def effective_variables(self):\n        return self.data.domain.attributes\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas))\n\n    # Input\n    @Inputs.data\n    @check_sql_input\n    def set_data(self, data):\n        data_existed = self.data is not None\n        effective_data = self.effective_data if data_existed else None\n        self.closeContext()\n        self.data = data\n        self.check_data()\n        self.init_attr_values()\n        self.openContext(self.data)\n        self._invalidated = not (\n            data_existed and self.data is not None and\n            array_equal(effective_data.X, self.effective_data.X))\n        self._domain_invalidated = not (\n            data_existed and self.data is not None and\n            effective_data.domain.checksum()\n            == self.effective_data.domain.checksum())\n        if self._invalidated:\n            self.clear()\n            self.input_changed.emit(data)\n        self.enable_controls()\n\n    def check_data(self):\n        self.clear_messages()\n\n    def enable_controls(self):\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    @Inputs.data_subset\n    @check_sql_input\n    def set_subset_data(self, subset):\n        self.subset_data = subset\n\n    def handleNewSignals(self):\n        self._handle_subset_data()\n        if self._invalidated:\n            self._invalidated = False\n            self.setup_plot()\n        else:\n            self.graph.update_point_props()\n        self._update_opacity_warning()\n        self.commit.now()\n\n    def _handle_subset_data(self):\n        self.Warning.subset_independent.clear()\n        self.Warning.subset_not_subset.clear()\n        if self.data is None or self.subset_data is None:\n            self.subset_indices = set()\n        else:\n            self.subset_indices = set(self.subset_data.ids)\n            ids = set(self.data.ids)\n            if not self.subset_indices & ids:\n                self.Warning.subset_independent()\n            elif self.subset_indices - ids:\n                self.Warning.subset_not_subset()\n\n    def _update_opacity_warning(self):\n        self.Warning.transparent_subset(\n            shown=self.subset_indices and self.graph.alpha_value < 128)\n\n    def get_subset_mask(self):\n        if not self.subset_indices:\n            return None\n        valid_data = self.data[self.valid_data]\n        return np.fromiter((ex.id in self.subset_indices for ex in valid_data),\n                           dtype=bool, count=len(valid_data))\n\n    # Plot\n    def get_embedding(self):\n        \"\"\"A get embedding method.\n\n        Derived classes must override this method. The overridden method\n        should return embedding for all data (valid and invalid). Invalid\n        data embedding coordinates should be set to 0 (in some cases to Nan).\n\n        The method should also set self.valid_data.\n\n        Returns:\n            np.array: Array of embedding coordinates with shape\n            len(self.data) x 2\n        \"\"\"\n        raise NotImplementedError\n\n    def get_coordinates_data(self):\n        embedding = self.get_embedding()\n        if embedding is not None and len(embedding[self.valid_data]):\n            return embedding[self.valid_data].T\n        return None, None\n\n    def setup_plot(self):\n        self.graph.reset_graph()\n        self.__pending_selection = self.selection or self.__pending_selection\n        self.apply_selection()\n\n    # Selection\n    def apply_selection(self):\n        pending = self.__pending_selection\n        if self.data is not None and pending is not None and len(pending) \\\n                and max(i for i, _ in pending) < self.graph.n_valid:\n            index_group = np.array(pending).T\n            selection = np.zeros(self.graph.n_valid, dtype=np.uint8)\n            selection[index_group[0]] = index_group[1]\n\n            self.selection = self.__pending_selection\n            self.__pending_selection = None\n            self.graph.selection = selection\n            self.graph.update_selection_colors()\n            if self.graph.label_only_selected:\n                self.graph.update_labels()\n\n    def selection_changed(self):\n        sel = None if self.data and isinstance(self.data, SqlTable) \\\n            else self.graph.selection\n        self.selection = [(i, x) for i, x in enumerate(sel) if x] \\\n            if sel is not None else None\n        self.commit.deferred()\n\n    # Output\n    @gui.deferred\n    def commit(self):\n        self.send_data()\n\n    def send_data(self):\n        group_sel, data, graph = None, self._get_projection_data(), self.graph\n        if graph.selection is not None:\n            group_sel = np.zeros(len(data), dtype=int)\n            group_sel[self.valid_data] = graph.selection\n        selected = self._get_selected_data(\n            data, graph.get_selection(), group_sel)\n        self.output_changed.emit(selected)\n        self.Outputs.selected_data.send(selected)\n        self.Outputs.annotated_data.send(\n            self._get_annotated_data(data, group_sel,\n                                     graph.selection))\n\n    def _get_projection_data(self):\n        if self.data is None or self.embedding_variables_names is None:\n            return self.data\n        variables = self._get_projection_variables()\n        data = self.data.transform(Domain(self.data.domain.attributes,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas + variables))\n        if data.metas.size:\n            with data.unlocked(data.metas):\n                data.metas[:, -2:] = self.get_embedding()\n        return data\n\n    def _get_projection_variables(self):\n        names = get_unique_names(\n            self.data.domain, self.embedding_variables_names)\n        return ContinuousVariable(names[0]), ContinuousVariable(names[1])\n\n    @staticmethod\n    def _get_selected_data(data, selection, group_sel):\n        return create_groups_table(data, group_sel, False, \"Group\") \\\n            if len(selection) else None\n\n    @staticmethod\n    def _get_annotated_data(data, group_sel, graph_sel):\n        if data is None:\n            return None\n        if graph_sel is not None and np.max(graph_sel) > 1:\n            return create_groups_table(data, group_sel)\n        else:\n            if group_sel is None:\n                mask = np.full((len(data), ), False)\n            else:\n                mask = np.nonzero(group_sel)[0]\n            return create_annotated_table(data, mask)\n\n    # Report\n    def send_report(self):\n        if self.data is None:\n            return\n\n        caption = self._get_send_report_caption()\n        self.report_plot()\n        if caption:\n            self.report_caption(caption)\n\n    def _get_send_report_caption(self):\n        return report.render_items_vert((\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    # Customize plot\n    def set_visual_settings(self, key, value):\n        self.graph.parameter_setter.set_parameter(key, value)\n        self.visual_settings[key] = value\n\n    @staticmethod\n    def _get_caption_var_name(var):\n        return var.name if isinstance(var, Variable) else var\n\n    # Misc\n    def sizeHint(self):\n        return QSize(1132, 708)\n\n    def clear(self):\n        self.selection = None\n        self.graph.selection = None\n\n    def onDeleteWidget(self):\n        super().onDeleteWidget()\n        self.graph.plot_widget.getViewBox().deleteLater()\n        self.graph.plot_widget.clear()\n        self.graph.clear()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 448,
                            "end_lineno": 466,
                            "parent": {
                                "file_name": "Orange/widgets/visualize/utils/widget.py",
                                "type": "class",
                                "name": "OWDataProjectionWidget",
                                "content": "class OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):\n    \"\"\"\n    Base widget for widgets that get Data and Data Subset (both\n    Orange.data.Table) on the input, and output Selected Data and Data\n    (both Orange.data.Table).\n\n    Beside that the widget displays data as two-dimensional projection\n    of points.\n    \"\"\"\n    class Inputs:\n        data = Input(\"Data\", Table, default=True)\n        data_subset = Input(\"Data Subset\", Table)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    class Warning(OWProjectionWidgetBase.Warning):\n        too_many_labels = Msg(\n            \"Too many labels to show (zoom in or label only selected)\")\n        subset_not_subset = Msg(\n            \"Subset data contains some instances that do not appear in \"\n            \"input data\")\n        subset_independent = Msg(\n            \"No subset data instances appear in input data\")\n        transparent_subset = Msg(\n            \"Increase opacity if subset is difficult to see\")\n\n    settingsHandler = DomainContextHandler()\n    selection = Setting(None, schema_only=True)\n    visual_settings = Setting({}, schema_only=True)\n    auto_commit = Setting(True)\n\n    GRAPH_CLASS = OWScatterPlotBase\n    graph = SettingProvider(OWScatterPlotBase)\n    graph_name = \"graph.plot_widget.plotItem\"\n    embedding_variables_names = (\"proj-x\", \"proj-y\")\n    buttons_area_orientation = Qt.Vertical\n\n    input_changed = Signal(object)\n    output_changed = Signal(object)\n\n    def __init__(self):\n        super().__init__()\n        self.subset_data = None\n        self.subset_indices = None\n        self.__pending_selection = self.selection\n        self._invalidated = True\n        self._domain_invalidated = True\n        self.setup_gui()\n        VisualSettingsDialog(self, self.graph.parameter_setter.initial_settings)\n\n    # GUI\n    def setup_gui(self):\n        self._add_graph()\n        self._add_controls()\n        self._add_buttons()\n        self.input_changed.emit(None)\n        self.output_changed.emit(None)\n\n    def _add_graph(self):\n        box = gui.vBox(self.mainArea, True, margin=0)\n        self.graph = self.GRAPH_CLASS(self, box)\n        box.layout().addWidget(self.graph.plot_widget)\n        self.graph.too_many_labels.connect(\n            lambda too_many: self.Warning.too_many_labels(shown=too_many))\n\n    def _add_controls(self):\n        self.gui = OWPlotGUI(self)\n        area = self.controlArea\n        self._point_box = self.gui.point_properties_box(area)\n        self._effects_box = self.gui.effects_box(area)\n        self._plot_box = self.gui.plot_properties_box(area)\n\n    def _add_buttons(self):\n        gui.rubber(self.controlArea)\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def effective_variables(self):\n        return self.data.domain.attributes\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas))\n\n    # Input\n    @Inputs.data\n    @check_sql_input\n    def set_data(self, data):\n        data_existed = self.data is not None\n        effective_data = self.effective_data if data_existed else None\n        self.closeContext()\n        self.data = data\n        self.check_data()\n        self.init_attr_values()\n        self.openContext(self.data)\n        self._invalidated = not (\n            data_existed and self.data is not None and\n            array_equal(effective_data.X, self.effective_data.X))\n        self._domain_invalidated = not (\n            data_existed and self.data is not None and\n            effective_data.domain.checksum()\n            == self.effective_data.domain.checksum())\n        if self._invalidated:\n            self.clear()\n            self.input_changed.emit(data)\n        self.enable_controls()\n\n    def check_data(self):\n        self.clear_messages()\n\n    def enable_controls(self):\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    @Inputs.data_subset\n    @check_sql_input\n    def set_subset_data(self, subset):\n        self.subset_data = subset\n\n    def handleNewSignals(self):\n        self._handle_subset_data()\n        if self._invalidated:\n            self._invalidated = False\n            self.setup_plot()\n        else:\n            self.graph.update_point_props()\n        self._update_opacity_warning()\n        self.commit.now()\n\n    def _handle_subset_data(self):\n        self.Warning.subset_independent.clear()\n        self.Warning.subset_not_subset.clear()\n        if self.data is None or self.subset_data is None:\n            self.subset_indices = set()\n        else:\n            self.subset_indices = set(self.subset_data.ids)\n            ids = set(self.data.ids)\n            if not self.subset_indices & ids:\n                self.Warning.subset_independent()\n            elif self.subset_indices - ids:\n                self.Warning.subset_not_subset()\n\n    def _update_opacity_warning(self):\n        self.Warning.transparent_subset(\n            shown=self.subset_indices and self.graph.alpha_value < 128)\n\n    def get_subset_mask(self):\n        if not self.subset_indices:\n            return None\n        valid_data = self.data[self.valid_data]\n        return np.fromiter((ex.id in self.subset_indices for ex in valid_data),\n                           dtype=bool, count=len(valid_data))\n\n    # Plot\n    def get_embedding(self):\n        \"\"\"A get embedding method.\n\n        Derived classes must override this method. The overridden method\n        should return embedding for all data (valid and invalid). Invalid\n        data embedding coordinates should be set to 0 (in some cases to Nan).\n\n        The method should also set self.valid_data.\n\n        Returns:\n            np.array: Array of embedding coordinates with shape\n            len(self.data) x 2\n        \"\"\"\n        raise NotImplementedError\n\n    def get_coordinates_data(self):\n        embedding = self.get_embedding()\n        if embedding is not None and len(embedding[self.valid_data]):\n            return embedding[self.valid_data].T\n        return None, None\n\n    def setup_plot(self):\n        self.graph.reset_graph()\n        self.__pending_selection = self.selection or self.__pending_selection\n        self.apply_selection()\n\n    # Selection\n    def apply_selection(self):\n        pending = self.__pending_selection\n        if self.data is not None and pending is not None and len(pending) \\\n                and max(i for i, _ in pending) < self.graph.n_valid:\n            index_group = np.array(pending).T\n            selection = np.zeros(self.graph.n_valid, dtype=np.uint8)\n            selection[index_group[0]] = index_group[1]\n\n            self.selection = self.__pending_selection\n            self.__pending_selection = None\n            self.graph.selection = selection\n            self.graph.update_selection_colors()\n            if self.graph.label_only_selected:\n                self.graph.update_labels()\n\n    def selection_changed(self):\n        sel = None if self.data and isinstance(self.data, SqlTable) \\\n            else self.graph.selection\n        self.selection = [(i, x) for i, x in enumerate(sel) if x] \\\n            if sel is not None else None\n        self.commit.deferred()\n\n    # Output\n    @gui.deferred\n    def commit(self):\n        self.send_data()\n\n    def send_data(self):\n        group_sel, data, graph = None, self._get_projection_data(), self.graph\n        if graph.selection is not None:\n            group_sel = np.zeros(len(data), dtype=int)\n            group_sel[self.valid_data] = graph.selection\n        selected = self._get_selected_data(\n            data, graph.get_selection(), group_sel)\n        self.output_changed.emit(selected)\n        self.Outputs.selected_data.send(selected)\n        self.Outputs.annotated_data.send(\n            self._get_annotated_data(data, group_sel,\n                                     graph.selection))\n\n    def _get_projection_data(self):\n        if self.data is None or self.embedding_variables_names is None:\n            return self.data\n        variables = self._get_projection_variables()\n        data = self.data.transform(Domain(self.data.domain.attributes,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas + variables))\n        if data.metas.size:\n            with data.unlocked(data.metas):\n                data.metas[:, -2:] = self.get_embedding()\n        return data\n\n    def _get_projection_variables(self):\n        names = get_unique_names(\n            self.data.domain, self.embedding_variables_names)\n        return ContinuousVariable(names[0]), ContinuousVariable(names[1])\n\n    @staticmethod\n    def _get_selected_data(data, selection, group_sel):\n        return create_groups_table(data, group_sel, False, \"Group\") \\\n            if len(selection) else None\n\n    @staticmethod\n    def _get_annotated_data(data, group_sel, graph_sel):\n        if data is None:\n            return None\n        if graph_sel is not None and np.max(graph_sel) > 1:\n            return create_groups_table(data, group_sel)\n        else:\n            if group_sel is None:\n                mask = np.full((len(data), ), False)\n            else:\n                mask = np.nonzero(group_sel)[0]\n            return create_annotated_table(data, mask)\n\n    # Report\n    def send_report(self):\n        if self.data is None:\n            return\n\n        caption = self._get_send_report_caption()\n        self.report_plot()\n        if caption:\n            self.report_caption(caption)\n\n    def _get_send_report_caption(self):\n        return report.render_items_vert((\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    # Customize plot\n    def set_visual_settings(self, key, value):\n        self.graph.parameter_setter.set_parameter(key, value)\n        self.visual_settings[key] = value\n\n    @staticmethod\n    def _get_caption_var_name(var):\n        return var.name if isinstance(var, Variable) else var\n\n    # Misc\n    def sizeHint(self):\n        return QSize(1132, 708)\n\n    def clear(self):\n        self.selection = None\n        self.graph.selection = None\n\n    def onDeleteWidget(self):\n        super().onDeleteWidget()\n        self.graph.plot_widget.getViewBox().deleteLater()\n        self.graph.plot_widget.clear()\n        self.graph.clear()",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 356,
                                "end_lineno": 656,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/visualize/utils/widget.py",
                            "type": "class",
                            "name": "OWDataProjectionWidget",
                            "content": "class OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):\n    \"\"\"\n    Base widget for widgets that get Data and Data Subset (both\n    Orange.data.Table) on the input, and output Selected Data and Data\n    (both Orange.data.Table).\n\n    Beside that the widget displays data as two-dimensional projection\n    of points.\n    \"\"\"\n    class Inputs:\n        data = Input(\"Data\", Table, default=True)\n        data_subset = Input(\"Data Subset\", Table)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    class Warning(OWProjectionWidgetBase.Warning):\n        too_many_labels = Msg(\n            \"Too many labels to show (zoom in or label only selected)\")\n        subset_not_subset = Msg(\n            \"Subset data contains some instances that do not appear in \"\n            \"input data\")\n        subset_independent = Msg(\n            \"No subset data instances appear in input data\")\n        transparent_subset = Msg(\n            \"Increase opacity if subset is difficult to see\")\n\n    settingsHandler = DomainContextHandler()\n    selection = Setting(None, schema_only=True)\n    visual_settings = Setting({}, schema_only=True)\n    auto_commit = Setting(True)\n\n    GRAPH_CLASS = OWScatterPlotBase\n    graph = SettingProvider(OWScatterPlotBase)\n    graph_name = \"graph.plot_widget.plotItem\"\n    embedding_variables_names = (\"proj-x\", \"proj-y\")\n    buttons_area_orientation = Qt.Vertical\n\n    input_changed = Signal(object)\n    output_changed = Signal(object)\n\n    def __init__(self):\n        super().__init__()\n        self.subset_data = None\n        self.subset_indices = None\n        self.__pending_selection = self.selection\n        self._invalidated = True\n        self._domain_invalidated = True\n        self.setup_gui()\n        VisualSettingsDialog(self, self.graph.parameter_setter.initial_settings)\n\n    # GUI\n    def setup_gui(self):\n        self._add_graph()\n        self._add_controls()\n        self._add_buttons()\n        self.input_changed.emit(None)\n        self.output_changed.emit(None)\n\n    def _add_graph(self):\n        box = gui.vBox(self.mainArea, True, margin=0)\n        self.graph = self.GRAPH_CLASS(self, box)\n        box.layout().addWidget(self.graph.plot_widget)\n        self.graph.too_many_labels.connect(\n            lambda too_many: self.Warning.too_many_labels(shown=too_many))\n\n    def _add_controls(self):\n        self.gui = OWPlotGUI(self)\n        area = self.controlArea\n        self._point_box = self.gui.point_properties_box(area)\n        self._effects_box = self.gui.effects_box(area)\n        self._plot_box = self.gui.plot_properties_box(area)\n\n    def _add_buttons(self):\n        gui.rubber(self.controlArea)\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def effective_variables(self):\n        return self.data.domain.attributes\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas))\n\n    # Input\n    @Inputs.data\n    @check_sql_input\n    def set_data(self, data):\n        data_existed = self.data is not None\n        effective_data = self.effective_data if data_existed else None\n        self.closeContext()\n        self.data = data\n        self.check_data()\n        self.init_attr_values()\n        self.openContext(self.data)\n        self._invalidated = not (\n            data_existed and self.data is not None and\n            array_equal(effective_data.X, self.effective_data.X))\n        self._domain_invalidated = not (\n            data_existed and self.data is not None and\n            effective_data.domain.checksum()\n            == self.effective_data.domain.checksum())\n        if self._invalidated:\n            self.clear()\n            self.input_changed.emit(data)\n        self.enable_controls()\n\n    def check_data(self):\n        self.clear_messages()\n\n    def enable_controls(self):\n        self.cb_class_density.setEnabled(self.can_draw_density())\n\n    @Inputs.data_subset\n    @check_sql_input\n    def set_subset_data(self, subset):\n        self.subset_data = subset\n\n    def handleNewSignals(self):\n        self._handle_subset_data()\n        if self._invalidated:\n            self._invalidated = False\n            self.setup_plot()\n        else:\n            self.graph.update_point_props()\n        self._update_opacity_warning()\n        self.commit.now()\n\n    def _handle_subset_data(self):\n        self.Warning.subset_independent.clear()\n        self.Warning.subset_not_subset.clear()\n        if self.data is None or self.subset_data is None:\n            self.subset_indices = set()\n        else:\n            self.subset_indices = set(self.subset_data.ids)\n            ids = set(self.data.ids)\n            if not self.subset_indices & ids:\n                self.Warning.subset_independent()\n            elif self.subset_indices - ids:\n                self.Warning.subset_not_subset()\n\n    def _update_opacity_warning(self):\n        self.Warning.transparent_subset(\n            shown=self.subset_indices and self.graph.alpha_value < 128)\n\n    def get_subset_mask(self):\n        if not self.subset_indices:\n            return None\n        valid_data = self.data[self.valid_data]\n        return np.fromiter((ex.id in self.subset_indices for ex in valid_data),\n                           dtype=bool, count=len(valid_data))\n\n    # Plot\n    def get_embedding(self):\n        \"\"\"A get embedding method.\n\n        Derived classes must override this method. The overridden method\n        should return embedding for all data (valid and invalid). Invalid\n        data embedding coordinates should be set to 0 (in some cases to Nan).\n\n        The method should also set self.valid_data.\n\n        Returns:\n            np.array: Array of embedding coordinates with shape\n            len(self.data) x 2\n        \"\"\"\n        raise NotImplementedError\n\n    def get_coordinates_data(self):\n        embedding = self.get_embedding()\n        if embedding is not None and len(embedding[self.valid_data]):\n            return embedding[self.valid_data].T\n        return None, None\n\n    def setup_plot(self):\n        self.graph.reset_graph()\n        self.__pending_selection = self.selection or self.__pending_selection\n        self.apply_selection()\n\n    # Selection\n    def apply_selection(self):\n        pending = self.__pending_selection\n        if self.data is not None and pending is not None and len(pending) \\\n                and max(i for i, _ in pending) < self.graph.n_valid:\n            index_group = np.array(pending).T\n            selection = np.zeros(self.graph.n_valid, dtype=np.uint8)\n            selection[index_group[0]] = index_group[1]\n\n            self.selection = self.__pending_selection\n            self.__pending_selection = None\n            self.graph.selection = selection\n            self.graph.update_selection_colors()\n            if self.graph.label_only_selected:\n                self.graph.update_labels()\n\n    def selection_changed(self):\n        sel = None if self.data and isinstance(self.data, SqlTable) \\\n            else self.graph.selection\n        self.selection = [(i, x) for i, x in enumerate(sel) if x] \\\n            if sel is not None else None\n        self.commit.deferred()\n\n    # Output\n    @gui.deferred\n    def commit(self):\n        self.send_data()\n\n    def send_data(self):\n        group_sel, data, graph = None, self._get_projection_data(), self.graph\n        if graph.selection is not None:\n            group_sel = np.zeros(len(data), dtype=int)\n            group_sel[self.valid_data] = graph.selection\n        selected = self._get_selected_data(\n            data, graph.get_selection(), group_sel)\n        self.output_changed.emit(selected)\n        self.Outputs.selected_data.send(selected)\n        self.Outputs.annotated_data.send(\n            self._get_annotated_data(data, group_sel,\n                                     graph.selection))\n\n    def _get_projection_data(self):\n        if self.data is None or self.embedding_variables_names is None:\n            return self.data\n        variables = self._get_projection_variables()\n        data = self.data.transform(Domain(self.data.domain.attributes,\n                                          self.data.domain.class_vars,\n                                          self.data.domain.metas + variables))\n        if data.metas.size:\n            with data.unlocked(data.metas):\n                data.metas[:, -2:] = self.get_embedding()\n        return data\n\n    def _get_projection_variables(self):\n        names = get_unique_names(\n            self.data.domain, self.embedding_variables_names)\n        return ContinuousVariable(names[0]), ContinuousVariable(names[1])\n\n    @staticmethod\n    def _get_selected_data(data, selection, group_sel):\n        return create_groups_table(data, group_sel, False, \"Group\") \\\n            if len(selection) else None\n\n    @staticmethod\n    def _get_annotated_data(data, group_sel, graph_sel):\n        if data is None:\n            return None\n        if graph_sel is not None and np.max(graph_sel) > 1:\n            return create_groups_table(data, group_sel)\n        else:\n            if group_sel is None:\n                mask = np.full((len(data), ), False)\n            else:\n                mask = np.nonzero(group_sel)[0]\n            return create_annotated_table(data, mask)\n\n    # Report\n    def send_report(self):\n        if self.data is None:\n            return\n\n        caption = self._get_send_report_caption()\n        self.report_plot()\n        if caption:\n            self.report_caption(caption)\n\n    def _get_send_report_caption(self):\n        return report.render_items_vert((\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    # Customize plot\n    def set_visual_settings(self, key, value):\n        self.graph.parameter_setter.set_parameter(key, value)\n        self.visual_settings[key] = value\n\n    @staticmethod\n    def _get_caption_var_name(var):\n        return var.name if isinstance(var, Variable) else var\n\n    # Misc\n    def sizeHint(self):\n        return QSize(1132, 708)\n\n    def clear(self):\n        self.selection = None\n        self.graph.selection = None\n\n    def onDeleteWidget(self):\n        super().onDeleteWidget()\n        self.graph.plot_widget.getViewBox().deleteLater()\n        self.graph.plot_widget.clear()\n        self.graph.clear()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 356,
                            "end_lineno": 656,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "b0fbaa11536e6f13d44157fda82e801cd56663db^",
    "new_commit_hash": "b0fbaa11536e6f13d44157fda82e801cd56663db",
    "commit_message": "Merge pull request #5828 from lanzagar/fix_lda\n\n[FIX] Linear Projection: Fix LDA",
    "commit_date": "2022-02-11T14:50:02+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "b0fbaa11536e6f13d44157fda82e801cd56663db",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom unittest.mock import Mock\nimport numpy as np\n\nfrom AnyQt.QtCore import QItemSelectionModel\n\nfrom Orange.data import Table, Domain, DiscreteVariable, ContinuousVariable\nfrom Orange.widgets.settings import Context\nfrom Orange.widgets.tests.base import (\n    WidgetTest, WidgetOutputsTestMixin, datasets,\n    AnchorProjectionWidgetTestMixin\n)\nfrom Orange.widgets.tests.utils import simulate\nfrom Orange.widgets.visualize.owlinearprojection import (\n    OWLinearProjection, LinearProjectionVizRank, Placement\n)\nfrom Orange.widgets.visualize.utils import run_vizrank\n\n\nclass TestOWLinearProjection(WidgetTest, AnchorProjectionWidgetTestMixin,\n                             WidgetOutputsTestMixin):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data\n        cls.same_input_output_domain = False\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)  # type: OWLinearProjection\n\n    def test_nan_plot(self):\n        data = datasets.missing_data_1()\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n            data.Y[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.data_subset, data[2:3])\n        simulate.combobox_run_through_all(self.widget.controls.attr_color)\n        simulate.combobox_run_through_all(self.widget.controls.attr_size)\n\n    def test_buttons(self):\n        for btn in self.widget.radio_placement.buttons[:3]:\n            self.send_signal(self.widget.Inputs.data, self.data)\n            self.assertTrue(btn.isEnabled())\n            btn.click()\n\n    def test_btn_vizrank(self):\n        def check_vizrank(data):\n            self.send_signal(self.widget.Inputs.data, data)\n            if data is not None and data.domain.class_var in \\\n                    self.widget.controls.attr_color.model():\n                self.widget.attr_color = data.domain.class_var\n            if self.widget.btn_vizrank.isEnabled():\n                vizrank = LinearProjectionVizRank(self.widget)\n                states = [state for state in vizrank.iterate_states(None)]\n                self.assertIsNotNone(vizrank.compute_score(states[0]))\n\n        check_vizrank(self.data)\n        check_vizrank(self.data[:, :3])\n        check_vizrank(None)\n        for ds in datasets.datasets():\n            check_vizrank(ds)\n\n    def test_bad_data(self):\n        w = self.widget\n        data = Table(\"iris\")[:20]\n        domain = data.domain\n        domain = Domain(\n            attributes=domain.attributes[:4], class_vars=DiscreteVariable(\"class\", values=(\"a\", )))\n        data = Table.from_numpy(domain=domain, X=data.X, Y=data.Y)\n        self.assertTrue(w.radio_placement.buttons[1].isEnabled())\n        self.send_signal(w.Inputs.data, data)\n        self.assertFalse(w.radio_placement.buttons[1].isEnabled())\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        output = self.get_output(self.widget.Outputs.components)\n        self.assertTrue(output and len(output) == 2)\n        self.send_signal(self.widget.Inputs.data, Table(\"housing\"))\n        self.assertFalse(buttons[Placement.LDA].isEnabled())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n\n    def test_data_no_cont_features(self):\n        data = Table(\"titanic\")\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertTrue(self.widget.Error.no_cont_features.is_shown())\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.no_cont_features.is_shown())\n\n    def test_radius(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.widget.controls.graph.hide_radius.setValue(5)\n\n    def test_invalid_data(self):\n        def assertErrorShown(data, is_shown):\n            self.send_signal(self.widget.Inputs.data, data)\n            self.assertEqual(is_shown, self.widget.Error.no_valid_data.is_shown())\n\n        data = Table(\"iris\")[::30].copy()\n        with data.unlocked():\n            data[:, 0] = np.nan\n        for data, is_shown in zip([None, data, Table(\"iris\")[:30]], [False, True, False]):\n            assertErrorShown(data, is_shown)\n\n    def test_migrate_settings_from_version_1(self):\n        # Settings from Orange 3.4.0\n        settings = {\n            '__version__': 1,\n            'alpha_value': 255,\n            'auto_commit': True,\n            'class_density': False,\n            'context_settings': [\n                Context(attributes={'iris': 1,\n                                    'petal length': 2, 'petal width': 2,\n                                    'sepal length': 2, 'sepal width': 2},\n                        metas={},\n                        ordered_domain=[('sepal length', 2),\n                                        ('sepal width', 2),\n                                        ('petal length', 2),\n                                        ('petal width', 2),\n                                        ('iris', 1)],\n                        time=1504865133.098991,\n                        values={'__version__': 1,\n                                'color_index': (5, -2),\n                                'shape_index': (1, -2),\n                                'size_index': (1, -2),\n                                'variable_state': ({}, -2)})],\n            'jitter_value': 0,\n            'legend_anchor': ((1, 0), (1, 0)),\n            'point_size': 8,\n            'savedWidgetGeometry': None\n        }\n        w = self.create_widget(OWLinearProjection, stored_settings=settings)\n        iris = Table(\"iris\")\n        self.send_signal(w.Inputs.data, iris, widget=w)\n        self.assertEqual(w.graph.point_width, 8)\n        self.assertEqual(w.attr_color, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_shape, iris.domain[\"iris\"])\n        self.assertEqual(w.attr_size, iris.domain[\"sepal length\"])\n\n    def test_set_radius_no_data(self):\n        \"\"\"\n        Widget should not crash when there is no data and radius slider is moved.\n        \"\"\"\n        w = self.widget\n        self.send_signal(w.Inputs.data, None)\n        w.controls.graph.hide_radius.setSliderPosition(3)\n\n    def test_invalidated_model_selected(self):\n        model = self.widget.model_selected\n\n        self.widget.setup_plot = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.widget.selected_vars[:] = self.data.domain[2:3]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data[:, 2:])\n        self.widget.setup_plot.assert_not_called()\n\n        self.widget.selected_vars[:] = [self.data.domain[3]]\n        model.selection_changed.emit()\n        self.widget.setup_plot.assert_called_once()\n\n        self.widget.setup_plot.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.setup_plot.assert_called_once()\n\n    def test_two_classes_dataset(self):\n        self.widget.radio_placement.buttons[1].click()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertFalse(self.widget.radio_placement.buttons[1].isEnabled())\n\n    def test_unique_name(self):\n        data = Table(\"iris\")\n        new = ContinuousVariable(\"C-y\")\n        d = Table.from_numpy(Domain(list(data.domain.attributes[:3])+[new],\n                                    class_vars=data.domain.class_vars), data.X,\n                             data.Y)\n        self.send_signal(self.widget.Inputs.data, d)\n        output = self.get_output(self.widget.Outputs.annotated_data)\n        metas = [\"C-x (1)\", \"C-y (1)\", \"Selected\"]\n        self.assertEqual([meta.name for meta in output.domain.metas], metas)\n\n\nclass LinProjVizRankTests(WidgetTest):\n    \"\"\"\n    Linear Projection VizRank tests are mostly done without threading.\n    This is because threads created with module coverage are not traced.\n    \"\"\"\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.data = Table(\"iris\")\n\n    def setUp(self):\n        self.widget = self.create_widget(OWLinearProjection)\n        self.vizrank = self.widget.vizrank\n\n    def test_discrete_class(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        run_vizrank(self.vizrank.compute_score,\n                    self.vizrank.iterate_states, None,\n                    [], 0, self.vizrank.state_count(), Mock())\n\n    def test_continuous_class(self):\n        data = Table(\"housing\")[::100]\n        self.send_signal(self.widget.Inputs.data, data)\n        run_vizrank(self.vizrank.compute_score,\n                    self.vizrank.iterate_states, None,\n                    [], 0, self.vizrank.state_count(), Mock())\n\n    def test_set_attrs(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        prev_selected = self.widget.selected_vars[:]\n        c1 = self.get_output(self.widget.Outputs.components)\n        self.vizrank.toggle()\n        self.process_events(until=lambda: not self.vizrank.keep_running)\n        self.assertEqual(len(self.vizrank.scores), self.vizrank.state_count())\n        self.vizrank.rank_table.selectionModel().select(\n            self.vizrank.rank_model.item(0, 0).index(),\n            QItemSelectionModel.ClearAndSelect\n        )\n        self.assertNotEqual(self.widget.selected_vars, prev_selected)\n        c2 = self.get_output(self.widget.Outputs.components)\n        self.assertNotEqual(c1.domain.attributes, c2.domain.attributes)\n\n\nif __name__ == \"__main__\":\n    import unittest\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\nCompiling Orange/classification/_tree_scorers.pyx because it changed.\nCompiling Orange/data/_contingency.pyx because it changed.\nCompiling Orange/data/_io.pyx because it changed.\nCompiling Orange/data/_valuecount.pyx because it changed.\nCompiling Orange/data/_variable.pyx because it changed.\nCompiling Orange/distance/_distance.pyx because it changed.\nCompiling Orange/preprocess/_discretize.pyx because it changed.\nCompiling Orange/preprocess/_relieff.pyx because it changed.\nCompiling Orange/projection/_som.pyx because it changed.\n[1/9] Cythonizing Orange/classification/_tree_scorers.pyx\n[2/9] Cythonizing Orange/data/_contingency.pyx\n[3/9] Cythonizing Orange/data/_io.pyx\n[4/9] Cythonizing Orange/data/_valuecount.pyx\n[5/9] Cythonizing Orange/data/_variable.pyx\n[6/9] Cythonizing Orange/distance/_distance.pyx\n[7/9] Cythonizing Orange/preprocess/_discretize.pyx\n[8/9] Cythonizing Orange/preprocess/_relieff.pyx\n[9/9] Cythonizing Orange/projection/_som.pyx\nbuilding 'Orange.classification._tree_scorers' extension\ncreating build\ncreating build/temp.linux-x86_64-3.7\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_tree_scorers.c -o build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o\ncreating build/lib.linux-x86_64-3.7\ncreating build/lib.linux-x86_64-3.7/Orange\ncreating build/lib.linux-x86_64-3.7/Orange/classification\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 build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_contingency.c -o build/temp.linux-x86_64-3.7/Orange/data/_contingency.o\ncreating build/lib.linux-x86_64-3.7/Orange/data\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 build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_io.c -o build/temp.linux-x86_64-3.7/Orange/data/_io.o\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 build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_valuecount.c -o build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o\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 build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_variable.c -o build/temp.linux-x86_64-3.7/Orange/data/_variable.o\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 build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/distance/_distance.c -o build/temp.linux-x86_64-3.7/Orange/distance/_distance.o\ncreating build/lib.linux-x86_64-3.7/Orange/distance\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 build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_discretize.c -o build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o\ncreating build/lib.linux-x86_64-3.7/Orange/preprocess\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 build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_relieff.cpp -o build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o\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 build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/projection/_som.c -o build/temp.linux-x86_64-3.7/Orange/projection/_som.o\ncreating build/lib.linux-x86_64-3.7/Orange/projection\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 build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._simple_tree' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_simple_tree.c -o build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o\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 build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/widgets/utils/_grid_density.cpp -o build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o\ncreating build/lib.linux-x86_64-3.7/Orange/widgets\ncreating build/lib.linux-x86_64-3.7/Orange/widgets/utils\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 build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nrunning develop\nrunning egg_info\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'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.32.0.dev0+b0fbaa1 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db\nProcessing dependencies for Orange3==3.32.0.dev0+b0fbaa1\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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for qtconsole==5.4.4\nBest match: qtconsole 5.4.4\nAdding qtconsole 5.4.4 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for pygments==2.17.2\nBest match: pygments 2.17.2\nAdding pygments 2.17.2 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for httpx==0.19.0\nBest match: httpx 0.19.0\nAdding httpx 0.19.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for ipykernel==6.16.2\nBest match: ipykernel 6.16.2\nAdding ipykernel 6.16.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for traitlets==5.9.0\nBest match: traitlets 5.9.0\nAdding traitlets 5.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for QtPy==2.4.2\nBest match: QtPy 2.4.2\nAdding QtPy 2.4.2 to easy-install.pth file\nInstalling qtpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for ipython-genutils==0.2.0\nBest match: ipython-genutils 0.2.0\nAdding ipython-genutils 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for jupyter-core==4.12.0\nBest match: jupyter-core 4.12.0\nAdding jupyter-core 4.12.0 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for jupyter-client==7.4.9\nBest match: jupyter-client 7.4.9\nAdding jupyter-client 7.4.9 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for pyzmq==26.2.0\nBest match: pyzmq 26.2.0\nAdding pyzmq 26.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.13.7\nBest match: httpcore 0.13.7\nAdding httpcore 0.13.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for debugpy==1.7.0\nBest match: debugpy 1.7.0\nAdding debugpy 1.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for matplotlib-inline==0.1.6\nBest match: matplotlib-inline 0.1.6\nAdding matplotlib-inline 0.1.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for nest-asyncio==1.6.0\nBest match: nest-asyncio 1.6.0\nAdding nest-asyncio 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for tornado==6.2\nBest match: tornado 6.2\nAdding tornado 6.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for psutil==6.1.1\nBest match: psutil 6.1.1\nAdding psutil 6.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for ipython==7.34.0\nBest match: ipython 7.34.0\nAdding ipython 7.34.0 to easy-install.pth file\nInstalling iptest script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling iptest3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for entrypoints==0.4\nBest match: entrypoints 0.4\nAdding entrypoints 0.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for h11==0.12.0\nBest match: h11 0.12.0\nAdding h11 0.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for anyio==3.7.1\nBest match: anyio 3.7.1\nAdding anyio 3.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for jedi==0.19.2\nBest match: jedi 0.19.2\nAdding jedi 0.19.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for prompt-toolkit==3.0.48\nBest match: prompt-toolkit 3.0.48\nAdding prompt-toolkit 3.0.48 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for pexpect==4.9.0\nBest match: pexpect 4.9.0\nAdding pexpect 4.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for backcall==0.2.0\nBest match: backcall 0.2.0\nAdding backcall 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for decorator==5.1.1\nBest match: decorator 5.1.1\nAdding decorator 5.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for pickleshare==0.7.5\nBest match: pickleshare 0.7.5\nAdding pickleshare 0.7.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for parso==0.8.4\nBest match: parso 0.8.4\nAdding parso 0.8.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for wcwidth==0.2.13\nBest match: wcwidth 0.2.13\nAdding wcwidth 0.2.13 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nSearching for ptyprocess==0.7.0\nBest match: ptyprocess 0.7.0\nAdding ptyprocess 0.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.32.0.dev0+b0fbaa1\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 154ms\nPrepared 18 packages in 11ms\nInstalled 18 packages in 79ms\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 55 packages in 359ms\nInstalled 48 packages in 733ms\n + anyio==3.7.1\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\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.12.0\n + httpcore==0.13.7\n + httpx==0.19.0\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 59 packages in 274ms\nInstalled 38 packages in 430ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + backcall==0.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + debugpy==1.7.0\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + entrypoints==0.4\n + ipykernel==6.16.2\n + ipython==7.34.0\n + ipython-genutils==0.2.0\n + jedi==0.19.2\n + jupyter-client==7.4.9\n + jupyter-core==4.12.0\n + matplotlib-inline==0.1.6\n + nest-asyncio==1.6.0\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + parso==0.8.4\n + pexpect==4.9.0\n + pickleshare==0.7.5\n + platformdirs==4.0.0\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pygments==2.17.2\n + pyqtgraph==0.12.4\n + pyzmq==26.2.0\n + qasync==0.25.0\n + qtconsole==5.4.4\n + qtpy==2.4.2\n + requests-cache==1.1.1\n + tornado==6.2\n + traitlets==5.9.0\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 2 packages in 3ms\nInstalled 2 packages in 7ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 105ms\nInstalled 5 packages in 1.09s\n + catboost==1.2.7\n + graphviz==0.20.1\n + plotly==5.18.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nAudited 2 packages in 1ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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:3427:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3427 |   __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:4883:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4883 |   __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:5629:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5629 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5750:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5750 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5756:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5756 |           __pyx_t_20 = (((__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:7217:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7217 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7874:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7874 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7934:150: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7934 |               __pyx_t_16 = (((*((__pyx_t_5numpy_int32_t const  *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                                      ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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:4120:43: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4120 |           __pyx_v_value = ((__pyx_v_value * __pyx_v_decs) + (__pyx_v_c & 0xf));\n      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/data/_io.c:4318:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4318 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 223, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:683:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  683 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1590:7: note: ‘__pyx_v_attr_index’ was declared here\n 1590 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:3183:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3183 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:774:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:790:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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:3863:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3863 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3862:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3862 |   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:4934:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4934 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4933:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4933 |   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:4732:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4732 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4307:7: note: ‘__pyx_v_win_y’ was declared here\n 4307 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4721:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4721 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4306:7: note: ‘__pyx_v_win_x’ was declared here\n 4306 |   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:5682:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5682 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5681:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5681 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:3184:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3184 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2887:7: note: ‘__pyx_v_win_y’ was declared here\n 2887 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3173:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3173 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2886:7: note: ‘__pyx_v_win_x’ was declared here\n 2886 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3357:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3357 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\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      |         ^~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_b0fbaa11536e6f13d44157fda82e801cd56663db/.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_b0fbaa11536e6f13d44157fda82e801cd56663db/.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,\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 '*.svg' under directory 'Orange/canvas'\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 '*.svg' under directory 'distribute'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 0,
    "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_b0fbaa11536e6f13d44157fda82e801cd56663db\nplugins: anyio-3.7.1\ncollected 45 items\n\nr2e_tests/test_1.py sss..........................................        [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_attr_label_metas\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_attr_models\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_bad_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_btn_vizrank\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_buttons\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_class_density\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_data_no_cont_features\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_datasets\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_default_attrs\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_dragging_tooltip\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_embedding_missing_values\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_handle_primitive_metas\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_hidden_effective_variables\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_image_export\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_invalid_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_invalidated_embedding\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_invalidated_model_selected\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_manual_move\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_migrate_settings_from_version_1\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_nan_plot\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_no_data_for_lda\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_none_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_outputs\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_plot_once\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_radius\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_saved_selection\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_send_report\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_set_radius_no_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_setup_graph\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_sparse_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_subset_data_color\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_two_classes_dataset\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_unique_name\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_visual_settings\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_continuous_class\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_discrete_class\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_image_export\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_minimum_size\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_msg_base_class\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_set_attrs\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\n======================== 42 passed, 3 skipped in 10.45s ========================\nWidgets left: 0    Max widgets: 9710 \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_b0fbaa11536e6f13d44157fda82e801cd56663db\nplugins: anyio-3.7.1\ncollected 45 items\n\nr2e_tests/test_1.py sss......................F...................        [100%]\n\n=================================== FAILURES ===================================\n_________________ TestOWLinearProjection.test_no_data_for_lda __________________\n\nself = <r2e_tests.test_1.TestOWLinearProjection testMethod=test_no_data_for_lda>\n\n    def test_no_data_for_lda(self):\n        buttons = self.widget.radio_placement.buttons\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.radio_placement.buttons[Placement.LDA].click()\n        self.assertTrue(buttons[Placement.LDA].isEnabled())\n        output = self.get_output(self.widget.Outputs.components)\n>       self.assertTrue(output and len(output) == 2)\nE       AssertionError: None is not true\n\nr2e_tests/test_1.py:89: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_attr_label_metas\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_attr_models\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_bad_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_btn_vizrank\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_buttons\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_class_density\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_data_no_cont_features\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_datasets\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_default_attrs\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_dragging_tooltip\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_embedding_missing_values\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_handle_primitive_metas\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_hidden_effective_variables\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_image_export\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_invalid_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_invalidated_embedding\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_invalidated_model_selected\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_manual_move\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_migrate_settings_from_version_1\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_nan_plot\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_none_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_outputs\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_plot_once\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_radius\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_saved_selection\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_send_report\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_set_radius_no_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_setup_graph\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_sparse_data\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_subset_data_color\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_two_classes_dataset\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_unique_name\nPASSED r2e_tests/test_1.py::TestOWLinearProjection::test_visual_settings\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_continuous_class\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_discrete_class\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_image_export\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_minimum_size\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_msg_base_class\nPASSED r2e_tests/test_1.py::LinProjVizRankTests::test_set_attrs\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::TestOWLinearProjection::test_no_data_for_lda - As...\n=================== 1 failed, 41 passed, 3 skipped in 8.07s ====================\nWidgets left: 0    Max widgets: 9710 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/visualize/owlinearprojection.py Orange/widgets/visualize/tests/test_owlinearprojection.py Orange/widgets/visualize/utils/widget.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
**[ISSUE]**

**Title:** LDA Placement in Linear Projection Widget Does Not Output Components

**Description:**
When using the Linear Projection widget with LDA placement, the widget fails to produce the expected output components. Specifically, after setting the placement to LDA and providing the appropriate dataset, the widget does not emit the transformed data, resulting in no components being available for further processing.

**Steps to Reproduce:**
1. Load a dataset with class variables into the Linear Projection widget.
2. Select the LDA placement option.
3. Attempt to retrieve the output components.

**Example Code:**
```python
from Orange.data import Table
from Orange.widgets.visualize.owlinearprojection import OWLinearProjection

# Initialize widget
widget = OWLinearProjection()

# Load data with class variables
data = Table("iris")
widget.set_data(data)

# Set placement to LDA
widget.placement = Placement.LDA

# Attempt to get output components
output = widget.get_output_components()
print(output)  # Expected to have 2 components, but returns None
```

**Expected Behavior:**
After selecting LDA placement and providing a dataset with class variables, the Linear Projection widget should transform the data accordingly and output the transformed components with a length of 2.

**Actual Behavior:**
Selecting LDA placement results in the widget not emitting any output components, causing downstream processes to receive `None` instead of the expected transformed data.
--- 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/visualize/owlinearprojection.py
"""
Linear Projection widget
------------------------
"""

from itertools import islice, permutations, chain
from math import factorial

import numpy as np

from sklearn.neighbors import NearestNeighbors
from sklearn.metrics import r2_score

from AnyQt.QtGui import QStandardItem, QPalette
from AnyQt.QtCore import Qt, QRectF, QLineF, pyqtSignal as Signal

import pyqtgraph as pg

from Orange.data import Table, Domain
from Orange.preprocess import Normalize
from Orange.preprocess.score import ReliefF, RReliefF
from Orange.projection import PCA, LDA, LinearProjector
from Orange.util import Enum
from Orange.widgets import gui, report
from Orange.widgets.gui import OWComponent
from Orange.widgets.settings import Setting, ContextSetting, SettingProvider
from Orange.widgets.utils.plot import variables_selection
from Orange.widgets.utils.plot.owplotgui import VariableSelectionModel
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.visualize.utils import VizRankDialog
from Orange.widgets.visualize.utils.component import OWGraphWithAnchors
from Orange.widgets.visualize.utils.plotutils import AnchorItem
from Orange.widgets.visualize.utils.widget import OWAnchorProjectionWidget
from Orange.widgets.widget import Msg


MAX_LABEL_LEN = 20


class LinearProjectionVizRank(VizRankDialog, OWComponent):
    captionTitle = "Score Plots"
    n_attrs = Setting(3)
    minK = 10

    attrsSelected = Signal([])
    _AttrRole = next(gui.OrangeUserRole)

    def __init__(self, master):
        # Add the spin box for a number of attributes to take into account.
        VizRankDialog.__init__(self, master)
        OWComponent.__init__(self, master)

        box = gui.hBox(self)
        max_n_attrs = len(master.model_selected)
        self.n_attrs_spin = gui.spin(
            box, self, "n_attrs", 3, max_n_attrs, label="Number of variables: ",
            controlWidth=50, alignment=Qt.AlignRight, callback=self._n_attrs_changed)
        gui.rubber(box)
        self.last_run_n_attrs = None
        self.attr_color = master.attr_color
        self.attrs = []

    def initialize(self):
        super().initialize()
        self.attr_color = self.master.attr_color

    def before_running(self):
        """
        Disable the spin for number of attributes before running and
        enable afterwards. Also, if the number of attributes is different than
        in the last run, reset the saved state (if it was paused).
        """
        if self.n_attrs != self.last_run_n_attrs:
            self.saved_state = None
            self.saved_progress = 0
        if self.saved_state is None:
            self.scores = []
            self.rank_model.clear()
        self.last_run_n_attrs = self.n_attrs
        self.n_attrs_spin.setDisabled(True)

    def stopped(self):
        self.n_attrs_spin.setDisabled(False)

    def check_preconditions(self):
        master = self.master
        if not super().check_preconditions():
            return False
        elif not master.btn_vizrank.isEnabled():
            return False
        n_cont_var = len([v for v in master.continuous_variables
                          if v is not master.attr_color])
        self.n_attrs_spin.setMaximum(n_cont_var)
        return True

    def state_count(self):
        n_all_attrs = len(self.attrs)
        if not n_all_attrs:
            return 0
        n_attrs = self.n_attrs
        return factorial(n_all_attrs) // (2 * factorial(n_all_attrs - n_attrs) * n_attrs)

    def iterate_states(self, state):
        if state is None:  # on the first call, compute order
            self.attrs = self._score_heuristic()
            state = list(range(self.n_attrs))
        else:
            state = list(state)

        def combinations(n, s):
            while True:
                yield s
                for up, _ in enumerate(s):
                    s[up] += 1
                    if up + 1 == len(s) or s[up] < s[up + 1]:
                        break
                    s[up] = up
                if s[-1] == n:
                    break

        for c in combinations(len(self.attrs), state):
            for p in islice(permutations(c[1:]), factorial(len(c) - 1) // 2):
                yield (c[0], ) + p

    def compute_score(self, state):
        master = self.master
        data = master.data
        domain = Domain([self.attrs[i] for i in state], data.domain.class_vars)
        projection = master.projector(data.transform(domain))
        ec = projection(data).X
        y = column_data(data, self.attr_color, dtype=float)
        if ec.shape[0] < self.minK:
            return None
        n_neighbors = min(self.minK, len(ec) - 1)
        knn = NearestNeighbors(n_neighbors=n_neighbors).fit(ec)
        ind = knn.kneighbors(return_distance=False)
        # pylint: disable=invalid-unary-operand-type
        if self.attr_color.is_discrete:
            return -np.sum(y[ind] == y.reshape(-1, 1)) / n_neighbors / len(y)
        return -r2_score(y, np.mean(y[ind], axis=1)) * (len(y) / len(data))

    def bar_length(self, score):
        return max(0, -score)

    def _score_heuristic(self):
        def normalized(a):
            span = np.max(a, axis=0) - np.min(a, axis=0)
            span[span == 0] = 1
            return (a - np.mean(a, axis=0)) / span

        domain = self.master.data.domain
        attr_color = self.master.attr_color
        domain = Domain(
            attributes=[v for v in chain(domain.variables, domain.metas)
                        if v.is_continuous and v is not attr_color],
            class_vars=attr_color
        )
        data = self.master.data.transform(domain).copy()
        with data.unlocked():
            data.X = normalized(data.X)
        relief = ReliefF if attr_color.is_discrete else RReliefF
        weights = relief(n_iterations=100, k_nearest=self.minK)(data)
        results = sorted(zip(weights, domain.attributes), key=lambda x: (-x[0], x[1].name))
        return [attr for _, attr in results]

    def row_for_state(self, score, state):
        attrs = [self.attrs[i] for i in state]
        item = QStandardItem(", ".join(a.name for a in attrs))
        item.setData(attrs, self._AttrRole)
        return [item]

    def on_selection_changed(self, selected, deselected):
        if not selected.indexes():
            return
        attrs = selected.indexes()[0].data(self._AttrRole)
        self.selectionChanged.emit([attrs])

    def _n_attrs_changed(self):
        if self.n_attrs != self.last_run_n_attrs or self.saved_state is None:
            self.button.setText("Start")
        else:
            self.button.setText("Continue")
        self.button.setEnabled(self.check_preconditions())


class OWLinProjGraph(OWGraphWithAnchors):
    hide_radius = Setting(0)

    @property
    def always_show_axes(self):
        return self.master.placement == Placement.Circular

    @property
    def scaled_radius(self):
        return self.hide_radius / 100 + 1e-5

    def update_radius(self):
        self.update_circle()
        self.update_anchors()

    def set_view_box_range(self):
        def min_max(a, b):
            return (min(np.amin(a), np.amin(b), -1.05),
                    max(np.amax(a), np.amax(b), 1.05))

        points, _ = self.master.get_anchors()
        coords = self.master.get_coordinates_data()
        if points is None or coords is None:
            return

        min_x, max_x = min_max(points[:, 0], coords[0])
        min_y, max_y = min_max(points[:, 1], coords[1])
        rect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y)
        self.view_box.setRange(rect, padding=0.025)

    def update_anchors(self):
        points, labels = self.master.get_anchors()
        if points is None:
            return
        r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))
        if self.anchor_items is None:
            self.anchor_items = []
            for point, label in zip(points, labels):
                anchor = AnchorItem(line=QLineF(0, 0, *point))
                anchor._label.setToolTip(f"<b>{label}</b>")
                label = label[:MAX_LABEL_LEN - 3] + "..." if len(label) > MAX_LABEL_LEN else label
                anchor.setText(label)
                anchor.setFont(self.parameter_setter.anchor_font)

                visible = self.always_show_axes or np.linalg.norm(point) > r
                anchor.setVisible(visible)
                anchor.setPen(pg.mkPen((100, 100, 100)))
                self.plot_widget.addItem(anchor)
                self.anchor_items.append(anchor)
        else:
            for anchor, point, label in zip(self.anchor_items, points, labels):
                anchor.setLine(QLineF(0, 0, *point))
                visible = self.always_show_axes or np.linalg.norm(point) > r
                anchor.setVisible(visible)
                anchor.setFont(self.parameter_setter.anchor_font)

    def update_circle(self):
        super().update_circle()

        if self.always_show_axes:
            self.plot_widget.removeItem(self.circle_item)
            self.circle_item = None

        if self.circle_item is not None:
            points, _ = self.master.get_anchors()
            if points is None:
                return

            r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))
            self.circle_item.setRect(QRectF(-r, -r, 2 * r, 2 * r))
            color = self.plot_widget.palette().color(QPalette.Disabled, QPalette.Text)
            pen = pg.mkPen(color, width=1, cosmetic=True)
            self.circle_item.setPen(pen)


Placement = Enum("Placement", dict(Circular=0, LDA=1, PCA=2), type=int,
                 qualname="Placement")


class OWLinearProjection(OWAnchorProjectionWidget):
    name = "Linear Projection"
    description = "A multi-axis projection of data onto " \
                  "a two-dimensional plane."
    icon = "icons/LinearProjection.svg"
    priority = 240
    keywords = []

    Projection_name = {Placement.Circular: "Circular Placement",
                       Placement.LDA: "Linear Discriminant Analysis",
                       Placement.PCA: "Principal Component Analysis"}

    settings_version = 6

    placement = Setting(Placement.Circular)
    selected_vars = ContextSetting([])
    vizrank = SettingProvider(LinearProjectionVizRank)
    GRAPH_CLASS = OWLinProjGraph
    graph = SettingProvider(OWLinProjGraph)

    class Error(OWAnchorProjectionWidget.Error):
        no_cont_features = Msg("Plotting requires numeric features")

    def _add_controls(self):
        box = gui.vBox(self.controlArea, box="Features")
        self._add_controls_variables(box)
        self._add_controls_placement(box)
        super()._add_controls()
        self.gui.add_control(
            self._effects_box, gui.hSlider, "Hide radius:", master=self.graph,
            value="hide_radius", minValue=0, maxValue=100, step=10,
            createLabel=False, callback=self.__radius_slider_changed
        )

    def _add_controls_variables(self, box):
        self.model_selected = VariableSelectionModel(self.selected_vars)
        variables_selection(box, self, self.model_selected)
        self.model_selected.selection_changed.connect(
            self.__model_selected_changed)
        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(
            None, self, "Suggest Features", self.__vizrank_set_attrs)
        box.layout().addWidget(self.btn_vizrank)

    def _add_controls_placement(self, box):
        self.radio_placement = gui.radioButtonsInBox(
            box, self, "placement",
            btnLabels=[self.Projection_name[x] for x in Placement],
            callback=self.__placement_radio_changed
        )

    def _add_buttons(self):
        self.gui.box_zoom_select(self.buttonsArea)
        gui.auto_send(self.buttonsArea, self, "auto_commit")

    @property
    def continuous_variables(self):
        if self.data is None or self.data.domain is None:
            return []
        dom = self.data.domain
        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]

    @property
    def effective_variables(self):
        return self.selected_vars

    @property
    def effective_data(self):
        return self.data.transform(Domain(self.effective_variables))

    def __vizrank_set_attrs(self, attrs):
        if not attrs:
            return
        self.selected_vars[:] = attrs
        # Ugly, but the alternative is to have yet another signal to which
        # the view will have to connect
        self.model_selected.selection_changed.emit()

    def __model_selected_changed(self):
        self.projection = None
        self._check_options()
        self.init_projection()
        self.setup_plot()
        self.commit.deferred()

    def __placement_radio_changed(self):
        self.controls.graph.hide_radius.setEnabled(
            self.placement != Placement.Circular)
        self.projection = self.projector = None
        self._init_vizrank()
        self.init_projection()
        self.setup_plot()
        self.commit.deferred()

    def __radius_slider_changed(self):
        self.graph.update_radius()

    def colors_changed(self):
        super().colors_changed()
        self._init_vizrank()

    @OWAnchorProjectionWidget.Inputs.data
    def set_data(self, data):
        super().set_data(data)
        self._check_options()
        self._init_vizrank()
        self.init_projection()

    def _check_options(self):
        buttons = self.radio_placement.buttons
        for btn in buttons:
            btn.setEnabled(True)

        if self.data is not None:
            has_discrete_class = self.data.domain.has_discrete_class
            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:
                buttons[Placement.LDA].setEnabled(False)
                if self.placement == Placement.LDA:
                    self.placement = Placement.Circular

        self.controls.graph.hide_radius.setEnabled(
            self.placement != Placement.Circular)

    def _init_vizrank(self):
        is_enabled, msg = False, ""
        if self.data is None:
            msg = "There is no data."
        elif self.attr_color is None:
            msg = "Color variable has to be selected"
        elif self.attr_color.is_continuous and \
                self.placement == Placement.LDA:
            msg = "Suggest Features does not work for Linear " \
                  "Discriminant Analysis Projection when " \
                  "continuous color variable is selected."
        elif len([v for v in self.continuous_variables
                  if v is not self.attr_color]) < 3:
            msg = "Not enough available continuous variables"
        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:
            msg = "Not enough valid data instances"
        else:
            is_enabled = not np.isnan(self.data.get_column_view(
                self.attr_color)[0].astype(float)).all()
        self.btn_vizrank.setToolTip(msg)
        self.btn_vizrank.setEnabled(is_enabled)
        if is_enabled:
            self.vizrank.initialize()

    def check_data(self):
        def error(err):
            err()
            self.data = None

        super().check_data()
        if self.data is not None:
            if not len(self.continuous_variables):
                error(self.Error.no_cont_features)

    def init_attr_values(self):
        super().init_attr_values()
        self.selected_vars[:] = self.continuous_variables[:3]
        self.model_selected[:] = self.continuous_variables

    def init_projection(self):
        if self.placement == Placement.Circular:
            self.projector = CircularPlacement()
        elif self.placement == Placement.LDA:
            self.projector = LDA(solver="eigen", n_components=2)
        elif self.placement == Placement.PCA:
            self.projector = PCA(n_components=2)
            self.projector.component = 2
            self.projector.preprocessors = PCA.preprocessors + [Normalize()]

        super().init_projection()

    def get_coordinates_data(self):
        def normalized(a):
            span = np.max(a, axis=0) - np.min(a, axis=0)
            span[span == 0] = 1
            return (a - np.mean(a, axis=0)) / span

        embedding = self.get_embedding()
        if embedding is None:
            return None, None
        norm_emb = normalized(embedding[self.valid_data])
        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \
            if embedding.shape[1] == 1 else norm_emb.T

    def _get_send_report_caption(self):
        def projection_name():
            return self.Projection_name[self.placement]

        return report.render_items_vert((
            ("Projection", projection_name()),
            ("Color", self._get_caption_var_name(self.attr_color)),
            ("Label", self._get_caption_var_name(self.attr_label)),
            ("Shape", self._get_caption_var_name(self.attr_shape)),
            ("Size", self._get_caption_var_name(self.attr_size)),
            ("Jittering", self.graph.jitter_size != 0 and
             "{} %".format(self.graph.jitter_size))))

    @classmethod
    def migrate_settings(cls, settings_, version):
        if version < 2:
            settings_["point_width"] = settings_["point_size"]
        if version < 3:
            settings_graph = {}
            settings_graph["jitter_size"] = settings_["jitter_value"]
            settings_graph["point_width"] = settings_["point_width"]
            settings_graph["alpha_value"] = settings_["alpha_value"]
            settings_graph["class_density"] = settings_["class_density"]
            settings_["graph"] = settings_graph
        if version < 4:
            if "radius" in settings_:
                settings_["graph"]["hide_radius"] = settings_["radius"]
            if "selection_indices" in settings_ and \
                    settings_["selection_indices"] is not None:
                selection = settings_["selection_indices"]
                settings_["selection"] = [(i, 1) for i, selected in
                                          enumerate(selection) if selected]
        if version < 5:
            if "placement" in settings_ and \
                    settings_["placement"] not in Placement:
                settings_["placement"] = Placement.Circular

    @classmethod
    def migrate_context(cls, context, version):
        values = context.values
        if version < 2:
            domain = context.ordered_domain
            c_domain = [t for t in context.ordered_domain if t[1] == 2]
            d_domain = [t for t in context.ordered_domain if t[1] == 1]
            for d, old_val, new_val in ((domain, "color_index", "attr_color"),
                                        (d_domain, "shape_index", "attr_shape"),
                                        (c_domain, "size_index", "attr_size")):
                index = context.values[old_val][0] - 1
                values[new_val] = (d[index][0], d[index][1] + 100) \
                    if 0 <= index < len(d) else None
        if version < 3:
            values["graph"] = {
                "attr_color": values["attr_color"],
                "attr_shape": values["attr_shape"],
                "attr_size": values["attr_size"]
            }
        if version == 3:
            values["attr_color"] = values["graph"]["attr_color"]
            values["attr_size"] = values["graph"]["attr_size"]
            values["attr_shape"] = values["graph"]["attr_shape"]
            values["attr_label"] = values["graph"]["attr_label"]
        if version < 6 and "selected_vars" in values:
            values["selected_vars"] = (values["selected_vars"], -3)

    # for backward compatibility with settings < 6, pull the enum from global
    # namespace into class
    Placement = Placement


def column_data(table, var, dtype):
    dtype = np.dtype(dtype)
    col, copy = table.get_column_view(var)
    if not isinstance(col.dtype.type, np.inexact):
        col = col.astype(float)
        copy = True
    if dtype != col.dtype:
        col = col.astype(dtype)
        copy = True

    if not copy:
        col = col.copy()
    return col


class CircularPlacement(LinearProjector):
    def get_components(self, X, Y):
        # Return circular axes for linear projection
        n_axes = X.shape[1]
        if n_axes == 1:
            axes_angle = [0]
        elif n_axes == 2:
            axes_angle = [0, np.pi / 2]
        else:
            axes_angle = np.linspace(0, 2 * np.pi, n_axes,
                                     endpoint=False)
        return np.vstack((np.cos(axes_angle), np.sin(axes_angle)))


if __name__ == "__main__":  # pragma: no cover
    iris = Table("iris")
    WidgetPreview(OWLinearProjection).run(set_data=iris,
                                          set_subset_data=iris[::10])

```
--- 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:** LDA Placement in Linear Projection Widget Does Not Output Components

**Description:**
When using the Linear Projection widget with LDA placement, the widget fails to produce the expected output components. Specifically, after setting the placement to LDA and providing the appropriate dataset, the widget does not emit the transformed data, resulting in no components being available for further processing.

**Steps to Reproduce:**
1. Load a dataset with class variables into the Linear Projection widget.
2. Select the LDA placement option.
3. Attempt to retrieve the output components.

**Example Code:**
```python
from Orange.data import Table
from Orange.widgets.visualize.owlinearprojection import OWLinearProjection

# Initialize widget
widget = OWLinearProjection()

# Load data with class variables
data = Table("iris")
widget.set_data(data)

# Set placement to LDA
widget.placement = Placement.LDA

# Attempt to get output components
output = widget.get_output_components()
print(output)  # Expected to have 2 components, but returns None
```

**Expected Behavior:**
After selecting LDA placement and providing a dataset with class variables, the Linear Projection widget should transform the data accordingly and output the transformed components with a length of 2.

**Actual Behavior:**
Selecting LDA placement results in the widget not emitting any output components, causing downstream processes to receive `None` instead of the expected transformed data.
{
    "TestOWLinearProjection.test_attr_label_metas": "PASSED",
    "TestOWLinearProjection.test_attr_models": "PASSED",
    "TestOWLinearProjection.test_bad_data": "PASSED",
    "TestOWLinearProjection.test_btn_vizrank": "PASSED",
    "TestOWLinearProjection.test_buttons": "PASSED",
    "TestOWLinearProjection.test_class_density": "PASSED",
    "TestOWLinearProjection.test_data_no_cont_features": "PASSED",
    "TestOWLinearProjection.test_datasets": "PASSED",
    "TestOWLinearProjection.test_default_attrs": "PASSED",
    "TestOWLinearProjection.test_dragging_tooltip": "PASSED",
    "TestOWLinearProjection.test_embedding_missing_values": "PASSED",
    "TestOWLinearProjection.test_handle_primitive_metas": "PASSED",
    "TestOWLinearProjection.test_hidden_effective_variables": "PASSED",
    "TestOWLinearProjection.test_image_export": "PASSED",
    "TestOWLinearProjection.test_invalid_data": "PASSED",
    "TestOWLinearProjection.test_invalidated_embedding": "PASSED",
    "TestOWLinearProjection.test_invalidated_model_selected": "PASSED",
    "TestOWLinearProjection.test_manual_move": "PASSED",
    "TestOWLinearProjection.test_migrate_settings_from_version_1": "PASSED",
    "TestOWLinearProjection.test_minimum_size": "PASSED",
    "TestOWLinearProjection.test_msg_base_class": "PASSED",
    "TestOWLinearProjection.test_nan_plot": "PASSED",
    "TestOWLinearProjection.test_no_data_for_lda": "PASSED",
    "TestOWLinearProjection.test_none_data": "PASSED",
    "TestOWLinearProjection.test_outputs": "PASSED",
    "TestOWLinearProjection.test_plot_once": "PASSED",
    "TestOWLinearProjection.test_radius": "PASSED",
    "TestOWLinearProjection.test_saved_selection": "PASSED",
    "TestOWLinearProjection.test_send_report": "PASSED",
    "TestOWLinearProjection.test_set_radius_no_data": "PASSED",
    "TestOWLinearProjection.test_setup_graph": "PASSED",
    "TestOWLinearProjection.test_sparse_data": "PASSED",
    "TestOWLinearProjection.test_subset_data_color": "PASSED",
    "TestOWLinearProjection.test_two_classes_dataset": "PASSED",
    "TestOWLinearProjection.test_unique_name": "PASSED",
    "TestOWLinearProjection.test_visual_settings": "PASSED",
    "LinProjVizRankTests.test_continuous_class": "PASSED",
    "LinProjVizRankTests.test_discrete_class": "PASSED",
    "LinProjVizRankTests.test_image_export": "PASSED",
    "LinProjVizRankTests.test_minimum_size": "PASSED",
    "LinProjVizRankTests.test_msg_base_class": "PASSED",
    "LinProjVizRankTests.test_set_attrs": "PASSED"
}
diff --git a/Orange/widgets/visualize/owlinearprojection.py b/Orange/widgets/visualize/owlinearprojection.py
index 8baa07524..1e6498f76 100644
--- a/Orange/widgets/visualize/owlinearprojection.py
+++ b/Orange/widgets/visualize/owlinearprojection.py
@@ -329,7 +329,10 @@ class OWLinearProjection(OWAnchorProjectionWidget):
 
     @property
     def effective_data(self):
-        return self.data.transform(Domain(self.effective_variables))
+        cvs = None
+        if self.placement == Placement.LDA:
+            cvs = self.data.domain.class_vars
+        return self.data.transform(Domain(self.effective_variables, cvs))
 
     def __vizrank_set_attrs(self, attrs):
         if not attrs:
diff --git a/Orange/widgets/visualize/utils/widget.py b/Orange/widgets/visualize/utils/widget.py
index 924acc179..62ede7c3e 100644
--- a/Orange/widgets/visualize/utils/widget.py
+++ b/Orange/widgets/visualize/utils/widget.py
@@ -455,7 +455,10 @@ class OWDataProjectionWidget(OWProjectionWidgetBase, openclass=True):
         self.openContext(self.data)
         self._invalidated = not (
             data_existed and self.data is not None and
-            array_equal(effective_data.X, self.effective_data.X))
+            array_equal(effective_data.X, self.effective_data.X) and
+            array_equal(effective_data.Y, self.effective_data.Y) and
+            array_equal(effective_data.metas, self.effective_data.metas)
+        )
         self._domain_invalidated = not (
             data_existed and self.data is not None and
             effective_data.domain.checksum()
 

{"Orange/widgets/visualize/owlinearprojection.py": "\"\"\"\nLinear Projection widget\n------------------------\n\"\"\"\n\nfrom itertools import islice, permutations, chain\nfrom math import factorial\n\nimport numpy as np\n\nfrom sklearn.neighbors import NearestNeighbors\nfrom sklearn.metrics import r2_score\n\nfrom AnyQt.QtGui import QStandardItem, QPalette\nfrom AnyQt.QtCore import Qt, QRectF, QLineF, pyqtSignal as Signal\n\nimport pyqtgraph as pg\n\nfrom Orange.data import Table, Domain\nfrom Orange.preprocess import Normalize\nfrom Orange.preprocess.score import ReliefF, RReliefF\nfrom Orange.projection import PCA, LDA, LinearProjector\nfrom Orange.util import Enum\nfrom Orange.widgets import gui, report\nfrom Orange.widgets.gui import OWComponent\nfrom Orange.widgets.settings import Setting, ContextSetting, SettingProvider\nfrom Orange.widgets.utils.plot import variables_selection\nfrom Orange.widgets.utils.plot.owplotgui import VariableSelectionModel\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.visualize.utils import VizRankDialog\nfrom Orange.widgets.visualize.utils.component import OWGraphWithAnchors\nfrom Orange.widgets.visualize.utils.plotutils import AnchorItem\nfrom Orange.widgets.visualize.utils.widget import OWAnchorProjectionWidget\nfrom Orange.widgets.widget import Msg\n\n\nMAX_LABEL_LEN = 20\n\n\nclass LinearProjectionVizRank(VizRankDialog, OWComponent):\n    captionTitle = \"Score Plots\"\n    n_attrs = Setting(3)\n    minK = 10\n\n    attrsSelected = Signal([])\n    _AttrRole = next(gui.OrangeUserRole)\n\n    def __init__(self, master):\n        # Add the spin box for a number of attributes to take into account.\n        VizRankDialog.__init__(self, master)\n        OWComponent.__init__(self, master)\n\n        box = gui.hBox(self)\n        max_n_attrs = len(master.model_selected)\n        self.n_attrs_spin = gui.spin(\n            box, self, \"n_attrs\", 3, max_n_attrs, label=\"Number of variables: \",\n            controlWidth=50, alignment=Qt.AlignRight, callback=self._n_attrs_changed)\n        gui.rubber(box)\n        self.last_run_n_attrs = None\n        self.attr_color = master.attr_color\n        self.attrs = []\n\n    def initialize(self):\n        super().initialize()\n        self.attr_color = self.master.attr_color\n\n    def before_running(self):\n        \"\"\"\n        Disable the spin for number of attributes before running and\n        enable afterwards. Also, if the number of attributes is different than\n        in the last run, reset the saved state (if it was paused).\n        \"\"\"\n        if self.n_attrs != self.last_run_n_attrs:\n            self.saved_state = None\n            self.saved_progress = 0\n        if self.saved_state is None:\n            self.scores = []\n            self.rank_model.clear()\n        self.last_run_n_attrs = self.n_attrs\n        self.n_attrs_spin.setDisabled(True)\n\n    def stopped(self):\n        self.n_attrs_spin.setDisabled(False)\n\n    def check_preconditions(self):\n        master = self.master\n        if not super().check_preconditions():\n            return False\n        elif not master.btn_vizrank.isEnabled():\n            return False\n        n_cont_var = len([v for v in master.continuous_variables\n                          if v is not master.attr_color])\n        self.n_attrs_spin.setMaximum(n_cont_var)\n        return True\n\n    def state_count(self):\n        n_all_attrs = len(self.attrs)\n        if not n_all_attrs:\n            return 0\n        n_attrs = self.n_attrs\n        return factorial(n_all_attrs) // (2 * factorial(n_all_attrs - n_attrs) * n_attrs)\n\n    def iterate_states(self, state):\n        if state is None:  # on the first call, compute order\n            self.attrs = self._score_heuristic()\n            state = list(range(self.n_attrs))\n        else:\n            state = list(state)\n\n        def combinations(n, s):\n            while True:\n                yield s\n                for up, _ in enumerate(s):\n                    s[up] += 1\n                    if up + 1 == len(s) or s[up] < s[up + 1]:\n                        break\n                    s[up] = up\n                if s[-1] == n:\n                    break\n\n        for c in combinations(len(self.attrs), state):\n            for p in islice(permutations(c[1:]), factorial(len(c) - 1) // 2):\n                yield (c[0], ) + p\n\n    def compute_score(self, state):\n        master = self.master\n        data = master.data\n        domain = Domain([self.attrs[i] for i in state], data.domain.class_vars)\n        projection = master.projector(data.transform(domain))\n        ec = projection(data).X\n        y = column_data(data, self.attr_color, dtype=float)\n        if ec.shape[0] < self.minK:\n            return None\n        n_neighbors = min(self.minK, len(ec) - 1)\n        knn = NearestNeighbors(n_neighbors=n_neighbors).fit(ec)\n        ind = knn.kneighbors(return_distance=False)\n        # pylint: disable=invalid-unary-operand-type\n        if self.attr_color.is_discrete:\n            return -np.sum(y[ind] == y.reshape(-1, 1)) / n_neighbors / len(y)\n        return -r2_score(y, np.mean(y[ind], axis=1)) * (len(y) / len(data))\n\n    def bar_length(self, score):\n        return max(0, -score)\n\n    def _score_heuristic(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        domain = self.master.data.domain\n        attr_color = self.master.attr_color\n        domain = Domain(\n            attributes=[v for v in chain(domain.variables, domain.metas)\n                        if v.is_continuous and v is not attr_color],\n            class_vars=attr_color\n        )\n        data = self.master.data.transform(domain).copy()\n        with data.unlocked():\n            data.X = normalized(data.X)\n        relief = ReliefF if attr_color.is_discrete else RReliefF\n        weights = relief(n_iterations=100, k_nearest=self.minK)(data)\n        results = sorted(zip(weights, domain.attributes), key=lambda x: (-x[0], x[1].name))\n        return [attr for _, attr in results]\n\n    def row_for_state(self, score, state):\n        attrs = [self.attrs[i] for i in state]\n        item = QStandardItem(\", \".join(a.name for a in attrs))\n        item.setData(attrs, self._AttrRole)\n        return [item]\n\n    def on_selection_changed(self, selected, deselected):\n        if not selected.indexes():\n            return\n        attrs = selected.indexes()[0].data(self._AttrRole)\n        self.selectionChanged.emit([attrs])\n\n    def _n_attrs_changed(self):\n        if self.n_attrs != self.last_run_n_attrs or self.saved_state is None:\n            self.button.setText(\"Start\")\n        else:\n            self.button.setText(\"Continue\")\n        self.button.setEnabled(self.check_preconditions())\n\n\nclass OWLinProjGraph(OWGraphWithAnchors):\n    hide_radius = Setting(0)\n\n    @property\n    def always_show_axes(self):\n        return self.master.placement == Placement.Circular\n\n    @property\n    def scaled_radius(self):\n        return self.hide_radius / 100 + 1e-5\n\n    def update_radius(self):\n        self.update_circle()\n        self.update_anchors()\n\n    def set_view_box_range(self):\n        def min_max(a, b):\n            return (min(np.amin(a), np.amin(b), -1.05),\n                    max(np.amax(a), np.amax(b), 1.05))\n\n        points, _ = self.master.get_anchors()\n        coords = self.master.get_coordinates_data()\n        if points is None or coords is None:\n            return\n\n        min_x, max_x = min_max(points[:, 0], coords[0])\n        min_y, max_y = min_max(points[:, 1], coords[1])\n        rect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y)\n        self.view_box.setRange(rect, padding=0.025)\n\n    def update_anchors(self):\n        points, labels = self.master.get_anchors()\n        if points is None:\n            return\n        r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))\n        if self.anchor_items is None:\n            self.anchor_items = []\n            for point, label in zip(points, labels):\n                anchor = AnchorItem(line=QLineF(0, 0, *point))\n                anchor._label.setToolTip(f\"<b>{label}</b>\")\n                label = label[:MAX_LABEL_LEN - 3] + \"...\" if len(label) > MAX_LABEL_LEN else label\n                anchor.setText(label)\n                anchor.setFont(self.parameter_setter.anchor_font)\n\n                visible = self.always_show_axes or np.linalg.norm(point) > r\n                anchor.setVisible(visible)\n                anchor.setPen(pg.mkPen((100, 100, 100)))\n                self.plot_widget.addItem(anchor)\n                self.anchor_items.append(anchor)\n        else:\n            for anchor, point, label in zip(self.anchor_items, points, labels):\n                anchor.setLine(QLineF(0, 0, *point))\n                visible = self.always_show_axes or np.linalg.norm(point) > r\n                anchor.setVisible(visible)\n                anchor.setFont(self.parameter_setter.anchor_font)\n\n    def update_circle(self):\n        super().update_circle()\n\n        if self.always_show_axes:\n            self.plot_widget.removeItem(self.circle_item)\n            self.circle_item = None\n\n        if self.circle_item is not None:\n            points, _ = self.master.get_anchors()\n            if points is None:\n                return\n\n            r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))\n            self.circle_item.setRect(QRectF(-r, -r, 2 * r, 2 * r))\n            color = self.plot_widget.palette().color(QPalette.Disabled, QPalette.Text)\n            pen = pg.mkPen(color, width=1, cosmetic=True)\n            self.circle_item.setPen(pen)\n\n\nPlacement = Enum(\"Placement\", dict(Circular=0, LDA=1, PCA=2), type=int,\n                 qualname=\"Placement\")\n\n\nclass OWLinearProjection(OWAnchorProjectionWidget):\n    name = \"Linear Projection\"\n    description = \"A multi-axis projection of data onto \" \\\n                  \"a two-dimensional plane.\"\n    icon = \"icons/LinearProjection.svg\"\n    priority = 240\n    keywords = []\n\n    Projection_name = {Placement.Circular: \"Circular Placement\",\n                       Placement.LDA: \"Linear Discriminant Analysis\",\n                       Placement.PCA: \"Principal Component Analysis\"}\n\n    settings_version = 6\n\n    placement = Setting(Placement.Circular)\n    selected_vars = ContextSetting([])\n    vizrank = SettingProvider(LinearProjectionVizRank)\n    GRAPH_CLASS = OWLinProjGraph\n    graph = SettingProvider(OWLinProjGraph)\n\n    class Error(OWAnchorProjectionWidget.Error):\n        no_cont_features = Msg(\"Plotting requires numeric features\")\n\n    def _add_controls(self):\n        box = gui.vBox(self.controlArea, box=\"Features\")\n        self._add_controls_variables(box)\n        self._add_controls_placement(box)\n        super()._add_controls()\n        self.gui.add_control(\n            self._effects_box, gui.hSlider, \"Hide radius:\", master=self.graph,\n            value=\"hide_radius\", minValue=0, maxValue=100, step=10,\n            createLabel=False, callback=self.__radius_slider_changed\n        )\n\n    def _add_controls_variables(self, box):\n        self.model_selected = VariableSelectionModel(self.selected_vars)\n        variables_selection(box, self, self.model_selected)\n        self.model_selected.selection_changed.connect(\n            self.__model_selected_changed)\n        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(\n            None, self, \"Suggest Features\", self.__vizrank_set_attrs)\n        box.layout().addWidget(self.btn_vizrank)\n\n    def _add_controls_placement(self, box):\n        self.radio_placement = gui.radioButtonsInBox(\n            box, self, \"placement\",\n            btnLabels=[self.Projection_name[x] for x in Placement],\n            callback=self.__placement_radio_changed\n        )\n\n    def _add_buttons(self):\n        self.gui.box_zoom_select(self.buttonsArea)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    @property\n    def continuous_variables(self):\n        if self.data is None or self.data.domain is None:\n            return []\n        dom = self.data.domain\n        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]\n\n    @property\n    def effective_variables(self):\n        return self.selected_vars\n\n    @property\n    def effective_data(self):\n        return self.data.transform(Domain(self.effective_variables))\n\n    def __vizrank_set_attrs(self, attrs):\n        if not attrs:\n            return\n        self.selected_vars[:] = attrs\n        # Ugly, but the alternative is to have yet another signal to which\n        # the view will have to connect\n        self.model_selected.selection_changed.emit()\n\n    def __model_selected_changed(self):\n        self.projection = None\n        self._check_options()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __placement_radio_changed(self):\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n        self.projection = self.projector = None\n        self._init_vizrank()\n        self.init_projection()\n        self.setup_plot()\n        self.commit.deferred()\n\n    def __radius_slider_changed(self):\n        self.graph.update_radius()\n\n    def colors_changed(self):\n        super().colors_changed()\n        self._init_vizrank()\n\n    @OWAnchorProjectionWidget.Inputs.data\n    def set_data(self, data):\n        super().set_data(data)\n        self._check_options()\n        self._init_vizrank()\n        self.init_projection()\n\n    def _check_options(self):\n        buttons = self.radio_placement.buttons\n        for btn in buttons:\n            btn.setEnabled(True)\n\n        if self.data is not None:\n            has_discrete_class = self.data.domain.has_discrete_class\n            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:\n                buttons[Placement.LDA].setEnabled(False)\n                if self.placement == Placement.LDA:\n                    self.placement = Placement.Circular\n\n        self.controls.graph.hide_radius.setEnabled(\n            self.placement != Placement.Circular)\n\n    def _init_vizrank(self):\n        is_enabled, msg = False, \"\"\n        if self.data is None:\n            msg = \"There is no data.\"\n        elif self.attr_color is None:\n            msg = \"Color variable has to be selected\"\n        elif self.attr_color.is_continuous and \\\n                self.placement == Placement.LDA:\n            msg = \"Suggest Features does not work for Linear \" \\\n                  \"Discriminant Analysis Projection when \" \\\n                  \"continuous color variable is selected.\"\n        elif len([v for v in self.continuous_variables\n                  if v is not self.attr_color]) < 3:\n            msg = \"Not enough available continuous variables\"\n        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:\n            msg = \"Not enough valid data instances\"\n        else:\n            is_enabled = not np.isnan(self.data.get_column_view(\n                self.attr_color)[0].astype(float)).all()\n        self.btn_vizrank.setToolTip(msg)\n        self.btn_vizrank.setEnabled(is_enabled)\n        if is_enabled:\n            self.vizrank.initialize()\n\n    def check_data(self):\n        def error(err):\n            err()\n            self.data = None\n\n        super().check_data()\n        if self.data is not None:\n            if not len(self.continuous_variables):\n                error(self.Error.no_cont_features)\n\n    def init_attr_values(self):\n        super().init_attr_values()\n        self.selected_vars[:] = self.continuous_variables[:3]\n        self.model_selected[:] = self.continuous_variables\n\n    def init_projection(self):\n        if self.placement == Placement.Circular:\n            self.projector = CircularPlacement()\n        elif self.placement == Placement.LDA:\n            self.projector = LDA(solver=\"eigen\", n_components=2)\n        elif self.placement == Placement.PCA:\n            self.projector = PCA(n_components=2)\n            self.projector.component = 2\n            self.projector.preprocessors = PCA.preprocessors + [Normalize()]\n\n        super().init_projection()\n\n    def get_coordinates_data(self):\n        def normalized(a):\n            span = np.max(a, axis=0) - np.min(a, axis=0)\n            span[span == 0] = 1\n            return (a - np.mean(a, axis=0)) / span\n\n        embedding = self.get_embedding()\n        if embedding is None:\n            return None, None\n        norm_emb = normalized(embedding[self.valid_data])\n        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \\\n            if embedding.shape[1] == 1 else norm_emb.T\n\n    def _get_send_report_caption(self):\n        def projection_name():\n            return self.Projection_name[self.placement]\n\n        return report.render_items_vert((\n            (\"Projection\", projection_name()),\n            (\"Color\", self._get_caption_var_name(self.attr_color)),\n            (\"Label\", self._get_caption_var_name(self.attr_label)),\n            (\"Shape\", self._get_caption_var_name(self.attr_shape)),\n            (\"Size\", self._get_caption_var_name(self.attr_size)),\n            (\"Jittering\", self.graph.jitter_size != 0 and\n             \"{} %\".format(self.graph.jitter_size))))\n\n    @classmethod\n    def migrate_settings(cls, settings_, version):\n        if version < 2:\n            settings_[\"point_width\"] = settings_[\"point_size\"]\n        if version < 3:\n            settings_graph = {}\n            settings_graph[\"jitter_size\"] = settings_[\"jitter_value\"]\n            settings_graph[\"point_width\"] = settings_[\"point_width\"]\n            settings_graph[\"alpha_value\"] = settings_[\"alpha_value\"]\n            settings_graph[\"class_density\"] = settings_[\"class_density\"]\n            settings_[\"graph\"] = settings_graph\n        if version < 4:\n            if \"radius\" in settings_:\n                settings_[\"graph\"][\"hide_radius\"] = settings_[\"radius\"]\n            if \"selection_indices\" in settings_ and \\\n                    settings_[\"selection_indices\"] is not None:\n                selection = settings_[\"selection_indices\"]\n                settings_[\"selection\"] = [(i, 1) for i, selected in\n                                          enumerate(selection) if selected]\n        if version < 5:\n            if \"placement\" in settings_ and \\\n                    settings_[\"placement\"] not in Placement:\n                settings_[\"placement\"] = Placement.Circular\n\n    @classmethod\n    def migrate_context(cls, context, version):\n        values = context.values\n        if version < 2:\n            domain = context.ordered_domain\n            c_domain = [t for t in context.ordered_domain if t[1] == 2]\n            d_domain = [t for t in context.ordered_domain if t[1] == 1]\n            for d, old_val, new_val in ((domain, \"color_index\", \"attr_color\"),\n                                        (d_domain, \"shape_index\", \"attr_shape\"),\n                                        (c_domain, \"size_index\", \"attr_size\")):\n                index = context.values[old_val][0] - 1\n                values[new_val] = (d[index][0], d[index][1] + 100) \\\n                    if 0 <= index < len(d) else None\n        if version < 3:\n            values[\"graph\"] = {\n                \"attr_color\": values[\"attr_color\"],\n                \"attr_shape\": values[\"attr_shape\"],\n                \"attr_size\": values[\"attr_size\"]\n            }\n        if version == 3:\n            values[\"attr_color\"] = values[\"graph\"][\"attr_color\"]\n            values[\"attr_size\"] = values[\"graph\"][\"attr_size\"]\n            values[\"attr_shape\"] = values[\"graph\"][\"attr_shape\"]\n            values[\"attr_label\"] = values[\"graph\"][\"attr_label\"]\n        if version < 6 and \"selected_vars\" in values:\n            values[\"selected_vars\"] = (values[\"selected_vars\"], -3)\n\n    # for backward compatibility with settings < 6, pull the enum from global\n    # namespace into class\n    Placement = Placement\n\n\ndef column_data(table, var, dtype):\n    dtype = np.dtype(dtype)\n    col, copy = table.get_column_view(var)\n    if not isinstance(col.dtype.type, np.inexact):\n        col = col.astype(float)\n        copy = True\n    if dtype != col.dtype:\n        col = col.astype(dtype)\n        copy = True\n\n    if not copy:\n        col = col.copy()\n    return col\n\n\nclass CircularPlacement(LinearProjector):\n    def get_components(self, X, Y):\n        # Return circular axes for linear projection\n        n_axes = X.shape[1]\n        if n_axes == 1:\n            axes_angle = [0]\n        elif n_axes == 2:\n            axes_angle = [0, np.pi / 2]\n        else:\n            axes_angle = np.linspace(0, 2 * np.pi, n_axes,\n                                     endpoint=False)\n        return np.vstack((np.cos(axes_angle), np.sin(axes_angle)))\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    iris = Table(\"iris\")\n    WidgetPreview(OWLinearProjection).run(set_data=iris,\n                                          set_subset_data=iris[::10])\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:** LDA Placement in Linear Projection Widget Does Not Output Components

**Description:**
When using the Linear Projection widget with LDA placement, the widget fails to produce the expected output components. Specifically, after setting the placement to LDA and providing the appropriate dataset, the widget does not emit the transformed data, resulting in no components being available for further processing.

**Steps to Reproduce:**
1. Load a dataset with class variables into the Linear Projection widget.
2. Select the LDA placement option.
3. Attempt to retrieve the output components.

**Example Code:**
```python
from Orange.data import Table
from Orange.widgets.visualize.owlinearprojection import OWLinearProjection

# Initialize widget
widget = OWLinearProjection()

# Load data with class variables
data = Table("iris")
widget.set_data(data)

# Set placement to LDA
widget.placement = Placement.LDA

# Attempt to get output components
output = widget.get_output_components()
print(output)  # Expected to have 2 components, but returns None
```

**Expected Behavior:**
After selecting LDA placement and providing a dataset with class variables, the Linear Projection widget should transform the data accordingly and output the transformed components with a length of 2.

**Actual Behavior:**
Selecting LDA placement results in the widget not emitting any output components, causing downstream processes to receive `None` instead of the expected transformed data.
--- 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/visualize/owlinearprojection.py
"""
Linear Projection widget
------------------------
"""

from itertools import islice, permutations, chain
from math import factorial

import numpy as np

from sklearn.neighbors import NearestNeighbors
from sklearn.metrics import r2_score

from AnyQt.QtGui import QStandardItem, QPalette
from AnyQt.QtCore import Qt, QRectF, QLineF, pyqtSignal as Signal

import pyqtgraph as pg

from Orange.data import Table, Domain
from Orange.preprocess import Normalize
from Orange.preprocess.score import ReliefF, RReliefF
from Orange.projection import PCA, LDA, LinearProjector
from Orange.util import Enum
from Orange.widgets import gui, report
from Orange.widgets.gui import OWComponent
from Orange.widgets.settings import Setting, ContextSetting, SettingProvider
from Orange.widgets.utils.plot import variables_selection
from Orange.widgets.utils.plot.owplotgui import VariableSelectionModel
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.visualize.utils import VizRankDialog
from Orange.widgets.visualize.utils.component import OWGraphWithAnchors
from Orange.widgets.visualize.utils.plotutils import AnchorItem
from Orange.widgets.visualize.utils.widget import OWAnchorProjectionWidget
from Orange.widgets.widget import Msg


MAX_LABEL_LEN = 20


class LinearProjectionVizRank(VizRankDialog, OWComponent):
    captionTitle = "Score Plots"
    n_attrs = Setting(3)
    minK = 10

    attrsSelected = Signal([])
    _AttrRole = next(gui.OrangeUserRole)

    def __init__(self, master):
        # Add the spin box for a number of attributes to take into account.
        VizRankDialog.__init__(self, master)
        OWComponent.__init__(self, master)

        box = gui.hBox(self)
        max_n_attrs = len(master.model_selected)
        self.n_attrs_spin = gui.spin(
            box, self, "n_attrs", 3, max_n_attrs, label="Number of variables: ",
            controlWidth=50, alignment=Qt.AlignRight, callback=self._n_attrs_changed)
        gui.rubber(box)
        self.last_run_n_attrs = None
        self.attr_color = master.attr_color
        self.attrs = []

    def initialize(self):
        super().initialize()
        self.attr_color = self.master.attr_color

    def before_running(self):
        """
        Disable the spin for number of attributes before running and
        enable afterwards. Also, if the number of attributes is different than
        in the last run, reset the saved state (if it was paused).
        """
        if self.n_attrs != self.last_run_n_attrs:
            self.saved_state = None
            self.saved_progress = 0
        if self.saved_state is None:
            self.scores = []
            self.rank_model.clear()
        self.last_run_n_attrs = self.n_attrs
        self.n_attrs_spin.setDisabled(True)

    def stopped(self):
        self.n_attrs_spin.setDisabled(False)

    def check_preconditions(self):
        master = self.master
        if not super().check_preconditions():
            return False
        elif not master.btn_vizrank.isEnabled():
            return False
        n_cont_var = len([v for v in master.continuous_variables
                          if v is not master.attr_color])
        self.n_attrs_spin.setMaximum(n_cont_var)
        return True

    def state_count(self):
        n_all_attrs = len(self.attrs)
        if not n_all_attrs:
            return 0
        n_attrs = self.n_attrs
        return factorial(n_all_attrs) // (2 * factorial(n_all_attrs - n_attrs) * n_attrs)

    def iterate_states(self, state):
        if state is None:  # on the first call, compute order
            self.attrs = self._score_heuristic()
            state = list(range(self.n_attrs))
        else:
            state = list(state)

        def combinations(n, s):
            while True:
                yield s
                for up, _ in enumerate(s):
                    s[up] += 1
                    if up + 1 == len(s) or s[up] < s[up + 1]:
                        break
                    s[up] = up
                if s[-1] == n:
                    break

        for c in combinations(len(self.attrs), state):
            for p in islice(permutations(c[1:]), factorial(len(c) - 1) // 2):
                yield (c[0], ) + p

    def compute_score(self, state):
        master = self.master
        data = master.data
        domain = Domain([self.attrs[i] for i in state], data.domain.class_vars)
        projection = master.projector(data.transform(domain))
        ec = projection(data).X
        y = column_data(data, self.attr_color, dtype=float)
        if ec.shape[0] < self.minK:
            return None
        n_neighbors = min(self.minK, len(ec) - 1)
        knn = NearestNeighbors(n_neighbors=n_neighbors).fit(ec)
        ind = knn.kneighbors(return_distance=False)
        # pylint: disable=invalid-unary-operand-type
        if self.attr_color.is_discrete:
            return -np.sum(y[ind] == y.reshape(-1, 1)) / n_neighbors / len(y)
        return -r2_score(y, np.mean(y[ind], axis=1)) * (len(y) / len(data))

    def bar_length(self, score):
        return max(0, -score)

    def _score_heuristic(self):
        def normalized(a):
            span = np.max(a, axis=0) - np.min(a, axis=0)
            span[span == 0] = 1
            return (a - np.mean(a, axis=0)) / span

        domain = self.master.data.domain
        attr_color = self.master.attr_color
        domain = Domain(
            attributes=[v for v in chain(domain.variables, domain.metas)
                        if v.is_continuous and v is not attr_color],
            class_vars=attr_color
        )
        data = self.master.data.transform(domain).copy()
        with data.unlocked():
            data.X = normalized(data.X)
        relief = ReliefF if attr_color.is_discrete else RReliefF
        weights = relief(n_iterations=100, k_nearest=self.minK)(data)
        results = sorted(zip(weights, domain.attributes), key=lambda x: (-x[0], x[1].name))
        return [attr for _, attr in results]

    def row_for_state(self, score, state):
        attrs = [self.attrs[i] for i in state]
        item = QStandardItem(", ".join(a.name for a in attrs))
        item.setData(attrs, self._AttrRole)
        return [item]

    def on_selection_changed(self, selected, deselected):
        if not selected.indexes():
            return
        attrs = selected.indexes()[0].data(self._AttrRole)
        self.selectionChanged.emit([attrs])

    def _n_attrs_changed(self):
        if self.n_attrs != self.last_run_n_attrs or self.saved_state is None:
            self.button.setText("Start")
        else:
            self.button.setText("Continue")
        self.button.setEnabled(self.check_preconditions())


class OWLinProjGraph(OWGraphWithAnchors):
    hide_radius = Setting(0)

    @property
    def always_show_axes(self):
        return self.master.placement == Placement.Circular

    @property
    def scaled_radius(self):
        return self.hide_radius / 100 + 1e-5

    def update_radius(self):
        self.update_circle()
        self.update_anchors()

    def set_view_box_range(self):
        def min_max(a, b):
            return (min(np.amin(a), np.amin(b), -1.05),
                    max(np.amax(a), np.amax(b), 1.05))

        points, _ = self.master.get_anchors()
        coords = self.master.get_coordinates_data()
        if points is None or coords is None:
            return

        min_x, max_x = min_max(points[:, 0], coords[0])
        min_y, max_y = min_max(points[:, 1], coords[1])
        rect = QRectF(min_x, min_y, max_x - min_x, max_y - min_y)
        self.view_box.setRange(rect, padding=0.025)

    def update_anchors(self):
        points, labels = self.master.get_anchors()
        if points is None:
            return
        r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))
        if self.anchor_items is None:
            self.anchor_items = []
            for point, label in zip(points, labels):
                anchor = AnchorItem(line=QLineF(0, 0, *point))
                anchor._label.setToolTip(f"<b>{label}</b>")
                label = label[:MAX_LABEL_LEN - 3] + "..." if len(label) > MAX_LABEL_LEN else label
                anchor.setText(label)
                anchor.setFont(self.parameter_setter.anchor_font)

                visible = self.always_show_axes or np.linalg.norm(point) > r
                anchor.setVisible(visible)
                anchor.setPen(pg.mkPen((100, 100, 100)))
                self.plot_widget.addItem(anchor)
                self.anchor_items.append(anchor)
        else:
            for anchor, point, label in zip(self.anchor_items, points, labels):
                anchor.setLine(QLineF(0, 0, *point))
                visible = self.always_show_axes or np.linalg.norm(point) > r
                anchor.setVisible(visible)
                anchor.setFont(self.parameter_setter.anchor_font)

    def update_circle(self):
        super().update_circle()

        if self.always_show_axes:
            self.plot_widget.removeItem(self.circle_item)
            self.circle_item = None

        if self.circle_item is not None:
            points, _ = self.master.get_anchors()
            if points is None:
                return

            r = self.scaled_radius * np.max(np.linalg.norm(points, axis=1))
            self.circle_item.setRect(QRectF(-r, -r, 2 * r, 2 * r))
            color = self.plot_widget.palette().color(QPalette.Disabled, QPalette.Text)
            pen = pg.mkPen(color, width=1, cosmetic=True)
            self.circle_item.setPen(pen)


Placement = Enum("Placement", dict(Circular=0, LDA=1, PCA=2), type=int,
                 qualname="Placement")


class OWLinearProjection(OWAnchorProjectionWidget):
    name = "Linear Projection"
    description = "A multi-axis projection of data onto " \
                  "a two-dimensional plane."
    icon = "icons/LinearProjection.svg"
    priority = 240
    keywords = []

    Projection_name = {Placement.Circular: "Circular Placement",
                       Placement.LDA: "Linear Discriminant Analysis",
                       Placement.PCA: "Principal Component Analysis"}

    settings_version = 6

    placement = Setting(Placement.Circular)
    selected_vars = ContextSetting([])
    vizrank = SettingProvider(LinearProjectionVizRank)
    GRAPH_CLASS = OWLinProjGraph
    graph = SettingProvider(OWLinProjGraph)

    class Error(OWAnchorProjectionWidget.Error):
        no_cont_features = Msg("Plotting requires numeric features")

    def _add_controls(self):
        box = gui.vBox(self.controlArea, box="Features")
        self._add_controls_variables(box)
        self._add_controls_placement(box)
        super()._add_controls()
        self.gui.add_control(
            self._effects_box, gui.hSlider, "Hide radius:", master=self.graph,
            value="hide_radius", minValue=0, maxValue=100, step=10,
            createLabel=False, callback=self.__radius_slider_changed
        )

    def _add_controls_variables(self, box):
        self.model_selected = VariableSelectionModel(self.selected_vars)
        variables_selection(box, self, self.model_selected)
        self.model_selected.selection_changed.connect(
            self.__model_selected_changed)
        self.vizrank, self.btn_vizrank = LinearProjectionVizRank.add_vizrank(
            None, self, "Suggest Features", self.__vizrank_set_attrs)
        box.layout().addWidget(self.btn_vizrank)

    def _add_controls_placement(self, box):
        self.radio_placement = gui.radioButtonsInBox(
            box, self, "placement",
            btnLabels=[self.Projection_name[x] for x in Placement],
            callback=self.__placement_radio_changed
        )

    def _add_buttons(self):
        self.gui.box_zoom_select(self.buttonsArea)
        gui.auto_send(self.buttonsArea, self, "auto_commit")

    @property
    def continuous_variables(self):
        if self.data is None or self.data.domain is None:
            return []
        dom = self.data.domain
        return [v for v in chain(dom.variables, dom.metas) if v.is_continuous]

    @property
    def effective_variables(self):
        return self.selected_vars

    @property
    def effective_data(self):
        return self.data.transform(Domain(self.effective_variables))

    def __vizrank_set_attrs(self, attrs):
        if not attrs:
            return
        self.selected_vars[:] = attrs
        # Ugly, but the alternative is to have yet another signal to which
        # the view will have to connect
        self.model_selected.selection_changed.emit()

    def __model_selected_changed(self):
        self.projection = None
        self._check_options()
        self.init_projection()
        self.setup_plot()
        self.commit.deferred()

    def __placement_radio_changed(self):
        self.controls.graph.hide_radius.setEnabled(
            self.placement != Placement.Circular)
        self.projection = self.projector = None
        self._init_vizrank()
        self.init_projection()
        self.setup_plot()
        self.commit.deferred()

    def __radius_slider_changed(self):
        self.graph.update_radius()

    def colors_changed(self):
        super().colors_changed()
        self._init_vizrank()

    @OWAnchorProjectionWidget.Inputs.data
    def set_data(self, data):
        super().set_data(data)
        self._check_options()
        self._init_vizrank()
        self.init_projection()

    def _check_options(self):
        buttons = self.radio_placement.buttons
        for btn in buttons:
            btn.setEnabled(True)

        if self.data is not None:
            has_discrete_class = self.data.domain.has_discrete_class
            if not has_discrete_class or len(np.unique(self.data.Y)) < 3:
                buttons[Placement.LDA].setEnabled(False)
                if self.placement == Placement.LDA:
                    self.placement = Placement.Circular

        self.controls.graph.hide_radius.setEnabled(
            self.placement != Placement.Circular)

    def _init_vizrank(self):
        is_enabled, msg = False, ""
        if self.data is None:
            msg = "There is no data."
        elif self.attr_color is None:
            msg = "Color variable has to be selected"
        elif self.attr_color.is_continuous and \
                self.placement == Placement.LDA:
            msg = "Suggest Features does not work for Linear " \
                  "Discriminant Analysis Projection when " \
                  "continuous color variable is selected."
        elif len([v for v in self.continuous_variables
                  if v is not self.attr_color]) < 3:
            msg = "Not enough available continuous variables"
        elif np.sum(np.all(np.isfinite(self.data.X), axis=1)) < 2:
            msg = "Not enough valid data instances"
        else:
            is_enabled = not np.isnan(self.data.get_column_view(
                self.attr_color)[0].astype(float)).all()
        self.btn_vizrank.setToolTip(msg)
        self.btn_vizrank.setEnabled(is_enabled)
        if is_enabled:
            self.vizrank.initialize()

    def check_data(self):
        def error(err):
            err()
            self.data = None

        super().check_data()
        if self.data is not None:
            if not len(self.continuous_variables):
                error(self.Error.no_cont_features)

    def init_attr_values(self):
        super().init_attr_values()
        self.selected_vars[:] = self.continuous_variables[:3]
        self.model_selected[:] = self.continuous_variables

    def init_projection(self):
        if self.placement == Placement.Circular:
            self.projector = CircularPlacement()
        elif self.placement == Placement.LDA:
            self.projector = LDA(solver="eigen", n_components=2)
        elif self.placement == Placement.PCA:
            self.projector = PCA(n_components=2)
            self.projector.component = 2
            self.projector.preprocessors = PCA.preprocessors + [Normalize()]

        super().init_projection()

    def get_coordinates_data(self):
        def normalized(a):
            span = np.max(a, axis=0) - np.min(a, axis=0)
            span[span == 0] = 1
            return (a - np.mean(a, axis=0)) / span

        embedding = self.get_embedding()
        if embedding is None:
            return None, None
        norm_emb = normalized(embedding[self.valid_data])
        return (norm_emb.ravel(), np.zeros(len(norm_emb), dtype=float)) \
            if embedding.shape[1] == 1 else norm_emb.T

    def _get_send_report_caption(self):
        def projection_name():
            return self.Projection_name[self.placement]

        return report.render_items_vert((
            ("Projection", projection_name()),
            ("Color", self._get_caption_var_name(self.attr_color)),
            ("Label", self._get_caption_var_name(self.attr_label)),
            ("Shape", self._get_caption_var_name(self.attr_shape)),
            ("Size", self._get_caption_var_name(self.attr_size)),
            ("Jittering", self.graph.jitter_size != 0 and
             "{} %".format(self.graph.jitter_size))))

    @classmethod
    def migrate_settings(cls, settings_, version):
        if version < 2:
            settings_["point_width"] = settings_["point_size"]
        if version < 3:
            settings_graph = {}
            settings_graph["jitter_size"] = settings_["jitter_value"]
            settings_graph["point_width"] = settings_["point_width"]
            settings_graph["alpha_value"] = settings_["alpha_value"]
            settings_graph["class_density"] = settings_["class_density"]
            settings_["graph"] = settings_graph
        if version < 4:
            if "radius" in settings_:
                settings_["graph"]["hide_radius"] = settings_["radius"]
            if "selection_indices" in settings_ and \
                    settings_["selection_indices"] is not None:
                selection = settings_["selection_indices"]
                settings_["selection"] = [(i, 1) for i, selected in
                                          enumerate(selection) if selected]
        if version < 5:
            if "placement" in settings_ and \
                    settings_["placement"] not in Placement:
                settings_["placement"] = Placement.Circular

    @classmethod
    def migrate_context(cls, context, version):
        values = context.values
        if version < 2:
            domain = context.ordered_domain
            c_domain = [t for t in context.ordered_domain if t[1] == 2]
            d_domain = [t for t in context.ordered_domain if t[1] == 1]
            for d, old_val, new_val in ((domain, "color_index", "attr_color"),
                                        (d_domain, "shape_index", "attr_shape"),
                                        (c_domain, "size_index", "attr_size")):
                index = context.values[old_val][0] - 1
                values[new_val] = (d[index][0], d[index][1] + 100) \
                    if 0 <= index < len(d) else None
        if version < 3:
            values["graph"] = {
                "attr_color": values["attr_color"],
                "attr_shape": values["attr_shape"],
                "attr_size": values["attr_size"]
            }
        if version == 3:
            values["attr_color"] = values["graph"]["attr_color"]
            values["attr_size"] = values["graph"]["attr_size"]
            values["attr_shape"] = values["graph"]["attr_shape"]
            values["attr_label"] = values["graph"]["attr_label"]
        if version < 6 and "selected_vars" in values:
            values["selected_vars"] = (values["selected_vars"], -3)

    # for backward compatibility with settings < 6, pull the enum from global
    # namespace into class
    Placement = Placement


def column_data(table, var, dtype):
    dtype = np.dtype(dtype)
    col, copy = table.get_column_view(var)
    if not isinstance(col.dtype.type, np.inexact):
        col = col.astype(float)
        copy = True
    if dtype != col.dtype:
        col = col.astype(dtype)
        copy = True

    if not copy:
        col = col.copy()
    return col


class CircularPlacement(LinearProjector):
    def get_components(self, X, Y):
        # Return circular axes for linear projection
        n_axes = X.shape[1]
        if n_axes == 1:
            axes_angle = [0]
        elif n_axes == 2:
            axes_angle = [0, np.pi / 2]
        else:
            axes_angle = np.linspace(0, 2 * np.pi, n_axes,
                                     endpoint=False)
        return np.vstack((np.cos(axes_angle), np.sin(axes_angle)))


if __name__ == "__main__":  # pragma: no cover
    iris = Table("iris")
    WidgetPreview(OWLinearProjection).run(set_data=iris,
                                          set_subset_data=iris[::10])

```
--- 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