Skip to content

Commit 38a3c78

Browse files
committed
"Update ruff pre-commit hook
"
1 parent 7cc736d commit 38a3c78

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: end-of-file-fixer
1111
- id: trailing-whitespace
1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.3.4
13+
rev: v0.15.8
1414
hooks:
1515
- id: ruff-format
1616
- id: ruff

adafruit_led_animation/animation/comet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def draw(self):
150150
if self.bounce:
151151
self.reverse = not self.reverse
152152
elif self._ring:
153-
self._tail_start = self._tail_start % self._num_pixels
153+
self._tail_start %= self._num_pixels
154154
else:
155155
self.reset()
156156

@@ -166,4 +166,4 @@ def reset(self):
166166
self._tail_start = -self._tail_length - 1
167167

168168
if self._ring:
169-
self._tail_start = self._tail_start % self._num_pixels
169+
self._tail_start %= self._num_pixels

adafruit_led_animation/animation/pacman.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def draw(self):
9595
self.ghost_timer = time.monotonic()
9696

9797
if self.pacman[1] >= self.num_leds - 2:
98-
self.direction = self.direction * -1
99-
self.black_dir = self.black_dir * -1
98+
self.direction *= -1
99+
self.black_dir *= -1
100100
for ghost in self.ghosts:
101101
ghost[0] = BLUE
102102

@@ -120,7 +120,7 @@ def draw(self):
120120
ghost[1] += self.direction
121121

122122
if self.ghosts[3][1] <= 0:
123-
self.direction = self.direction * -1
124-
self.black_dir = self.black_dir * -1
123+
self.direction *= -1
124+
self.black_dir *= -1
125125
for i, ghost in enumerate(self.ghosts):
126126
ghost[0] = self.ghosts_original[i][0]

adafruit_led_animation/animation/volume.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ def draw(self):
102102
self._num_pixels,
103103
)
104104
)
105-
if lit_pixels > self._num_pixels:
106-
lit_pixels = self._num_pixels
105+
lit_pixels = min(lit_pixels, self._num_pixels)
107106

108107
self.pixel_object[0:lit_pixels] = [(red, green, blue)] * lit_pixels
109108
self.pixel_object[lit_pixels : self._num_pixels] = [(0, 0, 0)] * (

0 commit comments

Comments
 (0)