Skip to content

Commit e586707

Browse files
committed
updating to use try/except
1 parent cc89d00 commit e586707

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_ahtx0.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def reset(self) -> None:
107107

108108
def calibrate(self) -> bool:
109109
"""Ask the sensor to self-calibrate. Returns True on success, False otherwise"""
110-
"""Newer AHT20's may not succeed, so wrapping in try/except"""
110+
# Newer AHT20's may not succeed, so wrapping in try/except
111111
try:
112112
self._buf[0] = AHTX0_CMD_CALIBRATE
113113
self._buf[1] = 0x08
@@ -118,9 +118,9 @@ def calibrate(self) -> bool:
118118
time.sleep(0.01)
119119
if not self.status & AHTX0_STATUS_CALIBRATED:
120120
return False
121-
return True
122-
except:
121+
except Exception: # pylint: disable=broad-except
123122
pass
123+
return True
124124

125125
@property
126126
def status(self) -> int:

0 commit comments

Comments
 (0)