Skip to content

Commit

Permalink
drivers/sensor/mcp9808: Ruff formatting.
Browse files Browse the repository at this point in the history
Signed-off-by: MarcoMiano <[email protected]>
  • Loading branch information
MarcoMiano committed Jan 1, 2025
1 parent 0d2e56c commit 233ec29
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions micropython/drivers/sensor/mcp9808/mcp9808.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,38 +242,36 @@ def _set_config(

# Type/value check the parameters
if hyst_mode not in [HYST_00, HYST_15, HYST_30, HYST_60]:
raise ValueError(
f"hyst_mode: {hyst_mode}. Value should be between 0 and 3 inclusive."
)
if shdn.__class__ != bool:
raise ValueError(f"hyst_mode: {hyst_mode}. Value should be between 0 and 3 inclusive.")
if shdn is not bool:
raise TypeError(
f"shdn: {shdn} {shdn.__class__}. Expecting a bool.",
)
if crit_lock.__class__ != bool:
if crit_lock is not bool:
raise TypeError(
f"crit_lock: {crit_lock} {crit_lock.__class__}. Expecting a bool.",
)
if alerts_lock.__class__ != bool:
if alerts_lock is not bool:
raise TypeError(
f"alerts_lock: {alerts_lock} {alerts_lock.__class__}. Expecting a bool.",
)
if irq_clear_bit.__class__ != bool:
if irq_clear_bit is not bool:
raise TypeError(
f"irq_clear_bit: {irq_clear_bit} {irq_clear_bit.__class__}. Expecting a bool.",
)
if alert_ctrl.__class__ != bool:
if alert_ctrl is not bool:
raise TypeError(
f"alert_ctrl: {alert_ctrl} {alert_ctrl.__class__}. Expecting a bool.",
)
if alert_sel.__class__ != bool:
if alert_sel is not bool:
raise TypeError(
f"alert_sel: {alert_sel} {alert_sel.__class__}. Expecting a bool.",
)
if alert_pol.__class__ != bool:
if alert_pol is not bool:
raise TypeError(
f"alert_pol: {alert_pol} {alert_pol.__class__}. Expecting a bool.",
)
if alert_mode.__class__ != bool:
if alert_mode is not bool:
raise TypeError(
f"alert_mode: {alert_mode} {alert_mode.__class__}. Expecting a bool.",
)
Expand Down Expand Up @@ -308,9 +306,7 @@ def _set_config(
f"[WARN] Failed to set crit_lock. Set {crit_lock} got {self._crit_lock}",
)
if self.irq_clear_bit:
print(
"[WARN] Something wrong with irq_clear_bit. Should always read False"
)
print("[WARN] Something wrong with irq_clear_bit. Should always read False")
if self._alerts_lock != alerts_lock:
print(
f"[WARN] Failed to set alerts_lock. Set {alerts_lock} got {self._alerts_lock}",
Expand Down Expand Up @@ -626,9 +622,7 @@ def set_resolution(self, resolution=RES_0_0625) -> None:
if self._debug:
check = self._i2c.readfrom_mem(self._addr, self.REG_RES, 1)
if check != buf:
print(
f"[WARN] Failed to set resolution. Set {resolution} got {check[0]}"
)
print(f"[WARN] Failed to set resolution. Set {resolution} got {check[0]}")

@property
def hyst_mode(self) -> int:
Expand Down

0 comments on commit 233ec29

Please sign in to comment.