mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
pybricks.tools: add read_input_byte()
This adds stubs and docs for the new `pybricks.tools.read_input_byte()` function.
This commit is contained in:
@@ -22,6 +22,11 @@ Timing tools
|
||||
|
||||
.. automethod:: pybricks.tools.StopWatch.reset
|
||||
|
||||
Input tools
|
||||
-----------
|
||||
|
||||
.. autofunction:: pybricks.tools.read_input_byte
|
||||
|
||||
Linear algebra tools
|
||||
--------------------
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ def test_from_pybricks_tools_import():
|
||||
"cross",
|
||||
"DataLog",
|
||||
"Matrix",
|
||||
"read_input_byte",
|
||||
"StopWatch",
|
||||
"vector",
|
||||
"wait",
|
||||
|
||||
+12
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Sequence, Tuple, overload
|
||||
from typing import TYPE_CHECKING, Any, Optional, Sequence, Tuple, overload
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .parameters import Number
|
||||
@@ -222,6 +222,17 @@ def cross(a: Matrix, b: Matrix) -> Matrix:
|
||||
"""
|
||||
|
||||
|
||||
def read_input_byte() -> Optional[int]:
|
||||
"""
|
||||
read_input_byte() -> int | None
|
||||
|
||||
Reads one byte from standard input without blocking.
|
||||
|
||||
Returns:
|
||||
The numeric value of the byte read or ``None`` if no data is available.
|
||||
"""
|
||||
|
||||
|
||||
# HACK: hide from jedi
|
||||
if TYPE_CHECKING:
|
||||
del Number
|
||||
|
||||
Reference in New Issue
Block a user