Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change mypy configuration to not ignore all missing imports #144

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ requires = [
build-backend = "poetry.core.masonry.api"

[tool.mypy]
python_version = "3.10"

[[tool.mypy.overrides]]
module = [
"coloredlogs",
"icecream",
"imgsize",
"networkx",
"objgraph",
"pylab",
"pyloot.*",
"pyquaternion",
"pyudev",
"scipy.*",
"serial.*",
"socketio.*",
"suntime",
"yappi",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
Expand Down
2 changes: 1 addition & 1 deletion rosys/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .memory import MemoryMiddleware
from .profile_button_ import ProfileButton as profile_button
from .timelapse_recorder import TimelapseRecorder
from .track import track
from .tracking import track
from .videos_page_ import VideosPage as videos_page

__all__ = [
Expand Down
File renamed without changes.
15 changes: 8 additions & 7 deletions rosys/driving/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import numpy as np

from .. import analysis, rosys
from .. import rosys
from ..analysis import track
from ..geometry import Point, Pose, Spline
from ..helpers import ModificationContext, eliminate_2pi, eliminate_pi, ramp
from .drivable import Drivable
Expand Down Expand Up @@ -68,13 +69,13 @@ def abort(self) -> None:
"""Abort the current drive routine."""
self._abort = True

@analysis.track
@track
async def drive_square(self) -> None:
start_pose = deepcopy(self.prediction)
for x, y in [(1, 0), (1, 1), (0, 1), (0, 0)]:
await self.drive_to(start_pose.transform(Point(x=x, y=y)))

@analysis.track
@track
async def drive_arc(self) -> None:
while self.prediction.x < 2:
if self._abort:
Expand All @@ -84,12 +85,12 @@ async def drive_arc(self) -> None:
await rosys.sleep(0.1)
await self.wheels.stop()

@analysis.track
@track
async def drive_path(self, path: list[PathSegment]) -> None:
for segment in path:
await self.drive_spline(segment.spline, throttle_at_end=segment == path[-1], flip_hook=segment.backward)

@analysis.track
@track
async def drive_to(self, target: Point, backward: bool = False) -> None:
if self.parameters.minimum_turning_radius:
await self.drive_circle(target, backward)
Expand All @@ -103,7 +104,7 @@ async def drive_to(self, target: Point, backward: bool = False) -> None:
)
await self.drive_spline(approach_spline, flip_hook=backward)

@analysis.track
@track
async def drive_circle(self, target: Point, backward: bool = False) -> None:
while True:
if self._abort:
Expand All @@ -123,7 +124,7 @@ async def drive_circle(self, target: Point, backward: bool = False) -> None:
await self.wheels.drive(*self._throttle(linear, angular))
await rosys.sleep(0.1)

@analysis.track
@track
async def drive_spline(self, spline: Spline, *, flip_hook: bool = False, throttle_at_end: bool = True) -> None:
if spline.start.distance(spline.end) < 0.01:
return # NOTE: skip tiny splines
Expand Down
41 changes: 0 additions & 41 deletions rosys/hardware/hardware_proxy.py

This file was deleted.

2 changes: 1 addition & 1 deletion rosys/vision/usb_camera/usb_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ... import run
from .usb_camera_scanner import device_nodes_from_uid

MJPG = cv2.VideoWriter_fourcc(*'MJPG')
MJPG = cv2.VideoWriter.fourcc(*'MJPG')


def find_video_id(camera_uid: str) -> Optional[int]:
Expand Down
Loading