Skip to content

Commit 58bf849

Browse files
committed
fix a few types
1 parent 90fc720 commit 58bf849

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ __pycache__
3232
# Sphinx build-specific files
3333
_build
3434

35-
# MyPy-specific type-checking files
36-
.mypy_cache
37-
38-
# pip install files
39-
/build/
40-
4135
# This file results from running `pip -e install .` in a local repository
4236
*.egg-info
4337

adafruit_bno08x/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
# For IDE type recognition
4242
try:
4343
from typing import Any, Dict, List, Optional, Tuple, Union
44+
from digitalio import DigitalInOut
4445
except ImportError:
4546
pass
4647

@@ -219,7 +220,7 @@ def _elapsed(start_time: float) -> float:
219220

220221

221222
############ PACKET PARSING ###########################
222-
def _parse_sensor_report_data(report_bytes: bytearray) -> Tuple[Any, int]:
223+
def _parse_sensor_report_data(report_bytes: bytearray) -> Tuple[Tuple, int]:
223224
"""Parses reports with only 16-bit fields"""
224225
data_offset = 4 # this may not always be true
225226
report_id = report_bytes[0]
@@ -272,7 +273,7 @@ def _parse_get_feature_response_report(report_bytes: bytearray) -> Tuple[Any, ..
272273
# 4 Page Number + EOS
273274
# 5 Most likely state
274275
# 6-15 Classification (10 x Page Number) + confidence
275-
def _parse_activity_classifier_report(report_bytes: bytearray) -> Dict[str, int]:
276+
def _parse_activity_classifier_report(report_bytes: bytearray) -> Dict[str, str]:
276277
activities = [
277278
"Unknown",
278279
"In-Vehicle", # look
@@ -491,9 +492,11 @@ class BNO08X: # pylint: disable=too-many-instance-attributes, too-many-public-m
491492
492493
"""
493494

494-
def __init__(self, reset: Optional[dict] = None, debug: bool = False) -> None:
495+
def __init__(
496+
self, reset: Optional[DigitalInOut] = None, debug: bool = False
497+
) -> None:
495498
self._debug: bool = debug
496-
self._reset: Optional[dict] = reset
499+
self._reset: Optional[DigitalInOut] = reset
497500
self._dbg("********** __init__ *************")
498501
self._data_buffer: bytearray = bytearray(DATA_BUFFER_SIZE)
499502
self._command_buffer: bytearray = bytearray(12)
@@ -503,7 +506,7 @@ def __init__(self, reset: Optional[dict] = None, debug: bool = False) -> None:
503506
self._sequence_number: List[int] = [0, 0, 0, 0, 0, 0]
504507
self._two_ended_sequence_numbers: Dict[int, int] = {}
505508
self._dcd_saved_at: float = -1
506-
self._me_calibration_started_at: float = -1
509+
self._me_calibration_started_at: float = -1.0
507510
self._calibration_complete = False
508511
self._magnetometer_accuracy = 0
509512
self._wait_for_initialize = True
@@ -956,7 +959,7 @@ def _process_report(self, report_id: int, report_bytes: bytearray) -> None:
956959
@staticmethod
957960
def _get_feature_enable_report(
958961
feature_id: int,
959-
report_interval: Any = _DEFAULT_REPORT_INTERVAL,
962+
report_interval: int = _DEFAULT_REPORT_INTERVAL,
960963
sensor_specific_config: int = 0,
961964
) -> bytearray:
962965
set_feature_report = bytearray(17)

0 commit comments

Comments
 (0)