Skip to content

Commit f27245c

Browse files
committed
Fix bad return type annotation, reformat per pre-commit
1 parent 4e993f8 commit f27245c

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

adafruit_rplidar.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def _process_scan(raw: bytes) -> Tuple[bool, int, float, float]:
105105
return new_scan, quality, angle, distance
106106

107107

108-
def _process_express_scan(data: "ExpressPacket", new_angle: float, frame: int) -> Tuple[bool, None, float, float]:
108+
def _process_express_scan(
109+
data: "ExpressPacket", new_angle: float, frame: int
110+
) -> Tuple[bool, None, float, float]:
109111
new_scan = (new_angle < data.start_angle) & (frame == 1)
110112
angle = (
111113
data.start_angle
@@ -132,7 +134,14 @@ class RPLidar:
132134
express_data = False
133135
express_old_data = None
134136

135-
def __init__(self, motor_pin: DigitalInOut, port: UART, baudrate: int = 115200, timeout: float = 1, logging: bool = False) -> None:
137+
def __init__(
138+
self,
139+
motor_pin: DigitalInOut,
140+
port: UART,
141+
baudrate: int = 115200,
142+
timeout: float = 1,
143+
logging: bool = False,
144+
) -> None:
136145
"""Initialize RPLidar object for communicating with the sensor.
137146
138147
Parameters
@@ -224,7 +233,7 @@ def start_motor(self) -> None:
224233
self.set_pwm(DEFAULT_MOTOR_PWM)
225234
self.motor_running = True
226235

227-
def stop_motor(self) > None:
236+
def stop_motor(self) -> None:
228237
"""Stops sensor motor"""
229238
self.log("info", "Stopping motor")
230239
# For A2
@@ -402,7 +411,9 @@ def reset(self) -> None:
402411
time.sleep(0.002)
403412
self.clear_input()
404413

405-
def iter_measurements(self, max_buf_meas: int = 500, scan_type: int = SCAN_TYPE_NORMAL) -> Iterator[Tuple[bool, Optional[int], float, float]]:
414+
def iter_measurements(
415+
self, max_buf_meas: int = 500, scan_type: int = SCAN_TYPE_NORMAL
416+
) -> Iterator[Tuple[bool, Optional[int], float, float]]:
406417
"""Iterate over measurements. Note that consumer must be fast enough,
407418
otherwise data will be accumulated inside buffer and consumer will get
408419
data with increasing lag.
@@ -488,7 +499,9 @@ def iter_measurements(self, max_buf_meas: int = 500, scan_type: int = SCAN_TYPE_
488499
self.express_frame,
489500
)
490501

491-
def iter_measurments(self, max_buf_meas: int = 500) -> Iterator[Tuple[bool, int, float, float]]:
502+
def iter_measurments(
503+
self, max_buf_meas: int = 500
504+
) -> Iterator[Tuple[bool, int, float, float]]:
492505
"""For compatibility, this method wraps `iter_measurements`"""
493506
warnings.warn(
494507
"The method `iter_measurments` has been renamed "
@@ -497,7 +510,9 @@ def iter_measurments(self, max_buf_meas: int = 500) -> Iterator[Tuple[bool, int,
497510
)
498511
self.iter_measurements(max_buf_meas=max_buf_meas)
499512

500-
def iter_scans(self, max_buf_meas: int = 500, min_len: int = 5) -> List[int, float, float]:
513+
def iter_scans(
514+
self, max_buf_meas: int = 500, min_len: int = 5
515+
) -> List[int, float, float]:
501516
"""Iterate over scans. Note that consumer must be fast enough,
502517
otherwise data will be accumulated inside buffer and consumer will get
503518
data with increasing lag.

0 commit comments

Comments
 (0)