Compare commits

...
Author SHA1 Message Date
David Lechner edf0f56675 github: simplify release-to-pypi action
We can just let pipx install poetry for us and we don't need a special
Python install or to run `poetry install`.

Also update action versions while we are touching this.
2022-12-09 15:05:10 -06:00
David Lechner 00f1c95ab2 pyproject: v3.2.0c1
Update `pybricks` package version for release to PyPI.
2022-12-09 15:03:27 -06:00
dependabot[bot] 72d55bdbd8 build(deps): bump certifi from 2022.9.24 to 2022.12.7
Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.9.24 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2022.09.24...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 09:21:17 -06:00
Laurens Valk 585b1b8ba3 pybricks.parameters.Side: Change Technic Hub orientation.
This makes it consistent with other hubs.

See: https://github.com/pybricks/support/issues/848

The IMU section was not included in V3.1 so it is not a breaking change,
but we add a versionchanged comment just in case.
2022-12-09 14:23:01 +01:00
Laurens Valk d9dfd0e370 doc/common/extensions: Separate checkmark from image.
This makes it easier to see when the images are small.

Fixes: https://github.com/pybricks/support/issues/838
2022-12-09 08:35:33 +01:00
David Lechner 8bfc2e10c8 doc: Use Pybricks blue.
This changes the navbar background color to use the official Pybricks
blue color.
2022-12-08 17:16:32 -06:00
Laurens Valk e2710157f0 doc/main/hubs: Use width to set scale.
Fixes https://github.com/pybricks/support/issues/844
2022-12-08 20:07:11 +01:00
Laurens Valk 96a3c04836 doc/main/index: Drop links from menu.
Table of contents can't be hidden based on tags, so we just remove them.

Instead, add a note in the body of the standalone version.

Fixes: https://github.com/pybricks/support/issues/839
2022-12-08 09:47:04 +01:00
Laurens Valk 72f5cb6827 micropython: Use separate keys for CTRL + C.
Since each :kbd: key is rendered as a button, it is more intuitive to
render them separately. (There is no CTRL-C button.)

Fixes https://github.com/pybricks/pybricks-api/issues/125
2022-12-08 09:32:08 +01:00
David Lechner e939c14fee docs/main/{prime,essential}hub: Remove beta note.
We are close to final release, so these are no longer considered beta.
2022-12-07 16:31:19 -06:00
David Lechner 3418c8320c doc/common/css/ide: improve styling of field list
The default style of using a grid with two columns wastes space when
displayed in a narrow pane, like in Pybricks Code. Using flex with
column direction makes it flow from top to bottom.

Fixes: https://github.com/pybricks/support/issues/832
2022-12-07 20:21:47 +01:00
Laurens Valk 4da4ce8f7c pybricks.robotics.DriveBase: Add clarifying comments.
Fixes https://github.com/pybricks/support/issues/698
2022-12-06 16:38:31 +01:00
Laurens Valk 6640fba104 npm/jedi: v1.5.0 2022-12-02 15:20:08 +01:00
Laurens Valk ecbfbcfccc jedi/pyproject: v1.5.0 2022-12-02 15:18:10 +01:00
Laurens Valk eff6eaa253 jedi: Add ustruct, json modules. 2022-12-02 15:17:55 +01:00
Laurens Valk f7984a4816 @pybricks/ide-docs v2.5.0 2022-12-02 14:37:50 +01:00
Laurens Valk eac3535d92 npm/jedi: v1.4.0
Update pybricks_jedi Python package to v1.4.0.
2022-12-02 14:36:21 +01:00
Laurens Valk 7fd508cc84 jedi/pyproject: v1.4.0 2022-12-02 14:34:47 +01:00
Laurens Valk 3a12de4766 jedi: update pybricks package to v3.2.0b6 2022-12-02 14:33:16 +01:00
Laurens Valk 5535da5b38 pyproject: v3.2.0b6
Update version for pybricks Python package release.
2022-12-02 14:29:33 +01:00
Laurens Valk ab4d4cc848 pybricks.pupdevices.Motor: Add versionchanged.
Document moving stalled, load, done.
2022-12-02 14:20:51 +01:00
Laurens Valk 82340c3eec jedi: Update tests for stalled, done. 2022-12-02 12:43:24 +01:00
Laurens Valk 14a4fc0d74 pybricks.robotics: Document behavior on shared resources.
Fixes https://github.com/pybricks/pybricks-api/issues/105.
2022-12-02 12:43:24 +01:00
Laurens Valk 99d5210313 pybricks.robotics.DriveBase: Add stalled, done. 2022-12-02 12:43:24 +01:00
Laurens Valk e6d2ce7f62 examples: Update use of done(). 2022-12-02 12:43:24 +01:00
Laurens Valk c3802d38c2 pybricks.ev3devices: Keep motor class in sync.
Let's make sure we keep EV3 pages building.
2022-12-02 12:43:24 +01:00
Laurens Valk ac23a9bb59 pybricks.common.Motor: Document compatibility.
Control methods are not available on Move Hub.

Fixes: https://github.com/pybricks/pybricks-api/issues/106
2022-12-02 12:15:25 +01:00
Laurens Valk 631cf31a07 pybricks.common.Motor: Document when settings take effect.
This updates how and when settings take effect. In this release, you can
change them even while the motor is moving. Some settings do not
take effect right away, as now indicated in the relevant methods.

See also https://github.com/pybricks/pybricks-api/issues/105
2022-12-02 12:10:31 +01:00
Laurens Valk 115ae0d856 pybricks.common.Motor: Add done, stalled, load.
These used to be implemented as part of the Control object,
but now they are available directly on the motor.

This way they:
- Also give useful values when control is passive, via dc().
- Can be supported on Move Hub
- Give useful values for drive bases (see next commits).

Fixes https://github.com/pybricks/pybricks-api/issues/115
2022-12-02 12:02:22 +01:00
Laurens Valk eec6d2ff85 pybricks.parameters: Delete TODO on hue.
This should be an issue, not a mark in the released docs.
2022-12-01 16:59:54 +01:00
Laurens Valk 4d360d2b01 pybricks.parameters: Reduce floating warning to note.
This is a good case of a box. But nothing blows up if you try it, so a note suffices.
2022-12-01 16:59:08 +01:00
Laurens Valk 52cb0fe81e ubuiltins: Fix missing types on print args. 2022-12-01 16:49:45 +01:00
Laurens Valk 961cebe48b ustruct: Document modules. 2022-12-01 16:48:20 +01:00
Laurens Valk 87c2802b17 jedi/tests: Fix order for Poll/poll.
Poll needs to come first for correct typing of poll.
2022-12-01 15:06:31 +01:00
Laurens Valk 3c0aaea207 usys: Add version info.
Fixes https://github.com/pybricks/pybricks-api/issues/119
2022-12-01 15:02:25 +01:00
Laurens Valk 553490874b usys: Add examples. 2022-12-01 14:21:12 +01:00
Laurens Valk 31d3872405 uselect: Rewrite the docs. 2022-12-01 14:11:41 +01:00
Laurens Valk 6f55e90365 urandom: Update remaining functions.
Also modify the categories given implicitly in the Python
file and make them explicit in the docs.

Most users are going to want to use `randint` or `random`, so
that basic category comes first.
2022-12-01 11:19:42 +01:00
Laurens Valk 76f129f6d1 urandom: Update docstring style.
Also remove the tip boxes. The entire documentation consist of tips of
one form or another.

Boxes should only be used when necessary such as safety reasons (warnings)
or to prevent costly/time consuming mistakes (notes/tips).
2022-12-01 10:48:06 +01:00
Laurens Valk d4d7971a56 pybricks.hubs: Update storage documentation.
This moves the per-hub storage size to the respective page.

This also clarifies that data is cleared when updating Powered Up hubs.

Also flip docstring signatures around to work around https://github.com/pybricks/pybricks-api/issues/117
2022-12-01 10:17:41 +01:00
Laurens Valk 64b0489a73 urandom: Move example to Move Hub.
Move it do a dedicated example instead of hardcoding it in the module docstring.

Also update changelog for missing previous changes while we are at it.
2022-12-01 09:55:40 +01:00
Laurens Valk 87ed7353b4 ujson, urandom, uselect: Document compatibility. 2022-11-29 20:32:53 +01:00
Laurens Valk aca23197a1 micropython: Document compatibility.
Fixes https://github.com/pybricks/pybricks-api/issues/118
2022-11-29 20:32:09 +01:00
Laurens Valk 69a2a2b8a2 uio: Don't use alloc_size.
Follows the upstream MicroPython guidance.
2022-11-29 20:30:08 +01:00
Laurens Valk f5d9a4f1c6 uio: Document getvalue. 2022-11-29 20:28:08 +01:00
Laurens Valk 71ce165a46 uio: Update style.
Also fix compatibility information.
2022-11-29 20:23:23 +01:00
Laurens Valk 56ab509630 ujson: Document module. 2022-11-29 16:00:00 +01:00
Laurens Valk 9608a16d95 micropython: Update style.
This makes it consistent with our other modules.

Follows https://github.com/pybricks/pybricks-api/issues/82
2022-11-29 15:59:32 +01:00
Laurens Valk 9b314777e0 micropython: Document heap_lock, heap_unlock.
Fixes https://github.com/pybricks/pybricks-api/issues/116
2022-11-29 13:51:34 +01:00
Laurens Valk 1ae0a9005f pybricks.parameters.Stop: Document NONE.
Fixes https://github.com/pybricks/pybricks-api/issues/104
2022-11-28 17:10:53 +01:00
Laurens Valk 1d5956a58a pybricks.parameters.Stop: Document COAST_SMART.
See https://github.com/pybricks/pybricks-api/issues/104
2022-11-28 17:01:06 +01:00
Laurens Valk 73c4a449ab ubuiltins: Document super. 2022-11-28 16:17:36 +01:00
Laurens Valk aeeed159d7 ubuiltins: Document isinstance, issubclass. 2022-11-28 16:13:59 +01:00
Laurens Valk 104fd7d70f ubuiltins: Document setattr. 2022-11-28 16:07:10 +01:00
Laurens Valk e9e5f48756 ubuiltins: Document getattr, hasattr. 2022-11-28 16:04:25 +01:00
Laurens Valk 8260d71cd7 ubuiltins: Document dir. 2022-11-28 15:51:44 +01:00
Laurens Valk ac43f8a29f ubuiltins: Document callable. 2022-11-28 15:45:30 +01:00
Laurens Valk f6f87fec95 ubuiltins: Document help. 2022-11-28 15:37:20 +01:00
Laurens Valk d1081229b3 ubuiltins: Document id. 2022-11-28 15:32:54 +01:00
Laurens Valk 8a73e916e7 ubuiltins: Fix id. 2022-11-28 15:31:25 +01:00
Laurens Valk 17c45c3245 ubuiltins: Document hash. 2022-11-28 15:30:55 +01:00
Laurens Valk 0ecf1cabde ubuiltins: Document globals. 2022-11-28 15:27:47 +01:00
Laurens Valk ba8d9806f7 ubuiltins: Document exec. 2022-11-28 15:25:12 +01:00
Laurens Valk 99b289aa58 ubuiltins: Document eval. 2022-11-28 15:19:43 +01:00
Laurens Valk 334b91f128 ubuiltins: Document sum. 2022-11-28 15:07:44 +01:00
Laurens Valk f7380b8bb0 ubuiltins: Remove set. This is not enabled. 2022-11-28 15:03:18 +01:00
Laurens Valk 6ad229c7c0 ubuiltins: Document round. 2022-11-28 15:02:03 +01:00
Laurens Valk 94dfbbf7c1 ubuiltins: Document pow. 2022-11-28 14:54:11 +01:00
Laurens Valk 88b2502eb3 ubuiltins: Fix pow.
MICROPY_PY_BUILTINS_POW3 is not enabled.

And floats are accepted.
2022-11-28 14:50:59 +01:00
Laurens Valk cd2e53f70b ubuiltins: Document max, min. 2022-11-28 14:41:29 +01:00
Laurens Valk e009ff2cbc ubuiltins: Document divmod. 2022-11-28 14:36:02 +01:00
Laurens Valk 4816b58914 ubuiltins: Document zip. 2022-11-28 14:23:55 +01:00
Laurens Valk 875a433182 ubuiltins: Document sorted. 2022-11-28 14:16:51 +01:00
Laurens Valk dc8d029e96 ubuiltins: Document reversed. 2022-11-28 14:05:48 +01:00
Laurens Valk af80c4770e ubuiltins: Document range. 2022-11-28 14:01:40 +01:00
Laurens Valk ddcdc6f745 ubuiltins: Document next. 2022-11-28 13:50:36 +01:00
Laurens Valk 81ac996deb ubuiltins: Fix next.
MICROPY_PY_BUILTINS_NEXT2 is not enabled.
2022-11-28 13:45:48 +01:00
Laurens Valk 84d1d7bf3b ubuiltins: Document iter, enumerate, map. 2022-11-28 12:36:32 +01:00
Laurens Valk 9578fc1035 ubuiltins: Document str. 2022-11-28 11:37:24 +01:00
Laurens Valk 25f427d8bf ubuiltins: Slice instances are not supported. 2022-11-28 11:24:51 +01:00
Laurens Valk 725b6d672c ubuiltins: Document list, tuple. 2022-11-28 11:17:18 +01:00
Laurens Valk 4bc53b17f4 ubuiltins: Document len(). 2022-11-28 11:11:15 +01:00
Laurens Valk 666f2a6b52 .vscode/settings: Set interpreter path.
This way vscode will pick up all the right tools and not complain about
linters not being installed.
2022-11-28 11:07:50 +01:00
Laurens Valk cbf6eb9578 ubuiltins: Document bytes, bytearray, type. 2022-11-28 10:53:53 +01:00
Laurens Valk 7dd3edaee4 jedi/tests: Make PrimeHub the same as InventorHub. 2022-11-22 14:26:25 +01:00
Laurens Valk ef57dbf4a1 pybricks.common.LightMatrix: Rename image() to icon().
Fixes https://github.com/pybricks/support/issues/409
2022-11-22 14:26:15 +01:00
102 changed files with 1726 additions and 1442 deletions
+4 -11
View File
@@ -6,17 +6,10 @@ on:
jobs:
build_and_publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.6
- run: poetry install
- run: poetry build
- run: poetry publish
- uses: actions/checkout@v3
- run: pipx run poetry build
- run: pipx run poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
+1 -1
View File
@@ -2,7 +2,7 @@
"files.exclude": {
"**/__pycache__": true,
},
"python.defaultInterpreterPath": ".venv/bin/python",
"python.autoComplete.extraPaths": ["jedi/src"],
"python.formatting.provider": "black",
"python.linting.pylintEnabled": false,
+21
View File
@@ -4,6 +4,27 @@
## Unreleased
## 3.2.0c1 - 2022-12-09
### Changed
- Updated "front" side of the Technic Hub to be consistent with
the Prime Hub.
## 3.2.0b6 - 2022-12-02
### Added
- Documented ``Stop.NONE`` and ``Stop.COAST_SMART``.
- Documented ``ujson`` module.
- Added `done` and `stalled` methods for `DriveBase`.
### Changed
- Changed `PrimeHub.display.image()` to `PrimeHub.display.icon()` and renamed
its kwarg from `image` to `icon`.
- Improved presentation and docstrings of the ``ubuiltins`` and other
MicroPython modules
- Moved the random numbers example for Move Hub to the Move Hub page.
- Moved `done()`, `stalled()`, `load()` from `Control` to `Motor` object.
## 3.2.0b5 - 2022-11-11
### Fixed
+2 -2
View File
@@ -16,8 +16,8 @@ help:
.PHONY: help Makefile
diagrams:
@$(MAKE) -C "$(SOURCEDIR)"/diagram_source clean
@$(MAKE) -C "$(SOURCEDIR)"/diagram_source
@$(MAKE) -C "$(SOURCEDIR)"/diagrams_source clean
@$(MAKE) -C "$(SOURCEDIR)"/diagrams_source
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+8
View File
@@ -40,3 +40,11 @@
::-webkit-scrollbar-thumb:hover {
background: #182026;
}
html.writer-html5 .rst-content dl.citation,
html.writer-html5 .rst-content dl.field-list,
html.writer-html5 .rst-content dl.footnote {
display: flex;
flex-direction: column;
grid-template-columns: unset;
}
@@ -41,3 +41,7 @@ span.caption-number:after {
.figure > a.reference.external::after {
content: none !important;
}
.wy-side-nav-search > div.version {
color: hsla(0, 0%, 100%, 0.75);
}
+1
View File
@@ -169,6 +169,7 @@ html_context = {
html_theme_options = {
"style_external_links": True,
"logo_only": True,
"style_nav_header_background": "#0088ce", # Pybricks blue
}
# Add any paths that contain custom static files (such as style sheets) here,
+10 -10
View File
@@ -11,6 +11,7 @@ FEATURES_SMALL = set()
# Medium feature set.
FEATURES_MEDIUM = FEATURES_SMALL | {
"pybricks-geometry",
"pybricks-common-control",
"pybricks-iodevices",
"stm32-extra",
"stm32-float",
@@ -46,20 +47,19 @@ class PybricksRequirementsStaticDirective(Directive):
makedirs(destdir)
for hub in HUB_FEATURES:
for compat in ("true", "false"):
uri = "compat_{0}_{1}.png".format(hub, compat)
src_uri = path.join(env.app.builder.srcdir, "diagrams", uri)
build_uri = path.join(env.app.builder.outdir, "_images", uri)
copyfile(src_uri, build_uri)
uri = "compat_{0}.png".format(hub)
src_uri = path.join(env.app.builder.srcdir, "diagrams", uri)
build_uri = path.join(env.app.builder.outdir, "_images", uri)
copyfile(src_uri, build_uri)
# Get requirements from sphinx-directive.
requirements = set(self.arguments)
# Cell with image of a hub.
hub_cell = """
<th><div class="align-default">
<img alt="" src="{0}_images/compat_{1}_{2}.png">
</div></th>
<th background="{0}_images/compat_{1}.png" class="requirements-table-th requirements-table-th">
{2}
</th>
"""
# Determine how far up the tree we are to set correct image path.
@@ -71,7 +71,7 @@ class PybricksRequirementsStaticDirective(Directive):
compat_row = "".join(
[
hub_cell.format(
depth_path, hub, "true" if requirements <= features else "false"
depth_path, hub, "" if requirements <= features else ""
)
for hub, features in HUB_FEATURES.items()
]
@@ -80,7 +80,7 @@ class PybricksRequirementsStaticDirective(Directive):
# Generate full table.
html = """
<div class="wy-table-responsive">
<table class="docutils align-default">
<table class="docutils align-default requirements-table">
<tbody>
<tr>
{0}
+16
View File
@@ -42,3 +42,19 @@ SOFTWARE. */
margin-bottom: 0px;
}
.requirements-table {
width: 100%;
}
.requirements-table-th {
background-size:contain;
background-repeat: no-repeat;
text-align: right;
padding: 6px !important;
}
.requirements-table-th:after {
content: '';
display: block;
margin-top: 80%;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 11 KiB

+1 -1
View File
@@ -24,7 +24,7 @@ cp LPub3D/assem/main_1_hubs_1_hub-prime-*35_-35_0_ABS.png output/hub-prime.png
cp LPub3D/assem/main_1_hubs_1_hub-prime-*45_45_0_ABS.png output/hub-prime-orientation.png
cp LPub3D/assem/main_1_hubs_1_hub-prime-*90_0_0_ABS.png output/hub-prime-display.png
cp LPub3D/assem/main_1_hubs_1_hub-technic-*35_-35_0_ABS.png output/hub-technic.png
cp LPub3D/assem/main_1_hubs_1_hub-technic-*45_-135_0_ABS.png output/hub-technic-orientation.png
cp LPub3D/assem/main_1_hubs_1_hub-technic-*45_45_0_ABS.png output/hub-technic-orientation.png
cp LPub3D/assem/main_1_iodevices-*.png output/iodevice-all.png
cp LPub3D/assem/main_1_iodevices_1_iodevice-dcmotor-*.png output/iodevice-dcmotor.png
cp LPub3D/assem/main_1_iodevices_1_iodevice-pupdevice-*.png output/iodevice-pupdevice.png
+2 -1
View File
@@ -163,7 +163,7 @@
1 71 0 0 0 1 0 0 0 1 0 0 0 1 22127.dat
0 ROTSTEP 35 -35 0 ABS
1 71 0 0 0 1 0 0 0 1 0 0 0 1 22127.dat
0 ROTSTEP 45 -135 0 ABS
0 ROTSTEP 45 45 0 ABS
0 NOFILE
0
0 FILE hub-prime.ldr
@@ -837,5 +837,6 @@
1 0 40 0 220 1 0 0 0 1 0 0 0 1 hub-city.ldr
1 0 450 0 -40 1 0 0 0 1 0 0 0 1 hub-move.ldr
0 ROTSTEP 40 -35 0 ABS
0
0
0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 64 KiB

@@ -8,7 +8,7 @@
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_cityhub_true.svg"
sodipodi:docname="compat_cityhub.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -40,15 +40,15 @@
inkscape:pageshadow="2"
inkscape:zoom="3.3219805"
inkscape:cx="34.617903"
inkscape:cy="95.726028"
inkscape:cy="95.575516"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1163"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
@@ -75,10 +75,5 @@
y="265.09711"
width="23.382999"
height="26.799999" />
<path
style="fill:none;stroke:#84ba4c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 31.147057,265.82725 1.011052,2.9815 3.622948,-4.60003"
id="path854"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150"
height="135"
viewBox="0 0 39.687499 35.718751"
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_cityhub_false.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs881">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="fill:#fe2020;fill-opacity:0.48022599;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect1547"
width="39.6875"
height="35.71875"
x="-25.390602"
y="312.93103" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.0825819"
inkscape:cx="78.505619"
inkscape:cy="101.70046"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-261.28123)">
<image
xlink:href="../cad/output/hub-city.png"
id="image1470"
x="8.0035677"
y="265.09711"
width="23.382999"
height="26.799999" />
<g
id="g862"
transform="matrix(0.84064533,0,0,0.84993509,-12.416361,243.07822)"
style="stroke-width:1.18304348">
<path
inkscape:connector-curvature="0"
id="path856"
d="m 51.33389,24.998882 5.622395,5.622396"
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 56.956285,24.998882 51.33389,30.621278"
id="path858"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -8,7 +8,7 @@
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_essentialhub_true.svg"
sodipodi:docname="compat_essentialhub.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -38,9 +38,9 @@
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="2.3960249"
inkscape:cx="-130.63303"
inkscape:cy="93.696856"
inkscape:zoom="3.4759103"
inkscape:cx="134.0656"
inkscape:cy="60.84737"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@@ -75,10 +75,5 @@
y="267.43524"
width="25.393"
height="22.579" />
<path
style="fill:none;stroke:#84ba4c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 31.147057,265.82725 1.011052,2.9815 3.622948,-4.60003"
id="path854"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150"
height="135"
viewBox="0 0 39.687499 35.718751"
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_essentialhub_false.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs881">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="fill:#fe2020;fill-opacity:0.48022599;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect1547"
width="39.6875"
height="35.71875"
x="-25.390602"
y="312.93103" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="1.8719138"
inkscape:cx="1.0684253"
inkscape:cy="79.330578"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-261.28123)">
<image
xlink:href="../cad/output/hub-essential.png"
id="image1470"
x="6.9396734"
y="267.43524"
width="25.393"
height="22.579" />
<g
id="g862"
transform="matrix(0.84064533,0,0,0.84993509,-12.416361,243.07822)"
style="stroke-width:1.18304348">
<path
inkscape:connector-curvature="0"
id="path856"
d="m 51.33389,24.998882 5.622395,5.622396"
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 56.956285,24.998882 51.33389,30.621278"
id="path858"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -8,7 +8,7 @@
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_inventorhub_true.svg"
sodipodi:docname="compat_inventorhub.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -38,9 +38,9 @@
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="30.052038"
inkscape:cy="63.260803"
inkscape:zoom="2.6570037"
inkscape:cx="57.583661"
inkscape:cy="87.504583"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@@ -75,10 +75,5 @@
y="262.86874"
width="34.237"
height="31.087999" />
<path
style="fill:none;stroke:#84ba4c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 31.147057,265.82725 1.011052,2.9815 3.622948,-4.60003"
id="path854"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150"
height="135"
viewBox="0 0 39.687499 35.718751"
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_inventorhub_false.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs881">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="fill:#fe2020;fill-opacity:0.48022599;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect1547"
width="39.6875"
height="35.71875"
x="-25.390602"
y="312.93103" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.0079775"
inkscape:cx="56.183931"
inkscape:cy="42.387285"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-261.28123)">
<image
xlink:href="../cad/output/hub-inventor.png"
id="image1481"
x="2.6458333"
y="262.86874"
width="34.237"
height="31.087999" />
<g
id="g862"
transform="matrix(0.84064533,0,0,0.84993509,-12.416361,243.07822)"
style="stroke-width:1.18304348">
<path
inkscape:connector-curvature="0"
id="path856"
d="m 51.33389,24.998882 5.622395,5.622396"
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 56.956285,24.998882 51.33389,30.621278"
id="path858"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -8,7 +8,7 @@
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_movehub_true.svg"
sodipodi:docname="compat_movehub.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -38,9 +38,9 @@
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="-61.114229"
inkscape:cy="79.170705"
inkscape:zoom="1.4539184"
inkscape:cx="101.79388"
inkscape:cy="158.5371"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@@ -75,10 +75,5 @@
y="261.79425"
width="38.50182"
height="34.867249" />
<path
style="fill:none;stroke:#84ba4c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 31.147057,265.82725 1.011052,2.9815 3.622948,-4.60003"
id="path854"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -1,95 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150"
height="135"
viewBox="0 0 39.687499 35.718751"
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_movehub_false.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs881">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="fill:#fe2020;fill-opacity:0.48022599;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect1547"
width="39.6875"
height="35.71875"
x="-25.390602"
y="312.93103" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.1282845"
inkscape:cx="30.687746"
inkscape:cy="7.8317686"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0"
showguides="false" />
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-261.28123)">
<image
xlink:href="../cad/output/hub-move.png"
id="image1492"
x="0.67666757"
y="261.79425"
width="38.50182"
height="34.867249" />
<g
id="g862"
transform="matrix(0.84064533,0,0,0.84993509,-12.416361,243.07822)"
style="stroke-width:1.18304348">
<path
inkscape:connector-curvature="0"
id="path856"
d="m 51.33389,24.998882 5.622395,5.622396"
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 56.956285,24.998882 51.33389,30.621278"
id="path858"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -8,7 +8,7 @@
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_primehub_true.svg"
sodipodi:docname="compat_primehub.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -38,9 +38,9 @@
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="-15.152288"
inkscape:cy="104.67706"
inkscape:zoom="2.5665087"
inkscape:cx="-39.742706"
inkscape:cy="115.13696"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@@ -75,10 +75,5 @@
y="263.1333"
width="34.237"
height="31.087999" />
<path
style="fill:none;stroke:#84ba4c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 31.147057,265.82725 1.011052,2.9815 3.622948,-4.60003"
id="path854"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150"
height="135"
viewBox="0 0 39.687499 35.718751"
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_primehub_false.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs881">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="fill:#fe2020;fill-opacity:0.48022599;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect1547"
width="39.6875"
height="35.71875"
x="-25.390602"
y="312.93103" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.4544425"
inkscape:cx="52.975264"
inkscape:cy="68.173085"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-261.28123)">
<image
xlink:href="../cad/output/hub-prime.png"
id="image1503"
x="2.6458333"
y="263.1333"
width="34.237"
height="31.087999" />
<g
id="g862"
transform="matrix(0.84064533,0,0,0.84993509,-12.416361,243.07822)"
style="stroke-width:1.18304348">
<path
inkscape:connector-curvature="0"
id="path856"
d="m 51.33389,24.998882 5.622395,5.622396"
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 56.956285,24.998882 51.33389,30.621278"
id="path858"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -8,7 +8,7 @@
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_technichub_true.svg"
sodipodi:docname="compat_technichub.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -38,9 +38,9 @@
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="51.517779"
inkscape:cy="94.82807"
inkscape:zoom="1.8594069"
inkscape:cx="-63.461097"
inkscape:cy="62.116582"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@@ -75,10 +75,5 @@
y="263.52396"
width="35.710999"
height="30.552" />
<path
style="fill:none;stroke:#84ba4c;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 31.147057,265.82725 1.011052,2.9815 3.622948,-4.60003"
id="path854"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150"
height="135"
viewBox="0 0 39.687499 35.718751"
version="1.1"
id="svg887"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="compat_technichub_false.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs881">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1545">
<rect
style="fill:#fe2020;fill-opacity:0.48022599;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="rect1547"
width="39.6875"
height="35.71875"
x="-25.390602"
y="312.93103" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#fcfcfc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="3.0468564"
inkscape:cx="34.461749"
inkscape:cy="66.133737"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1856"
inkscape:window-height="1136"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<metadata
id="metadata884">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-261.28123)">
<image
xlink:href="../cad/output/hub-technic.png"
id="image1514"
x="2.0608866"
y="263.52396"
width="35.710999"
height="30.552" />
<g
id="g862"
transform="matrix(0.84064533,0,0,0.84993509,-12.416361,243.07822)"
style="stroke-width:1.18304348">
<path
inkscape:connector-curvature="0"
id="path856"
d="m 51.33389,24.998882 5.622395,5.622396"
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;stroke:#e2302f;stroke-width:1.18304348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 56.956285,24.998882 51.33389,30.621278"
id="path858"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -66,9 +66,9 @@
inkscape:window-height="1136"
id="namedview4"
showgrid="false"
inkscape:zoom="1.0710043"
inkscape:cx="253.96723"
inkscape:cy="270.30703"
inkscape:zoom="0.70516005"
inkscape:cx="286.45979"
inkscape:cy="338.22109"
inkscape:window-x="64"
inkscape:window-y="27"
inkscape:window-maximized="1"
@@ -76,36 +76,37 @@
inkscape:snap-global="false"
inkscape:pagecheckerboard="0" />
<image
width="362.92642"
height="317.47708"
width="360.79803"
height="329.56876"
preserveAspectRatio="none"
xlink:href="../cad/output/hub-technic-orientation.png"
id="image1727"
x="92.506996"
y="67.242409" />
id="image861"
x="102.51701"
y="59.175568"
style="stroke-width:1.505" />
<rect
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.13333321;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.13333;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect873"
width="94.047379"
height="42.092525"
x="369.40115"
y="235.02014" />
x="372.33868"
y="256.1105" />
<rect
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.13333321;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.13333;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect875"
width="94.047379"
height="4"
x="369.40115"
y="235.02014" />
x="372.33868"
y="256.1105" />
<text
id="text879"
y="265.60547"
x="379.37143"
style="font-style:normal;font-weight:normal;font-size:24.19441986px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.60486054"
y="286.69583"
x="382.30896"
style="font-style:normal;font-weight:normal;font-size:24.1944px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.604861"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.60486054"
y="265.60547"
x="379.37143"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.604861"
y="286.69583"
x="382.30896"
id="tspan877"
sodipodi:role="line">RIGHT</tspan></text>
<path
@@ -165,90 +166,90 @@
y="303.26227"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.60486054">BACK</tspan></text>
<rect
y="157.47092"
x="232.60791"
y="144.53636"
x="254.17665"
height="42.092525"
width="67.413025"
id="rect4648"
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.13333321;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.13333;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="157.47092"
x="232.60791"
y="144.53636"
x="254.17665"
height="4"
width="67.413025"
id="rect4650"
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.13333321;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.13333;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:24.19441986px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.60486054"
x="243.7567"
y="188.05624"
style="font-style:normal;font-weight:normal;font-size:24.1944px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.604861"
x="265.32544"
y="175.12169"
id="text4654"><tspan
sodipodi:role="line"
id="tspan4652"
x="243.7567"
y="188.05624"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.60486054">TOP</tspan></text>
x="265.32544"
y="175.12169"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.604861">TOP</tspan></text>
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path987"
d="m 218.40482,122.94083 c -16.91553,4.34545 -0.82755,-60.207095 -43.66667,-57.999995"
d="m 209.97456,140.94286 c -16.91553,4.34545 -0.82755,-60.207095 -43.66667,-57.999995"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<rect
y="42.940842"
x="100.96023"
y="60.942871"
x="92.529968"
height="42.092525"
width="80.376648"
id="rect932"
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.13333321;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.13333;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="42.940842"
x="100.96023"
y="60.942871"
x="92.529968"
height="4"
width="80.376648"
id="rect934"
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.13333321;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.13333;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:24.19441986px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.60486054"
x="113.1997"
y="73.526169"
style="font-style:normal;font-weight:normal;font-size:24.1944px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.604861"
x="104.76944"
y="91.528198"
id="text938"><tspan
sodipodi:role="line"
id="tspan936"
x="113.1997"
y="73.526169"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.60486054">LEFT</tspan></text>
x="104.76944"
y="91.528198"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.604861">LEFT</tspan></text>
<path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="path1114"
d="m 352.17398,396.21985 c -30.79693,19.2617 -138.39669,37.9659 -117.51303,-31.272"
d="m 364.20393,405.65488 c -30.79693,19.2617 -138.39669,37.9659 -117.51303,-31.272"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<rect
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.52250361;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
style="opacity:1;fill:#e7f2fa;fill-opacity:1;stroke:none;stroke-width:2.5225;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1116"
width="117.09069"
height="42.092525"
x="340.08701"
y="371.42603" />
x="352.11694"
y="380.86105" />
<rect
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.52250361;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
style="opacity:1;fill:#6ab0de;fill-opacity:1;stroke:none;stroke-width:2.5225;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect1118"
width="117.09069"
height="4"
x="340.08701"
y="371.42603" />
x="352.11694"
y="380.86105" />
<text
id="text1122"
y="402.01135"
x="349.49805"
style="font-style:normal;font-weight:normal;font-size:24.19441986px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.60486054"
y="411.44638"
x="361.52798"
style="font-style:normal;font-weight:normal;font-size:24.1944px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#404140;fill-opacity:1;stroke:none;stroke-width:0.604861"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.60486054"
y="402.01135"
x="349.49805"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab';fill:#404140;fill-opacity:1;stroke-width:0.604861"
y="411.44638"
x="361.52798"
id="tspan1120"
sodipodi:role="line">BOTTOM</tspan></text>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

+18 -21
View File
@@ -26,6 +26,10 @@ Motors
.. automethod:: pybricks.ev3devices.Motor.reset_angle
.. automethod:: pybricks.ev3devices.Motor.load
.. automethod:: pybricks.ev3devices.Motor.stalled
.. rubric:: Stopping
.. automethod:: pybricks.ev3devices.Motor.stop
@@ -34,10 +38,14 @@ Motors
.. automethod:: pybricks.ev3devices.Motor.hold
.. rubric:: Action
.. rubric:: Running forever
.. automethod:: pybricks.ev3devices.Motor.run
.. automethod:: pybricks.ev3devices.Motor.dc
.. rubric:: Running by a fixed amount
.. automethod:: pybricks.ev3devices.Motor.run_time
.. automethod:: pybricks.ev3devices.Motor.run_angle
@@ -48,31 +56,14 @@ Motors
.. automethod:: pybricks.ev3devices.Motor.run_until_stalled
.. automethod:: pybricks.ev3devices.Motor.dc
.. rubric:: Motor status
.. attribute:: control.scale
Number of degrees that the motor turns to complete one degree at the
output of the gear train. This is the gear ratio determined from the
``gears`` argument when initializing the motor.
.. automethod:: pybricks.ev3devices.Motor.control.done
.. automethod:: pybricks.ev3devices.Motor.control.stalled
.. automethod:: pybricks.ev3devices.Motor.control.load
.. automethod:: pybricks.ev3devices.Motor.done
.. rubric:: Motor settings
You can only change these settings while the controller is stopped. For
example, you can change them at the start of your program. Alternatively,
first call :meth:`stop() <pybricks.ev3devices.Motor.stop>`, and then change
the settings.
.. automethod:: pybricks.ev3devices.Motor.settings
.. rubric:: Control settings
.. automethod:: pybricks.ev3devices.Motor.control.limits
.. automethod:: pybricks.ev3devices.Motor.control.pid
@@ -81,6 +72,12 @@ Motors
.. automethod:: pybricks.ev3devices.Motor.control.stall_tolerances
.. attribute:: control.scale
Number of degrees that the motor turns to complete one degree at the
output of the gear train. This is the gear ratio determined from the
``gears`` argument when initializing the motor.
Touch Sensor
^^^^^^^^^^^^
+5 -1
View File
@@ -4,7 +4,7 @@ City Hub
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: ../../main/cad/output/hub-city.png
:height: 15 em
:width: 30%
.. autoclass:: pybricks.hubs.CityHub
:no-members:
@@ -35,6 +35,10 @@ City Hub
.. automethod:: pybricks.hubs::CityHub.system.storage
You can store up to 128 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware or if you restore the original
firmware.
.. automethod:: pybricks.hubs::CityHub.system.shutdown
.. automethod:: pybricks.hubs::CityHub.system.reset_reason
+2 -8
View File
@@ -6,14 +6,6 @@ Essential Hub
.. figure:: ../../main/cad/output/hub-essential.png
:width: 30%
.. note:: Pybricks support for this hub is in beta.
Check the `installation instructions`_ to try it out.
The following functions may change before the final release.
.. _installation instructions: https://pybricks.com/install/
.. autoclass:: pybricks.hubs.EssentialHub
:no-members:
@@ -67,6 +59,8 @@ Essential Hub
.. automethod:: pybricks.hubs::EssentialHub.system.storage
You can store up to 512 bytes of data on this hub.
.. automethod:: pybricks.hubs::EssentialHub.system.shutdown
.. automethod:: pybricks.hubs::EssentialHub.system.reset_reason
+1 -1
View File
@@ -2,7 +2,7 @@ MINDSTORMS EV3 Brick
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: ../../main/cad/output/ev3device-ev3.png
:height: 15 em
:width: 50%
.. autoclass:: pybricks.hubs.EV3Brick
:no-members:
+6 -6
View File
@@ -18,35 +18,35 @@
.. pybricks-classlink:: MoveHub
.. figure:: ../../main/cad/output/hub-move.png
:width: 30%
:width: 40%
:target: movehub.html
.. pybricks-classlink:: CityHub
.. figure:: ../../main/cad/output/hub-city.png
:width: 20%
:width: 25%
:target: cityhub.html
.. pybricks-classlink:: TechnicHub
.. figure:: ../../main/cad/output/hub-technic.png
:width: 25%
:width: 35%
:target: technichub.html
.. pybricks-classlink:: InventorHub PrimeHub
.. figure:: ../../main/cad/output/hub-inventor.png
:width: 25%
:width: 35%
:target: primehub.html
.. pybricks-classlink:: PrimeHub
.. figure:: ../../main/cad/output/hub-prime.png
:width: 25%
:width: 35%
:target: primehub.html
.. pybricks-classlink:: EssentialHub
.. figure:: ../../main/cad/output/hub-essential.png
:width: 20%
:width: 25%
:target: essentialhub.html
+18 -1
View File
@@ -6,7 +6,7 @@ Move Hub
.. _fig_movehub:
.. figure:: ../../main/diagrams/movehub.png
:height: 15 em
:width: 100%
.. autoclass:: pybricks.hubs.MoveHub
:no-members:
@@ -47,6 +47,10 @@ Move Hub
.. automethod:: pybricks.hubs::MoveHub.system.storage
You can store up to 128 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware or if you restore the original
firmware.
.. automethod:: pybricks.hubs::MoveHub.system.shutdown
.. automethod:: pybricks.hubs::MoveHub.system.reset_reason
@@ -95,3 +99,16 @@ Turning the hub off
.. literalinclude::
../../../examples/pup/hub_common/build/system_shutdown_movehub.py
Making random numbers
**************************************************
The Move Hub does not include the :mod:`urandom` module. If you need random
numbers in your application, you can try a variation of the following example.
To make it work better, change the initial value of ``_rand`` to something
that is truly random in your application. You could use the IMU acceleration
or a sensor value, for example.
.. literalinclude::
../../../examples/pup/hub_movehub/randint_implementation.py
+4 -9
View File
@@ -4,12 +4,7 @@ Prime Hub / Inventor Hub
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: ../../main/cad/output/hub-spike-inventor.png
:height: 15 em
.. note:: Pybricks support for these hubs is in beta.
Check the `installation instructions`_ to try it out.
The following functions may change before the final release.
:width: 80%
.. class:: InventorHub
@@ -45,7 +40,7 @@ Prime Hub / Inventor Hub
.. automethod:: pybricks.hubs::PrimeHub.display.pixel
.. automethod:: pybricks.hubs::PrimeHub.display.image
.. automethod:: pybricks.hubs::PrimeHub.display.icon
.. automethod:: pybricks.hubs::PrimeHub.display.animate
@@ -106,6 +101,8 @@ Prime Hub / Inventor Hub
.. automethod:: pybricks.hubs::PrimeHub.system.storage
You can store up to 512 bytes of data on this hub.
.. automethod:: pybricks.hubs::PrimeHub.system.shutdown
.. automethod:: pybricks.hubs::PrimeHub.system.reset_reason
@@ -255,5 +252,3 @@ Turning the hub off
.. literalinclude::
../../../examples/pup/hub_common/build/system_shutdown_primehub.py
.. _installation instructions: https://pybricks.com/install/
+5 -1
View File
@@ -4,7 +4,7 @@ Technic Hub
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: ../../main/cad/output/hub-technic.png
:height: 15 em
:width: 40%
.. autoclass:: pybricks.hubs.TechnicHub
:no-members:
@@ -49,6 +49,10 @@ Technic Hub
.. automethod:: pybricks.hubs::TechnicHub.system.storage
You can store up to 128 bytes of data on this hub. The data is cleared
when you update the Pybricks firmware or if you restore the original
firmware.
.. automethod:: pybricks.hubs::TechnicHub.system.shutdown
.. automethod:: pybricks.hubs::TechnicHub.system.reset_reason
+12 -16
View File
@@ -8,14 +8,22 @@ directly on the hub, and get full control of your motors and sensors.
Pybricks runs on LEGO® BOOST, City, Technic, MINDSTORMS®, and SPIKE®. You
can code using Windows, Mac, Linux, Chromebook, and Android.
To run Pybricks MicroPython scripts, you must install the Pybricks firmware
on your hub. Check `pybricks.com/install`_ to learn how.
Click on any device below to see its documentation. Use the menu on the left
to find documentation for additional modules. You may need to click the ☰ icon
above to reveal this menu.
.. only:: main
.. note:: You are viewing the stand-alone version of the documentation. To
learn more about Pybricks and to start coding, visit
the `Pybricks website`_
.. note:: Are you using LEGO MINDSTORMS EV3? Check out the
`EV3 documentation`_ instead.
.. _EV3 documentation: https://pybricks.com/ev3-micropython/
.. _Pybricks website: https://pybricks.com/
.. rubric:: Programmable hubs
.. figure:: ../main/cad/output/hub-all.png
@@ -36,25 +44,11 @@ on your hub. Check `pybricks.com/install`_ to learn how.
:width: 70 %
:target: pupdevices/dcmotor.html
.. _support page: https://github.com/pybricks/support/issues/
.. _EV3 documentation: https://pybricks.com/ev3-micropython/
.. _Pybricks website: https://pybricks.com/
.. _pybricks.com/install: https://pybricks.com/install/
.. _latest stable release: https://www.code.pybricks.com/
.. toctree::
:maxdepth: 1
:caption: Table of contents
:hidden:
.. toctree::
:maxdepth: 1
:caption: Pybricks
:hidden:
Home page <https://pybricks.com>
Installation <https://pybricks.com/install/>
.. toctree::
:maxdepth: 1
:caption: Pybricks modules
@@ -79,7 +73,9 @@ on your hub. Check `pybricks.com/install`_ to learn how.
micropython/micropython
micropython/uerrno
micropython/uio
micropython/ujson
micropython/umath
micropython/urandom
micropython/uselect
micropython/ustruct
micropython/usys
+9 -3
View File
@@ -1,3 +1,5 @@
.. pybricks-requirements:: stm32-extra
:mod:`micropython` -- MicroPython internals
===========================================
@@ -6,16 +8,20 @@
.. autofunction:: micropython.const
.. autofunction:: micropython.opt_level
.. autofunction:: micropython.heap_lock
.. autofunction:: micropython.heap_unlock
.. autofunction:: micropython.kbd_intr
.. autofunction:: micropython.mem_info
.. autofunction:: micropython.opt_level
.. autofunction:: micropython.qstr_info
.. autofunction:: micropython.stack_use
.. autofunction:: micropython.kbd_intr
Examples
---------------------
+2 -2
View File
@@ -1,6 +1,6 @@
.. pybricks-requirements:: stm32-extra
:mod:`uio` -- Input/output streams
==================================
.. note:: This module is not available on the BOOST Move Hub.
.. automodule:: uio
+15
View File
@@ -0,0 +1,15 @@
.. pybricks-requirements:: stm32-extra
:mod:`ujson` -- JSON encoding and decoding
===========================================
.. automodule:: ujson
:no-members:
.. autofunction:: ujson.dump
.. autofunction:: ujson.dumps
.. autofunction:: ujson.load
.. autofunction:: ujson.loads
+26
View File
@@ -1,4 +1,30 @@
.. pybricks-requirements:: stm32-extra
:mod:`urandom` -- Pseudo-random numbers
================================================
.. automodule:: urandom
:no-members:
.. rubric:: Basic random numbers
.. autofunction:: randint
.. autofunction:: random
.. rubric:: Random numbers from a range
.. autofunction:: getrandbits
.. autofunction:: randrange
.. autofunction:: uniform
.. rubric:: Random elements from a sequence
.. autofunction:: choice
.. rubric:: Updating the random seed
.. autofunction:: seed
+37
View File
@@ -1,4 +1,41 @@
.. pybricks-requirements:: stm32-extra
:mod:`uselect` -- Wait for events
=================================
.. automodule:: uselect
:no-members:
.. rubric:: Poll instance and class
.. autofunction:: poll
.. autoclass:: Poll
:no-members:
.. automethod:: register
.. automethod:: unregister
.. automethod:: modify
.. automethod:: poll
.. automethod:: ipoll
.. rubric:: Event mask flags
.. autodata:: POLLIN
.. autodata:: POLLOUT
.. autodata:: POLLERR
.. autodata:: POLLHUP
Examples
---------------
See the `projects website`_ for a demo that uses this module.
.. _projects website: https://pybricks.com/projects/tutorials/wireless/hub-to-device/pc-keyboard/
+56
View File
@@ -0,0 +1,56 @@
.. pybricks-requirements:: stm32-extra
:mod:`ustruct` -- Pack and unpack binary data
====================================================
.. automodule:: ustruct
The following byte orders are supported:
+-----------+------------------------+----------+-----------+
| Character | Byte order | Size | Alignment |
+===========+========================+==========+===========+
| @ | native | native | native |
+-----------+------------------------+----------+-----------+
| < | little-endian | standard | none |
+-----------+------------------------+----------+-----------+
| > | big-endian | standard | none |
+-----------+------------------------+----------+-----------+
| ! | network (= big-endian) | standard | none |
+-----------+------------------------+----------+-----------+
The following data types are supported:
+--------+--------------------+-------------+---------------+
| Format | C Type | Python type | Standard size |
+========+====================+=============+===============+
| b | signed char | integer | 1 |
+--------+--------------------+-------------+---------------+
| B | unsigned char | integer | 1 |
+--------+--------------------+-------------+---------------+
| h | short | integer | 2 |
+--------+--------------------+-------------+---------------+
| H | unsigned short | integer | 2 |
+--------+--------------------+-------------+---------------+
| i | int | integer | 4 |
+--------+--------------------+-------------+---------------+
| I | unsigned int | integer | 4 |
+--------+--------------------+-------------+---------------+
| l | long | integer (1) | 4 |
+--------+--------------------+-------------+---------------+
| L | unsigned long | integer (1) | 4 |
+--------+--------------------+-------------+---------------+
| q | long long | integer (1) | 8 |
+--------+--------------------+-------------+---------------+
| Q | unsigned long long | integer (1) | 8 |
+--------+--------------------+-------------+---------------+
| f | float | float | 4 |
+--------+--------------------+-------------+---------------+
| d | double | float | 8 |
+--------+--------------------+-------------+---------------+
| s | char[] | bytes | |
+--------+--------------------+-------------+---------------+
| P | void * | integer | |
+--------+--------------------+-------------+---------------+
- \(1\) Supports values up to +/-1073741823
+35
View File
@@ -5,6 +5,8 @@
This MicroPython module is a subset of the `sys module`_ in Python.
.. rubric:: Input and output streams
.. module:: usys
.. autodata:: usys.stdin
@@ -16,4 +18,37 @@ This MicroPython module is a subset of the `sys module`_ in Python.
.. autodata:: usys.stderr
:annotation:
.. rubric:: Version info
.. autodata:: implementation
:annotation:
.. autodata:: version
:annotation:
.. autodata:: version_info
:annotation:
Examples
---------------
Version information
*******************************
.. literalinclude::
../../../examples/micropython/usys/pybricks_version.py
.. literalinclude::
../../../examples/micropython/usys/micropython_version.py
Standard input and output
*******************************
The ``stdin`` stream can be used to capture input via the Pybricks Code
input/output window. See the `keyboard input`_ project to learn how this works.
This approach can be extended to exchange data with any `other device`_ as well.
.. _keyboard input: https://pybricks.com/projects/tutorials/wireless/hub-to-device/pc-keyboard/
.. _other device: https://pybricks.com/projects/tutorials/wireless/hub-to-device/
.. _sys module: https://docs.python.org/3.5/library/sys.html
+10 -6
View File
@@ -34,29 +34,33 @@ Side
**Prime Hub**
.. figure:: ../../main/diagrams/orientation_primehub.png
:height: 17 em
:width: 60%
**Inventor Hub**
.. figure:: ../../main/diagrams/orientation_inventorhub.png
:height: 17 em
:width: 60%
**Essential Hub**
.. figure:: ../../main/diagrams/orientation_essentialhub.png
:height: 17 em
:width: 60%
**Move Hub**
.. figure:: ../../main/diagrams/orientation_movehub.png
:height: 17 em
:width: 60%
**Technic Hub**
.. figure:: ../../main/diagrams/orientation_technichub.png
:height: 17 em
:width: 60%
.. versionchanged:: 3.2
Changed which side is the front.
**Tilt Sensor**
.. figure:: ../../main/diagrams/orientation_tiltsensor.png
:height: 17 em
:width: 50%
+8 -2
View File
@@ -10,14 +10,20 @@ Stop
.. autoattribute:: pybricks.parameters.Stop.COAST
:annotation:
.. autoattribute:: pybricks.parameters.Stop.COAST_SMART
:annotation:
.. autoattribute:: pybricks.parameters.Stop.BRAKE
:annotation:
.. autoattribute:: pybricks.parameters.Stop.HOLD
:annotation:
The following table shows how each stop type adds an extra level of
resistance to motion. In these examples, ``m`` is a
.. autoattribute:: pybricks.parameters.Stop.NONE
:annotation:
The following table shows how each of the basic stop types add an extra
level of resistance to motion. In these examples, ``m`` is a
:class:`Motor <pybricks.pupdevices.Motor>` and
and ``d`` is a :class:`DriveBase <pybricks.robotics.DriveBase>`. The
examples also show how running at zero speed compares to these stop types.
+36 -23
View File
@@ -24,6 +24,10 @@ Motors with rotation sensors
.. automethod:: pybricks.pupdevices.Motor.reset_angle
.. automethod:: pybricks.pupdevices.Motor.load
.. automethod:: pybricks.pupdevices.Motor.stalled
.. rubric:: Stopping
.. automethod:: pybricks.pupdevices.Motor.stop
@@ -32,10 +36,14 @@ Motors with rotation sensors
.. automethod:: pybricks.pupdevices.Motor.hold
.. rubric:: Action
.. rubric:: Running forever
.. automethod:: pybricks.pupdevices.Motor.run
.. automethod:: pybricks.pupdevices.Motor.dc
.. rubric:: Running by a fixed amount
.. automethod:: pybricks.pupdevices.Motor.run_time
.. automethod:: pybricks.pupdevices.Motor.run_angle
@@ -46,11 +54,33 @@ Motors with rotation sensors
.. automethod:: pybricks.pupdevices.Motor.run_until_stalled
.. automethod:: pybricks.pupdevices.Motor.dc
.. automethod:: pybricks.pupdevices.Motor.done
.. _settings:
.. rubric:: Motor status
.. rubric:: Motor settings
.. automethod:: pybricks.pupdevices.Motor.settings
.. rubric:: Control settings
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.control.limits
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.control.pid
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.control.target_tolerances
.. pybricks-requirements:: pybricks-common-control
.. automethod:: pybricks.pupdevices.Motor.control.stall_tolerances
.. pybricks-requirements:: pybricks-common-control
.. attribute:: control.scale
@@ -58,27 +88,10 @@ Motors with rotation sensors
output of the gear train. This is the gear ratio determined from the
``gears`` argument when initializing the motor.
.. automethod:: pybricks.pupdevices.Motor.control.done
.. versionchanged:: 3.2
.. automethod:: pybricks.pupdevices.Motor.control.stalled
.. automethod:: pybricks.pupdevices.Motor.control.load
.. rubric:: Motor settings
You can only change these settings while the controller is stopped. For
example, you can change them at the start of your program. Alternatively,
first call :meth:`stop() <pybricks.pupdevices.Motor.stop>`, and then change the settings.
.. automethod:: pybricks.pupdevices.Motor.settings
.. automethod:: pybricks.pupdevices.Motor.control.limits
.. automethod:: pybricks.pupdevices.Motor.control.pid
.. automethod:: pybricks.pupdevices.Motor.control.target_tolerances
.. automethod:: pybricks.pupdevices.Motor.control.stall_tolerances
The :meth:`done`, :meth:`stalled` and :meth:`load` methods have been
moved.
Initialization examples
-----------------------
+21 -10
View File
@@ -10,7 +10,7 @@
.. autoclass:: pybricks.robotics.DriveBase
:no-members:
.. rubric:: Driving for a given distance or by an angle
.. rubric:: Driving by a given distance or angle
Use the following commands to drive a given distance, or turn by a
given angle.
@@ -26,6 +26,8 @@
.. automethod:: pybricks.robotics.DriveBase.settings
.. automethod:: pybricks.robotics.DriveBase.done
.. rubric:: Drive forever
Use :meth:`.drive` to begin driving at a desired speed and steering.
@@ -48,6 +50,10 @@
.. automethod:: pybricks.robotics.DriveBase.reset
.. automethod:: pybricks.robotics.DriveBase.stalled
.. _measuring:
.. rubric:: Measuring and validating the robot dimensions
As a first estimate, you can measure the ``wheel_diameter`` and the
@@ -55,6 +61,11 @@
effectively touch the ground, you can estimate the ``axle_track`` as
the distance between the midpoint of the wheels.
If you don't have a ruler, you can use a LEGO beam to measure. The
center-to-center distance of the holes is 8 mm. For some tyres, the
diameter is printed on the side. For example, 62.4 x 20 means that the
diameter is 62.4mm and that the width is 20 mm.
In practice, most wheels compress slightly under the weight of your robot.
To verify, make your robot drive 1000 mm using ``my_robot.straight(1000)``
and measure how far it really traveled. Compensate as follows:
@@ -80,15 +91,11 @@
.. rubric:: Using the DriveBase motors individually
Suppose you make a :class:`.DriveBase` object using two ``Motor`` objects called
``left_motor`` and ``right_motor``. You **cannot** use these motors
individually while the DriveBase is **active**.
The DriveBase is active if it is driving, but also when it is actively
holding the wheels in place after a :meth:`.straight` or
:meth:`.turn` command.
To deactivate the :class:`.DriveBase`, call :meth:`.stop`.
After creating a :class:`.DriveBase` object, you can still use its two
motors individually. If you start one motor, the other motor will
automatically stop. Likewise, if a motor is already running and you make
the drive base move, the original maneuver is cancelled and the drive base
will take over.
.. rubric:: Advanced settings
@@ -105,6 +112,10 @@
.. autoattribute:: pybricks.robotics.DriveBase.heading_control
:annotation:
.. versionchanged:: 3.2
The :meth:`done` and :meth:`stalled` methods have been moved.
Examples
-------------------
-2
View File
@@ -260,5 +260,3 @@ Fahrenheit (°F) or Kelvin (K), you can use the following conversion formulas:
hue: deg
--------------
Hue of a color (0-359 degrees).
TODO: diagram
@@ -0,0 +1,10 @@
import usys
# ('micropython', (1, 19, 1), 'SPIKE Essential Hub with STM32F413RG', 6)
print(usys.implementation)
# '3.4.0; Pybricks MicroPython v3.2.0b5 on 2022-11-11'
print(usys.version)
# (3, 4, 0)
print(usys.version_info)
@@ -0,0 +1,4 @@
from pybricks import version
# ('essentialhub', '3.2.0b5', 'v3.2.0b5 on 2022-11-11')
print(version)
@@ -0,0 +1,19 @@
from pybricks.hubs import MoveHub
# Initialize the hub.
hub = MoveHub()
# Initialize "random" seed.
_rand = hub.battery.voltage() + hub.battery.current()
# Return a random integer N such that a <= N <= b.
def randint(a, b):
global _rand
_rand = 75 * _rand % 65537 # Lehmer
return _rand * (b - a + 1) // 65537 + a
# Generate a few example numbers.
for i in range(5):
print(randint(0, 1000))
+4 -4
View File
@@ -12,7 +12,7 @@ while not any(pressed):
wait(10)
# Display a circle.
hub.display.image(Icon.CIRCLE)
hub.display.icon(Icon.CIRCLE)
# Wait for all buttons to be released.
while any(hub.buttons.pressed()):
@@ -20,10 +20,10 @@ while any(hub.buttons.pressed()):
# Display an arrow to indicate which button was pressed.
if Button.LEFT in pressed:
hub.display.image(Icon.ARROW_LEFT_DOWN)
hub.display.icon(Icon.ARROW_LEFT_DOWN)
elif Button.RIGHT in pressed:
hub.display.image(Icon.ARROW_RIGHT_DOWN)
hub.display.icon(Icon.ARROW_RIGHT_DOWN)
elif Button.BLUETOOTH in pressed:
hub.display.image(Icon.ARROW_RIGHT_UP)
hub.display.icon(Icon.ARROW_RIGHT_UP)
wait(3000)
@@ -24,11 +24,9 @@ while True:
for i in range(3):
# Display eyes open plus the random brows.
hub.display.image(Icon.EYE_LEFT + Icon.EYE_RIGHT + brows)
hub.display.icon(Icon.EYE_LEFT + Icon.EYE_RIGHT + brows)
wait(2000)
# Display eyes blinked plus the random brows.
hub.display.image(
Icon.EYE_LEFT_BLINK * 0.7 + Icon.EYE_RIGHT_BLINK * 0.7 + brows
)
hub.display.icon(Icon.EYE_LEFT_BLINK * 0.7 + Icon.EYE_RIGHT_BLINK * 0.7 + brows)
wait(200)
+2 -2
View File
@@ -6,13 +6,13 @@ from pybricks.parameters import Icon
hub = PrimeHub()
# Display a big arrow pointing up.
hub.display.image(Icon.UP)
hub.display.icon(Icon.UP)
# Wait so we can see what is displayed.
wait(2000)
# Display a heart at half brightness.
hub.display.image(Icon.HEART / 2)
hub.display.icon(Icon.HEART / 2)
# Wait so we can see what is displayed.
wait(2000)
+2 -2
View File
@@ -17,7 +17,7 @@ SQUARE = Matrix(
)
# Display the square.
hub.display.image(SQUARE)
hub.display.icon(SQUARE)
wait(3000)
# Make an image using a Python list comprehension. In this image, the
@@ -26,5 +26,5 @@ wait(3000)
GRADIENT = Matrix([[(r + c) for c in range(5)] for r in range(5)]) * 12.5
# Display the generated gradient.
hub.display.image(GRADIENT)
hub.display.icon(GRADIENT)
wait(3000)
@@ -14,6 +14,6 @@ while True:
hub.display.orientation(up_side)
# Display something, like an arrow.
hub.display.image(Icon.UP)
hub.display.icon(Icon.UP)
wait(10)
@@ -12,7 +12,7 @@ gripper_motor.run_angle(200, 720, wait=False)
# While one or both of the motors are not done yet,
# do something else. In this example, just wait.
while not track_motor.control.done() or not gripper_motor.control.done():
while not track_motor.done() or not gripper_motor.done():
wait(10)
print("Both motors are done!")
+10
View File
@@ -4,6 +4,16 @@
## Unreleased
## 1.5.0 - 2022-12-02
### Changed
- Added `ujson` and `ustruct` modules.
## 1.4.0 - 2022-12-02
### Changed
- Updated `pybricks` package to v3.2.0b6.
## 1.3.0 - 2022-11-11
### Changed
+67 -79
View File
@@ -1,39 +1,31 @@
[[package]]
name = "atomicwrites"
version = "1.4.0"
description = "Atomic file writes."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "attrs"
version = "21.4.0"
version = "22.1.0"
description = "Classes Without Boilerplate"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
python-versions = ">=3.5"
[package.extras]
dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "sphinx", "sphinx-notfound-page", "zope.interface"]
dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"]
docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"]
tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "zope.interface"]
tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six"]
tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"]
tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"]
[[package]]
name = "black"
version = "22.3.0"
version = "22.10.0"
description = "The uncompromising code formatter."
category = "dev"
optional = false
python-versions = ">=3.6.2"
python-versions = ">=3.7"
[package.dependencies]
click = ">=8.0.0"
mypy-extensions = ">=0.4.3"
pathspec = ">=0.9.0"
platformdirs = ">=2"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""}
[package.extras]
colorama = ["colorama (>=0.4.3)"]
@@ -54,11 +46,11 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "colorama"
version = "0.4.5"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
[[package]]
name = "docstring-parser"
@@ -68,6 +60,17 @@ category = "main"
optional = false
python-versions = ">=3.6,<4.0"
[[package]]
name = "exceptiongroup"
version = "1.0.4"
description = "Backport of PEP 654 (exception groups)"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
test = ["pytest (>=6)"]
[[package]]
name = "flake8"
version = "4.0.1"
@@ -145,23 +148,23 @@ testing = ["docopt", "pytest (<6.0.0)"]
[[package]]
name = "pathspec"
version = "0.9.0"
version = "0.10.2"
description = "Utility library for gitignore style pattern matching of file paths."
category = "dev"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
python-versions = ">=3.7"
[[package]]
name = "platformdirs"
version = "2.5.2"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
version = "2.5.4"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx (>=4)", "sphinx-autodoc-typehints (>=1.12)"]
test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"]
docs = ["furo (>=2022.9.29)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.4)"]
test = ["appdirs (==1.4.4)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"]
[[package]]
name = "pluggy"
@@ -175,17 +178,9 @@ python-versions = ">=3.6"
dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "py"
version = "1.11.0"
description = "library with cross-python path, ini-parsing, io, code, log facilities"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "pybricks"
version = "3.2.0b5"
version = "3.2.0b6"
description = "Documentation and user-API stubs for Pybricks MicroPython"
category = "main"
optional = false
@@ -225,21 +220,20 @@ diagrams = ["jinja2", "railroad-diagrams"]
[[package]]
name = "pytest"
version = "7.1.2"
version = "7.2.0"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.dependencies]
atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""}
attrs = ">=19.2.0"
colorama = {version = "*", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
iniconfig = "*"
packaging = "*"
pluggy = ">=0.12,<2.0"
py = ">=1.8.2"
tomli = ">=1.0.0"
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
[package.extras]
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"]
@@ -263,54 +257,52 @@ python-versions = ">=3.7"
[metadata]
lock-version = "1.1"
python-versions = ">= 3.10, < 3.11"
content-hash = "4f27a31e5659d2900dfa700d0e7a87ec6a2b4557af49f21102fbbc78054371c2"
content-hash = "a0626d7e1cf972e4716f8122865c1d4b6355e1a5104b6f538da2c1cb44ba792c"
[metadata.files]
atomicwrites = [
{file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"},
{file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"},
]
attrs = [
{file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"},
{file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"},
{file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"},
{file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"},
]
black = [
{file = "black-22.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2497f9c2386572e28921fa8bec7be3e51de6801f7459dffd6e62492531c47e09"},
{file = "black-22.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5795a0375eb87bfe902e80e0c8cfaedf8af4d49694d69161e5bd3206c18618bb"},
{file = "black-22.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e3556168e2e5c49629f7b0f377070240bd5511e45e25a4497bb0073d9dda776a"},
{file = "black-22.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67c8301ec94e3bcc8906740fe071391bce40a862b7be0b86fb5382beefecd968"},
{file = "black-22.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:fd57160949179ec517d32ac2ac898b5f20d68ed1a9c977346efbac9c2f1e779d"},
{file = "black-22.3.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:cc1e1de68c8e5444e8f94c3670bb48a2beef0e91dddfd4fcc29595ebd90bb9ce"},
{file = "black-22.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2fc92002d44746d3e7db7cf9313cf4452f43e9ea77a2c939defce3b10b5c82"},
{file = "black-22.3.0-cp36-cp36m-win_amd64.whl", hash = "sha256:a6342964b43a99dbc72f72812bf88cad8f0217ae9acb47c0d4f141a6416d2d7b"},
{file = "black-22.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:328efc0cc70ccb23429d6be184a15ce613f676bdfc85e5fe8ea2a9354b4e9015"},
{file = "black-22.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06f9d8846f2340dfac80ceb20200ea5d1b3f181dd0556b47af4e8e0b24fa0a6b"},
{file = "black-22.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:ad4efa5fad66b903b4a5f96d91461d90b9507a812b3c5de657d544215bb7877a"},
{file = "black-22.3.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8477ec6bbfe0312c128e74644ac8a02ca06bcdb8982d4ee06f209be28cdf163"},
{file = "black-22.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:637a4014c63fbf42a692d22b55d8ad6968a946b4a6ebc385c5505d9625b6a464"},
{file = "black-22.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:863714200ada56cbc366dc9ae5291ceb936573155f8bf8e9de92aef51f3ad0f0"},
{file = "black-22.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10dbe6e6d2988049b4655b2b739f98785a884d4d6b85bc35133a8fb9a2233176"},
{file = "black-22.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:cee3e11161dde1b2a33a904b850b0899e0424cc331b7295f2a9698e79f9a69a0"},
{file = "black-22.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5891ef8abc06576985de8fa88e95ab70641de6c1fca97e2a15820a9b69e51b20"},
{file = "black-22.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:30d78ba6bf080eeaf0b7b875d924b15cd46fec5fd044ddfbad38c8ea9171043a"},
{file = "black-22.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ee8f1f7228cce7dffc2b464f07ce769f478968bfb3dd1254a4c2eeed84928aad"},
{file = "black-22.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ee227b696ca60dd1c507be80a6bc849a5a6ab57ac7352aad1ffec9e8b805f21"},
{file = "black-22.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:9b542ced1ec0ceeff5b37d69838106a6348e60db7b8fdd245294dc1d26136265"},
{file = "black-22.3.0-py3-none-any.whl", hash = "sha256:bc58025940a896d7e5356952228b68f793cf5fcb342be703c3a2669a1488cb72"},
{file = "black-22.3.0.tar.gz", hash = "sha256:35020b8886c022ced9282b51b5a875b6d1ab0c387b31a065b84db7c33085ca79"},
{file = "black-22.10.0-1fixedarch-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:5cc42ca67989e9c3cf859e84c2bf014f6633db63d1cbdf8fdb666dcd9e77e3fa"},
{file = "black-22.10.0-1fixedarch-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:5d8f74030e67087b219b032aa33a919fae8806d49c867846bfacde57f43972ef"},
{file = "black-22.10.0-1fixedarch-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:197df8509263b0b8614e1df1756b1dd41be6738eed2ba9e9769f3880c2b9d7b6"},
{file = "black-22.10.0-1fixedarch-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:2644b5d63633702bc2c5f3754b1b475378fbbfb481f62319388235d0cd104c2d"},
{file = "black-22.10.0-1fixedarch-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:e41a86c6c650bcecc6633ee3180d80a025db041a8e2398dcc059b3afa8382cd4"},
{file = "black-22.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2039230db3c6c639bd84efe3292ec7b06e9214a2992cd9beb293d639c6402edb"},
{file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"},
{file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"},
{file = "black-22.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b9b29da4f564ba8787c119f37d174f2b69cdfdf9015b7d8c5c16121ddc054ae"},
{file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"},
{file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"},
{file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"},
{file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"},
{file = "black-22.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fba8a281e570adafb79f7755ac8721b6cf1bbf691186a287e990c7929c7692ff"},
{file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"},
{file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"},
{file = "black-22.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:974308c58d057a651d182208a484ce80a26dac0caef2895836a92dd6ebd725e0"},
{file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"},
{file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"},
{file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"},
{file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"},
]
click = [
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
]
colorama = [
{file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"},
{file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"},
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
docstring-parser = [
{file = "docstring_parser-0.14.1-py3-none-any.whl", hash = "sha256:14ac6ec1f1ba6905c4d8cb90fd0bc55394f5678183752c90e44812bf28d7a515"},
{file = "docstring_parser-0.14.1.tar.gz", hash = "sha256:2c77522e31b7c88b1ab457a1f3c9ae38947ad719732260ba77ee8a3deb58622a"},
]
exceptiongroup = [
{file = "exceptiongroup-1.0.4-py3-none-any.whl", hash = "sha256:542adf9dea4055530d6e1279602fa5cb11dab2395fa650b8674eaec35fc4a828"},
{file = "exceptiongroup-1.0.4.tar.gz", hash = "sha256:bd14967b79cd9bdb54d97323216f8fdf533e278df937aa2a90089e7d6e06e5ec"},
]
flake8 = [
{file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"},
{file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"},
@@ -340,21 +332,17 @@ parso = [
{file = "parso-0.8.3.tar.gz", hash = "sha256:8c07be290bb59f03588915921e29e8a50002acaf2cdc5fa0e0114f91709fafa0"},
]
pathspec = [
{file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"},
{file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"},
{file = "pathspec-0.10.2-py3-none-any.whl", hash = "sha256:88c2606f2c1e818b978540f73ecc908e13999c6c3a383daf3705652ae79807a5"},
{file = "pathspec-0.10.2.tar.gz", hash = "sha256:8f6bf73e5758fd365ef5d58ce09ac7c27d2833a8d7da51712eac6e27e35141b0"},
]
platformdirs = [
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
{file = "platformdirs-2.5.4-py3-none-any.whl", hash = "sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10"},
{file = "platformdirs-2.5.4.tar.gz", hash = "sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7"},
]
pluggy = [
{file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"},
{file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"},
]
py = [
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
]
pybricks = []
pycodestyle = [
{file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"},
@@ -369,8 +357,8 @@ pyparsing = [
{file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"},
]
pytest = [
{file = "pytest-7.1.2-py3-none-any.whl", hash = "sha256:13d0e3ccfc2b6e26be000cb6568c832ba67ba32e719443bfe725814d3c42433c"},
{file = "pytest-7.1.2.tar.gz", hash = "sha256:a06a0425453864a270bc45e71f783330a7428defb4230fb5e6a731fde06ecd45"},
{file = "pytest-7.2.0-py3-none-any.whl", hash = "sha256:892f933d339f068883b6fd5a459f03d85bfcb355e4981e146d2c7616c21fef71"},
{file = "pytest-7.2.0.tar.gz", hash = "sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59"},
]
tomli = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
+2 -2
View File
@@ -1,13 +1,13 @@
[tool.poetry]
name = "pybricks_jedi"
version = "1.3.0"
version = "1.5.0"
description = "Code completion for Pybricks."
authors = ["The Pybricks Authors"]
license = "MIT"
[tool.poetry.dependencies]
python = ">= 3.10, < 3.11"
pybricks = "3.2.0b5"
pybricks = "3.2.0b6"
jedi = "0.18.1"
typing-extensions = "4.2.0"
docstring-parser = "0.14.1"
+2
View File
@@ -21,9 +21,11 @@ PYBRICKS_CODE_PACKAGES = {
"pybricks.tools",
"uerrno",
"uio",
"ujson",
"umath",
"urandom",
"uselect",
"ustruct",
"usys",
}
+33 -1
View File
@@ -18,9 +18,11 @@ def test_from():
"pybricks",
"uerrno",
"uio",
"ujson",
"umath",
"urandom",
"uselect",
"ustruct",
"usys",
]
@@ -149,6 +151,8 @@ def test_from_micropython_import():
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"const",
"heap_lock",
"heap_unlock",
"kbd_intr",
"mem_info",
"opt_level",
@@ -184,6 +188,19 @@ def test_from_uio_import():
]
def test_from_ujson_import():
code = "from ujson import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"decode", # FIXME: Shouldn't be here
"dump",
"dumps",
"encode", # FIXME: Shouldn't be here
"load",
"loads",
]
def test_from_umath_import():
code = "from umath import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
@@ -236,8 +253,8 @@ def test_from_uselect_import():
code = "from uselect import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"poll",
"Poll",
"poll",
"POLLERR",
"POLLHUP",
"POLLIN",
@@ -245,11 +262,26 @@ def test_from_uselect_import():
]
def test_from_ustruct_import():
code = "from ustruct import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"calcsize",
"pack",
"pack_into",
"unpack",
"unpack_from",
]
def test_from_usys_import():
code = "from usys import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"implementation",
"stderr",
"stdin",
"stdout",
"version",
"version_info",
]
+12 -109
View File
@@ -27,113 +27,16 @@ def _create_snippet(line: str) -> str:
return "\n".join((IMPORT, CREATE_INSTANCE, line))
def test_hub_dot():
line = "hub."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"battery",
"buttons",
"charger",
"display",
"imu",
"light",
"speaker",
"system",
]
# Everything else is the same as the Prime Hub.
def test_hub_dot_battery_dot():
line = "hub.battery."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"current",
"voltage",
]
def test_hub_dot_buttons_dot():
line = "hub.buttons."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"pressed",
]
def test_hub_dot_charger_dot():
line = "hub.charger."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"connected",
"current",
"status",
]
def test_hub_dot_display_dot():
line = "hub.display."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"animate",
"char",
"image",
"number",
"off",
"orientation",
"pixel",
"text",
]
def test_hub_dot_imu_dot():
line = "hub.imu."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"acceleration",
"angular_velocity",
"heading",
"reset_heading",
"tilt",
"up",
]
def test_hub_dot_light_dot():
line = "hub.light."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"animate",
"blink",
"off",
"on",
]
def test_hub_dot_speaker_dot():
line = "hub.speaker."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"beep",
"play_notes",
"volume",
]
def test_hub_dot_system_dot():
line = "hub.system."
code = _create_snippet(line)
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
assert [c["insertText"] for c in completions] == [
"name",
"reset_reason",
"set_stop_button",
"shutdown",
"storage",
]
from test_complete_prime_hub import ( # noqa F401
test_hub_dot,
test_hub_dot_battery_dot,
test_hub_dot_buttons_dot,
test_hub_dot_charger_dot,
test_hub_dot_display_dot,
test_hub_dot_imu_dot,
test_hub_dot_light_dot,
test_hub_dot_speaker_dot,
test_hub_dot_system_dot,
)
+1 -1
View File
@@ -102,7 +102,7 @@ ENUMS = [
),
pytest.param("Port", ["A", "B", "C", "D", "E", "F", "S1", "S2", "S3", "S4"]),
pytest.param("Side", ["BACK", "BOTTOM", "FRONT", "LEFT", "RIGHT", "TOP"]),
pytest.param("Stop", ["BRAKE", "COAST", "HOLD"]),
pytest.param("Stop", ["BRAKE", "COAST", "COAST_SMART", "HOLD", "NONE"]),
]
+1 -1
View File
@@ -80,7 +80,7 @@ def test_hub_dot_display_dot():
assert [c["insertText"] for c in completions] == [
"animate",
"char",
"image",
"icon",
"number",
"off",
"orientation",
+6 -4
View File
@@ -360,7 +360,7 @@ METHOD_PARAMS = [
[(["row: Number", "column: Number", "brightness: Number=100"], "None")],
),
pytest.param(
"pybricks.hubs", "PrimeHub", "display.image", [(["matrix: Matrix"], "None")]
"pybricks.hubs", "PrimeHub", "display.icon", [(["icon: Matrix"], "None")]
),
pytest.param(
"pybricks.hubs",
@@ -602,9 +602,9 @@ METHOD_PARAMS = [
],
),
pytest.param("pybricks.pupdevices", "Motor", "dc", [(["duty: Number"], "None")]),
pytest.param("pybricks.pupdevices", "Motor", "control.done", [([], "bool")]),
pytest.param("pybricks.pupdevices", "Motor", "control.stalled", [([], "bool")]),
pytest.param("pybricks.pupdevices", "Motor", "control.load", [([], "int")]),
pytest.param("pybricks.pupdevices", "Motor", "done", [([], "bool")]),
pytest.param("pybricks.pupdevices", "Motor", "stalled", [([], "bool")]),
pytest.param("pybricks.pupdevices", "Motor", "load", [([], "int")]),
pytest.param(
"pybricks.pupdevices",
"Motor",
@@ -853,6 +853,8 @@ METHOD_PARAMS = [
"pybricks.robotics", "DriveBase", "state", [([], "Tuple[int, int, int, int]")]
),
pytest.param("pybricks.robotics", "DriveBase", "reset", [([], "None")]),
pytest.param("pybricks.robotics", "DriveBase", "done", [([], "bool")]),
pytest.param("pybricks.robotics", "DriveBase", "stalled", [([], "bool")]),
]
+5
View File
@@ -2,6 +2,11 @@
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 2.5.0 - 2022-12-02
### Changed
- Updated docs to v3.2.0b6.
## 2.4.0 - 2022-11-11
### Changed
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pybricks/ide-docs",
"version": "2.4.0",
"version": "2.5.0",
"description": "Special build of Pybricks API docs for embedding in an IDE.",
"repository": {
"type": "git",
+10
View File
@@ -2,6 +2,16 @@
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 1.5.0 - 2022-12-02
### Changed
- Updated `pybricks_jedi` Python package to v1.5.0.
## 1.4.0 - 2022-12-02
### Changed
- Updated `pybricks_jedi` Python package to v1.4.0.
## 1.3.0 - 2022-11-11
### Changed
+2 -2
View File
@@ -12,7 +12,7 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
package_json = {
"name": "@pybricks/jedi",
"version": "1.3.0",
"version": "1.5.0",
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
"repository": {
"type": "git",
@@ -38,7 +38,7 @@ subprocess.check_call(
"pip",
"download",
"--only-binary=any",
"pybricks-jedi==1.3.0",
"pybricks-jedi==1.5.0",
],
cwd=BUILD_DIR,
)
Generated
+85 -87
View File
@@ -8,7 +8,7 @@ python-versions = "*"
[[package]]
name = "Babel"
version = "2.10.3"
version = "2.11.0"
description = "Internationalization utilities"
category = "dev"
optional = false
@@ -19,11 +19,11 @@ pytz = ">=2015.7"
[[package]]
name = "black"
version = "22.8.0"
version = "22.10.0"
description = "The uncompromising code formatter."
category = "dev"
optional = false
python-versions = ">=3.6.2"
python-versions = ">=3.7"
[package.dependencies]
click = ">=8.0.0"
@@ -41,7 +41,7 @@ uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "certifi"
version = "2022.6.15"
version = "2022.12.7"
description = "Python package for providing Mozilla's CA Bundle."
category = "dev"
optional = false
@@ -49,11 +49,11 @@ python-versions = ">=3.6"
[[package]]
name = "chardet"
version = "5.0.0"
version = "5.1.0"
description = "Universal encoding detector for Python 3"
category = "dev"
optional = false
python-versions = ">=3.6"
python-versions = ">=3.7"
[[package]]
name = "charset-normalizer"
@@ -64,7 +64,7 @@ optional = false
python-versions = ">=3.6.0"
[package.extras]
unicode_backport = ["unicodedata2"]
unicode-backport = ["unicodedata2"]
[[package]]
name = "click"
@@ -79,11 +79,11 @@ colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "colorama"
version = "0.4.5"
version = "0.4.6"
description = "Cross-platform colored terminal text."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
[[package]]
name = "doc8"
@@ -124,7 +124,7 @@ pyflakes = ">=2.4.0,<2.5.0"
[[package]]
name = "idna"
version = "3.3"
version = "3.4"
description = "Internationalized Domain Names in Applications (IDNA)"
category = "dev"
optional = false
@@ -140,7 +140,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "importlib-metadata"
version = "4.12.0"
version = "5.1.0"
description = "Read metadata from Python packages"
category = "dev"
optional = false
@@ -150,9 +150,9 @@ python-versions = ">=3.7"
zipp = ">=0.5"
[package.extras]
docs = ["jaraco.packaging (>=9)", "rst.linker (>=1.9)", "sphinx"]
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"]
perf = ["ipython"]
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"]
testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"]
[[package]]
name = "Jinja2"
@@ -205,7 +205,7 @@ pyparsing = ">=2.0.2,<3.0.5 || >3.0.5"
[[package]]
name = "pathspec"
version = "0.10.1"
version = "0.10.2"
description = "Utility library for gitignore style pattern matching of file paths."
category = "dev"
optional = false
@@ -213,7 +213,7 @@ python-versions = ">=3.7"
[[package]]
name = "pbr"
version = "5.10.0"
version = "5.11.0"
description = "Python Build Reasonableness"
category = "dev"
optional = false
@@ -221,15 +221,15 @@ python-versions = ">=2.6"
[[package]]
name = "platformdirs"
version = "2.5.2"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
version = "2.5.4"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx (>=4)", "sphinx-autodoc-typehints (>=1.12)"]
test = ["appdirs (==1.4.4)", "pytest (>=6)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)"]
docs = ["furo (>=2022.9.29)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.4)"]
test = ["appdirs (==1.4.4)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"]
[[package]]
name = "pycodestyle"
@@ -271,7 +271,7 @@ diagrams = ["jinja2", "railroad-diagrams"]
[[package]]
name = "pytz"
version = "2022.2.1"
version = "2022.6"
description = "World timezone definitions, modern and historical"
category = "dev"
optional = false
@@ -293,7 +293,7 @@ urllib3 = ">=1.21.1,<1.27"
[package.extras]
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
use_chardet_on_py3 = ["chardet (>=3.0.2,<6)"]
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
[[package]]
name = "restructuredtext-lint"
@@ -324,7 +324,7 @@ python-versions = "*"
[[package]]
name = "Sphinx"
version = "5.1.0.dev20220621"
version = "5.1.0.dev20221209"
description = "Python documentation generator"
category = "dev"
optional = false
@@ -353,7 +353,7 @@ sphinxcontrib-serializinghtml = ">=1.1.5"
[package.extras]
docs = ["sphinxcontrib-websupport"]
lint = ["docutils-stubs", "flake8 (>=3.5.0)", "isort", "mypy (>=0.950)", "types-requests", "types-typed-ast"]
test = ["cython", "html5lib", "pytest (>=4.6)", "typed_ast"]
test = ["cython", "html5lib", "pytest (>=4.6)", "typed-ast"]
[package.source]
type = "git"
@@ -363,18 +363,18 @@ resolved_reference = "b00124cb07318fd6875f6d53e0b26e50c7dde597"
[[package]]
name = "sphinx-rtd-theme"
version = "1.0.0"
version = "1.1.1"
description = "Read the Docs theme for Sphinx"
category = "dev"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7"
[package.dependencies]
docutils = "<0.18"
sphinx = ">=1.6"
sphinx = ">=1.6,<6"
[package.extras]
dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client"]
dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client", "wheel"]
[[package]]
name = "sphinxcontrib-applehelp"
@@ -449,7 +449,7 @@ test = ["pytest"]
[[package]]
name = "stevedore"
version = "4.0.0"
version = "4.1.1"
description = "Manage dynamic plugins for Python applications"
category = "dev"
optional = false
@@ -476,7 +476,7 @@ python-versions = ">=3.7"
[[package]]
name = "typing-extensions"
version = "4.3.0"
version = "4.4.0"
description = "Backported and Experimental Type Hints for Python 3.7+"
category = "dev"
optional = false
@@ -484,11 +484,11 @@ python-versions = ">=3.7"
[[package]]
name = "urllib3"
version = "1.26.12"
version = "1.26.13"
description = "HTTP library with thread-safe connection pooling, file post, and more."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4"
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
[package.extras]
brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
@@ -497,15 +497,15 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[[package]]
name = "zipp"
version = "3.8.1"
version = "3.11.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.extras]
docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"]
testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"]
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"]
testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"]
[metadata]
lock-version = "1.1"
@@ -518,41 +518,39 @@ alabaster = [
{file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"},
]
Babel = [
{file = "Babel-2.10.3-py3-none-any.whl", hash = "sha256:ff56f4892c1c4bf0d814575ea23471c230d544203c7748e8c68f0089478d48eb"},
{file = "Babel-2.10.3.tar.gz", hash = "sha256:7614553711ee97490f732126dc077f8d0ae084ebc6a96e23db1482afabdb2c51"},
{file = "Babel-2.11.0-py3-none-any.whl", hash = "sha256:1ad3eca1c885218f6dce2ab67291178944f810a10a9b5f3cb8382a5a232b64fe"},
{file = "Babel-2.11.0.tar.gz", hash = "sha256:5ef4b3226b0180dedded4229651c8b0e1a3a6a2837d45a073272f313e4cf97f6"},
]
black = [
{file = "black-22.8.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ce957f1d6b78a8a231b18e0dd2d94a33d2ba738cd88a7fe64f53f659eea49fdd"},
{file = "black-22.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5107ea36b2b61917956d018bd25129baf9ad1125e39324a9b18248d362156a27"},
{file = "black-22.8.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e8166b7bfe5dcb56d325385bd1d1e0f635f24aae14b3ae437102dedc0c186747"},
{file = "black-22.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd82842bb272297503cbec1a2600b6bfb338dae017186f8f215c8958f8acf869"},
{file = "black-22.8.0-cp310-cp310-win_amd64.whl", hash = "sha256:d839150f61d09e7217f52917259831fe2b689f5c8e5e32611736351b89bb2a90"},
{file = "black-22.8.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:a05da0430bd5ced89176db098567973be52ce175a55677436a271102d7eaa3fe"},
{file = "black-22.8.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a098a69a02596e1f2a58a2a1c8d5a05d5a74461af552b371e82f9fa4ada8342"},
{file = "black-22.8.0-cp36-cp36m-win_amd64.whl", hash = "sha256:5594efbdc35426e35a7defa1ea1a1cb97c7dbd34c0e49af7fb593a36bd45edab"},
{file = "black-22.8.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a983526af1bea1e4cf6768e649990f28ee4f4137266921c2c3cee8116ae42ec3"},
{file = "black-22.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b2c25f8dea5e8444bdc6788a2f543e1fb01494e144480bc17f806178378005e"},
{file = "black-22.8.0-cp37-cp37m-win_amd64.whl", hash = "sha256:78dd85caaab7c3153054756b9fe8c611efa63d9e7aecfa33e533060cb14b6d16"},
{file = "black-22.8.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:cea1b2542d4e2c02c332e83150e41e3ca80dc0fb8de20df3c5e98e242156222c"},
{file = "black-22.8.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5b879eb439094751185d1cfdca43023bc6786bd3c60372462b6f051efa6281a5"},
{file = "black-22.8.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:0a12e4e1353819af41df998b02c6742643cfef58282915f781d0e4dd7a200411"},
{file = "black-22.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c3a73f66b6d5ba7288cd5d6dad9b4c9b43f4e8a4b789a94bf5abfb878c663eb3"},
{file = "black-22.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:e981e20ec152dfb3e77418fb616077937378b322d7b26aa1ff87717fb18b4875"},
{file = "black-22.8.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8ce13ffed7e66dda0da3e0b2eb1bdfc83f5812f66e09aca2b0978593ed636b6c"},
{file = "black-22.8.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:32a4b17f644fc288c6ee2bafdf5e3b045f4eff84693ac069d87b1a347d861497"},
{file = "black-22.8.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0ad827325a3a634bae88ae7747db1a395d5ee02cf05d9aa7a9bd77dfb10e940c"},
{file = "black-22.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53198e28a1fb865e9fe97f88220da2e44df6da82b18833b588b1883b16bb5d41"},
{file = "black-22.8.0-cp39-cp39-win_amd64.whl", hash = "sha256:bc4d4123830a2d190e9cc42a2e43570f82ace35c3aeb26a512a2102bce5af7ec"},
{file = "black-22.8.0-py3-none-any.whl", hash = "sha256:d2c21d439b2baf7aa80d6dd4e3659259be64c6f49dfd0f32091063db0e006db4"},
{file = "black-22.8.0.tar.gz", hash = "sha256:792f7eb540ba9a17e8656538701d3eb1afcb134e3b45b71f20b25c77a8db7e6e"},
{file = "black-22.10.0-1fixedarch-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:5cc42ca67989e9c3cf859e84c2bf014f6633db63d1cbdf8fdb666dcd9e77e3fa"},
{file = "black-22.10.0-1fixedarch-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:5d8f74030e67087b219b032aa33a919fae8806d49c867846bfacde57f43972ef"},
{file = "black-22.10.0-1fixedarch-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:197df8509263b0b8614e1df1756b1dd41be6738eed2ba9e9769f3880c2b9d7b6"},
{file = "black-22.10.0-1fixedarch-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:2644b5d63633702bc2c5f3754b1b475378fbbfb481f62319388235d0cd104c2d"},
{file = "black-22.10.0-1fixedarch-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:e41a86c6c650bcecc6633ee3180d80a025db041a8e2398dcc059b3afa8382cd4"},
{file = "black-22.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2039230db3c6c639bd84efe3292ec7b06e9214a2992cd9beb293d639c6402edb"},
{file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"},
{file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"},
{file = "black-22.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b9b29da4f564ba8787c119f37d174f2b69cdfdf9015b7d8c5c16121ddc054ae"},
{file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"},
{file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"},
{file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"},
{file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"},
{file = "black-22.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fba8a281e570adafb79f7755ac8721b6cf1bbf691186a287e990c7929c7692ff"},
{file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"},
{file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"},
{file = "black-22.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:974308c58d057a651d182208a484ce80a26dac0caef2895836a92dd6ebd725e0"},
{file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"},
{file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"},
{file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"},
{file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"},
]
certifi = [
{file = "certifi-2022.6.15-py3-none-any.whl", hash = "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412"},
{file = "certifi-2022.6.15.tar.gz", hash = "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"},
{file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"},
{file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"},
]
chardet = [
{file = "chardet-5.0.0-py3-none-any.whl", hash = "sha256:d3e64f022d254183001eccc5db4040520c0f23b1a3f33d6413e099eb7f126557"},
{file = "chardet-5.0.0.tar.gz", hash = "sha256:0368df2bfd78b5fc20572bb4e9bb7fb53e2c094f60ae9993339e8671d0afb8aa"},
{file = "chardet-5.1.0-py3-none-any.whl", hash = "sha256:362777fb014af596ad31334fde1e8c327dfdb076e1960d1694662d46a6917ab9"},
{file = "chardet-5.1.0.tar.gz", hash = "sha256:0d62712b956bc154f85fb0a266e2a3c5913c2967e00348701b32411d6def31e5"},
]
charset-normalizer = [
{file = "charset-normalizer-2.1.1.tar.gz", hash = "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"},
@@ -563,8 +561,8 @@ click = [
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
]
colorama = [
{file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"},
{file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"},
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
doc8 = [
{file = "doc8-0.8.1-py2.py3-none-any.whl", hash = "sha256:4d58a5c8c56cedd2b2c9d6e3153be5d956cf72f6051128f0f2255c66227df721"},
@@ -579,16 +577,16 @@ flake8 = [
{file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"},
]
idna = [
{file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"},
{file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"},
{file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"},
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
]
imagesize = [
{file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"},
{file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"},
]
importlib-metadata = [
{file = "importlib_metadata-4.12.0-py3-none-any.whl", hash = "sha256:7401a975809ea1fdc658c3aa4f78cc2195a0e019c5cbc4c06122884e9ae80c23"},
{file = "importlib_metadata-4.12.0.tar.gz", hash = "sha256:637245b8bab2b6502fcbc752cc4b7a6f6243bb02b31c5c26156ad103d3d45670"},
{file = "importlib_metadata-5.1.0-py3-none-any.whl", hash = "sha256:d84d17e21670ec07990e1044a99efe8d615d860fd176fc29ef5c306068fda313"},
{file = "importlib_metadata-5.1.0.tar.gz", hash = "sha256:d5059f9f1e8e41f80e9c56c2ee58811450c31984dfa625329ffd7c0dad88a73b"},
]
Jinja2 = [
{file = "Jinja2-3.1.2-py3-none-any.whl", hash = "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"},
@@ -649,16 +647,16 @@ packaging = [
{file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"},
]
pathspec = [
{file = "pathspec-0.10.1-py3-none-any.whl", hash = "sha256:46846318467efc4556ccfd27816e004270a9eeeeb4d062ce5e6fc7a87c573f93"},
{file = "pathspec-0.10.1.tar.gz", hash = "sha256:7ace6161b621d31e7902eb6b5ae148d12cfd23f4a249b9ffb6b9fee12084323d"},
{file = "pathspec-0.10.2-py3-none-any.whl", hash = "sha256:88c2606f2c1e818b978540f73ecc908e13999c6c3a383daf3705652ae79807a5"},
{file = "pathspec-0.10.2.tar.gz", hash = "sha256:8f6bf73e5758fd365ef5d58ce09ac7c27d2833a8d7da51712eac6e27e35141b0"},
]
pbr = [
{file = "pbr-5.10.0-py2.py3-none-any.whl", hash = "sha256:da3e18aac0a3c003e9eea1a81bd23e5a3a75d745670dcf736317b7d966887fdf"},
{file = "pbr-5.10.0.tar.gz", hash = "sha256:cfcc4ff8e698256fc17ea3ff796478b050852585aa5bae79ecd05b2ab7b39b9a"},
{file = "pbr-5.11.0-py2.py3-none-any.whl", hash = "sha256:db2317ff07c84c4c63648c9064a79fe9d9f5c7ce85a9099d4b6258b3db83225a"},
{file = "pbr-5.11.0.tar.gz", hash = "sha256:b97bc6695b2aff02144133c2e7399d5885223d42b7912ffaec2ca3898e673bfe"},
]
platformdirs = [
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
{file = "platformdirs-2.5.4-py3-none-any.whl", hash = "sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10"},
{file = "platformdirs-2.5.4.tar.gz", hash = "sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7"},
]
pycodestyle = [
{file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"},
@@ -677,8 +675,8 @@ pyparsing = [
{file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"},
]
pytz = [
{file = "pytz-2022.2.1-py2.py3-none-any.whl", hash = "sha256:220f481bdafa09c3955dfbdddb7b57780e9a94f5127e35456a48589b9e0c0197"},
{file = "pytz-2022.2.1.tar.gz", hash = "sha256:cea221417204f2d1a2aa03ddae3e867921971d0d76f14d87abb4414415bbdcf5"},
{file = "pytz-2022.6-py2.py3-none-any.whl", hash = "sha256:222439474e9c98fced559f1709d89e6c9cbf8d79c794ff3eb9f8800064291427"},
{file = "pytz-2022.6.tar.gz", hash = "sha256:e89512406b793ca39f5971bc999cc538ce125c0e51c27941bef4568b460095e2"},
]
requests = [
{file = "requests-2.28.1-py3-none-any.whl", hash = "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349"},
@@ -697,8 +695,8 @@ snowballstemmer = [
]
Sphinx = []
sphinx-rtd-theme = [
{file = "sphinx_rtd_theme-1.0.0-py2.py3-none-any.whl", hash = "sha256:4d35a56f4508cfee4c4fb604373ede6feae2a306731d533f409ef5c3496fdbd8"},
{file = "sphinx_rtd_theme-1.0.0.tar.gz", hash = "sha256:eec6d497e4c2195fa0e8b2016b337532b8a699a68bcb22a512870e16925c6a5c"},
{file = "sphinx_rtd_theme-1.1.1-py2.py3-none-any.whl", hash = "sha256:31faa07d3e97c8955637fc3f1423a5ab2c44b74b8cc558a51498c202ce5cbda7"},
{file = "sphinx_rtd_theme-1.1.1.tar.gz", hash = "sha256:6146c845f1e1947b3c3dd4432c28998a1693ccc742b4f9ad7c63129f0757c103"},
]
sphinxcontrib-applehelp = [
{file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"},
@@ -725,8 +723,8 @@ sphinxcontrib-serializinghtml = [
{file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"},
]
stevedore = [
{file = "stevedore-4.0.0-py3-none-any.whl", hash = "sha256:87e4d27fe96d0d7e4fc24f0cbe3463baae4ec51e81d95fbe60d2474636e0c7d8"},
{file = "stevedore-4.0.0.tar.gz", hash = "sha256:f82cc99a1ff552310d19c379827c2c64dd9f85a38bcd5559db2470161867b786"},
{file = "stevedore-4.1.1-py3-none-any.whl", hash = "sha256:aa6436565c069b2946fe4ebff07f5041e0c8bf18c7376dd29edf80cf7d524e4e"},
{file = "stevedore-4.1.1.tar.gz", hash = "sha256:7f8aeb6e3f90f96832c301bff21a7eb5eefbe894c88c506483d355565d88cc1a"},
]
toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
@@ -737,14 +735,14 @@ tomli = [
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
]
typing-extensions = [
{file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"},
{file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"},
{file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"},
{file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"},
]
urllib3 = [
{file = "urllib3-1.26.12-py2.py3-none-any.whl", hash = "sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997"},
{file = "urllib3-1.26.12.tar.gz", hash = "sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"},
{file = "urllib3-1.26.13-py2.py3-none-any.whl", hash = "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc"},
{file = "urllib3-1.26.13.tar.gz", hash = "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"},
]
zipp = [
{file = "zipp-3.8.1-py3-none-any.whl", hash = "sha256:47c40d7fe183a6f21403a199b3e4192cca5774656965b0a4988ad2f8feb5f009"},
{file = "zipp-3.8.1.tar.gz", hash = "sha256:05b45f1ee8f807d0cc928485ca40a07cb491cf092ff587c0df9cb1fd154848d2"},
{file = "zipp-3.11.0-py3-none-any.whl", hash = "sha256:83a28fcb75844b5c0cdaf5aa4003c2d728c77e05f5aeabe8e95e56727005fbaa"},
{file = "zipp-3.11.0.tar.gz", hash = "sha256:a7a22e05929290a67401440b39690ae6563279bced5f314609d9d03798f56766"},
]
+3 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybricks"
version = "3.2.0b5"
version = "3.2.0c1"
description = "Documentation and user-API stubs for Pybricks MicroPython"
authors = ["The Pybricks Authors <dev@pybricks.com>"]
maintainers = ["Laurens Valk <laurens@pybricks.com>", "David Lechner <david@pybricks.com>" ]
@@ -18,9 +18,11 @@ packages = [
{ include = "micropython", from = "src" },
{ include = "uerrno", from = "src" },
{ include = "uio", from = "src" },
{ include = "ujson", from = "src" },
{ include = "umath", from = "src" },
{ include = "urandom", from = "src" },
{ include = "uselect", from = "src" },
{ include = "ustruct", from = "src" },
{ include = "usys", from = "src" },
]
+81 -18
View File
@@ -12,10 +12,31 @@ Access and control MicroPython internals.
from typing import Any, overload
@overload
def const(value: int) -> int:
...
@overload
def const(value: str) -> str:
...
@overload
def const(value: float) -> float:
...
@overload
def const(value: tuple) -> tuple:
...
def const(value):
"""
Declares the value as a constant. This value will be
substituted wherever it is used, which makes your code more efficient.
const(value) -> Any
Declares the value as a constant, which makes your code more efficient.
To reduce memory usage further, prefix its name with an
underscore (``_ORANGES``). This constant can only be used within the
@@ -23,8 +44,13 @@ def const(value: int) -> int:
If you want to import the value from another module, use a name without an
underscore (``APPLES``). This uses a bit more memory.
Arguments:
value (int or float or str or tuple): The literal to be made constant.
Returns:
The constant value.
"""
...
@overload
@@ -54,8 +80,11 @@ def opt_level(*args):
This applies only to code that you run in the REPL, because regular scripts
are already compiled before they are sent to the hub.
If no argument is given, this function returns the current optimization
level.
Arguments:
level (int): The level to be set.
Returns:
If no argument is given, this returns the current optimization level.
"""
@@ -72,10 +101,14 @@ def mem_info(verbose: Any) -> None:
def mem_info(*args):
"""
mem_info()
mem_info(verbose)
Prints information about stack and heap memory usage.
If the ``verbose`` argument is given, it also prints out
the entire heap, indicating which blocks are used and which are free.
Arguments:
verbose: If any value is given, it also prints out the entire heap.
This indicates which blocks are used and which are free.
"""
@@ -91,34 +124,64 @@ def qstr_info(verbose: Any) -> None:
def qstr_info(*args):
"""
qstr_info()
qstr_info(verbose)
Prints how many strings are interned and how much RAM they use.
MicroPython uses string interning to save both RAM and ROM.
This avoids having to store duplicate copies of the same string.
If the ``verbose`` argument is given it also prints out the names of all
RAM-interned strings.
Arguments:
verbose: If any value is given, it also prints out the names of all
RAM-interned strings.
"""
def stack_use() -> int:
"""
Returns the amount of stack that is being used. This can be used to
stack_use() -> int
Checks the amount of stack that is being used. This can be used to
compute differences in stack usage at different points in a script.
Returns:
The amount of stack in use.
"""
# REVISIT: Skipping heap lock funcs for now
def heap_lock() -> None:
"""
heap_lock()
Locks the heap. When locked, no memory allocation can occur. A
``MemoryError`` will be raised if any heap allocation is attempted.
"""
def heap_unlock() -> int:
"""
heap_unlock() -> int
Unlocks the heap. Memory allocation is now allowed again.
If :func:`heap_lock()` was called multiple times, :func:`heap_unlock()`
must be called the same number of times to make the heap available again.
Returns:
The lock depth after unlocking. It is ``0`` once it is unlocked.
"""
def kbd_intr(chr: int) -> None:
"""
Set the character that will raise a ``KeyboardInterrupt`` exception. By
default this is set to ``3`` during script execution, corresponding to
:kbd:`Ctrl-C`. Passing ``-1`` to this function will disable capture of
:kbd:`Ctrl-C`, and passing ``3`` will restore it.
kbd_intr(chr)
This function can be used to prevent the capturing of :kbd:`Ctrl-C` on the
incoming stream of characters that is usually used for the REPL, in case
that stream is used for other purposes.
Sets the character that triggers a ``KeyboardInterrupt`` exception when
you type it in the input window. By default it is set to ``3``,
which corresponds to pressing :kbd:`Ctrl` :kbd:`C`.
Arguments:
chr (int): Character that should raise the ``KeyboardInterrupt``.
Choose ``-1`` to disable this feature.
"""
+2 -2
View File
@@ -3,6 +3,6 @@ from typing import Tuple
version: Tuple[str, str, str] = (
"hub",
"3.2.0b1",
"v3.2.0b1-GIT_HASH on DATE",
"3.X.YbZ",
"v3.X.YbZ-GIT_HASH on DATE",
)
+48 -47
View File
@@ -78,20 +78,23 @@ class System:
def storage(self, offset, read=None, write=None):
"""
storage(self, offset, read=) -> bytes
storage(self, offset, write=)
storage(self, offset, read=) -> bytes
Reads or writes binary data to persistent storage.
The available storage size is 128 bytes on Move, City and Technic hubs
and 512 bytes on SPIKE and MINDSTORMS hubs.
This lets you store data that can be used the next time you run the
program.
.. note:: The data is written to flash memory on shutdown, so will only
be saved if the hub is properly shut down. It will not be saved if
the batteries are removed while the hub is still running.
The data will be saved to flash memory when you turn the hub off
normally. It will not be saved if the batteries are removed *while* the
hub is still running.
Once saved, the data will remain available even after you remove the
batteries.
Args:
offset (int): The offset from the start of the user storage memory in bytes.
offset (int): The offset from the start of the user storage memory, in bytes.
read (int): The number of bytes to read. Omit this argument when writing.
write (bytes): The bytes to write. Omit this argument when reading.
@@ -100,8 +103,7 @@ class System:
Raises:
ValueError:
The offset and/or the size of bytes to be read/written are
outside of the range of the allocated memory.
If you try to read or write data outside of the allowed range.
"""
@@ -197,6 +199,9 @@ class Control:
If no arguments are given, this will return the current values.
The new ``acceleration`` and ``speed`` limit will become effective
when you give a new motor command. Ongoing maneuvers are not affected.
Arguments:
speed (Number, deg/s or Number, mm/s):
Maximum speed. All speed commands will be capped to this value.
@@ -297,40 +302,6 @@ class Control:
minimum ``speed`` before we say it is stalled.
"""
def stalled(self) -> bool:
"""stalled() -> bool
Checks if the controller is currently stalled.
A controller is stalled when it cannot reach the target speed or
position, even with the maximum actuation signal.
Returns:
``True`` if the controller is stalled, ``False`` if not.
"""
def done(self) -> bool:
"""done() -> bool
Checks if an ongoing command or maneuver is done.
Returns:
``True`` if the command is done, ``False`` if not.
"""
def load(self) -> int:
"""load() -> int: mNm
Estimates the load based on the torque required to maintain the
specified speed or angle.
When coasting, braking, or controlling the duty cycle manually, the
load cannot be estimated in this way. Then this method returns zero.
Returns:
The load torque. It returns 0 if control is not active.
"""
class Motor(DCMotor):
"""Generic class to control motors with built-in rotation sensors."""
@@ -392,6 +363,27 @@ class Motor(DCMotor):
"""
def stalled(self) -> bool:
"""stalled() -> bool
Checks if the motor is currently stalled.
It is stalled when it cannot reach the target speed or position, even
with the maximum actuation signal.
Returns:
``True`` if the motor is stalled, ``False`` if not.
"""
def load(self) -> int:
"""load() -> int: mNm
Estimates the load that holds back the motor when it tries to move.
Returns:
The load torque.
"""
def reset_angle(self, angle: Optional[Number]) -> None:
"""
reset_angle(angle)
@@ -503,6 +495,15 @@ class Motor(DCMotor):
Angle at which the motor becomes stalled.
"""
def done(self) -> bool:
"""done() -> bool
Checks if an ongoing command or maneuver is done.
Returns:
``True`` if the command is done, ``False`` if not.
"""
def track_target(self, target_angle: Number) -> None:
"""track_target(target_angle)
@@ -708,14 +709,14 @@ class LightMatrix:
or ``Side.BOTTOM``.
"""
def image(self, matrix: Matrix) -> None:
"""image(matrix)
def icon(self, icon: Matrix) -> None:
"""icon(icon)
Displays an image, represented by a matrix of :ref:`brightness`
Displays an icon, represented by a matrix of :ref:`brightness`
values.
Arguments:
matrix (Matrix): Matrix of intensities (:ref:`brightness`). A 2D
icon (Matrix): Matrix of intensities (:ref:`brightness`). A 2D
list is also accepted.
"""
+20 -5
View File
@@ -29,9 +29,9 @@ if TYPE_CHECKING or os.environ.get("SPHINX_BUILD") == "True":
however, your input value will be truncated to a whole number anyway. In this
example, either command makes the program pause for just 15 milliseconds.
.. warning::
.. note::
The BOOST Move hub doesn't support floating point numbers due to
limited system resources, so only integers can be used on that hub.
limited system resources. Only integers can be used on that hub.
"""
@@ -152,17 +152,32 @@ class Port(_PybricksEnum):
class Stop(_PybricksEnum):
"""Action after the motor stops."""
"""Action after the motor stops or reaches its target."""
COAST: Stop = 0
"""Let the motor move freely."""
COAST_SMART: Stop = 4
"""
Let the motor move freely. For the next relative angle maneuver,
take the last target angle (instead of the current angle) as the new
starting point. This reduces cumulative errors. This will apply only if the
current angle is less than twice the configured position tolerance.
"""
BRAKE: Stop = 1
"""Passively resist small external forces."""
HOLD: Stop = 2
"""Keep controlling the motor to hold it at the commanded angle. This is
only available on motors with encoders."""
"""Keep controlling the motor to hold it at the commanded angle."""
NONE: Stop = 3
"""
Do not decelerate when approaching the target position. This can be used
to concatenate multiple motor or drive base maneuvers without stopping. If
no further commands are given, the motor will proceed to run indefinitely
at the given speed.
"""
class Direction(_PybricksEnum):
+30 -1
View File
@@ -28,8 +28,12 @@ class DriveBase:
**Positive** angles and turn rates mean turning **right**.
**Negative** means **left**. So when viewed from the top,
positive means clockwise and negative means counterclockwise.
positive means clockwise and negative means counterclockwise. If desired,
you can flip this convention by reversing the ``left_motor`` and
``right_motor`` when you initialize this class.
See the `measuring`_ section for tips to measure and adjust the diameter
and axle track values.
"""
distance_control = _common.Control()
@@ -139,6 +143,10 @@ class DriveBase:
If you give no arguments, this returns the current values as a tuple.
The default values are automatically configured based on your wheel
diameter and axle track. They are selected such that your robot
drives at about 40% of its maximum speed.
Arguments:
straight_speed (Number, mm/s): Straight-line speed of the robot.
straight_acceleration (Number, mm/): Straight-line
@@ -189,6 +197,27 @@ class DriveBase:
with the rest of the program.
"""
def done(self) -> bool:
"""done() -> bool
Checks if an ongoing command or maneuver is done.
Returns:
``True`` if the command is done, ``False`` if not.
"""
def stalled(self) -> bool:
"""stalled() -> bool
Checks if the drive base is currently stalled.
It is stalled when it cannot reach the target speed or position, even
with the maximum actuation signal.
Returns:
``True`` if the drivebase is stalled, ``False`` if not.
"""
# HACK: hide from jedi
if TYPE_CHECKING:
+409 -124
View File
@@ -15,6 +15,8 @@
"""
The following functions and exceptions can be used without importing anything.
Most functions and classes in this module do not accept keyword arguments.
"""
from typing import (
@@ -177,19 +179,27 @@ class bytes:
def __init__(self, *args):
r"""
bytes()
bytes(integer)
bytes(iterable)
bytes(string, encoding)
Creates a new ``bytes`` object, which is a sequence of integers
in the range :math:`0 \leq x \leq 255`. This object is *immutable*,
which means that you *cannot* change its contents after you create it.
* If no argument is given, this creates an empty ``bytes`` object.
* If the ``source`` argument is an integer, this creates a ``bytes``
object of zeros. The argument specifies how many zeros.
* If ``source`` is a ``bytearray``, ``bytes`` object, or some other
iterable of integers, this creates a ``bytes``
object with the same byte sequence as the ``source`` argument.
* If ``source`` is a string, choose ``'utf8'`` as the ``encoding``
argument. Then this creates a ``bytes`` object containing the
encoded string.
If no argument is given, this creates an empty ``bytes`` object.
Arguments:
integer (int): If the argument is a single integer, this creates
a ``bytes`` object of zeros. The argument specifies how many.
iterable (iter): If the argument is a ``bytearray``, ``bytes``
object, or some other iterable of integers, this creates a ``bytes``
object with the same byte sequence as the argument.
string (str): If the argument is a string, this creates a ``bytes``
object containing the encoded string.
encoding (str): Specifies which encoding to use for the ``string``
argument. Only ``"utf-8"`` is supported.
"""
@@ -208,21 +218,39 @@ class bytearray:
def __init__(self, *args):
r"""
bytearray()
bytearray(integer)
bytearray(iterable)
bytearray(string)
Creates a new ``bytearray`` object, which is a sequence of integers
in the range :math:`0 \leq x \leq 255`. This object is *mutable*, which
means that you *can* change its contents after you create it.
* If no argument is given, this creates an empty ``bytearray``.
* If the ``source`` argument is an integer, this creates a ``bytearray``
of zeros. The argument specifies how many zeros.
* For all other valid ``source`` arguments, this creates a bytearray with
the same byte sequence as the given ``source`` argument.
If no argument is given, this creates an empty ``bytearray`` object.
Arguments:
integer (int): If the argument is a single integer, this creates
a ``bytearray`` object of zeros. The argument specifies how many.
iterable (iter): If the argument is a ``bytearray``, ``bytes``
object, or some other iterable of integers, this creates
a ``bytearray`` object with the same byte sequence as the argument.
string (str): If the argument is a string, this creates
a ``bytearray`` object containing the encoded string.
"""
def callable(object: Any) -> _bool:
"""
Returns ``True`` if the object argument appears callable, ``False`` if not.
callable(object) -> bool
Checks if an object is callable.
Arguments:
object: Object to check.
Returns:
``True`` if the object argument appears callable, ``False`` if not.
"""
@@ -306,6 +334,8 @@ class dict:
dict(mapping, **kwargs)
dict(iterable, **kwargs)
Creates a dictionary object.
See the standard
`Python documentation
<https://docs.python.org/3/library/stdtypes.html#mapping-types-dict>`_
@@ -325,8 +355,19 @@ def dir(object: Any) -> List[_str]:
def dir(*args) -> List[_str]:
"""
Without arguments, return the list of names in the current local scope. With
an argument, attempt to return a list of valid attributes for that object.
dir() -> List[str]
dir(object) -> List[str]
Gets a list of attributes of an object.
If no object argument is given, this function gets the list of names in the
current local scope.
Arguments:
object: Object to check for valid attributes.
Returns:
List of object attributes or list of names in current local scope.
"""
@@ -342,8 +383,21 @@ def divmod(a: _float, b: _float) -> Tuple[_float, _float]:
def divmod(a, b):
"""
Takes two (non complex) numbers as arguments and returns a pair of numbers
consisting of their quotient and remainder when using integer division.
divmod(a, b) -> Tuple[int, int]
Gets the quotient and remainder for dividing two integers.
See the standard `Python divmod documentation
<https://docs.python.org/3/library/functions.html#divmod>`_ for
the expected behavior when ``a`` or ``b`` are floating point numbers
instead.
Arguments:
a (int): Numerator.
b (int): Denominator.
Returns:
A tuple with the quotient ``a // b`` and the remainder ``a % b``.
"""
@@ -358,9 +412,11 @@ class enumerate:
def __init__(self, *args) -> None:
"""
Returns an enumerate object.
enumerate(iterable, start=0)
Equivalent to::
Enumerates an existing iterator by adding a numeric index.
This function is equivalent to::
def enumerate(sequence, start=0):
n = start
@@ -387,12 +443,23 @@ def eval(expression: _str, globals: _dict, locals: Mapping) -> Any:
def eval(*args):
"""
The arguments are a string and optional globals and locals. If provided,
``globals`` must be a dictionary. If provided, ``locals`` can be any mapping
object.
eval(expression) -> Any
eval(expression, globals) -> Any
eval(expression, globals, locals) -> Any
The return value is the result of the evaluated expression. Syntax errors
are reported as exceptions.
Evaluates the result of an expression.
Syntax errors are reported as exceptions.
Arguments:
expression (str): Expression to evaluate result of.
globals (dict): If given, this controls what functions are available
for use in the expression. By default the global scope is accessible.
locals (dict): If given, this controls what functions are available
for use in the expression. Defaults to the same as ``globals``.
Returns:
The value obtained by executing the expression.
"""
@@ -413,7 +480,20 @@ def exec(object: Any, globals: _dict, locals: Mapping) -> None:
def exec(*args):
"""
This function supports dynamic execution of Python code.
exec(expression)
exec(expression, globals)
exec(expression, globals, locals)
Executes MicroPython code.
Syntax errors are reported as exceptions.
Arguments:
expression (str): Code to be executed.
globals (dict): If given, this controls what functions are available
for use in the expression. By default the global scope is accessible.
locals (dict): If given, this controls what functions are available
for use in the expression. Defaults to the same as ``globals``.
"""
@@ -456,26 +536,58 @@ def getattr(object: Any, name: _str, default: Any) -> Any:
def getattr(*args):
"""
Returns the value of the named attribute of object.
getattr(object, name) -> Any
getattr(object, name, default) -> Any
Looks up the attribute called ``name`` in the given ``object``.
Arguments:
object: Object in which to look for the attribute.
name (str): Name of the attribute.
default: Object to return if the attribute is not found.
Returns:
Returns the value of the named attribute.
"""
def globals() -> Dict[_str, Any]:
"""
Return a dictionary representing the current global symbol table.
globals() -> dict
Gets a dictionary representing the current global symbol table.
Returns:
The dictionary of globals.
"""
def hasattr(object: Any, name: _str) -> _bool:
"""
The result is ``True`` if the string is the name of one of the objects
attributes, ``False`` if not.
hasattr(object, name) -> bool
Checks if an attribute exists on an object.
Arguments:
object: Object in which to look for the attribute.
name (str): Name of the attribute.
Returns:
``True`` if an attribute by that name exists, ``False`` if not.
"""
def hash(object: Any) -> _int:
"""
Returns the hash value of the object (if it has one).
hash(object) -> int
Gets the hash value of an object, if the object supports it.
Arguments:
object: Object for which to get a hash value.
Returns:
The hash value.
"""
@@ -491,8 +603,16 @@ def help(object: Any) -> None:
def help(*args) -> None:
"""
Prints help for the ``object``. If no argument is given, prints general help.
If object is ``'modules'``, prints available modules.
help()
help(object)
Get information about an object.
If no arguments are given, this function prints instructions to operate the
REPL. If the argument is ``"modules"``, it prints the available modules.
Arguments:
object: Object for which to print help information.
"""
@@ -511,10 +631,18 @@ def hex(x: int) -> _str:
"""
def id() -> _int:
def id(object: Any) -> _int:
"""
Returns the identity of an object. This is an integer which is guaranteed
id(object) -> int
Gets the *identity* of an object. This is an integer which is guaranteed
to be unique and constant for this object during its lifetime.
Arguments:
object: Object of which to get the identifier.
Returns:
The identifier.
"""
@@ -605,26 +733,60 @@ class int:
def isinstance(object: Any, classinfo: Union[_type, Tuple[_type]]) -> _bool:
"""
Returns ``True`` if the ``object`` argument is an instance of the ``classinfo``
argument, or of a subclass thereof.
isinstance(object, classinfo) -> bool
Checks if an object is an instance of a certain class.
Arguments:
object: Object to check the type of.
classinfo (type or tuple): Class information.
Returns:
``True`` if the ``object`` argument is an instance of the ``classinfo``
argument, or of a subclass thereof.
"""
def issubclass(cls: _type, classinfo: Union[_type, Tuple[_type]]) -> _bool:
"""
Returns ``True`` if ``cls`` is a subclass of ``classinfo``.
issubclass(cls, classinfo) -> bool
Checks if one class is a subclass of another class.
Arguments:
cls: Class type.
classinfo (type or tuple): Class information.
Returns:
``True`` if ``cls`` is a subclass of ``classinfo``.
"""
def iter(object: Union[Iterable, Sequence]) -> Iterator:
"""
Returns an iterator object.
iter(object) -> Iterator
Gets the iterator of the object if available.
Arguments:
object: Object for which to get the iterator.
Returns:
The iterator.
"""
def len(s: Sequence) -> _int:
"""
Returns the length (the number of items) of an object.
len(s) -> int
Gets the length (the number of items) of an object.
Arguments:
s (Sequence): The sequence of which to get the length.
Returns:
The length.
"""
@@ -639,20 +801,49 @@ class list:
def __init__(self, *args) -> None:
"""
Creates a new list.
list()
list(iterable)
Creates a new list. If no argument is given, this creates an empty
``list`` object.
A list is *mutable*, which means that you *can* change its contents
after you create it.
Arguments:
iterable (iter): Iterable from which to build the list.
"""
def locals() -> _dict:
"""
Updates and returns a dictionary representing the current local symbol table.
locals() -> dict
Gets a dictionary representing the current local symbol table.
Returns:
The dictionary of locals.
"""
def map(function: Callable, iterable: Iterable, *args: Any) -> Iterator:
"""
Returns an iterator that applies function to every item of iterable,
yielding the results.
map(function, iterable) -> Iterator
map(function, iterable1, iterable2...) -> Iterator
Creates a new iterator that applies the given function to each item in the
given iterable and yields the results.
Arguments:
function (callable): Function that computes a result for one item in the
iterable(s). The number of arguments to this function must match
the number of iterables given.
iterable (iter): One or more source interables from which to draw data.
With multiple iterables, the iterator stops when the shortest
iterable is exhausted.
Returns:
The new, mapped iterator.
"""
@@ -668,7 +859,15 @@ def max(arg1: Any, arg2: Any, *args: Any) -> Any:
def max(*args):
"""
Returns the largest item in an iterable or the largest of two or more arguments.
max(iterable) -> Any
max(arg1, arg2, ....) -> Any
Gets the object with largest value.
The argument may be a single iterable, or any number of objects.
Returns:
The object with the largest value.
"""
@@ -684,32 +883,37 @@ def min(arg1: Any, arg2: Any, *args: Any) -> Any:
def min(*args):
"""
Returns the smallest item in an iterable or the smallest of two or more arguments.
min(iterable) -> Any
min(arg1, arg2, ....) -> Any
Gets the object with smallest value.
The argument may be a single iterable, or any number of objects.
Returns:
The object with the smallest value.
"""
@overload
def next(iterator: Iterator) -> Any:
...
@overload
def next(iterator: Iterator, default: Any) -> Any:
...
def next(*args):
"""
next(iterator) -> Any
Retrieves the next item from the iterator by calling its ``__next__()`` method.
If ``default`` is given, it is returned if the iterator is exhausted,
otherwise ``StopIteration`` is raised.
Arguments:
iterator (iter): Initialized generator object from which to draw the next
value.
Returns:
The next value from the generator.
"""
class object:
def __init__(self) -> None:
"""
Return a new featureless object.
Creates a new, featureless object.
"""
@@ -745,23 +949,20 @@ def ord(c: _str) -> _int:
"""
@overload
def pow(base: _int, exp: _int) -> Union[_int, _float]:
...
@overload
def pow(base: _int, exp: _int, mod: _int) -> Union[_int, _float]:
...
def pow():
def pow(base: Union[_int, _float], exp: Union[_int, _float]) -> Union[_int, _float]:
"""
Returns ``base`` to the power ``exp``; if ``mod`` is present, returns ``base``
to the power ``exp``, modulo ``mod``.
pow(base, exp) -> Number
The two-argument form ``pow(base, exp)`` is equivalent to using the power
operator: ``base ** exp``.
Raises the base to the given exponent: :math:`\\text{base}^{\\mathrm{exp}}`.
This is the same as doing ``base ** exp``.
Arguments:
base (Number): The base.
exp (Number): The exponent.
Returns:
The result.
"""
@@ -784,9 +985,9 @@ def print(*args):
objects: Zero or more objects to print.
Keyword Arguments:
sep: This is printed between objects, if there is more than one.
end: This is printed after the last object.
file: By default, the result is printed in the terminal window. This
sep (str): This is printed between objects, if there is more than one.
end (str): This is printed after the last object.
file (FileIO): By default, the result is printed in the terminal window. This
argument lets you print it to a file instead, if files are
supported.
"""
@@ -807,7 +1008,18 @@ class range:
def __init__(self, *args) -> None:
"""
Rather than being a function, ``range`` is actually an immutable sequence type.
range(stop)
range(start, stop)
range(start, stop, step)
Creates a generator that yields values from ``start`` up to
``stop``, with increments of ``step``.
Arguments:
start (int): Starting value. Defaults to ``0`` if only one argument is given.
stop (int): Endpoint. This value is *not* included.
step (int): Increment between values. Defaults to ``1`` if only one
or two arguments are given.
"""
@@ -826,7 +1038,16 @@ def repr(x: Any) -> _str:
def reversed(seq: Sequence) -> Iterator:
"""
Returns a reverse iterator.
reversed(seq) -> Iterator
Gets an iterator that yields the values from the sequence in the reverse, if
supported.
Arguments:
seq: Sequence from which to draw samples.
Returns:
Iterator that yields values in reverse order, starting with the last value.
"""
@@ -842,42 +1063,38 @@ def round(number: _float, ndigits: _int) -> _float:
def round(*args):
"""
Returns ``number`` rounded to ``ndigits`` precision after the decimal point.
If ``ndigits`` is omitted or is ``None``, it returns the nearest integer to
its input.
round(number) -> int
round(number, ndigits) -> float
.. tip:: To print a number use a format function instead. Since many floating
point numbers don't have exact representations, :meth:`round` often gives
unexpected results!
Round a number to a given number of digits after the decimal point.
Example::
If ``ndigits`` is omitted or ``None``, it returns the nearest integer.
# print two decimal places
print('my number: %.2f' % number)
print('my number: {:.2f}'.format(number))
Rounding with one or more digits after the decimal point will not always
truncate trailing zeros. To print numbers nicely, format strings instead::
# print two decimal places
print('my number: %.2f' % number) print('my number:
{:.2f}'.format(number))
Arguments:
number (float): The number to be rounded.
ndigits (int): The number of digits remaining after the decimal point.
"""
class set:
@overload
def __init__(self) -> None:
...
@overload
def __init__(self, iterable: Iterable) -> None:
...
def __init__(self, *args) -> None:
"""
Returns a new set object, optionally with elements taken from ``iterable``.
"""
def setattr(object: Any, name: _str, value: Any) -> None:
"""
Assigns the value to the attribute, provided the object allows it.
setattr(object, name, value)
Assigns a value to an attribute, provided that the object allows it.
This is the counterpart of :meth:`getattr`.
Arguments:
object: Object in which to store the attribute.
name (str): Name of the attribute.
value: Value to store.
"""
@@ -896,17 +1113,31 @@ class slice:
def __init__(self, *args) -> None:
"""
Returns a slice object representing the set of indices specified by
``range(start, stop, step)``.
slice()
Slice objects are also generated when extended indexing syntax is used.
For example: ``a[start:stop:step]`` or ``a[start:stop, i]``.
Creating instances of this class is not supported.
Use indexing syntax instead. For
example: ``a[start:stop:step]`` or ``a[start:stop, i]``.
"""
def sorted(iterable: Iterable, key=None, reverse=False) -> List:
"""
Returns a new sorted list from the items in ``iterable``.
Sorts objects.
Arguments:
iterable (iter): Objects to be sorted. This can also be a generator that
yield a finite number of objects.
key (callable): Function ``def(item) -> int`` that maps an object to a
numerical value. This is used to figure out the order of the sorted
items.
reverse (bool): Whether to sort in reverse, putting the highest value
first.
Returns:
A new list with the sorted items.
"""
@@ -929,7 +1160,20 @@ class str:
def __init__(self) -> None:
"""
Return a :class:`str` version of object.
str()
str(object)
str(object, encoding)
Gets the string representation of an object.
If no argument is given, this creates an empty ``str`` object.
Arguments:
object: If only this argument is given, this returns the stirng
representation of the object.
encoding (str): If the first argument is a ``bytearray`` or ``bytes``
object and the encoding argument is ``"utf-8"``, this will decode
the byte data to get a string representation.
"""
@@ -945,8 +1189,17 @@ def sum(iterable: Iterable, start: _int) -> _int:
def sum(*args):
"""
Sums ``start`` and the items of an ``iterable`` from left to right and
returns the total.
sum(iterable) -> Number
sum(iterable, start) -> Number
Sums the items from the iterable and the start value.
Arguments:
iterable (iter): Values to be summed, starting with the first value.
start (Number): Value added to the total.
Returns:
The total sum.
"""
@@ -967,8 +1220,15 @@ def super(type: _type, object_or_type: Any) -> _type:
def super(*args):
"""
Returns am object that delegates method calls to a parent or sibling class
of ``type``.
super() -> type
super(type) -> type
super(type, object_or_type) -> type
Gets an object that delegates method calls to a parent, or a sibling class
of the given type.
Returns:
The matching `super()` object.
"""
@@ -983,31 +1243,46 @@ class tuple:
def __init__(self, *args) -> None:
"""
Rather than being a function, :class:`tuple` is actually an immutable
sequence type.
tuple()
tuple(iterable)
Creates a new tuple. If no argument is given, this creates an empty
``tuple`` object.
A tuple is *immutable*, which means that you *cannot* change its
contents after you create it.
Arguments:
iterable (iter): Iterable from which to build the tuple.
"""
class type:
def __init__(self, object: Any) -> None:
"""
With one argument, returns the type of an ``object``.
"""type(object)
Gets the type of an object. This can be used to check if an object
is an instance of a particular class.
Arguments:
object: Object of which to check the type.
"""
def zip(*iterables: Iterable) -> Iterable[Tuple]:
"""
Returns an iterator of tuples, where the i-th tuple contains the i-th
zip(iter_a, iter_b, ...) -> Iterable[Tuple]
Returns an iterator of tuples, where the *i*-th tuple contains the *i*-th
element from each of the argument sequences or iterables. The iterator
stops when the shortest input iterable is exhausted.
With a single iterable argument, it returns an iterator of 1-tuples.
With no arguments, it returns an empty iterator.
Equivalent to::
This functionality is equivalent to::
def zip(*iterables):
# zip('ABCD', 'xy') --> Ax By
sentinel = object()
iterators = [iter(it) for it in iterables]
while iterators:
@@ -1018,6 +1293,16 @@ def zip(*iterables: Iterable) -> Iterable[Tuple]:
return
result.append(elem)
yield tuple(result)
Arguments:
iter_a (iter): The first iterable. This provides the first value for
each of the yielded tuples.
iter_b (iter): The second iterable. This provides the second value in
each of the yielded tuples. And so on.
Returns:
A new iterator that yields tuples containing the values of the
individual iterables.
"""
@@ -1114,7 +1399,7 @@ class KeyError(LookupError):
class KeyboardInterrupt(BaseException):
"""
Raised when the user hits the interrupt key (normally :kbd:`Control-C`).
Raised when the user hits the interrupt key (normally :kbd:`Ctrl` :kbd:`C`).
"""
+41 -15
View File
@@ -1,21 +1,20 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 The Pybricks Authors
# Copyright (c) 2022 The Pybricks Authors
#
# Portions of documentation copied from:
# https://raw.githubusercontent.com/micropython/micropython/1e6d18c915ccea0b6a19ffec9710d33dd7e5f866/docs/library/uio.rst
# Copyright (c) 2014-2021, Damien P. George, Paul Sokolovsky, and contributors
"""
This module contains additional types of ``stream`` (file-like) objects
and helper functions.
This module contains ``stream`` objects that behave like files.
"""
# TODO: open() is not implemented on Powered Up hubs
from typing import overload
from typing import overload, Union
# TODO: MicroPython streams implement '__enter__', '__exit__', 'close', 'read',
# 'readinto', 'readline', 'write', 'flush', 'getvalue', 'seek', 'tell'
# 'readinto', 'readline', 'write', 'flush', 'seek', 'tell'
# and are iterable
@@ -25,7 +24,7 @@ class BytesIO:
...
@overload
def __init__(self, initial_bytes: bytes) -> None:
def __init__(self, data: Union[bytes, bytearray]) -> None:
...
@overload
@@ -34,11 +33,25 @@ class BytesIO:
def __init__(self, *args) -> None:
"""
BytesIO()
BytesIO(data)
BytesIO(alloc_size)
A binary stream using an in-memory bytes buffer.
Args:
initial_bytes: Optional bytes-like object that contains initial data.
alloc_size: Optional number of preallocated bytes.
Arguments:
data (bytes or bytearray): Optional bytes-like object
that contains initial data.
alloc_size (int): Optional number of preallocated bytes. This
parameter is unique to MicroPython. It is not recommended to
use it in end-user code.
"""
def getvalue(self) -> bytes:
"""
getvalue() -> bytes
Gets the contents of the underlying buffer.
"""
@@ -48,7 +61,7 @@ class StringIO:
...
@overload
def __init__(self, initial_value: str) -> None:
def __init__(self, string: str) -> None:
...
@overload
@@ -57,16 +70,29 @@ class StringIO:
def __init__(self, *args) -> None:
"""
A binary stream using an in-memory string buffer.
StringIO()
StringIO(string)
StringIO(alloc_size)
Args:
initial_value: Optional string object that contains initial data.
alloc_size: Optional number of preallocated bytes.
A stream using an in-memory string buffer.
Arguments:
string (str): Optional string with initial data.
alloc_size (int): Optional number of preallocated bytes. This
parameter is unique to MicroPython. It is not recommended to
use it in end-user code.
"""
def getvalue(self) -> str:
"""
getvalue() -> str
Gets the contents of the underlying buffer.
"""
class FileIO:
"""
This is type of a file open in binary mode, e.g. using ``open(name, 'rb')``.
This type represents a file opened in binary mode with ``open(name, 'rb')``.
You should not instantiate this class directly.
"""
+77
View File
@@ -0,0 +1,77 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2022 The Pybricks Authors
#
# Documentation adapted from:
# https://raw.githubusercontent.com/micropython/micropython/master/docs/library/json.rst
# Copyright (c) 2014-2021, Damien P. George, Paul Sokolovsky, and contributors
"""
Convert between Python objects and the JSON data format.
"""
from typing import IO, Any, Tuple
def dump(object: Any, stream: IO, separators: Tuple[str, str] = (", ", ": ")):
"""
dump(object, stream, separators=(", ", ": "))
Serializes an object to a JSON string and write it to a stream.
Arguments:
obj: Object to serialize.
stream: Stream to write the output to.
separators (tuple): An ``(item_separator, key_separator)`` tuple to
specify how elements should be separated.
"""
def dumps(object: Any, separators: Tuple[str, str] = (", ", ": ")) -> str:
"""
dumps(object, separators=(", ", ": "))
Serializes an object to JSON and return it as a string
Arguments:
obj: Object to serialize.
separators (tuple): An ``(item_separator, key_separator)`` tuple to
specify how elements should be separated.
Return:
The JSON string.
"""
def load(stream: IO) -> Any:
"""
load(stream)
Parses the stream to interpret and deserialize the JSON data to a
MicroPython object.
Parsing continues until end-of-file is encountered. A ``ValueError`` is
raised if the data in stream is not correctly formed.
Arguments:
stream: Stream from which to read the JSON string.
Returns:
The deserialized MicroPython object.
"""
def loads(string) -> Any:
"""
loads(string)
Parses the string to interpret and deserialize the JSON data to a
MicroPython object.
A ``ValueError`` is raised if the string is not correctly formed.
Arguments:
string (str): JSON string to decode.
Returns:
The deserialized MicroPython object.
"""
+67 -38
View File
@@ -9,17 +9,8 @@
"""
This module implements pseudo-random number generators.
.. note:: This module is not available on the BOOST Move Hub.
You can make your own random number generator like this instead::
_rand = hub.battery.voltage() + hub.battery.current() # seed
# Return a random integer N such that a <= N <= b.
def randint(a, b):
global _rand
_rand = 75 * _rand % 65537 # Lehmer
return _rand * (b - a + 1) // 65537 + a
All functions in this module should be used with positional arguments. Keyword
arguments are not supported.
"""
from typing import Any, Optional, Sequence, overload
@@ -27,19 +18,18 @@ from typing import Any, Optional, Sequence, overload
def seed(a: Optional[int] = None) -> None:
"""
Initialize the random number generator.
seed(value=None)
Args:
a: Optional seed value. If ``None``, the system timer will be used.
Initializes the random number generator.
.. tip:: This is called when the module is imported, so normally you do
not need to call this.
This gets called when the module is imported, so normally you do
not need to call this.
Arguments:
value: Seed value. When using ``None``, the system timer will be used.
"""
# integers
@overload
def randrange(stop: int) -> int:
...
@@ -57,53 +47,92 @@ def randrange(start: int, stop: int, step: int) -> int:
def randrange(start, stop, step):
"""
randrange(stop) -> int
randrange(start, stop) -> int
randrange(start, stop, step) -> int
Returns a randomly selected element from ``range(start, stop, step)``.
For example, ``randrange(1, 7, 2)`` returns random numbers from ``1`` up to
(but excluding) ``7``, in increments of ``2``. In other words, it
returns ``1``, ``3``, or ``5``.
Arguments:
start (int): Lowest value. Defaults to ``0`` if only one argument is given.
stop (int): Highest value. This value is *not* included in the range.
step (int): Increment between values. Defaults to ``1`` if only one
or two arguments are given.
Returns:
The random number.
"""
def randint(a: int, b: int) -> int:
"""
Returns a random integer *N* such that ``a`` <= *N* <= ``b``.
randint(a, b) -> int
Gets a random integer :math:`N` satisfying :math:`a \\leq N \\leq b`.
Arguments:
a (int): Lowest value. This value *is* included in the range.
b (int): Highest value. This value *is* included in the range.
Returns:
The random integer.
"""
def getrandbits(k: int) -> int:
"""
Returns a non-negative integer with ``k`` random bits.
getrandbits(k) -> int
Gets a random integer :math:`N` satisfying :math:`0 \\leq N < 2^{\\text{bits}}`.
Arguments:
k (int): How many bits to use for the result.
"""
# sequences
def choice(seq: Sequence[Any]) -> Any:
"""
Returns a random element from the non-empty sequence ``seq``.
choice(sequence) -> Any
If ``seq`` is empty, raises ``IndexError``.
Gets a random element from a sequence such as a tuple or list.
Arguments:
sequence: Sequence from which to select a random element.
Returns:
The randomly selected element.
Raises:
``IndexError``: If the sequence is empty.
"""
# real
def random() -> float:
"""
Return the next random floating point number in the range [0.0, 1.0).
random() -> float
.. tip:: The `interval notation`_ indicates that this includes 0.0 and
excludes 1.0.
Gets a random value :math:`x` satisfying :math:`0 \\leq x < 1`.
.. _interval notation:
https://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals
Returns:
The random value.
"""
def uniform(a: float, b: float) -> float:
"""
Returns a random floating point number *N* such that ``a`` <= *N* <= ``b``
for ``a`` <= ``b`` and ``b`` <= *N* <= ``a`` for ``b`` < ``a``.
uniform(a, b) -> float
The end-point value ``b`` may or may not be included in the range depending
on floating-point rounding in the equation ``a + (b-a) * random()``.
Gets a random floating point value :math:`x` satisfying :math:`a \\leq x \\leq b`.
Arguments:
a (float): Lowest value.
b (float): Highest value.
Returns:
The random value.
"""
+73 -59
View File
@@ -7,8 +7,6 @@
"""
This module provides functions to efficiently wait for events on multiple streams.
.. note:: This module is not available on the BOOST Move hub.
"""
from typing import IO, Iterator, List, Tuple, overload
@@ -25,61 +23,58 @@ More data can be written.
POLLERR: int
"""
Error condition happened on the associated stream.
Error condition happened on the associated stream. Should be handled explicitly
or else further invocations of :meth:`poll` may return right away.
"""
POLLHUP: int
"""
Hang up happened on the associated stream.
Hang up happened on the associated stream. Should be handled explicitly
or else further invocations of :meth:`poll` may return right away.
"""
def poll() -> "Poll":
"""
Creates an instance of the Poll class.
"""
# skipping def select(...)
class Poll:
@overload
def register(self, obj: IO) -> None:
...
@overload
def register(self, obj: IO, eventmask: int) -> None:
...
def register(self, obj: IO, eventmask: int) -> None:
def register(self, object: IO, eventmask: int) -> None:
"""
Register `stream` ``obj`` for polling. ``eventmask`` is logical OR of:
register(object, eventmask=POLLOUT | POLLOUT)
* :data:`POLLIN`
* :data:`POLLOUT`
Register a stream object for polling. The stream object will now be
monitored for events. If an event happens, it becomes part of the
return value of :meth:`poll`.
Note that flags like :data:`POLLHUP` and :data:`POLLERR` are
*not* valid as input eventmask (these are unsolicited events which
will be returned from :meth:`poll` regardless of whether they are asked
for). This semantics is per POSIX.
If this method is called again for the same stream object, the object
will not be registered again, but the ``eventmask`` flags will be
updated, as if calling :meth:`modify()`.
``eventmask`` defaults to ``POLLIN | POLLOUT``.
It is OK to call this function multiple times for the same ``obj``.
Successive calls will update ``obj``'s eventmask to the value of
``eventmask`` (i.e. will behave as :meth:`modify()`).
Arguments:
object (FileIO): Stream to be registered for polling.
eventmask (int): Which events to use. Should be ``POLLIN``,
``POLLOUT``, or their logical disjunction: ``POLLIN | POLLOUT``.
"""
def unregister(self, obj: IO) -> None:
def unregister(self, object: IO) -> None:
"""
Unregister ``obj`` from polling.
unregister(poll)
Unregister an object from polling.
Arguments:
object (FileIO): Stream to be unregistered from polling.
"""
def modify(self, obj: IO, eventmask: int) -> None:
"""
Modify the ``eventmask`` for ``obj``. If ``obj`` is not registered, ``OSError``
is raised with error of ``ENOENT``.
modify(object, eventmask)
Modifies the event mask for the stream object.
Arguments:
object (FileIO): Stream to be registered for polling.
eventmask (int): Which events to use.
Raises:
``OSError``: If the object is not registered. The error is ``ENOENT``.
"""
@overload
@@ -92,21 +87,21 @@ class Poll:
def poll(self, timeout: int = -1, /) -> List[Tuple[IO, int]]:
"""
Wait for at least one of the registered objects to become ready or have an
exceptional condition, with optional timeout in milliseconds (if ``timeout``
arg is not specified or -1, there is no timeout).
poll(timeout=-1) -> List[Tuple[FileIO, int]]
Returns list of (``obj``, ``event``, ...) tuples. There may be other elements in
tuple, depending on a platform and version, so don't assume that its size is 2.
The ``event`` element specifies which events happened with a stream and
is a combination of ``POLL*`` constants described above. Note that
flags :data:`POLLHUP` and :data:`POLLERR` can be returned at any time
(even if were not asked for), and must be acted on accordingly (the
corresponding stream unregistered from poll and likely closed), because
otherwise all further invocations of :meth:`poll` may return immediately with
these flags set for this stream again.
Wait until at least one of the registered objects has a new event or
exceptional condition ready to be handled.
In case of timeout, an empty list is returned.
Arguments:
timeout (int): Timeout in milliseconds. Choose ``0`` to return
immediately or choose ``-1`` to wait indefinitely.
Returns:
A list of tuples. There is one (``object``, ``eventmask``, ...)
tuple for each object with an event, or no tuples if there are no
events to be handled. The ``eventmask`` value
is a combination of poll flags to indicate what happened. This may
include ``POLLERR`` and ``POLLHUP`` even if they were not registered.
"""
@overload
@@ -123,13 +118,32 @@ class Poll:
def ipoll(self, timeout: int = -1, flags: int = 0, /) -> Iterator[Tuple[IO, int]]:
"""
Like :meth:`poll`, but instead returns an iterator which yields a
`callee-owned tuple`. This function provides an efficient, allocation-free
way to poll on streams.
ipoll(timeout=-1, flags=1) -> Iterator[Tuple[FileIO, int]]
If ``flags`` is 1, one-shot behavior for events is employed: streams for
which events happened will have their event masks automatically reset
(equivalent to ``poll.modify(obj, 0)``), so new events for such a stream
won't be processed until new mask is set with :meth:`modify`. This
behavior is useful for asynchronous I/O schedulers.
First, just like :meth:`poll`, wait until at least one of the registered
objects has a new event or exceptional condition ready to be handled.
But instead of a list, this method returns an iterator for improved
efficiency. The iterator yields one (``object``, ``eventmask``, ...)
tuple at a time, and overwrites it when yielding the next value. If you
need the values later, make sure to copy them explicitly.
Arguments:
timeout (int): Timeout in milliseconds. Choose ``0`` to return
immediately or choose ``-1`` to wait indefinitely.
flags (int): If set to ``1``, one-shot behavior for events is
employed. This means that streams for which events happened
will have their event masks automatically reset using
``poll.modify(obj, 0)``. This way, new events for such a stream
won't be processed until a new mask is set with :meth:`modify`,
which is useful for asynchronous I/O schedulers.
"""
def poll() -> Poll:
"""
Creates an instance of the :class:`Poll` class.
Returns:
The :class:`Poll` instance.
"""

Some files were not shown because too many files have changed in this diff Show More