@@ -76,24 +76,24 @@ def __init__(
76
76
value_range : Union [Tuple [int , int ], Tuple [float , float ]] = (0 , 100 ),
77
77
) -> None :
78
78
79
- if not ( value_range [0 ] < value_range [1 ]) :
79
+ if value_range [0 ] >= value_range [1 ]:
80
80
raise ValueError ("The minimum value must be less than the maximum value" )
81
81
82
- if not ( size [0 ] > 0 and size [1 ] > 0 ) :
82
+ if size [0 ] <= 0 or size [1 ] <= 0 :
83
83
raise ValueError ("The width and the height must be greater than zero" )
84
84
85
- if not ( value_range [0 ] <= value <= value_range [1 ]) :
85
+ if not value_range [0 ] <= value <= value_range [1 ]:
86
86
raise ValueError ("The starting value must be within the range of minimum to maximum" )
87
87
88
88
_edge_size = 2 * margin_size + 2 * border_thickness
89
89
90
- if not ( _edge_size < size [0 ]) :
90
+ if _edge_size >= size [0 ]:
91
91
raise ValueError (
92
92
"The size of the borders and margins combined must be "
93
93
"less than the width of the widget"
94
94
)
95
95
96
- if not ( _edge_size < size [1 ]) :
96
+ if _edge_size >= size [1 ]:
97
97
raise ValueError (
98
98
"The size of the borders and margins combined must be "
99
99
"less than the height of the widget"
@@ -283,10 +283,10 @@ def value(self, value: Union[int, float]) -> None:
283
283
:rtype: None
284
284
"""
285
285
286
- if not ( isinstance (value , (int , float ) )):
286
+ if not isinstance (value , (int , float )):
287
287
raise TypeError ("The value to set must be either an integer or a float" )
288
288
289
- if not ( self .minimum <= value <= self .maximum ) :
289
+ if not self .minimum <= value <= self .maximum :
290
290
raise ValueError (f"The value must be between minimum ({ self .minimum } ) and maximum ({ self .maximum } )" )
291
291
292
292
# Save off the previous value, so we can pass it in the
@@ -328,10 +328,10 @@ def progress(self, value: float) -> None:
328
328
:rtype: None
329
329
"""
330
330
331
- if not ( isinstance (value , (float , int ) )):
331
+ if not isinstance (value , (float , int )):
332
332
raise TypeError ("'progress' must be an int or a float" )
333
333
334
- if not ( 0.0 <= value <= 100.0 ) :
334
+ if not 0.0 <= value <= 100.0 :
335
335
raise ValueError ("'progress' must be between 0 and 100" )
336
336
337
337
self .value = (self .minimum + (self .maximum - self .minimum )) * (value * 0.01 )
@@ -447,18 +447,18 @@ def margin_size(self, value: int) -> None:
447
447
:rtype: None
448
448
"""
449
449
450
- if not ( isinstance (value , int ) ):
450
+ if not isinstance (value , int ):
451
451
raise TypeError ("The margin size must be an integer" )
452
452
453
453
margin_spacing = (2 * value ) + (2 * self ._border_thickness )
454
454
455
- if not ( margin_spacing < self .widget_width ) :
455
+ if margin_spacing >= self .widget_width :
456
456
raise ValueError (
457
457
"The size of the borders and margins combined can total the same or more"
458
458
"than the widget's width."
459
459
)
460
460
461
- if not ( margin_spacing < self .widget_height ) :
461
+ if margin_spacing >= self .widget_height :
462
462
raise ValueError (
463
463
"The size of the borders and margins combined can total the same or more"
464
464
"than the widget's height."
0 commit comments