Skip to content

Commit

Permalink
pybricks.tools: Document run loop active check.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Mar 5, 2024
1 parent 2e538b6 commit 7acdfc0
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions src/pybricks/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class StopWatch:
"""A stopwatch to measure time intervals. Similar to the stopwatch
feature on your phone."""

def __init__(self):
...
def __init__(self): ...

def time(self) -> int:
"""time() -> int: ms
Expand Down Expand Up @@ -108,38 +107,27 @@ class Matrix:
A :class:`.Matrix` object is immutable."""

def __add__(self, other) -> Matrix:
...
def __add__(self, other) -> Matrix: ...

def __iadd__(self, other) -> Matrix:
...
def __iadd__(self, other) -> Matrix: ...

def __sub__(self, other) -> Matrix:
...
def __sub__(self, other) -> Matrix: ...

def __isub__(self, other) -> Matrix:
...
def __isub__(self, other) -> Matrix: ...

def __mul__(self, other) -> Matrix:
...
def __mul__(self, other) -> Matrix: ...

def __rmul__(self, other) -> Matrix:
...
def __rmul__(self, other) -> Matrix: ...

def __imul__(self, other) -> Matrix:
...
def __imul__(self, other) -> Matrix: ...

def __truediv__(self, other) -> Matrix:
...
def __truediv__(self, other) -> Matrix: ...

def __itruediv__(self, other) -> Matrix:
...
def __itruediv__(self, other) -> Matrix: ...

def __floordiv__(self, other) -> Matrix:
...
def __floordiv__(self, other) -> Matrix: ...

def __ifloordiv__(self, other) -> Matrix:
...
def __ifloordiv__(self, other) -> Matrix: ...

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


def run_task(coroutine: Coroutine):
def run_task(coroutine: Coroutine) -> Optional[bool]:
"""
run_task(coroutine)
run_task(coroutine) -> bool | None
Runs a coroutine from start to finish while blocking the rest of the
program. This is used primarily to run the main coroutine of a program.
Calls to this function are not allowed to be nested.
Arguments:
coroutine (coroutine): The main coroutine to run.
Returns:
If no ``coroutine`` is given, this function returns whether the
run loop is currently active (``True``) or not (``False``).
"""


Expand Down

0 comments on commit 7acdfc0

Please sign in to comment.