22import struct
33import platform
44from openrgb import utils
5- from typing import Union , Any
5+ from typing import Union , Any , Optional
66from openrgb .network import NetworkClient
77# from dataclasses import dataclass
88from os import environ
@@ -76,7 +76,7 @@ class Zone(utils.RGBContainer):
7676 def __init__ (self , data : utils .ZoneData , zone_id : int , device_id : int , network_client : NetworkClient ):
7777 self .leds = [None for led in data .leds ]
7878 try :
79- self .segments = [None for _ in data .segments ]
79+ self .segments : Optional [ list [ Segment ]] = [None for _ in data .segments ] # type: ignore
8080 except TypeError :
8181 self .segments = None
8282 self .device_id = device_id
@@ -96,11 +96,11 @@ def _update(self, data: utils.ZoneData):
9696 else :
9797 self .leds [x ]._update (data .leds [x ], data .colors [x ])
9898 if self .segments :
99- for x in range (len (data .segments )):
99+ for x in range (len (data .segments )): # type: ignore
100100 if self .segments [x ] is None :
101- self .segments [x ] = Segment (data .segments [x ], x , self )
101+ self .segments [x ] = Segment (data .segments [x ], x , self ) # type: ignore
102102 else :
103- self .segments [x ]._update (data .segments [x ])
103+ self .segments [x ]._update (data .segments [x ]) # type: ignore
104104 self .mat_width = data .mat_width
105105 self .mat_height = data .mat_height
106106 self .matrix_map = data .matrix_map
@@ -260,8 +260,8 @@ def _set_mode_colors(self, colors: list[utils.RGBColor]):
260260 active_mode = self .modes [self .active_mode ]
261261 assert active_mode .color_mode == utils .ModeColors .MODE_SPECIFIC
262262 assert active_mode .colors is not None
263- assert active_mode .colors_min <= len (
264- colors ) <= active_mode .colors_max # type: ignore
263+ assert active_mode .colors_min <= len ( # type: ignore
264+ colors ) <= active_mode .colors_max
265265 active_mode .colors = colors
266266 self .set_mode (active_mode )
267267
@@ -366,7 +366,7 @@ class OpenRGBClient(utils.RGBObject):
366366 Devices, Zones, and LEDs for you.
367367 '''
368368
369- def __init__ (self , address : str = "127.0.0.1" , port : int = 6742 , name : str = "openrgb-python" , protocol_version : int = None ):
369+ def __init__ (self , address : str = "127.0.0.1" , port : int = 6742 , name : str = "openrgb-python" , protocol_version : Optional [ int ] = None ):
370370 '''
371371 :param address: the ip address of the SDK server
372372 :param port: the port of the SDK server
@@ -390,8 +390,8 @@ def _callback(self, device: int, type: int, data: Any):
390390 if type == utils .PacketType .REQUEST_CONTROLLER_COUNT :
391391 if data != self .device_num or data != len (self .devices ):
392392 self .device_num = data
393- self .devices = [None for x in range (
394- self .device_num )] # type: ignore
393+ self .devices = [None for x in range ( # type: ignore
394+ self .device_num )]
395395 for x in range (self .device_num ):
396396 self .comms .requestDeviceData (x )
397397 elif type == utils .PacketType .REQUEST_CONTROLLER_DATA :
0 commit comments