Skip to content

Commit 951aaff

Browse files
committed
adjusted moved pylint statements and other small items
1 parent aa2a50b commit 951aaff

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

adafruit_bno055.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from adafruit_register.i2c_struct import Struct, UnaryStruct
3737

3838
try:
39-
from typing import Optional, Tuple, Union
39+
from typing import Optional, Tuple, Type, Union
4040
from busio import I2C, UART
4141
except ImportError:
4242
pass
@@ -221,7 +221,7 @@ class BNO055: # pylint: disable=too-many-public-methods
221221
def __init__(self) -> None:
222222
chip_id = self._read_register(_ID_REGISTER)
223223
if chip_id != _CHIP_ID:
224-
raise RuntimeError("bad chip id (%x != %x)" % (chip_id, _CHIP_ID))
224+
raise RuntimeError(f"bad chip id ({chip_id:#x} != {_CHIP_ID:#x})")
225225
self._reset()
226226
self.set_normal_mode()
227227
self._write_register(_PAGE_REGISTER, 0x00)
@@ -406,7 +406,7 @@ def _temperature(self) -> None:
406406
raise NotImplementedError("Must be implemented.")
407407

408408
@property
409-
def acceleration(self) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
409+
def acceleration(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
410410
"""Gives the raw accelerometer readings, in m/s.
411411
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
412412
"""
@@ -419,7 +419,7 @@ def _acceleration(self) -> None:
419419
raise NotImplementedError("Must be implemented.")
420420

421421
@property
422-
def magnetic(self) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
422+
def magnetic(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
423423
"""Gives the raw magnetometer readings in microteslas.
424424
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
425425
"""
@@ -432,7 +432,7 @@ def _magnetic(self) -> None:
432432
raise NotImplementedError("Must be implemented.")
433433

434434
@property
435-
def gyro(self) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
435+
def gyro(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
436436
"""Gives the raw gyroscope reading in radians per second.
437437
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
438438
"""
@@ -445,7 +445,7 @@ def _gyro(self) -> None:
445445
raise NotImplementedError("Must be implemented.")
446446

447447
@property
448-
def euler(self) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
448+
def euler(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
449449
"""Gives the calculated orientation angles, in degrees.
450450
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
451451
"""
@@ -458,7 +458,7 @@ def _euler(self) -> None:
458458
raise NotImplementedError("Must be implemented.")
459459

460460
@property
461-
def quaternion(self) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
461+
def quaternion(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
462462
"""Gives the calculated orientation as a quaternion.
463463
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
464464
"""
@@ -473,7 +473,7 @@ def _quaternion(self) -> None:
473473
@property
474474
def linear_acceleration(
475475
self,
476-
) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
476+
) -> Tuple[Optional[float], Optional[float], Optional[float]]:
477477
"""Returns the linear acceleration, without gravity, in m/s.
478478
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
479479
"""
@@ -486,7 +486,7 @@ def _linear_acceleration(self) -> None:
486486
raise NotImplementedError("Must be implemented.")
487487

488488
@property
489-
def gravity(self) -> Tuple[Optonal[float], Optional[float], Optional[float]]:
489+
def gravity(self) -> Tuple[Optional[float], Optional[float], Optional[float]]:
490490
"""Returns the gravity vector, without acceleration in m/s.
491491
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
492492
"""
@@ -811,9 +811,9 @@ def __init__(self, uart: UART) -> None:
811811
self._uart.baudrate = 115200
812812
super().__init__()
813813

814-
def _write_register(
814+
def _write_register( # pylint: disable=arguments-differ,arguments-renamed
815815
self, register: int, data: int
816-
) -> None: # pylint: disable=arguments-differ,arguments-renamed
816+
) -> None:
817817
if not isinstance(data, bytes):
818818
data = bytes([data])
819819
self._uart.write(bytes([0xAA, 0x00, register, len(data)]) + data)
@@ -826,9 +826,9 @@ def _write_register(
826826
if resp[0] != 0xEE or resp[1] != 0x01:
827827
raise RuntimeError(f"UART write error: {resp[1]}")
828828

829-
def _read_register(
829+
def _read_register( # pylint: disable=arguments-differ
830830
self, register: int, length: int = 1
831-
) -> int: # pylint: disable=arguments-differ
831+
) -> int:
832832
i = 0
833833
while i < 3:
834834
self._uart.write(bytes([0xAA, 0x01, register, length]))

0 commit comments

Comments
 (0)