pybricks.common.Charger: Add typing.

This commit is contained in:
Laurens Valk
2022-05-30 09:29:14 +02:00
parent dd54d67720
commit 515d261bad
2 changed files with 19 additions and 18 deletions
+19 -13
View File
@@ -828,33 +828,39 @@ class Battery:
class Charger:
"""Get the status of a battery charger."""
def connected(self):
"""Checks whether a charger is connected via USB.
def connected(self) -> bool:
"""connected() -> bool
Checks whether a charger is connected via USB.
Returns:
bool: ``True`` if a charger is connected, ``False`` if not.
``True`` if a charger is connected, ``False`` if not.
"""
def status(self):
"""Gets the status of the battery charger, represented by one of the
def status(self) -> int:
"""status() -> int
Gets the status of the battery charger, represented by one of the
following values. This corresponds to the battery light indicator
right next to the USB port.
0. Not charging (off).
1. Charging (red).
2. Charging is complete (green).
3. There is a problem with the charger (yellow).
0. Not charging (light is off).
1. Charging (light is red).
2. Charging is complete (light is green).
3. There is a problem with the charger (light is yellow).
Returns:
int: Status value.
Status value.
"""
pass
def current(self):
"""Gets the charging current.
def current(self) -> int:
"""current() -> int: mA
Gets the charging current.
Returns:
:ref:`current`: Charging current.
Charging current.
"""
pass
-5
View File
@@ -6,11 +6,6 @@ from typing import Collection, Iterable, Optional, Tuple, Union, overload
from .geometry import Axis, Matrix, vector
from .parameters import Button, Color, Direction, Side, Stop, Port
class Charger:
def connected(self) -> bool: ...
def status(self) -> int: ...
def current(self) -> int: ...
class SimpleAccelerometer:
def acceleration(self) -> Tuple[int, int, int]: ...
def up(self) -> Side: ...