@@ -271,21 +271,22 @@ def fill_gradient(
271
271
if vertical :
272
272
for line in range (y1 , y2 ):
273
273
color = (
274
- min (max (a [0 ] + (rate [0 ] * (line - y1 )), 0 ), 255 ),
275
- min (max (a [1 ] + (rate [1 ] * (line - y1 )), 0 ), 255 ),
276
- min (max (a [2 ] + (rate [2 ] * (line - y1 )), 0 ), 255 )
274
+ int ( min (max (a [0 ] + (rate [0 ] * (line - y1 )), 0 ), 255 ) ),
275
+ int ( min (max (a [1 ] + (rate [1 ] * (line - y1 )), 0 ), 255 ) ),
276
+ int ( min (max (a [2 ] + (rate [2 ] * (line - y1 )), 0 ), 255 ) )
277
277
)
278
278
fn_line (surface , color , (x1 , line ), (x2 , line ))
279
279
else :
280
280
for col in range (x1 , x2 ):
281
281
color = (
282
- min (max (a [0 ] + (rate [0 ] * (col - x1 )), 0 ), 255 ),
283
- min (max (a [1 ] + (rate [1 ] * (col - x1 )), 0 ), 255 ),
284
- min (max (a [2 ] + (rate [2 ] * (col - x1 )), 0 ), 255 )
282
+ int ( min (max (a [0 ] + (rate [0 ] * (col - x1 )), 0 ), 255 ) ),
283
+ int ( min (max (a [1 ] + (rate [1 ] * (col - x1 )), 0 ), 255 ) ),
284
+ int ( min (max (a [2 ] + (rate [2 ] * (col - x1 )), 0 ), 255 ) )
285
285
)
286
286
fn_line (surface , color , (col , y1 ), (col , y2 ))
287
287
288
288
289
+ # noinspection PyUnusedLocal
289
290
def format_color (
290
291
color : Union [ColorInputType , Any ],
291
292
warn_if_invalid : bool = True
@@ -401,15 +402,13 @@ def load_pygame_image_file(image_path: str, **kwargs) -> 'pygame.Surface':
401
402
402
403
pil_invalid_exception = UnidentifiedImageError
403
404
img_pil = Image .open (image_path )
404
- # noinspection PyTypeChecker
405
+ # noinspection PyTypeChecker,PyUnusedLocal
405
406
surface = pygame .image .fromstring (
406
407
img_pil .tobytes (), img_pil .size , img_pil .mode ).convert ()
407
-
408
408
except (ModuleNotFoundError , ImportError ):
409
409
warn (f'Image file "{ image_path } " could not be loaded, as pygame.error '
410
410
f'is raised. To avoid this issue install the Pillow library' )
411
411
raise
412
-
413
412
except pil_invalid_exception :
414
413
warn (f'The image "{ image_path } " could not be loaded using Pillow' )
415
414
raise
@@ -442,7 +441,6 @@ def make_surface(
442
441
'surface width and height must be equal or greater than zero'
443
442
surface = pygame .Surface ((int (width ), int (height )), pygame .SRCALPHA , 32 )
444
443
if alpha and _ALPHA_CHANNEL [0 ]:
445
- # noinspection PyArgumentList
446
444
surface = pygame .Surface .convert_alpha (surface )
447
445
if fill_color is not None :
448
446
fill_color = assert_color (fill_color )
@@ -602,7 +600,6 @@ def set_pygame_cursor(cursor: CursorInputType) -> None: # type: ignore
602
600
"""
603
601
try :
604
602
if cursor is not None :
605
- # noinspection PyArgumentList
606
603
pygame .mouse .set_cursor (cursor )
607
604
except (pygame .error , TypeError ):
608
605
if PYGAME_V2 :
0 commit comments