@@ -106,6 +106,7 @@ class MultiSparkline(displayio.TileGrid):
106106 will scroll to the left.
107107 """
108108
109+ # pylint: disable=too-many-arguments, too-many-instance-attributes
109110 def __init__ (
110111 self ,
111112 width : int ,
@@ -150,6 +151,8 @@ def __init__(
150151
151152 super ().__init__ (self ._bitmap , pixel_shader = self ._palette , x = x , y = y )
152153
154+ # pylint: enable=too-many-arguments
155+
153156 def clear_values (self ) -> None :
154157 """Clears _buffer and removes all lines in the group"""
155158 self ._bitmap .fill (0 )
@@ -208,11 +211,10 @@ def _xintercept(
208211
209212 if slope == 0 and y_1 != horizontal_y : # does not intercept horizontalY
210213 return None
211- else :
212- xint = (
213- horizontal_y - b
214- ) / slope # calculate the x-intercept at position y=horizontalY
215- return int (xint )
214+ xint = (
215+ horizontal_y - b
216+ ) / slope # calculate the x-intercept at position y=horizontalY
217+ return int (xint )
216218
217219 def _add_point (
218220 self ,
@@ -234,6 +236,7 @@ def _draw(self) -> None:
234236 for i in range (self ._lines ):
235237 Polygon .draw (self ._bitmap , self ._points [i ].values (), i + 1 , close = False )
236238
239+ # pylint: disable=too-many-locals, too-many-nested-blocks, too-many-branches
237240 def update_line (self , line : int = None ) -> None :
238241 """Update the drawing of the sparkline.
239242 param int|None line: Line to update. Set to None for updating all (default).
@@ -245,9 +248,9 @@ def update_line(self, line: int = None) -> None:
245248 lines = [line ]
246249
247250 redraw = False
248- for l in lines :
251+ for a_line in lines :
249252 # bail out early if we only have a single point
250- n_points = self ._buffers [l ].len ()
253+ n_points = self ._buffers [a_line ].len ()
251254 if n_points < 2 :
252255 continue
253256
@@ -258,21 +261,21 @@ def update_line(self, line: int = None) -> None:
258261 else :
259262 xpitch = self ._xpitch
260263
261- self ._points [l ].clear () # remove all points
264+ self ._points [a_line ].clear () # remove all points
262265
263- for count , value in enumerate (self ._buffers [l ].values ()):
266+ for count , value in enumerate (self ._buffers [a_line ].values ()):
264267 if count == 0 :
265- self ._add_point (l , 0 , value )
268+ self ._add_point (a_line , 0 , value )
266269 else :
267270 x = int (xpitch * count )
268271 last_x = int (xpitch * (count - 1 ))
269- top = self .y_tops [l ]
270- bottom = self .y_bottoms [l ]
272+ top = self .y_tops [a_line ]
273+ bottom = self .y_bottoms [a_line ]
271274
272275 if (bottom <= last_value <= top ) and (
273276 bottom <= value <= top
274277 ): # both points are in range, plot the line
275- self ._add_point (l , x , value )
278+ self ._add_point (a_line , x , value )
276279
277280 else : # at least one point is out of range, clip one or both ends the line
278281 if ((last_value > top ) and (value > top )) or (
@@ -312,7 +315,9 @@ def update_line(self, line: int = None) -> None:
312315 if redraw :
313316 self ._draw ()
314317
315- def values (self , line : int ) -> List [float ]:
318+ # pylint: enable=too-many-locals, too-many-nested-blocks, too-many-branches
319+
320+ def values_of (self , line : int ) -> List [float ]:
316321 """Returns the values displayed on the sparkline at given index."""
317322
318323 return self ._buffers [line ].values ()
0 commit comments