Skip to content

Commit 8b9ec43

Browse files
committed
format with ruff instead of black
1 parent 36bb4e6 commit 8b9ec43

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

adafruit_ina3221.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ def enable(self) -> None:
152152
"""Enable this channel"""
153153
config = self._device._read_register(CONFIGURATION, 2)
154154
config_value = (config[0] << 8) | config[1]
155-
config_value |= 1 << (
156-
14 - self._channel
157-
) # Set the bit for the specific channel
155+
config_value |= 1 << (14 - self._channel) # Set the bit for the specific channel
158156
high_byte = (config_value >> 8) & 0xFF
159157
low_byte = config_value & 0xFF
160158
self._device._write_register(CONFIGURATION, bytes([high_byte, low_byte]))
@@ -242,9 +240,7 @@ def warning_alert_threshold(self, current: float) -> None:
242240
class INA3221:
243241
"""Driver for the INA3221 device with three channels."""
244242

245-
def __init__(
246-
self, i2c, address: int = DEFAULT_ADDRESS, enable: List = [0, 1, 2]
247-
) -> None:
243+
def __init__(self, i2c, address: int = DEFAULT_ADDRESS, enable: List = [0, 1, 2]) -> None:
248244
"""Initializes the INA3221 class over I2C
249245
Args:
250246
i2c (I2C): The I2C bus to which the INA3221 is connected.
@@ -253,9 +249,7 @@ def __init__(
253249
self.i2c_dev = I2CDevice(i2c, address)
254250
self.reset()
255251

256-
self.channels: List[INA3221Channel] = [
257-
INA3221Channel(self, i) for i in range(3)
258-
]
252+
self.channels: List[INA3221Channel] = [INA3221Channel(self, i) for i in range(3)]
259253
for i in enable:
260254
self.channels[i].enable()
261255
self.mode: int = MODE.SHUNT_BUS_CONT
@@ -439,9 +433,7 @@ def summation_channels(self) -> tuple:
439433
@summation_channels.setter
440434
def summation_channels(self, channels: tuple) -> None:
441435
if len(channels) != 3:
442-
raise ValueError(
443-
"Must pass a tuple of three boolean values (ch1, ch2, ch3)"
444-
)
436+
raise ValueError("Must pass a tuple of three boolean values (ch1, ch2, ch3)")
445437
ch1, ch2, ch3 = channels
446438
scc_value = (ch1 << 2) | (ch2 << 1) | (ch3 << 0)
447439
result = self._read_register(MASK_ENABLE, 2)

0 commit comments

Comments
 (0)