From 515d261bad05f3c4373b341567ef38982634bf54 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Mon, 30 May 2022 09:29:14 +0200 Subject: [PATCH] pybricks.common.Charger: Add typing. --- src/pybricks/_common.py | 32 +++++++++++++++++++------------- src/pybricks/_common.pyi | 5 ----- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/pybricks/_common.py b/src/pybricks/_common.py index 09fd2d3..b81b6f7 100644 --- a/src/pybricks/_common.py +++ b/src/pybricks/_common.py @@ -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 diff --git a/src/pybricks/_common.pyi b/src/pybricks/_common.pyi index 3640123..f87a73a 100644 --- a/src/pybricks/_common.pyi +++ b/src/pybricks/_common.pyi @@ -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: ...