Skip to content

Commit bf0ac9e

Browse files
author
Margaret Matocha
committed
updated for pylint
1 parent 7fe45cb commit bf0ac9e

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

adafruit_display_shapes/sparkline.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,31 @@
1515
# included in the graph. When additional elements are added to the sparkline and
1616
# the number of items has exceeded max_items, any excess values are removed from
1717
# the left of the graph, and new values are added to the right.
18+
"""
19+
`sparkline`
20+
================================================================================
21+
22+
Various common shapes for use with displayio - Sparkline!
23+
24+
25+
* Author(s): Kevin Matocha
26+
27+
Implementation Notes
28+
--------------------
29+
30+
**Software and Dependencies:**
31+
32+
* Adafruit CircuitPython firmware for the supported boards:
33+
https://github.com/adafruit/circuitpython/releases
34+
35+
"""
1836

1937
import displayio
2038
from adafruit_display_shapes.line import Line
2139

2240

2341
class Sparkline(displayio.Group):
24-
# pylint: disable=invalid-name
42+
# pylint: disable=invalid-name, too-many-arguments
2543
""" A sparkline graph.
2644
2745
: param width: Width of the sparkline graph in pixels
@@ -54,8 +72,12 @@ def __init__(
5472
self._spark_list = [] # list containing the values
5573
self.yMin = yMin # minimum of y-axis (None: autoscale)
5674
self.yMax = yMax # maximum of y-axis (None: autoscale)
57-
self.yBottom = yMin # yBottom: The actual minimum value of the vertical scale, will be updated if autorange
58-
self.yTop = yMax # yTop: The actual minimum value of the vertical scale, will be updated if autorange
75+
self.yBottom = yMin
76+
# yBottom: The actual minimum value of the vertical scale, will be
77+
# updated if autorange
78+
self.yTop = yMax
79+
# yTop: The actual minimum value of the vertical scale, will be
80+
# updated if autorange
5981
self._x = x
6082
self._y = y
6183

@@ -65,7 +87,6 @@ def __init__(
6587

6688
def add_value(self, value):
6789
""" Add a value to the sparkline.
68-
6990
: param value: The value to be added to the sparkline
7091
"""
7192

@@ -121,7 +142,7 @@ def update(self):
121142
len(self._spark_list) - 1
122143
) # this is a float, only make int when plotting the line
123144

124-
for i in range(len(self)): # remove all items from the current group
145+
for _ in range(len(self)): # remove all items from the current group
125146
self.pop()
126147

127148
for count, value in enumerate(self._spark_list):
@@ -192,4 +213,7 @@ def update(self):
192213
last_value = value # store value for the next iteration
193214

194215
def values(self):
216+
"""Returns the values displayed on the sparkline
217+
"""
218+
195219
return self._spark_list

0 commit comments

Comments
 (0)