diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py index 24e48d27ea5..e24d322a85c 100644 --- a/Orange/widgets/visualize/owscatterplotgraph.py +++ b/Orange/widgets/visualize/owscatterplotgraph.py @@ -128,7 +128,8 @@ def restoreAnchor(self, anchors): anchor, parentanchor = anchors self.anchor(*bound_anchor_pos(anchor, parentanchor)) - def paint(self, painter, option, widget=None): + # pylint: disable=arguments-differ + def paint(self, painter, _option, _widget=None): painter.setPen(self.__pen) painter.setBrush(self.__brush) rect = self.contentsRect() @@ -619,7 +620,7 @@ def _get_jittering_tooltip(self): def update_jittering(self): self.update_tooltip() x, y = self.get_coordinates() - if x is None or not len(x) or self.scatterplot_item is None: + if x is None or len(x) == 0 or self.scatterplot_item is None: return self._update_plot_coordinates(self.scatterplot_item, x, y) self._update_plot_coordinates(self.scatterplot_item_sel, x, y) @@ -834,7 +835,7 @@ def update_coordinates(self): the complete update by calling `reset_graph` instead of this method. """ x, y = self.get_coordinates() - if x is None or not len(x): + if x is None or len(x) == 0: return if self.scatterplot_item is None: if self.sample_indices is None: @@ -1053,9 +1054,9 @@ def _get_continuous_colors(self, c_data, subset): # Reuse pens and brushes with the same colors because PyQtGraph then # builds smaller pixmap atlas, which makes the drawing faster - def reuse(cache, fn, *args): + def reuse(cache, fun, *args): if args not in cache: - cache[args] = fn(args) + cache[args] = fun(args) return cache[args] def create_pen(col): @@ -1113,7 +1114,7 @@ def _get_discrete_colors(self, c_data, subset): def update_colors(self): """ - Trigger an update of point sizes + Trigger an update of point colors The method calls `self.get_colors`, which in turn calls the widget's `get_color_data` to get the indices in the pallette. `get_colors` diff --git a/Orange/widgets/visualize/tests/test_owscatterplotbase.py b/Orange/widgets/visualize/tests/test_owscatterplotbase.py index 9dc7e26fba2..ce04126033e 100644 --- a/Orange/widgets/visualize/tests/test_owscatterplotbase.py +++ b/Orange/widgets/visualize/tests/test_owscatterplotbase.py @@ -58,6 +58,7 @@ def setUp(self): # pylint: disable=keyword-arg-before-vararg def setRange(self, rect=None, *_, **__): if isinstance(rect, QRectF): + # pylint: disable=attribute-defined-outside-init self.last_setRange = [[rect.left(), rect.right()], [rect.top(), rect.bottom()]] @@ -308,12 +309,13 @@ def test_sampling_keeps_selection(self): base = "Orange.widgets.visualize.owscatterplotgraph.OWScatterPlotBase." + @staticmethod @patch(base + "update_sizes") @patch(base + "update_colors") @patch(base + "update_selection_colors") @patch(base + "update_shapes") @patch(base + "update_labels") - def test_reset_calls_all_updates_and_update_doesnt(self, *mocks): + def test_reset_calls_all_updates_and_update_doesnt(*mocks): master = MockWidget() graph = OWScatterPlotBase(master) for mock in mocks: @@ -443,6 +445,7 @@ def impute_max(size_data): graph = self.graph + # pylint: disable=attribute-defined-outside-init self.master.get_size_data = lambda: d self.master.impute_sizes = impute_max d = np.arange(10, dtype=float) @@ -1162,6 +1165,7 @@ def test_shapes_nan(self): def impute0(data, _): data[np.isnan(data)] = 0 + # pylint: disable=attribute-defined-outside-init self.master.impute_shapes = impute0 d = np.arange(10, dtype=float) % 3 d[2] = np.nan