Skip to content

Commit 9d95322

Browse files
committed
Satisfying linter
1 parent 6d734ca commit 9d95322

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

openrgb/network.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import struct
55
import threading
66
from openrgb import utils
7-
from typing import Callable
7+
from typing import Callable, Optional
88

99
OPENRGB_PROTOCOL_VERSION = 4
1010

@@ -19,7 +19,7 @@ class NetworkClient:
1919
A class for interfacing with the OpenRGB SDK
2020
'''
2121

22-
def __init__(self, update_callback: Callable, address: str = "127.0.0.1", port: int = 6742, name: str = "openrgb-python", protocol_version: int = None):
22+
def __init__(self, update_callback: Callable, address: str = "127.0.0.1", port: int = 6742, name: str = "openrgb-python", protocol_version: Optional[int] = None):
2323
'''
2424
:param update_callback: the function to call when data is received
2525
:param address: the ip address of the SDK server

openrgb/orgb.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import struct
33
import platform
44
from openrgb import utils
5-
from typing import Union, Any
5+
from typing import Union, Any, Optional
66
from openrgb.network import NetworkClient
77
# from dataclasses import dataclass
88
from 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:

openrgb/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def pack(self, version: int) -> bytes:
448448
data += struct.pack("H", 0)
449449

450450
if version >= 4:
451-
data += pack_list(self.segments, version)
451+
data += pack_list(self.segments, version) # type: ignore
452452
return data
453453

454454
@classmethod

0 commit comments

Comments
 (0)