From d06fc75c39def0dcbc46a3befcc6eb4a9f9fcdc9 Mon Sep 17 00:00:00 2001 From: introkun Date: Mon, 25 Mar 2024 20:27:25 -0300 Subject: [PATCH] code style updates --- .pylintrc | 4 ++-- qt_range_slider/__init__.py | 12 +++++++----- tests/test_slider.py | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6949bec..a74445c 100644 --- a/.pylintrc +++ b/.pylintrc @@ -559,5 +559,5 @@ min-public-methods=2 # Exceptions that will emit a warning when being caught. Defaults to # "BaseException, Exception". -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtins.BaseException, + builtins.Exception diff --git a/qt_range_slider/__init__.py b/qt_range_slider/__init__.py index 5a84e4f..ff587e4 100644 --- a/qt_range_slider/__init__.py +++ b/qt_range_slider/__init__.py @@ -229,7 +229,6 @@ def mouseReleaseEvent(self, event): self._right_thumb.pressed = False super().mouseReleaseEvent(event) - # pylint: disable=no-self-use def __get_thumb_value(self, x, canvas_width, right_value): # pylint: disable=logging-fstring-interpolation logging.debug( @@ -246,12 +245,15 @@ def mouseMoveEvent(self, event): if thumb.pressed: if thumb == self._left_thumb: value_setter = self.set_left_thumb_value - value_adjuster = lambda val: _left_thumb_adjuster(val, 0) + + def value_adjuster(val): + return _left_thumb_adjuster(val, 0) + else: value_setter = self.set_right_thumb_value - value_adjuster = lambda val: _right_thumb_adjuster( - val, self._right_value - ) + + def value_adjuster(val): + return _right_thumb_adjuster(val, self._right_value) new_val = self.__get_thumb_value( event.position().x(), self._canvas_width, self._right_value diff --git a/tests/test_slider.py b/tests/test_slider.py index ff76a5b..e1e820f 100644 --- a/tests/test_slider.py +++ b/tests/test_slider.py @@ -48,7 +48,6 @@ def test_init(self): with self.assertRaises(ValueError): QtRangeSlider(QtRangeSliderTest._form, 0, 10, 5, 3) - # pylint: disable=no-self-use def test_paint_event(self): slider = QtRangeSlider(QtRangeSliderTest._form, 0, 10, 3, 5) _draw_widget(slider)