Skip to content

Commit 7fcada8

Browse files
committed
black and pylint cleanup
1 parent c4930c8 commit 7fcada8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

adafruit_mpu6050.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class Rate: # pylint: disable=too-few-public-methods
173173
CYCLE_40_HZ = 3 # 40 Hz
174174

175175

176-
class MPU6050:
176+
class MPU6050: # pylint: disable=too-many-instance-attributes
177177
"""Driver for the MPU6050 6-DoF accelerometer and gyroscope.
178178
179179
:param ~busio.I2C i2c_bus: The I2C bus the device is connected to
@@ -218,7 +218,7 @@ def __init__(self, i2c_bus: I2C, address: int = _MPU6050_DEFAULT_ADDRESS) -> Non
218218
self._filter_bandwidth = Bandwidth.BAND_260_HZ
219219
self._gyro_range = GyroRange.RANGE_500_DPS
220220
self._accel_range = Range.RANGE_2_G
221-
self._accel_scale = 1.0/[16384,8192,4096,2048][self._accel_range]
221+
self._accel_scale = 1.0 / [16384,8192,4096,2048][self._accel_range]
222222
sleep(0.100)
223223
self.clock_source = (
224224
ClockSource.CLKSEL_INTERNAL_X
@@ -277,10 +277,10 @@ def temperature(self) -> float:
277277
def acceleration(self) -> Tuple[float, float, float]:
278278
"""Acceleration X, Y, and Z axis data in :math:`m/s^2`"""
279279
raw_data = self._raw_accel_data
280-
return self.scale_accel([raw_data[0][0],raw_data[1][0],raw_data[2][0]])
280+
return self.scale_accel([raw_data[0][0], raw_data[1][0], raw_data[2][0]])
281281

282282
def scale_accel(self, raw_data) -> Tuple[float, float, float]:
283-
# setup range dependent scaling
283+
"""Scale raw X, Y, and Z axis data to :math:`m/s^2`"""
284284
accel_x = (raw_data[0] * self._accel_scale) * STANDARD_GRAVITY
285285
accel_y = (raw_data[1] * self._accel_scale) * STANDARD_GRAVITY
286286
accel_z = (raw_data[2] * self._accel_scale) * STANDARD_GRAVITY
@@ -293,6 +293,7 @@ def gyro(self) -> Tuple[float, float, float]:
293293
return self.scale_gyro((raw_data[0][0], raw_data[1][0], raw_data[2][0]))
294294

295295
def scale_gyro(self, raw_data) -> Tuple[float, float, float]:
296+
"""Scale raw gyro data to :math:`º/s`"""
296297
raw_x = raw_data[0]
297298
raw_y = raw_data[1]
298299
raw_z = raw_data[2]
@@ -348,7 +349,7 @@ def accelerometer_range(self, value: int) -> None:
348349
if (value < 0) or (value > 3):
349350
raise ValueError("accelerometer_range must be a Range")
350351
self._accel_range = value
351-
self._accel_scale = 1.0/[16384,8192,4096,2048][value]
352+
self._accel_scale = 1.0 / [16384,8192,4096,2048][value]
352353
sleep(0.01)
353354

354355
@property
@@ -392,8 +393,8 @@ def clock_source(self, value: int) -> None:
392393
def read_whole_fifo(self):
393394
"""Return raw FIFO bytes"""
394395
# This code must be fast to ensure samples are contiguous
395-
c = self.fifo_count
396-
buf = bytearray(c)
396+
count = self.fifo_count
397+
buf = bytearray(count)
397398
buf[0] = _MPU6050_FIFO_R_W
398399
with self.i2c_device:
399400
self.i2c_device.write_then_readinto(buf, buf, out_end=1, in_start=0)

0 commit comments

Comments
 (0)