@@ -187,13 +187,13 @@ class DefaultFdMixin(ProgressBarMixinBase):
187187 enable_colors : progressbar .env .ColorSupport = progressbar .env .COLOR_SUPPORT
188188
189189 def __init__ (
190- self ,
191- fd : base .TextIO = sys .stderr ,
192- is_terminal : bool | None = None ,
193- line_breaks : bool | None = None ,
194- enable_colors : progressbar .env .ColorSupport | None = None ,
195- line_offset : int = 0 ,
196- ** kwargs ,
190+ self ,
191+ fd : base .TextIO = sys .stderr ,
192+ is_terminal : bool | None = None ,
193+ line_breaks : bool | None = None ,
194+ enable_colors : progressbar .env .ColorSupport | None = None ,
195+ line_offset : int = 0 ,
196+ ** kwargs ,
197197 ):
198198 if fd is sys .stdout :
199199 fd = utils .streams .original_stdout
@@ -210,9 +210,9 @@ def __init__(
210210 super ().__init__ (** kwargs )
211211
212212 def _apply_line_offset (
213- self ,
214- fd : base .TextIO ,
215- line_offset : int ,
213+ self ,
214+ fd : base .TextIO ,
215+ line_offset : int ,
216216 ) -> base .TextIO :
217217 if line_offset :
218218 return progressbar .terminal .stream .LineOffsetStreamWrapper (
@@ -232,8 +232,8 @@ def _determine_line_breaks(self, line_breaks: bool | None) -> bool | None:
232232 return line_breaks
233233
234234 def _determine_enable_colors (
235- self ,
236- enable_colors : progressbar .env .ColorSupport | None ,
235+ self ,
236+ enable_colors : progressbar .env .ColorSupport | None ,
237237 ) -> progressbar .env .ColorSupport :
238238 '''
239239 Determines the color support for the progress bar.
@@ -309,9 +309,9 @@ def update(self, *args: types.Any, **kwargs: types.Any) -> None:
309309 self .fd .write (types .cast (str , line .encode ('ascii' , 'replace' )))
310310
311311 def finish (
312- self ,
313- * args : types .Any ,
314- ** kwargs : types .Any ,
312+ self ,
313+ * args : types .Any ,
314+ ** kwargs : types .Any ,
315315 ) -> None : # pragma: no cover
316316 if self ._finished :
317317 return
@@ -341,8 +341,8 @@ def _format_widgets(self):
341341
342342 for index , widget in enumerate (self .widgets ):
343343 if isinstance (
344- widget ,
345- widgets .WidgetBase ,
344+ widget ,
345+ widgets .WidgetBase ,
346346 ) and not widget .check_size (self ):
347347 continue
348348 elif isinstance (widget , widgets .AutoWidthWidgetBase ):
@@ -388,9 +388,11 @@ def __init__(self, term_width: int | None = None, **kwargs):
388388 import signal
389389
390390 self ._prev_handle = signal .getsignal (
391- signal .SIGWINCH ) # type: ignore
392- signal .signal (signal .SIGWINCH , # type: ignore
393- self ._handle_resize )
391+ signal .SIGWINCH # type: ignore
392+ )
393+ signal .signal (
394+ signal .SIGWINCH , self ._handle_resize # type: ignore
395+ )
394396 self .signal_set = True
395397
396398 def _handle_resize (self , signum = None , frame = None ):
@@ -404,8 +406,9 @@ def finish(self): # pragma: no cover
404406 with contextlib .suppress (Exception ):
405407 import signal
406408
407- signal .signal (signal .SIGWINCH , # type: ignore
408- self ._prev_handle )
409+ signal .signal (
410+ signal .SIGWINCH , self ._prev_handle # type: ignore
411+ )
409412
410413
411414class StdRedirectMixin (DefaultFdMixin ):
@@ -417,10 +420,10 @@ class StdRedirectMixin(DefaultFdMixin):
417420 _stderr : base .IO
418421
419422 def __init__ (
420- self ,
421- redirect_stderr : bool = False ,
422- redirect_stdout : bool = False ,
423- ** kwargs ,
423+ self ,
424+ redirect_stderr : bool = False ,
425+ redirect_stdout : bool = False ,
426+ ** kwargs ,
424427 ):
425428 DefaultFdMixin .__init__ (self , ** kwargs )
426429 self .redirect_stderr = redirect_stderr
@@ -548,23 +551,23 @@ class ProgressBar(
548551 paused : bool = False
549552
550553 def __init__ (
551- self ,
552- min_value : NumberT = 0 ,
553- max_value : NumberT | types .Type [base .UnknownLength ] | None = None ,
554- widgets : types .Optional [
555- types .Sequence [widgets_module .WidgetBase | str ]
556- ] = None ,
557- left_justify : bool = True ,
558- initial_value : NumberT = 0 ,
559- poll_interval : types .Optional [float ] = None ,
560- widget_kwargs : types .Optional [types .Dict [str , types .Any ]] = None ,
561- custom_len : types .Callable [[str ], int ] = utils .len_color ,
562- max_error = True ,
563- prefix = None ,
564- suffix = None ,
565- variables = None ,
566- min_poll_interval = None ,
567- ** kwargs ,
554+ self ,
555+ min_value : NumberT = 0 ,
556+ max_value : NumberT | types .Type [base .UnknownLength ] | None = None ,
557+ widgets : types .Optional [
558+ types .Sequence [widgets_module .WidgetBase | str ]
559+ ] = None ,
560+ left_justify : bool = True ,
561+ initial_value : NumberT = 0 ,
562+ poll_interval : types .Optional [float ] = None ,
563+ widget_kwargs : types .Optional [types .Dict [str , types .Any ]] = None ,
564+ custom_len : types .Callable [[str ], int ] = utils .len_color ,
565+ max_error = True ,
566+ prefix = None ,
567+ suffix = None ,
568+ variables = None ,
569+ min_poll_interval = None ,
570+ ** kwargs ,
568571 ): # sourcery skip: low-code-quality
569572 '''Initializes a progress bar with sane defaults.'''
570573 StdRedirectMixin .__init__ (self , ** kwargs )
@@ -629,8 +632,8 @@ def __init__(
629632 default = None ,
630633 )
631634 self ._MINIMUM_UPDATE_INTERVAL = (
632- utils .deltas_to_seconds (self ._MINIMUM_UPDATE_INTERVAL )
633- or self ._MINIMUM_UPDATE_INTERVAL
635+ utils .deltas_to_seconds (self ._MINIMUM_UPDATE_INTERVAL )
636+ or self ._MINIMUM_UPDATE_INTERVAL
634637 )
635638
636639 # Note that the _MINIMUM_UPDATE_INTERVAL sets the minimum in case of
@@ -646,8 +649,8 @@ def __init__(
646649 self .variables = utils .AttributeDict (variables or {})
647650 for widget in self .widgets :
648651 if (
649- isinstance (widget , widgets_module .VariableMixin )
650- and widget .name not in self .variables
652+ isinstance (widget , widgets_module .VariableMixin )
653+ and widget .name not in self .variables
651654 ):
652655 self .variables [widget .name ] = None
653656
@@ -768,7 +771,7 @@ def data(self) -> types.Dict[str, types.Any]:
768771 total_seconds_elapsed = total_seconds_elapsed ,
769772 # The seconds since the bar started modulo 60
770773 seconds_elapsed = (elapsed .seconds % 60 )
771- + (elapsed .microseconds / 1000000.0 ),
774+ + (elapsed .microseconds / 1000000.0 ),
772775 # The minutes since the bar started modulo 60
773776 minutes_elapsed = (elapsed .seconds / 60 ) % 60 ,
774777 # The hours since the bar started modulo 24
@@ -898,9 +901,9 @@ def update(self, value=None, force=False, **kwargs):
898901 self .start ()
899902
900903 if (
901- value is not None
902- and value is not base .UnknownLength
903- and isinstance (value , (int , float ))
904+ value is not None
905+ and value is not base .UnknownLength
906+ and isinstance (value , (int , float ))
904907 ):
905908 if self .max_value is base .UnknownLength :
906909 # Can't compare against unknown lengths so just update
@@ -1023,9 +1026,9 @@ def _init_prefix(self):
10231026
10241027 def _verify_max_value (self ):
10251028 if (
1026- self .max_value is not base .UnknownLength
1027- and self .max_value is not None
1028- and self .max_value < 0 # type: ignore
1029+ self .max_value is not base .UnknownLength
1030+ and self .max_value is not None
1031+ and self .max_value < 0 # type: ignore
10291032 ):
10301033 raise ValueError ('max_value out of range, got %r' % self .max_value )
10311034
0 commit comments