pybricks.ev3devices: fix Motor code completion

The Microsoft Python extension for VS code doesn't include imports in
type hints, so the Motor type wasn't working properly. We can fix this
by wrapping the import type in a new, empty class definition.

The DCMotor class was also missing from ev3devices so this is fixed as well.
This commit is contained in:
David Lechner
2022-02-21 11:01:11 -06:00
parent df27ebc27e
commit 6b1f7d8eaa
2 changed files with 15 additions and 4 deletions
+10 -2
View File
@@ -1,10 +1,18 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
# Copyright (c) 2018-2022 The Pybricks Authors
"""LEGO® MINDSTORMS® EV3 motors and sensors."""
from .parameters import Direction as _Direction
from ._common import Motor # noqa E402
from ._common import DCMotor as _DCMotor, Motor as _Motor
class DCMotor(_DCMotor):
pass
class Motor(_Motor):
pass
class TouchSensor:
+5 -2
View File
@@ -1,10 +1,13 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
# Copyright (c) 2020-2022 The Pybricks Authors
from typing import List, Optional, Tuple
from .parameters import Color, Direction, Port, Button
from ._common import Motor # noqa E402
from ._common import DCMotor as _DCMotor, Motor as _Motor
class DCMotor(_DCMotor): ...
class Motor(_Motor): ...
class TouchSensor:
def __init__(self, port: Port): ...