@@ -76,24 +76,24 @@ def __init__(
7676 value_range : Union [Tuple [int , int ], Tuple [float , float ]] = (0 , 100 ),
7777 ) -> None :
7878
79- if not ( value_range [0 ] < value_range [1 ]) :
79+ if value_range [0 ] >= value_range [1 ]:
8080 raise ValueError ("The minimum value must be less than the maximum value" )
8181
82- if not ( size [0 ] > 0 and size [1 ] > 0 ) :
82+ if size [0 ] <= 0 or size [1 ] <= 0 :
8383 raise ValueError ("The width and the height must be greater than zero" )
8484
85- if not ( value_range [0 ] <= value <= value_range [1 ]) :
85+ if not value_range [0 ] <= value <= value_range [1 ]:
8686 raise ValueError ("The starting value must be within the range of minimum to maximum" )
8787
8888 _edge_size = 2 * margin_size + 2 * border_thickness
8989
90- if not ( _edge_size < size [0 ]) :
90+ if _edge_size >= size [0 ]:
9191 raise ValueError (
9292 "The size of the borders and margins combined must be "
9393 "less than the width of the widget"
9494 )
9595
96- if not ( _edge_size < size [1 ]) :
96+ if _edge_size >= size [1 ]:
9797 raise ValueError (
9898 "The size of the borders and margins combined must be "
9999 "less than the height of the widget"
@@ -283,10 +283,10 @@ def value(self, value: Union[int, float]) -> None:
283283 :rtype: None
284284 """
285285
286- if not ( isinstance (value , (int , float ) )):
286+ if not isinstance (value , (int , float )):
287287 raise TypeError ("The value to set must be either an integer or a float" )
288288
289- if not ( self .minimum <= value <= self .maximum ) :
289+ if not self .minimum <= value <= self .maximum :
290290 raise ValueError (f"The value must be between minimum ({ self .minimum } ) and maximum ({ self .maximum } )" )
291291
292292 # Save off the previous value, so we can pass it in the
@@ -328,10 +328,10 @@ def progress(self, value: float) -> None:
328328 :rtype: None
329329 """
330330
331- if not ( isinstance (value , (float , int ) )):
331+ if not isinstance (value , (float , int )):
332332 raise TypeError ("'progress' must be an int or a float" )
333333
334- if not ( 0.0 <= value <= 100.0 ) :
334+ if not 0.0 <= value <= 100.0 :
335335 raise ValueError ("'progress' must be between 0 and 100" )
336336
337337 self .value = (self .minimum + (self .maximum - self .minimum )) * (value * 0.01 )
@@ -447,18 +447,18 @@ def margin_size(self, value: int) -> None:
447447 :rtype: None
448448 """
449449
450- if not ( isinstance (value , int ) ):
450+ if not isinstance (value , int ):
451451 raise TypeError ("The margin size must be an integer" )
452452
453453 margin_spacing = (2 * value ) + (2 * self ._border_thickness )
454454
455- if not ( margin_spacing < self .widget_width ) :
455+ if margin_spacing >= self .widget_width :
456456 raise ValueError (
457457 "The size of the borders and margins combined can total the same or more"
458458 "than the widget's width."
459459 )
460460
461- if not ( margin_spacing < self .widget_height ) :
461+ if margin_spacing >= self .widget_height :
462462 raise ValueError (
463463 "The size of the borders and margins combined can total the same or more"
464464 "than the widget's height."
0 commit comments