Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5535da5b38 | ||
|
|
ab4d4cc848 | ||
|
|
82340c3eec | ||
|
|
14a4fc0d74 | ||
|
|
99d5210313 | ||
|
|
e6d2ce7f62 | ||
|
|
c3802d38c2 | ||
|
|
ac23a9bb59 | ||
|
|
631cf31a07 | ||
|
|
115ae0d856 | ||
|
|
eec6d2ff85 | ||
|
|
4d360d2b01 | ||
|
|
52cb0fe81e | ||
|
|
961cebe48b | ||
|
|
87c2802b17 | ||
|
|
3c0aaea207 | ||
|
|
553490874b | ||
|
|
31d3872405 | ||
|
|
6f55e90365 | ||
|
|
76f129f6d1 | ||
|
|
d4d7971a56 | ||
|
|
64b0489a73 | ||
|
|
87ed7353b4 | ||
|
|
aca23197a1 | ||
|
|
69a2a2b8a2 | ||
|
|
f5d9a4f1c6 | ||
|
|
71ce165a46 | ||
|
|
56ab509630 | ||
|
|
9608a16d95 | ||
|
|
9b314777e0 | ||
|
|
1ae0a9005f | ||
|
|
1d5956a58a | ||
|
|
73c4a449ab | ||
|
|
aeeed159d7 | ||
|
|
104fd7d70f | ||
|
|
e9e5f48756 | ||
|
|
8260d71cd7 | ||
|
|
ac43f8a29f | ||
|
|
f6f87fec95 | ||
|
|
d1081229b3 | ||
|
|
8a73e916e7 | ||
|
|
17c45c3245 | ||
|
|
0ecf1cabde | ||
|
|
ba8d9806f7 | ||
|
|
99b289aa58 | ||
|
|
334b91f128 | ||
|
|
f7380b8bb0 | ||
|
|
6ad229c7c0 | ||
|
|
94dfbbf7c1 | ||
|
|
88b2502eb3 | ||
|
|
cd2e53f70b | ||
|
|
e009ff2cbc | ||
|
|
4816b58914 | ||
|
|
875a433182 | ||
|
|
dc8d029e96 | ||
|
|
af80c4770e | ||
|
|
ddcdc6f745 | ||
|
|
81ac996deb | ||
|
|
84d1d7bf3b | ||
|
|
9578fc1035 | ||
|
|
25f427d8bf | ||
|
|
725b6d672c | ||
|
|
4bc53b17f4 | ||
|
|
666f2a6b52 | ||
|
|
cbf6eb9578 | ||
|
|
7dd3edaee4 | ||
|
|
ef57dbf4a1 | ||
|
|
3a60d40bac | ||
|
|
cb0dee3e99 | ||
|
|
19673da32e | ||
|
|
b8b5652cb6 | ||
|
|
7b4953bc5f | ||
|
|
62f6fc85a5 | ||
|
|
d2b1b2183b | ||
|
|
a236609ebf | ||
|
|
6c893c136e | ||
|
|
f4212f232e | ||
|
|
3a805b0ca9 | ||
|
|
c52627cc8f | ||
|
|
b84fed1de9 | ||
|
|
d49bc548c7 | ||
|
|
492d6cd2d4 | ||
|
|
be3558167e | ||
|
|
4573fd2760 | ||
|
|
2a23c2e81d |
@@ -0,0 +1,23 @@
|
||||
name: Release @pybricks/images
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '@pybricks/images/**'
|
||||
|
||||
jobs:
|
||||
publish_ide_docs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# Setup .npmrc file to publish to npm
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: ./build.py
|
||||
working-directory: npm/images
|
||||
- run: yarn publish
|
||||
working-directory: npm/images/build
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||
@@ -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,
|
||||
|
||||
@@ -4,6 +4,26 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 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
|
||||
- Fixed Jedi code completion for `Color` and `Icon` classes in `pybricks.parameters`.
|
||||
|
||||
## 3.2.0b4 - 2022-10-21
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2021 The Pybricks Authors
|
||||
Copyright (c) 2018-2022 The Pybricks Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -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",
|
||||
@@ -24,8 +25,8 @@ HUB_FEATURES = {
|
||||
"movehub": {"movehub"} | FEATURES_SMALL,
|
||||
"cityhub": {"cityhub"} | FEATURES_MEDIUM,
|
||||
"technichub": {"technichub"} | FEATURES_MEDIUM,
|
||||
"primehub": {"primehub", "inventorhub"} | FEATURES_LARGE,
|
||||
"inventorhub": {"primehub", "inventorhub"} | FEATURES_LARGE,
|
||||
"primehub": {"primehub", "inventorhub", "light-matrix"} | FEATURES_LARGE,
|
||||
"inventorhub": {"primehub", "inventorhub", "light-matrix"} | FEATURES_LARGE,
|
||||
"essentialhub": {"essentialhub"} | FEATURES_LARGE,
|
||||
}
|
||||
|
||||
@@ -58,7 +59,7 @@ class PybricksRequirementsStaticDirective(Directive):
|
||||
# Cell with image of a hub.
|
||||
hub_cell = """
|
||||
<th><div class="align-default">
|
||||
<img alt="" src="{0}_images/compat_{1}_{2}_label.png">
|
||||
<img alt="" src="{0}_images/compat_{1}_{2}.png">
|
||||
</div></th>
|
||||
"""
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 80 KiB |
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="525"
|
||||
height="525"
|
||||
viewBox="0 0 525 525"
|
||||
sodipodi:docname="icon_cityhub.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
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/">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<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>
|
||||
<defs
|
||||
id="defs6">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath860">
|
||||
<rect
|
||||
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect862"
|
||||
width="589.10107"
|
||||
height="96.333336"
|
||||
x="235.33333"
|
||||
y="-236.00002" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath1040">
|
||||
<rect
|
||||
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1042"
|
||||
width="128.5101"
|
||||
height="19.934668"
|
||||
x="827.15656"
|
||||
y="74.666672" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#fcfcfc"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1856"
|
||||
inkscape:window-height="1136"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.9950413"
|
||||
inkscape:cx="301.49502"
|
||||
inkscape:cy="344.20682"
|
||||
inkscape:window-x="64"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<image
|
||||
width="349"
|
||||
height="400"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="../cad/output/hub-city.png"
|
||||
id="image834"
|
||||
x="90"
|
||||
y="55" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="525"
|
||||
height="525"
|
||||
viewBox="0 0 525 525"
|
||||
sodipodi:docname="icon_essentialhub.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
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/">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<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>
|
||||
<defs
|
||||
id="defs6">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath860">
|
||||
<rect
|
||||
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect862"
|
||||
width="589.10107"
|
||||
height="96.333336"
|
||||
x="235.33333"
|
||||
y="-236.00002" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath1040">
|
||||
<rect
|
||||
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1042"
|
||||
width="128.5101"
|
||||
height="19.934668"
|
||||
x="827.15656"
|
||||
y="74.666672" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#fcfcfc"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1856"
|
||||
inkscape:window-height="1136"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.9950413"
|
||||
inkscape:cx="301.49502"
|
||||
inkscape:cy="344.20682"
|
||||
inkscape:window-x="64"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<image
|
||||
width="379"
|
||||
height="338"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="../cad/output/hub-essential.png"
|
||||
id="image1283"
|
||||
x="80"
|
||||
y="80" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="525"
|
||||
height="525"
|
||||
viewBox="0 0 525 525"
|
||||
sodipodi:docname="icon_inventorhub.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
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/">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<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>
|
||||
<defs
|
||||
id="defs6">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath860">
|
||||
<rect
|
||||
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect862"
|
||||
width="589.10107"
|
||||
height="96.333336"
|
||||
x="235.33333"
|
||||
y="-236.00002" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath1040">
|
||||
<rect
|
||||
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1042"
|
||||
width="128.5101"
|
||||
height="19.934668"
|
||||
x="827.15656"
|
||||
y="74.666672" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#fcfcfc"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1856"
|
||||
inkscape:window-height="1136"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.9950413"
|
||||
inkscape:cx="301.49502"
|
||||
inkscape:cy="344.20682"
|
||||
inkscape:window-x="64"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<image
|
||||
width="513"
|
||||
height="465"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="../cad/output/hub-inventor.png"
|
||||
id="image1430"
|
||||
x="7"
|
||||
y="21" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="525"
|
||||
height="525"
|
||||
viewBox="0 0 525 525"
|
||||
sodipodi:docname="icon_movehub.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
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/">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<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>
|
||||
<defs
|
||||
id="defs6">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath860">
|
||||
<rect
|
||||
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect862"
|
||||
width="589.10107"
|
||||
height="96.333336"
|
||||
x="235.33333"
|
||||
y="-236.00002" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath1040">
|
||||
<rect
|
||||
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1042"
|
||||
width="128.5101"
|
||||
height="19.934668"
|
||||
x="827.15656"
|
||||
y="74.666672" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#fcfcfc"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1856"
|
||||
inkscape:window-height="1136"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.9950413"
|
||||
inkscape:cx="301.49502"
|
||||
inkscape:cy="344.20682"
|
||||
inkscape:window-x="64"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<image
|
||||
width="525"
|
||||
height="475.44"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="../cad/output/hub-move.png"
|
||||
id="image1015"
|
||||
x="0"
|
||||
y="18"
|
||||
style="stroke-width:1.19048" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="525"
|
||||
height="525"
|
||||
viewBox="0 0 525 525"
|
||||
sodipodi:docname="icon_primehub.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
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/">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<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>
|
||||
<defs
|
||||
id="defs6">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath860">
|
||||
<rect
|
||||
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect862"
|
||||
width="589.10107"
|
||||
height="96.333336"
|
||||
x="235.33333"
|
||||
y="-236.00002" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath1040">
|
||||
<rect
|
||||
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1042"
|
||||
width="128.5101"
|
||||
height="19.934668"
|
||||
x="827.15656"
|
||||
y="74.666672" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#fcfcfc"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1856"
|
||||
inkscape:window-height="1136"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.9950413"
|
||||
inkscape:cx="301.49502"
|
||||
inkscape:cy="344.20682"
|
||||
inkscape:window-x="64"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<image
|
||||
width="513"
|
||||
height="465"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="../cad/output/hub-prime.png"
|
||||
id="image1329"
|
||||
x="7"
|
||||
y="21" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="525"
|
||||
height="525"
|
||||
viewBox="0 0 525 525"
|
||||
sodipodi:docname="icon_technichub.svg"
|
||||
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
|
||||
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/">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<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>
|
||||
<defs
|
||||
id="defs6">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath860">
|
||||
<rect
|
||||
style="fill:#6ab0de;fill-opacity:1;stroke:#6ab0de;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect862"
|
||||
width="589.10107"
|
||||
height="96.333336"
|
||||
x="235.33333"
|
||||
y="-236.00002" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath1040">
|
||||
<rect
|
||||
style="fill:#1e1e1e;fill-opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect1042"
|
||||
width="128.5101"
|
||||
height="19.934668"
|
||||
x="827.15656"
|
||||
y="74.666672" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#fcfcfc"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1856"
|
||||
inkscape:window-height="1136"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.9950413"
|
||||
inkscape:cx="301.49502"
|
||||
inkscape:cy="344.20682"
|
||||
inkscape:window-x="64"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2"
|
||||
inkscape:snap-global="false"
|
||||
inkscape:pagecheckerboard="0" />
|
||||
<image
|
||||
width="525"
|
||||
height="447.47662"
|
||||
preserveAspectRatio="none"
|
||||
xlink:href="../cad/output/hub-technic.png"
|
||||
id="image985"
|
||||
x="0"
|
||||
y="35.996998"
|
||||
style="stroke-width:1.01905" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -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
|
||||
^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -67,6 +67,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,7 +45,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 +106,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
|
||||
@@ -177,13 +179,15 @@ Changing the display orientation
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_orientation_imu.py
|
||||
|
||||
.. _make_icons:
|
||||
|
||||
Making your own images
|
||||
**********************
|
||||
|
||||
.. literalinclude::
|
||||
../../../examples/pup/hub_primehub/display_matrix.py
|
||||
|
||||
Combining images to make expressions
|
||||
Combining icons to make expressions
|
||||
************************************
|
||||
|
||||
.. literalinclude::
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -79,7 +79,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
|
||||
|
||||
@@ -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
|
||||
---------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.. pybricks-requirements:: light-matrix
|
||||
|
||||
Icon
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. autoclass:: pybricks.parameters.Icon
|
||||
|
||||
See the :ref:`make_icons` section for examples.
|
||||
@@ -13,6 +13,7 @@
|
||||
button
|
||||
color
|
||||
direction
|
||||
icon
|
||||
port
|
||||
side
|
||||
stop
|
||||
@@ -23,6 +24,8 @@
|
||||
|
||||
.. pybricks-classlink:: Direction
|
||||
|
||||
.. pybricks-classlink:: Icon
|
||||
|
||||
.. pybricks-classlink:: Port
|
||||
|
||||
.. pybricks-classlink:: Side
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
-----------------------
|
||||
|
||||
@@ -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,8 @@
|
||||
|
||||
.. automethod:: pybricks.robotics.DriveBase.reset
|
||||
|
||||
.. automethod:: pybricks.robotics.DriveBase.stalled
|
||||
|
||||
.. rubric:: Measuring and validating the robot dimensions
|
||||
|
||||
As a first estimate, you can measure the ``wheel_diameter`` and the
|
||||
@@ -80,15 +84,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
|
||||
|
||||
@@ -104,3 +104,16 @@
|
||||
|
||||
.. autoattribute:: pybricks.robotics.DriveBase.heading_control
|
||||
:annotation:
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
|
||||
The :meth:`done` and :meth:`stalled` methods have been moved.
|
||||
|
||||
Examples
|
||||
-------------------
|
||||
|
||||
Driving straight and turning in place
|
||||
**********************************************
|
||||
|
||||
.. literalinclude::
|
||||
../../examples/pup/robotics/drivebase_basics.py
|
||||
|
||||
@@ -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))
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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!")
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
from pybricks.pupdevices import Motor
|
||||
from pybricks.parameters import Port, Direction
|
||||
from pybricks.robotics import DriveBase
|
||||
|
||||
# Initialize both motors. In this example, the motor on the
|
||||
# left must turn counterclockwise to make the robot go forward.
|
||||
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
|
||||
right_motor = Motor(Port.B)
|
||||
|
||||
# Initialize the drive base. In this example, the wheel diameter is 56mm.
|
||||
# The distance between the two wheel-ground contact points is 112mm.
|
||||
drive_base = DriveBase(left_motor, right_motor, wheel_diameter=56, axle_track=112)
|
||||
|
||||
# Drive forward by 500mm (half a meter).
|
||||
drive_base.straight(500)
|
||||
|
||||
# Turn around clockwise (180 degrees)
|
||||
drive_base.turn(180)
|
||||
|
||||
# Drive forward again to drive back.
|
||||
drive_base.straight(500)
|
||||
|
||||
# Turn around counterclockwise.
|
||||
drive_base.turn(-180)
|
||||
@@ -4,6 +4,14 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.3.0 - 2022-11-11
|
||||
|
||||
### Changed
|
||||
- Updated `pybricks` package to v3.2.0b5.
|
||||
|
||||
### Fixed
|
||||
- Fixed code completion for `Color` and `Icon` classes in `pybricks.parameters`.
|
||||
|
||||
## 1.2.0 - 2022-10-21
|
||||
|
||||
### Added
|
||||
|
||||
@@ -185,7 +185,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[[package]]
|
||||
name = "pybricks"
|
||||
version = "3.2.0b4"
|
||||
version = "3.2.0b5"
|
||||
description = "Documentation and user-API stubs for Pybricks MicroPython"
|
||||
category = "main"
|
||||
optional = false
|
||||
@@ -263,7 +263,7 @@ python-versions = ">=3.7"
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = ">= 3.10, < 3.11"
|
||||
content-hash = "f3cd92de360fc68d8bc8ad0999eb5d0591e7f33dc5f20a32409b3787cac71965"
|
||||
content-hash = "4f27a31e5659d2900dfa700d0e7a87ec6a2b4557af49f21102fbbc78054371c2"
|
||||
|
||||
[metadata.files]
|
||||
atomicwrites = [
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks_jedi"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
description = "Code completion for Pybricks."
|
||||
authors = ["The Pybricks Authors"]
|
||||
license = "MIT"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">= 3.10, < 3.11"
|
||||
pybricks = "3.2.0b4"
|
||||
pybricks = "3.2.0b5"
|
||||
jedi = "0.18.1"
|
||||
typing-extensions = "4.2.0"
|
||||
docstring-parser = "0.14.1"
|
||||
|
||||
@@ -149,6 +149,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",
|
||||
@@ -236,8 +238,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",
|
||||
@@ -249,7 +251,10 @@ 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",
|
||||
]
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from pybricks_jedi import CompletionItem, complete
|
||||
|
||||
|
||||
def _create_snippet(class_name: str) -> str:
|
||||
"""
|
||||
Creates a code snippet::
|
||||
|
||||
from pybricks.parameters import {class_name}
|
||||
{class_name}.
|
||||
|
||||
Args:
|
||||
line: The value substituted for ``{class_name}``
|
||||
"""
|
||||
return "\n".join(
|
||||
(f"from pybricks.parameters import {class_name}", f"{class_name}.")
|
||||
)
|
||||
|
||||
|
||||
ENUMS = [
|
||||
pytest.param(
|
||||
"Button",
|
||||
[
|
||||
"BEACON",
|
||||
"BLUETOOTH",
|
||||
"CENTER",
|
||||
"DOWN",
|
||||
"LEFT",
|
||||
"LEFT_DOWN",
|
||||
"LEFT_MINUS",
|
||||
"LEFT_PLUS",
|
||||
"LEFT_UP",
|
||||
"RIGHT",
|
||||
"RIGHT_DOWN",
|
||||
"RIGHT_MINUS",
|
||||
"RIGHT_PLUS",
|
||||
"RIGHT_UP",
|
||||
"UP",
|
||||
],
|
||||
),
|
||||
pytest.param(
|
||||
"Color",
|
||||
[
|
||||
"BLACK",
|
||||
"BLUE",
|
||||
"BROWN",
|
||||
"CYAN",
|
||||
"GRAY",
|
||||
"GREEN",
|
||||
"MAGENTA",
|
||||
"NONE",
|
||||
"ORANGE",
|
||||
"RED",
|
||||
"VIOLET",
|
||||
"WHITE",
|
||||
"YELLOW",
|
||||
],
|
||||
),
|
||||
pytest.param("Direction", ["CLOCKWISE", "COUNTERCLOCKWISE"]),
|
||||
pytest.param(
|
||||
"Icon",
|
||||
[
|
||||
"ARROW_DOWN",
|
||||
"ARROW_LEFT",
|
||||
"ARROW_LEFT_DOWN",
|
||||
"ARROW_LEFT_UP",
|
||||
"ARROW_RIGHT",
|
||||
"ARROW_RIGHT_DOWN",
|
||||
"ARROW_RIGHT_UP",
|
||||
"ARROW_UP",
|
||||
"CIRCLE",
|
||||
"CLOCKWISE",
|
||||
"COUNTERCLOCKWISE",
|
||||
"DOWN",
|
||||
"EMPTY",
|
||||
"EYE_LEFT",
|
||||
"EYE_LEFT_BLINK",
|
||||
"EYE_LEFT_BROW",
|
||||
"EYE_LEFT_BROW_UP",
|
||||
"EYE_RIGHT",
|
||||
"EYE_RIGHT_BLINK",
|
||||
"EYE_RIGHT_BROW",
|
||||
"EYE_RIGHT_BROW_UP",
|
||||
"FALSE",
|
||||
"FULL",
|
||||
"HAPPY",
|
||||
"HEART",
|
||||
"LEFT",
|
||||
"PAUSE",
|
||||
"RIGHT",
|
||||
"SAD",
|
||||
"SQUARE",
|
||||
"TRIANGLE_DOWN",
|
||||
"TRIANGLE_LEFT",
|
||||
"TRIANGLE_RIGHT",
|
||||
"TRIANGLE_UP",
|
||||
"TRUE",
|
||||
"UP",
|
||||
],
|
||||
),
|
||||
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", "COAST_SMART", "HOLD", "NONE"]),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("class_name,members", ENUMS)
|
||||
def test_get_parameter_class_member_completion(class_name: str, members: list[str]):
|
||||
|
||||
code = _create_snippet(class_name)
|
||||
completions: list[CompletionItem] = json.loads(
|
||||
complete(code, 2, len(class_name) + 2)
|
||||
)
|
||||
assert [c["insertText"] for c in completions] == members
|
||||
|
||||
|
||||
def test_get_parameter_color_completion():
|
||||
code = "\n".join(["from pybricks.parameters import Color", "Color.RED."])
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 2, 11))
|
||||
assert [c["insertText"] for c in completions] == [
|
||||
"BLACK",
|
||||
"BLUE",
|
||||
"BROWN",
|
||||
"CYAN",
|
||||
"GRAY",
|
||||
"GREEN",
|
||||
"h",
|
||||
"MAGENTA",
|
||||
"NONE",
|
||||
"ORANGE",
|
||||
"RED",
|
||||
"s",
|
||||
"v",
|
||||
"VIOLET",
|
||||
"WHITE",
|
||||
"YELLOW",
|
||||
]
|
||||
@@ -80,7 +80,7 @@ def test_hub_dot_display_dot():
|
||||
assert [c["insertText"] for c in completions] == [
|
||||
"animate",
|
||||
"char",
|
||||
"image",
|
||||
"icon",
|
||||
"number",
|
||||
"off",
|
||||
"orientation",
|
||||
|
||||
@@ -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")]),
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
## 2.4.0 - 2022-11-11
|
||||
|
||||
### Changed
|
||||
- Updated docs to v3.2.0b5.
|
||||
|
||||
## 2.3.0 - 2022-10-21
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pybricks/ide-docs",
|
||||
"version": "2.3.0",
|
||||
"version": "2.4.0",
|
||||
"description": "Special build of Pybricks API docs for embedding in an IDE.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
version-tag-prefix "@pybricks/images/v"
|
||||
version-git-message "@pybricks/images v%s"
|
||||
@@ -0,0 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
## 1.2.1 - 2022-11-08
|
||||
|
||||
### Changed
|
||||
- Changed size of some icons.
|
||||
|
||||
## 1.2.0 - 2022-10-28
|
||||
|
||||
### Changed
|
||||
- Changed all icon files to have the same dimensions.
|
||||
|
||||
## 1.1.0 - 2022-10-28
|
||||
|
||||
### Added
|
||||
- Added MINDSTORMS Robot Inventor hub image.
|
||||
|
||||
## 1.0.0 - 2022-10-28
|
||||
|
||||
### Added
|
||||
- Added new @pybricks/images package.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2022 The Pybricks Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,5 @@
|
||||
@pybricks/images
|
||||
================
|
||||
|
||||
Image resource for Pybricks Code.
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
|
||||
BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
||||
IMAGE_DIR = (
|
||||
pathlib.Path(__file__).parent.parent.parent / "doc" / "main" / "diagrams"
|
||||
).resolve()
|
||||
HUBS = ["move", "city", "technic", "prime", "essential", "inventor"]
|
||||
|
||||
package_json = {
|
||||
"name": "@pybricks/images",
|
||||
"version": "1.2.1",
|
||||
"description": "Distribution of Pybricks images.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/pybricks/pybricks-api",
|
||||
"directory": "npm/images",
|
||||
},
|
||||
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
|
||||
}
|
||||
|
||||
# ensure empty build directory so we don't end up with stale files
|
||||
shutil.rmtree(BUILD_DIR, True)
|
||||
BUILD_DIR.mkdir()
|
||||
|
||||
# copy the hub images
|
||||
for h in HUBS:
|
||||
shutil.copyfile(IMAGE_DIR / f"icon_{h}hub.png", BUILD_DIR / f"hub-{h}.png")
|
||||
|
||||
# generate package.json file
|
||||
|
||||
# create "exports" item for hub images.
|
||||
package_json["exports"] = {f"./hub-{h}.png": f"./hub-{h}.png" for h in HUBS}
|
||||
|
||||
with open(BUILD_DIR / "package.json", "w") as f:
|
||||
json.dump(package_json, f, indent=2)
|
||||
|
||||
# copy additional files
|
||||
|
||||
ROOT_DIR = (pathlib.Path(__file__).parent).resolve()
|
||||
|
||||
for file in "README.md", "CHANGELOG.md", "LICENSE":
|
||||
shutil.copy(ROOT_DIR / file, BUILD_DIR / file)
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
## 1.3.0 - 2022-11-11
|
||||
|
||||
### Changed
|
||||
- Updated `pybricks_jedi` Python package to v1.3.0.
|
||||
|
||||
## 1.2.0 - 2022-10-21
|
||||
|
||||
### Changed
|
||||
- Updated `pybricks_jedi` Python package to v1.2.0.
|
||||
|
||||
## 1.0.1 - 2022-09-07
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -12,7 +12,7 @@ BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
|
||||
|
||||
package_json = {
|
||||
"name": "@pybricks/jedi",
|
||||
"version": "1.0.1",
|
||||
"version": "1.3.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.1.0",
|
||||
"pybricks-jedi==1.3.0",
|
||||
],
|
||||
cwd=BUILD_DIR,
|
||||
)
|
||||
|
||||
@@ -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.9.24"
|
||||
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"
|
||||
@@ -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
|
||||
@@ -324,7 +324,7 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "Sphinx"
|
||||
version = "5.1.0.dev20220621"
|
||||
version = "5.1.0.dev20221202"
|
||||
description = "Python documentation generator"
|
||||
category = "dev"
|
||||
optional = false
|
||||
@@ -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.9.24-py3-none-any.whl", hash = "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382"},
|
||||
{file = "certifi-2022.9.24.tar.gz", hash = "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"},
|
||||
]
|
||||
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"},
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pybricks"
|
||||
version = "3.2.0b4"
|
||||
version = "3.2.0b6"
|
||||
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>" ]
|
||||
|
||||
@@ -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 raises a ``KeyboardInterrupt`` exception when
|
||||
you type it in the input window. By default it is set to ``3``,
|
||||
corresponding to :kbd:`Ctrl-C`.
|
||||
|
||||
Arguments:
|
||||
chr (int): Character that should raise the ``KeyboardInterrupt``.
|
||||
Choose ``-1`` to disable this feature.
|
||||
"""
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
|
||||
@@ -60,21 +60,43 @@ class _PybricksEnum(Enum, metaclass=_PybricksEnumMeta):
|
||||
class Color:
|
||||
"""Light or surface color."""
|
||||
|
||||
h: int
|
||||
s: int
|
||||
v: int
|
||||
NONE: Color = ...
|
||||
BLACK: Color = ...
|
||||
GRAY: Color = ...
|
||||
WHITE: Color = ...
|
||||
RED: Color = ...
|
||||
ORANGE: Color = ...
|
||||
BROWN: Color = ...
|
||||
YELLOW: Color = ...
|
||||
GREEN: Color = ...
|
||||
CYAN: Color = ...
|
||||
BLUE: Color = ...
|
||||
VIOLET: Color = ...
|
||||
MAGENTA: Color = ...
|
||||
|
||||
def __init__(self, h: Number, s: Number = 100, v: Number = 100):
|
||||
"""Color(h, s=100, v=100)
|
||||
|
||||
Arguments:
|
||||
h (Number, deg): Hue (0--360)
|
||||
h (Number, deg): Hue.
|
||||
s (Number, %): Saturation.
|
||||
v (Number, %): Brightness value.
|
||||
"""
|
||||
self.h = h % 360
|
||||
self.s = max(0, min(s, 100))
|
||||
self.v = max(0, min(v, 100))
|
||||
|
||||
self.h = int(h) % 360
|
||||
"""
|
||||
The hue.
|
||||
"""
|
||||
|
||||
self.s = max(0, min(int(s), 100))
|
||||
"""
|
||||
The saturation.
|
||||
"""
|
||||
|
||||
self.v = max(0, min(int(v), 100))
|
||||
"""
|
||||
The brightness value.
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
return "Color(h={}, s={}, v={})".format(self.h, self.s, self.v)
|
||||
@@ -130,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):
|
||||
@@ -185,39 +222,297 @@ class Side(_PybricksEnum):
|
||||
|
||||
|
||||
class Icon:
|
||||
UP: _Matrix
|
||||
DOWN: _Matrix
|
||||
LEFT: _Matrix
|
||||
RIGHT: _Matrix
|
||||
ARROW_RIGHT_UP: _Matrix
|
||||
ARROW_RIGHT_DOWN: _Matrix
|
||||
ARROW_LEFT_UP: _Matrix
|
||||
ARROW_LEFT_DOWN: _Matrix
|
||||
ARROW_UP: _Matrix
|
||||
ARROW_DOWN: _Matrix
|
||||
ARROW_LEFT: _Matrix
|
||||
ARROW_RIGHT: _Matrix
|
||||
HAPPY: _Matrix
|
||||
SAD: _Matrix
|
||||
EYE_LEFT: _Matrix
|
||||
EYE_RIGHT: _Matrix
|
||||
EYE_LEFT_BLINK: _Matrix
|
||||
EYE_RIGHT_BLINK: _Matrix
|
||||
EYE_RIGHT_BROW: _Matrix
|
||||
EYE_LEFT_BROW: _Matrix
|
||||
EYE_LEFT_BROW_UP: _Matrix
|
||||
EYE_RIGHT_BROW_UP: _Matrix
|
||||
HEART: _Matrix
|
||||
PAUSE: _Matrix
|
||||
EMPTY: _Matrix
|
||||
FULL: _Matrix
|
||||
SQUARE: _Matrix
|
||||
TRIANGLE_RIGHT: _Matrix
|
||||
TRIANGLE_LEFT: _Matrix
|
||||
TRIANGLE_UP: _Matrix
|
||||
TRIANGLE_DOWN: _Matrix
|
||||
CIRCLE: _Matrix
|
||||
CLOCKWISE: _Matrix
|
||||
COUNTERCLOCKWISE: _Matrix
|
||||
TRUE: _Matrix
|
||||
FALSE: _Matrix
|
||||
"""Icons to display on a light matrix.
|
||||
|
||||
Each of the following attributes are matrices. This means you can scale
|
||||
icons to adjust the brightness or add icons to make composites.
|
||||
"""
|
||||
|
||||
UP: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
"""
|
||||
DOWN: _Matrix = ...
|
||||
"""
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
LEFT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨🟨🟨🟨
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
RIGHT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| 🟨🟨🟨🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
ARROW_RIGHT_UP: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨🟨🟨
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜🟨⬜🟨
|
||||
| ⬜🟨⬜⬜⬜
|
||||
| 🟨⬜⬜⬜⬜
|
||||
"""
|
||||
ARROW_RIGHT_DOWN: _Matrix = ...
|
||||
"""
|
||||
| 🟨⬜⬜⬜⬜
|
||||
| ⬜🟨⬜⬜⬜
|
||||
| ⬜⬜🟨⬜🟨
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜🟨🟨🟨
|
||||
"""
|
||||
ARROW_LEFT_UP: _Matrix = ...
|
||||
"""
|
||||
| 🟨🟨🟨⬜⬜
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| 🟨⬜🟨⬜⬜
|
||||
| ⬜⬜⬜🟨⬜
|
||||
| ⬜⬜⬜⬜🟨
|
||||
"""
|
||||
ARROW_LEFT_DOWN: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜🟨
|
||||
| ⬜⬜⬜🟨⬜
|
||||
| 🟨⬜🟨⬜⬜
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| 🟨🟨🟨⬜⬜
|
||||
"""
|
||||
ARROW_UP: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| 🟨⬜🟨⬜🟨
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
ARROW_DOWN: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| 🟨⬜🟨⬜🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
ARROW_LEFT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜🟨⬜⬜⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨⬜⬜⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
ARROW_RIGHT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜⬜⬜🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜⬜⬜🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
HAPPY: _Matrix = ...
|
||||
"""
|
||||
| 🟨🟨⬜🟨🟨
|
||||
| 🟨🟨⬜🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| 🟨⬜⬜⬜🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
"""
|
||||
SAD: _Matrix = ...
|
||||
"""
|
||||
| 🟨🟨⬜🟨🟨
|
||||
| 🟨🟨⬜🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| 🟨⬜⬜⬜🟨
|
||||
"""
|
||||
EYE_LEFT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_RIGHT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_LEFT_BLINK: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_RIGHT_BLINK: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_RIGHT_BROW: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_LEFT_BROW: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_LEFT_BROW_UP: _Matrix = ...
|
||||
"""
|
||||
| 🟨🟨⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EYE_RIGHT_BROW_UP: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
HEART: _Matrix = ...
|
||||
"""
|
||||
| ⬜🟨⬜🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
"""
|
||||
PAUSE: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜🟨⬜🟨⬜
|
||||
| ⬜🟨⬜🟨⬜
|
||||
| ⬜🟨⬜🟨⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
EMPTY: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
FULL: _Matrix = ...
|
||||
"""
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
"""
|
||||
SQUARE: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
TRIANGLE_RIGHT: _Matrix = ...
|
||||
"""
|
||||
| ⬜🟨⬜⬜⬜
|
||||
| ⬜🟨🟨⬜⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜🟨🟨⬜⬜
|
||||
| ⬜🟨⬜⬜⬜
|
||||
"""
|
||||
TRIANGLE_LEFT: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜🟨⬜
|
||||
| ⬜⬜🟨🟨⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜⬜🟨🟨⬜
|
||||
| ⬜⬜⬜🟨⬜
|
||||
"""
|
||||
TRIANGLE_UP: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
TRIANGLE_DOWN: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
CIRCLE: _Matrix = ...
|
||||
"""
|
||||
| ⬜🟨🟨🟨⬜
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| 🟨🟨🟨🟨🟨
|
||||
| ⬜🟨🟨🟨⬜
|
||||
"""
|
||||
CLOCKWISE: _Matrix = ...
|
||||
"""
|
||||
| 🟨🟨🟨🟨⬜
|
||||
| 🟨⬜⬜🟨⬜
|
||||
| 🟨⬜⬜🟨⬜
|
||||
| 🟨⬜🟨🟨🟨
|
||||
| ⬜⬜⬜🟨⬜
|
||||
"""
|
||||
COUNTERCLOCKWISE: _Matrix = ...
|
||||
"""
|
||||
| ⬜🟨🟨🟨🟨
|
||||
| ⬜🟨⬜⬜🟨
|
||||
| ⬜🟨⬜⬜🟨
|
||||
| 🟨🟨🟨⬜🟨
|
||||
| ⬜🟨⬜⬜⬜
|
||||
"""
|
||||
TRUE: _Matrix = ...
|
||||
"""
|
||||
| ⬜⬜⬜⬜🟨
|
||||
| ⬜⬜⬜🟨⬜
|
||||
| 🟨⬜🟨⬜⬜
|
||||
| ⬜🟨⬜⬜⬜
|
||||
| ⬜⬜⬜⬜⬜
|
||||
"""
|
||||
FALSE: _Matrix = ...
|
||||
"""
|
||||
| 🟨⬜⬜⬜🟨
|
||||
| ⬜🟨⬜🟨⬜
|
||||
| ⬜⬜🟨⬜⬜
|
||||
| ⬜🟨⬜🟨⬜
|
||||
| 🟨⬜⬜⬜🟨
|
||||
"""
|
||||
|
||||
@@ -189,6 +189,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:
|
||||
|
||||
@@ -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 object’s
|
||||
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.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# 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
|
||||
|
||||
import json
|
||||
|
||||
json.dump
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (c) 2021 The Pybricks Authors
|
||||
#
|
||||
# Portions of documentation copied from:
|
||||
# https://raw.githubusercontent.com/micropython/micropython/1e6d18c915ccea0b6a19ffec9710d33dd7e5f866/docs/library/ustruct.rst
|
||||
# Copyright (c) 2014-2021, Damien P. George, Paul Sokolovsky, and contributors
|
||||
|
||||
"""
|
||||
This module provides functions to convert between Python values and C-like
|
||||
data structs.
|
||||
"""
|
||||
|
||||
from typing import Union, Tuple
|
||||
|
||||
|
||||
def calcsize(format: str) -> int:
|
||||
"""
|
||||
Gets the data size corresponding to a format string
|
||||
|
||||
Arguments:
|
||||
format (str): Data format string.
|
||||
|
||||
Returns:
|
||||
The number of bytes needed to represent this format.
|
||||
"""
|
||||
|
||||
|
||||
def pack(format: str, *values) -> bytes:
|
||||
"""
|
||||
pack(format, value1, value2, ...)
|
||||
|
||||
Packs the values using the given format.
|
||||
|
||||
Arguments:
|
||||
format (str): Data format string.
|
||||
|
||||
Returns:
|
||||
The data encoded as bytes.
|
||||
"""
|
||||
|
||||
|
||||
def pack_into(format: str, buffer: bytearray, offset: int, *values) -> bytes:
|
||||
"""
|
||||
pack_into(format, buffer, offset, value1, value2, ...)
|
||||
|
||||
Encode the values using the given format and write them to a given buffer.
|
||||
|
||||
Arguments:
|
||||
format (str): Data format string.
|
||||
buffer (bytearray): Buffer to store the encoded data.
|
||||
offset (int): Offset from the start of the buffer. Use a negative value
|
||||
to count from the end of the buffer.
|
||||
"""
|
||||
|
||||
|
||||
def unpack(format: str, data: Union[bytes, bytearray]) -> Tuple:
|
||||
"""
|
||||
unpack(format, data) -> Tuple
|
||||
|
||||
Decodes the binary data using the given format.
|
||||
|
||||
Arguments:
|
||||
format (str): Data format string.
|
||||
data (bytes or bytearray): Data to unpack.
|
||||
|
||||
Returns:
|
||||
The decoded data as a tuple of values.
|
||||
"""
|
||||
|
||||
|
||||
def unpack_from(format: str, data: Union[bytes, bytearray], offset: int) -> Tuple:
|
||||
"""
|
||||
unpack_from(format, data, offset) -> Tuple
|
||||
|
||||
Decodes binary data from a buffer using the given format.
|
||||
|
||||
Arguments:
|
||||
format (str): Data format string.
|
||||
data (bytes or bytearray): Data buffer to unpack.
|
||||
offset (int): Offset from the start of the data. Use a negative value
|
||||
to count from the end of the data.
|
||||
|
||||
Returns:
|
||||
The decoded data as a tuple of values.
|
||||
"""
|
||||
@@ -9,32 +9,45 @@
|
||||
This module provides a subset of the standard Python ``sys`` module.
|
||||
"""
|
||||
|
||||
from uio import FileIO as _FileIO
|
||||
from typing import Tuple
|
||||
|
||||
# REVISIT: most functions are excluded since they aren't useful for Pybricks
|
||||
from uio import FileIO as _FileIO
|
||||
|
||||
stdin: _FileIO = _FileIO()
|
||||
"""
|
||||
Stream object (:class:`uio.FileIO`) that receives input from a connected
|
||||
terminal, if any.
|
||||
This is a stream object (:class:`uio.FileIO`) that receives input from a
|
||||
connected terminal, if any.
|
||||
|
||||
Writing may modify newline characters. Use ``usys.stdin.buffer`` instead if
|
||||
this is undesirable.
|
||||
|
||||
Also see :func:`micropython.kbd_intr` to disable ``KeyboardInterrupt`` if you
|
||||
are passing binary data via ``stdin``.
|
||||
Also see :func:`kbd_intr <micropython.kbd_intr>` to disable
|
||||
``KeyboardInterrupt`` when passing binary data via ``stdin``.
|
||||
"""
|
||||
|
||||
stdout: _FileIO = _FileIO()
|
||||
"""
|
||||
Stream object (:class:`uio.FileIO`) that sends output to a connected terminal,
|
||||
if any.
|
||||
|
||||
Reading may modify newline characters. Use ``usys.stdout.buffer`` instead if
|
||||
this is undesirable.
|
||||
This is a stream object (:class:`uio.FileIO`) that sends output to a connected
|
||||
terminal, if any.
|
||||
"""
|
||||
|
||||
stderr: _FileIO = _FileIO()
|
||||
"""
|
||||
Alias for :data:`stdout`.
|
||||
"""
|
||||
|
||||
implementation: Tuple[str, Tuple[int, int, int], str, int] = (
|
||||
"micropython",
|
||||
(1, 19, 1),
|
||||
"NAME Hub with PROCESSOR",
|
||||
6,
|
||||
)
|
||||
"""
|
||||
MicroPython version tuple. See format and example below.
|
||||
"""
|
||||
|
||||
version: str = "3.4.0; Pybricks MicroPython v3.2.0b5 on 2022-11-11"
|
||||
"""
|
||||
Python compatibility version, Pybricks version, and build date.
|
||||
See format and example below.
|
||||
"""
|
||||
|
||||
version_info: Tuple[int, int, int] = (3, 4, 0)
|
||||
"""Python compatibility version. See format and example below."""
|
||||
|
||||