Skip to content

Commit 813fa94

Browse files
committed
make CI happy
1 parent 724453c commit 813fa94

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

adafruit_ads1x15/ads1x15.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ def __init__(
150150
):
151151
self._last_pin_read = None
152152
self.buf = bytearray(3)
153-
self.initialized = (
154-
False # Prevents writing to ADC until all values are initialized
155-
)
153+
self.initialized = False # Prevents writing to ADC until all values are initialized
156154
self.i2c_device = I2CDevice(i2c, address)
157155
self.gain = gain
158156
self.data_rate = self._data_rate_default() if data_rate is None else data_rate
@@ -225,9 +223,7 @@ def comparator_queue_length(self) -> int:
225223
def comparator_queue_length(self, comparator_queue_length: int) -> None:
226224
possible_comp_queue_lengths = self.comparator_queue_lengths
227225
if comparator_queue_length not in possible_comp_queue_lengths:
228-
raise ValueError(
229-
f"Comparator Queue must be one of: {possible_comp_queue_lengths}"
230-
)
226+
raise ValueError(f"Comparator Queue must be one of: {possible_comp_queue_lengths}")
231227
self._comparator_queue_length = comparator_queue_length
232228
if self.initialized:
233229
self._write_config()
@@ -256,9 +252,7 @@ def comparator_low_threshold(self, value: int) -> None:
256252
:param int value: 16-bit signed integer to write to register
257253
"""
258254
if value < -32768 or value > 32767:
259-
raise ValueError(
260-
"Comparator Threshold value must be between -32768 and 32767"
261-
)
255+
raise ValueError("Comparator Threshold value must be between -32768 and 32767")
262256

263257
self._comparator_low_threshold = value
264258
self._write_register(_ADS1X15_POINTER_LO_THRES, self.comparator_low_threshold)
@@ -270,9 +264,7 @@ def comparator_high_threshold(self, value: int) -> None:
270264
:param int value: 16-bit signed integer to write to register
271265
"""
272266
if value < -32768 or value > 32767:
273-
raise ValueError(
274-
"Comparator Threshold value must be between -32768 and 32767"
275-
)
267+
raise ValueError("Comparator Threshold value must be between -32768 and 32767")
276268

277269
self._comparator_high_threshold = value
278270
self._write_register(_ADS1X15_POINTER_HI_THRES, self.comparator_high_threshold)
@@ -440,28 +432,20 @@ def _read_config(self) -> None:
440432
config_value = self._read_register(_ADS1X15_POINTER_CONFIG)
441433

442434
self.gain = next(
443-
key
444-
for key, value in _ADS1X15_CONFIG_GAIN.items()
445-
if value == (config_value & 0x0E00)
435+
key for key, value in _ADS1X15_CONFIG_GAIN.items() if value == (config_value & 0x0E00)
446436
)
447437
self.data_rate = next(
448-
key
449-
for key, value in self.rate_config.items()
450-
if value == (config_value & 0x00E0)
438+
key for key, value in self.rate_config.items() if value == (config_value & 0x00E0)
451439
)
452440
self.comparator_queue_length = next(
453441
key
454442
for key, value in _ADS1X15_CONFIG_COMP_QUEUE.items()
455443
if value == (config_value & 0x0003)
456444
)
457445
self.mode = Mode.SINGLE if config_value & 0x0100 else Mode.CONTINUOUS
458-
self.comparator_mode = (
459-
Comp_Mode.WINDOW if config_value & 0x0010 else Comp_Mode.TRADITIONAL
460-
)
446+
self.comparator_mode = Comp_Mode.WINDOW if config_value & 0x0010 else Comp_Mode.TRADITIONAL
461447
self.comparator_polarity = (
462-
Comp_Polarity.ACTIVE_HIGH
463-
if config_value & 0x0008
464-
else Comp_Polarity.ACTIVE_LOW
448+
Comp_Polarity.ACTIVE_HIGH if config_value & 0x0008 else Comp_Polarity.ACTIVE_LOW
465449
)
466450
self.comparator_latch = (
467451
Comp_Latch.LATCHING if config_value & 0x0004 else Comp_Latch.NONLATCHING

0 commit comments

Comments
 (0)