Skip to content

Commit

Permalink
switch to ruff 0.3.7 --preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Apr 12, 2024
1 parent 70155d8 commit df7a415
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ls -l
- name: Download ruff
run: |
wget -c https://github.com/astral-sh/ruff/releases/download/v0.3.2/ruff-0.3.2-x86_64-unknown-linux-gnu.tar.gz
wget -c https://github.com/astral-sh/ruff/releases/download/v0.3.7/ruff-0.3.7-x86_64-unknown-linux-gnu.tar.gz
tar -xzf ruff-*.tar.gz
ls -l ruff
chmod a+x ruff
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ lint.select = [
# To avoid unexpected behavior, we recommend disabling these rules, either by removing them from the `select` or `extend-select` configuration, or adding them to the `ignore` configuration.

lint.ignore = [
"PLR6104", # Use `+=` to perform an augmented assignment directly
# until this bug is fixed: https://github.com/astral-sh/ruff/issues/10911

"PYI034", # py3.11: `__iadd__` methods in classes like `...` usually return `self` at runtime

"PLR1702", # Too many nested blocks
Expand Down
6 changes: 2 additions & 4 deletions scal3/event_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,7 @@ def calcOccurrence(
) -> OccurSet:
daySecStart = getSecondsFromHms(*self.dayTimeStart)
daySecEnd = getSecondsFromHms(*self.dayTimeEnd)
if daySecEnd <= daySecStart:
daySecEnd = daySecStart
daySecEnd = max(daySecStart, daySecEnd)
tmList = []
for jd in range(startJd, endJd):
epoch = self.getEpochFromJd(jd)
Expand Down Expand Up @@ -4331,8 +4330,7 @@ def setData(self, data: "dict[str, Any]") -> None:
self.endJd = int(self.endJd)

if self.eventCacheSize != eventCacheSize:
if self.eventCacheSize < self.eventCacheSizeMin:
self.eventCacheSize = self.eventCacheSizeMin
self.eventCacheSize = max(self.eventCacheSize, self.eventCacheSizeMin)
self.resetCache()

# ----
Expand Down
3 changes: 1 addition & 2 deletions scal3/ui_gtk/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def newTextLayout(
else:
if maximizeScale > 0:
minRat = minRat / maximizeScale
if minRat < layoutW / maxW:
minRat = layoutW / maxW
minRat = max(minRat, layoutW / maxW)
if minRat > 1:
font.size /= minRat
layout.set_font_description(pfontEncode(font))
Expand Down
6 changes: 2 additions & 4 deletions scal3/ui_gtk/event/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,8 @@ def multiSelectLabelUpdate(self):
_("{count} events selected").format(
count=_(
sum(
[
len(eventIndexes)
for eventIndexes in self.multiSelectPathDict.values()
],
len(eventIndexes)
for eventIndexes in self.multiSelectPathDict.values()
),
),
),
Expand Down
3 changes: 1 addition & 2 deletions scal3/ui_gtk/gtk_ud.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ def updateCSS(self):
def getGtkDefaultFont():
fontName = settings.get_property("gtk-font-name")
font = gfontDecode(fontName)
if font.size < 5:
font.size = 5
font.size = max(font.size, 5)
return font


Expand Down
3 changes: 1 addition & 2 deletions scal3/ui_gtk/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ def setVolume(self, value):
def stepVolume(self, increase):
if increase:
self.pbox.volAdj.value += VOLUME_STEP
if self.pbox.volAdj.value > 100:
self.pbox.volAdj.value = 100
self.pbox.volAdj.value = min(self.pbox.volAdj.value, 100)

elif self.pbox.volAdj.value <= VOLUME_STEP:
self.pbox.volAdj.value = 0
Expand Down

0 comments on commit df7a415

Please sign in to comment.