Skip to content

Commit 0238dc2

Browse files
committed
linted
1 parent 5ee2a2b commit 0238dc2

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

adafruit_display_shapes/circle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
3939
"""
4040

41-
import displayio
4241
from adafruit_display_shapes.roundrect import RoundRect
4342

4443
__version__ = "0.0.0-auto.0"

adafruit_display_shapes/rect.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,17 @@ class Rect(displayio.TileGrid):
5353
def __init__(self, x, y, width, height, *, stroke=1, fill=None, outline=None):
5454
self._bitmap = displayio.Bitmap(width, height, 2)
5555
self._palette = displayio.Palette(2)
56+
self.position = None # this is later set up by super()'s init
5657

5758
if outline is not None:
5859
for w in range(width):
5960
for line in range(stroke):
6061
self._bitmap[w, line] = 1
6162
self._bitmap[w, height-1-line] = 1
62-
for h in range(height):
63+
for _h in range(height):
6364
for line in range(stroke):
64-
self._bitmap[line, h] = 1
65-
self._bitmap[width-1-line, h] = 1
65+
self._bitmap[line, _h] = 1
66+
self._bitmap[width-1-line, _h] = 1
6667
self._palette[1] = outline
6768
if fill is not None:
6869
self._palette[0] = fill
@@ -84,6 +85,6 @@ def y(self):
8485
"""The y coordinate of the position"""
8586
return self.position[1]
8687

87-
@x.setter
88+
@y.setter
8889
def y(self, y):
8990
self.position = (self.position[0], y)

adafruit_display_shapes/roundrect.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ class RoundRect(displayio.TileGrid):
5050
not change outer bound size set by width and height. Fill can be a hex value
5151
for the color or None for transparent. Outline can be a hex value for the color
5252
or None for no outline."""
53-
def __init__(self, x, y, width, height, r, *, fill=None, outline=None, stroke=1):
53+
def __init__(self, x, y, width, height, r, *, fill=None, outline=None, stroke=1): # pylint: disable=too-many-arguments
5454
self._bitmap = displayio.Bitmap(width, height, 3)
5555
self._palette = displayio.Palette(3)
5656
self._palette.make_transparent(0)
57+
self.position = None # this is reset by the super().init
5758

5859
if fill is not None:
5960
for i in range(0, width): # draw the center chunk
@@ -72,16 +73,18 @@ def __init__(self, x, y, width, height, r, *, fill=None, outline=None, stroke=1)
7273
for line in range(stroke):
7374
self._bitmap[w, line] = 1
7475
self._bitmap[w, height-line-1] = 1
75-
for h in range(r, height-r):
76+
for _h in range(r, height-r):
7677
for line in range(stroke):
77-
self._bitmap[line, h] = 1
78-
self._bitmap[width-line-1, h] = 1
78+
self._bitmap[line, _h] = 1
79+
self._bitmap[width-line-1, _h] = 1
7980
# draw round corners
8081
self._helper(r, r, r, color=1, stroke=stroke,
8182
x_offset=width-2*r-1, y_offset=height-2*r-1)
8283

8384
super().__init__(self._bitmap, pixel_shader=self._palette, position=(x, y))
8485

86+
87+
# pylint: disable=invalid-name, too-many-locals, too-many-branches
8588
def _helper(self, x0, y0, r, *, color, x_offset=0, y_offset=0,
8689
stroke=1, cornerflags=0xF, fill=False):
8790
f = 1 - r
@@ -126,6 +129,7 @@ def _helper(self, x0, y0, r, *, color, x_offset=0, y_offset=0,
126129
for line in range(stroke):
127130
self._bitmap[x0+x+x_offset, y0-y+line] = color
128131
self._bitmap[x0+y+x_offset-line, y0-x] = color
132+
# pylint: enable=invalid-name, too-many-locals, too-many-branches
129133

130134
@property
131135
def x(self):
@@ -141,6 +145,6 @@ def y(self):
141145
"""The y coordinate of the position"""
142146
return self.position[1]
143147

144-
@x.setter
148+
@y.setter
145149
def y(self, y):
146150
self.position = (self.position[0], y)

0 commit comments

Comments
 (0)