Skip to content

Commit 43c363c

Browse files
committed
Fix various Ruff errors
1 parent dd111da commit 43c363c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ target-version = "py39" # Assume Python 3.9.
6969
select = ["E", "F", "W", "I", "NPY201"]
7070
ignore = [
7171
"E203", # space before : (needed for how black formats slicing)
72+
"E501", # line too long
7273
]
7374

7475
[tool.ruff.format]

qwt/graphic.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,20 @@ def scaledBoundingRect(self, sx, sy, scalePens):
139139
rect = transform.mapRect(self.__boundingRect)
140140
else:
141141
rect = transform.mapRect(self.__pointRect)
142-
l = abs(self.__pointRect.left() - self.__boundingRect.left())
143-
r = abs(self.__pointRect.right() - self.__boundingRect.right())
144-
t = abs(self.__pointRect.top() - self.__boundingRect.top())
145-
b = abs(self.__pointRect.bottom() - self.__boundingRect.bottom())
146-
rect.adjust(-l, -t, r, b)
142+
left_diff = abs(self.__pointRect.left() - self.__boundingRect.left())
143+
right_diff = abs(self.__pointRect.right() - self.__boundingRect.right())
144+
top_diff = abs(self.__pointRect.top() - self.__boundingRect.top())
145+
bottom_diff = abs(self.__pointRect.bottom() - self.__boundingRect.bottom())
146+
rect.adjust(-left_diff, -top_diff, right_diff, bottom_diff)
147147
return rect
148148

149149
def scaleFactorX(self, pathRect, targetRect, scalePens):
150150
if pathRect.width() <= 0.0:
151151
return 0.0
152152
p0 = self.__pointRect.center()
153-
l = abs(pathRect.left() - p0.x())
153+
left_diff = abs(pathRect.left() - p0.x())
154154
r = abs(pathRect.right() - p0.x())
155-
w = 2.0 * min([l, r]) * targetRect.width() / pathRect.width()
155+
w = 2.0 * min([left_diff, r]) * targetRect.width() / pathRect.width()
156156
if scalePens and self.__scalablePen:
157157
sx = w / self.__boundingRect.width()
158158
else:

qwt/plot_curve.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import math
1717
import os
1818

19+
import numpy as np
1920
from qtpy.QtCore import QLineF, QPointF, QRectF, QSize, Qt
2021
from qtpy.QtGui import QBrush, QColor, QPainter, QPen, QPolygonF
2122

@@ -40,8 +41,6 @@
4041

4142
import shiboken6 as shiboken
4243

43-
import numpy as np
44-
4544

4645
def qwtUpdateLegendIconSize(curve):
4746
if curve.symbol() and curve.testLegendAttribute(QwtPlotCurve.LegendShowSymbol):

0 commit comments

Comments
 (0)