Skip to content

Commit 7acdfc0

Browse files
committed
pybricks.tools: Document run loop active check.
1 parent 2e538b6 commit 7acdfc0

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

src/pybricks/tools.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ class StopWatch:
2626
"""A stopwatch to measure time intervals. Similar to the stopwatch
2727
feature on your phone."""
2828

29-
def __init__(self):
30-
...
29+
def __init__(self): ...
3130

3231
def time(self) -> int:
3332
"""time() -> int: ms
@@ -108,38 +107,27 @@ class Matrix:
108107
109108
A :class:`.Matrix` object is immutable."""
110109

111-
def __add__(self, other) -> Matrix:
112-
...
110+
def __add__(self, other) -> Matrix: ...
113111

114-
def __iadd__(self, other) -> Matrix:
115-
...
112+
def __iadd__(self, other) -> Matrix: ...
116113

117-
def __sub__(self, other) -> Matrix:
118-
...
114+
def __sub__(self, other) -> Matrix: ...
119115

120-
def __isub__(self, other) -> Matrix:
121-
...
116+
def __isub__(self, other) -> Matrix: ...
122117

123-
def __mul__(self, other) -> Matrix:
124-
...
118+
def __mul__(self, other) -> Matrix: ...
125119

126-
def __rmul__(self, other) -> Matrix:
127-
...
120+
def __rmul__(self, other) -> Matrix: ...
128121

129-
def __imul__(self, other) -> Matrix:
130-
...
122+
def __imul__(self, other) -> Matrix: ...
131123

132-
def __truediv__(self, other) -> Matrix:
133-
...
124+
def __truediv__(self, other) -> Matrix: ...
134125

135-
def __itruediv__(self, other) -> Matrix:
136-
...
126+
def __itruediv__(self, other) -> Matrix: ...
137127

138-
def __floordiv__(self, other) -> Matrix:
139-
...
128+
def __floordiv__(self, other) -> Matrix: ...
140129

141-
def __ifloordiv__(self, other) -> Matrix:
142-
...
130+
def __ifloordiv__(self, other) -> Matrix: ...
143131

144132
def __init__(self, rows: Sequence[Sequence[float]]):
145133
"""Matrix(rows)
@@ -275,15 +263,21 @@ def multitask(*coroutines: Coroutine, race=False) -> MaybeAwaitableTuple:
275263
"""
276264

277265

278-
def run_task(coroutine: Coroutine):
266+
def run_task(coroutine: Coroutine) -> Optional[bool]:
279267
"""
280-
run_task(coroutine)
268+
run_task(coroutine) -> bool | None
281269
282270
Runs a coroutine from start to finish while blocking the rest of the
283271
program. This is used primarily to run the main coroutine of a program.
284272
273+
Calls to this function are not allowed to be nested.
274+
285275
Arguments:
286276
coroutine (coroutine): The main coroutine to run.
277+
278+
Returns:
279+
If no ``coroutine`` is given, this function returns whether the
280+
run loop is currently active (``True``) or not (``False``).
287281
"""
288282

289283

0 commit comments

Comments
 (0)