Skip to content

Commit 233ec29

Browse files
committed
drivers/sensor/mcp9808: Ruff formatting.
Signed-off-by: MarcoMiano <[email protected]>
1 parent 0d2e56c commit 233ec29

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

micropython/drivers/sensor/mcp9808/mcp9808.py

+11-17
Original file line numberDiff line numberDiff line change
@@ -242,38 +242,36 @@ def _set_config(
242242

243243
# Type/value check the parameters
244244
if hyst_mode not in [HYST_00, HYST_15, HYST_30, HYST_60]:
245-
raise ValueError(
246-
f"hyst_mode: {hyst_mode}. Value should be between 0 and 3 inclusive."
247-
)
248-
if shdn.__class__ != bool:
245+
raise ValueError(f"hyst_mode: {hyst_mode}. Value should be between 0 and 3 inclusive.")
246+
if shdn is not bool:
249247
raise TypeError(
250248
f"shdn: {shdn} {shdn.__class__}. Expecting a bool.",
251249
)
252-
if crit_lock.__class__ != bool:
250+
if crit_lock is not bool:
253251
raise TypeError(
254252
f"crit_lock: {crit_lock} {crit_lock.__class__}. Expecting a bool.",
255253
)
256-
if alerts_lock.__class__ != bool:
254+
if alerts_lock is not bool:
257255
raise TypeError(
258256
f"alerts_lock: {alerts_lock} {alerts_lock.__class__}. Expecting a bool.",
259257
)
260-
if irq_clear_bit.__class__ != bool:
258+
if irq_clear_bit is not bool:
261259
raise TypeError(
262260
f"irq_clear_bit: {irq_clear_bit} {irq_clear_bit.__class__}. Expecting a bool.",
263261
)
264-
if alert_ctrl.__class__ != bool:
262+
if alert_ctrl is not bool:
265263
raise TypeError(
266264
f"alert_ctrl: {alert_ctrl} {alert_ctrl.__class__}. Expecting a bool.",
267265
)
268-
if alert_sel.__class__ != bool:
266+
if alert_sel is not bool:
269267
raise TypeError(
270268
f"alert_sel: {alert_sel} {alert_sel.__class__}. Expecting a bool.",
271269
)
272-
if alert_pol.__class__ != bool:
270+
if alert_pol is not bool:
273271
raise TypeError(
274272
f"alert_pol: {alert_pol} {alert_pol.__class__}. Expecting a bool.",
275273
)
276-
if alert_mode.__class__ != bool:
274+
if alert_mode is not bool:
277275
raise TypeError(
278276
f"alert_mode: {alert_mode} {alert_mode.__class__}. Expecting a bool.",
279277
)
@@ -308,9 +306,7 @@ def _set_config(
308306
f"[WARN] Failed to set crit_lock. Set {crit_lock} got {self._crit_lock}",
309307
)
310308
if self.irq_clear_bit:
311-
print(
312-
"[WARN] Something wrong with irq_clear_bit. Should always read False"
313-
)
309+
print("[WARN] Something wrong with irq_clear_bit. Should always read False")
314310
if self._alerts_lock != alerts_lock:
315311
print(
316312
f"[WARN] Failed to set alerts_lock. Set {alerts_lock} got {self._alerts_lock}",
@@ -626,9 +622,7 @@ def set_resolution(self, resolution=RES_0_0625) -> None:
626622
if self._debug:
627623
check = self._i2c.readfrom_mem(self._addr, self.REG_RES, 1)
628624
if check != buf:
629-
print(
630-
f"[WARN] Failed to set resolution. Set {resolution} got {check[0]}"
631-
)
625+
print(f"[WARN] Failed to set resolution. Set {resolution} got {check[0]}")
632626

633627
@property
634628
def hyst_mode(self) -> int:

0 commit comments

Comments
 (0)