scirodev 0.5.2__tar.gz → 0.5.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scirodev-0.5.2/scirodev.egg-info → scirodev-0.5.3}/PKG-INFO +1 -1
- {scirodev-0.5.2 → scirodev-0.5.3}/pyproject.toml +1 -1
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/tools.py +50 -1
- {scirodev-0.5.2 → scirodev-0.5.3/scirodev.egg-info}/PKG-INFO +1 -1
- {scirodev-0.5.2 → scirodev-0.5.3}/LICENSE +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/README.md +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/__init__.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/_common.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/floorpro.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/hubs.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/iodevices.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/parameters.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/pump.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/py.typed +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/sciro/robotics.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev/__init__.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev/cli.py +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev.egg-info/SOURCES.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev.egg-info/dependency_links.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev.egg-info/entry_points.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev.egg-info/requires.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/scirodev.egg-info/top_level.txt +0 -0
- {scirodev-0.5.2 → scirodev-0.5.3}/setup.cfg +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scirodev"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.3"
|
|
8
8
|
description = "PeakHub / sciro extensions to Pybricks: typed API stubs (sciro.*) and hub tooling on top of pybricksdev"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -4,7 +4,56 @@ helpers. EXPERIMENTAL: the API may still change between releases.
|
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
-
from typing import
|
|
7
|
+
from typing import (
|
|
8
|
+
TYPE_CHECKING,
|
|
9
|
+
Any,
|
|
10
|
+
Awaitable,
|
|
11
|
+
Callable,
|
|
12
|
+
Iterable,
|
|
13
|
+
Iterator,
|
|
14
|
+
Optional,
|
|
15
|
+
Sequence,
|
|
16
|
+
Tuple,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from pybricks._common import MaybeAwaitableTuple
|
|
21
|
+
else:
|
|
22
|
+
# Upstream defines this only for type checkers; runtime importers of the
|
|
23
|
+
# stubs (the docs build) need a value. Annotations are strings here
|
|
24
|
+
# (from __future__ import annotations), so a placeholder suffices.
|
|
25
|
+
MaybeAwaitableTuple = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def multitask(*coroutines: Awaitable[Any], race: bool = False) -> MaybeAwaitableTuple:
|
|
29
|
+
"""multitask(coroutine1, coroutine2, ..., race=False) -> Tuple
|
|
30
|
+
|
|
31
|
+
``pybricks.tools.multitask`` (the same function on the hub), typed to
|
|
32
|
+
accept any awaitable.
|
|
33
|
+
|
|
34
|
+
The upstream stub asks for ``Coroutine``, which every *maybe-awaitable*
|
|
35
|
+
hub method fails to satisfy for a type checker: ``motor.run_angle(...)``,
|
|
36
|
+
``db.straight(...)`` or ``sensor.read()`` are declared as awaitables, not
|
|
37
|
+
as coroutines, because they return a plain value when called outside
|
|
38
|
+
``run_task``. Importing ``multitask`` (and :func:`run_task`) from
|
|
39
|
+
``sciro.tools`` instead of ``pybricks.tools`` removes those warnings::
|
|
40
|
+
|
|
41
|
+
from sciro.tools import multitask, run_task
|
|
42
|
+
|
|
43
|
+
async def main():
|
|
44
|
+
await multitask(db.straight(500), log.record(db.state), race=True)
|
|
45
|
+
|
|
46
|
+
run_task(main())
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def run_task(coroutine: Optional[Awaitable[Any]] = None) -> Optional[bool]:
|
|
51
|
+
"""run_task(coroutine) -> bool | None
|
|
52
|
+
|
|
53
|
+
``pybricks.tools.run_task`` (the same function on the hub), typed to
|
|
54
|
+
accept any awaitable; see :func:`multitask`. Without an argument it
|
|
55
|
+
returns whether the run loop is active.
|
|
56
|
+
"""
|
|
8
57
|
|
|
9
58
|
|
|
10
59
|
class RingBuffer:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|