Compare commits

...
6 Commits
Author SHA1 Message Date
David Lechner bf59ef4478 v2.0.0.post2 2022-02-21 11:29:57 -06:00
David Lechner 6b1f7d8eaa pybricks.ev3devices: fix Motor code completion
The Microsoft Python extension for VS code doesn't include imports in
type hints, so the Motor type wasn't working properly. We can fix this
by wrapping the import type in a new, empty class definition.

The DCMotor class was also missing from ev3devices so this is fixed as well.
2022-02-21 11:01:11 -06:00
David Lechnerandlaurensvalk df27ebc27e pybricks.messaging: fix BluetoothMailboxServer close
As per standard Python socketserver, there is `server_close()` rather than `close()`.

Fixes #51
2021-04-07 19:41:30 +02:00
David Lechner b471cae0bc v2.0.0.post1 2020-12-28 16:40:42 -06:00
David Lechner eb7f441c9e pybricks: remove non-EV3 APIs
This is the v2 branch which only supports EV3. Removing the extra APIs
will prevent them from showing up when this library is used for code
completion.
2020-12-28 16:36:47 -06:00
David Lechner dca8518575 pybricks: add type hints for v2
This adds PEP 561 style type hints for Pybricks v2 (just EV3).
2020-12-28 16:21:56 -06:00
31 changed files with 984 additions and 860 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.8, 3.9]
steps:
- uses: actions/checkout@v2
+2
View File
@@ -1,8 +1,10 @@
{
"python.pythonPath": "${workspaceFolder}/.venv",
"python.formatting.provider": "black",
"python.linting.pycodestyleEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"python.languageServer": "Pylance",
"files.associations": {"*.inc": "restructuredtext"},
"restructuredtext.confPath": "${workspaceFolder}/doc/api",
"spellright.language": [
+12
View File
@@ -0,0 +1,12 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 2.0.0.post2
### Added
- Added this changelog.
### Fixed
- Fixed code completion for `DCMotor` and `Motor` classes in MS Python VS Code extension.
- Fixed missing `DCMotor` type in `ev3devices`.
-22
View File
@@ -16,25 +16,3 @@ Select your programmable hub using the buttons below.
:height: 15 em
.. include:: hubs_ev3brick.inc
.. tab-container:: movehub
:title: Move Hub
.. figure:: ../api/images/movehub_label.png
:height: 15 em
.. include:: hubs_movehub.inc
.. tab-container:: cityhub
:title: City Hub
.. figure:: ../api/images/cityhub.png
:height: 15 em
.. include:: hubs_cityhub.inc
.. tab-container:: cplushub
:title: Control+ Hub
.. figure:: ../api/images/cplushub.png
:height: 15 em
-15
View File
@@ -1,15 +0,0 @@
.. autoclass:: pybricks.hubs.CityHub
:no-members:
.. rubric:: Using the hub status light
.. automethod:: pybricks.hubs::CityHub.light.on
.. automethod:: pybricks.hubs::CityHub.light.off
.. rubric:: Using the battery
.. automethod:: pybricks.hubs::CityHub.battery.voltage
.. automethod:: pybricks.hubs::CityHub.battery.current
-14
View File
@@ -1,14 +0,0 @@
.. autoclass:: pybricks.hubs.MoveHub
:no-members:
.. rubric:: Using the hub status light
.. automethod:: pybricks.hubs::MoveHub.light.on
.. automethod:: pybricks.hubs::MoveHub.light.off
.. rubric:: Using the battery
.. automethod:: pybricks.hubs::MoveHub.battery.voltage
.. automethod:: pybricks.hubs::MoveHub.battery.current
+1 -24
View File
@@ -7,28 +7,7 @@ run your first scripts.
**Step 1: Install Pybricks**
To get started, go to the :doc:`EV3 Quick Start <start_ev3>`
or the :doc:`Powered Up Quick Start <start_ev3>` or pick your hub
below.
.. list-table::
* - **EV3 Brick**
- **Move Hub**
- **City Hub**
- **Control+ Hub**
* - .. image:: images/ev3brick.png
:target: start_ev3.html
- .. figure:: images/movehub.png
:target: start_pup.html
- .. figure:: images/cityhub.png
:target: start_pup.html
- .. figure:: images/cplushub.png
:target: start_pup.html
To get started, go to the :doc:`EV3 Quick Start <start_ev3>`.
**Step 2: Start coding!**
@@ -68,7 +47,6 @@ findings on our `support page`_ so we can make Pybricks even better.
:hidden:
start_ev3
start_pup
.. toctree::
:maxdepth: 1
@@ -76,7 +54,6 @@ findings on our `support page`_ so we can make Pybricks even better.
:hidden:
hubs
pupdevices
ev3devices
nxtdevices
iodevices
+10 -41
View File
@@ -7,42 +7,19 @@
.. autoclass:: pybricks.parameters.Port
:no-members:
.. content-tabs::
Motor ports:
.. tab-container:: ev3brick
:title: EV3 Brick
.. data:: A
.. data:: B
.. data:: C
.. data:: D
Motor ports:
Sensor ports:
.. data:: A
.. data:: B
.. data:: C
.. data:: D
Sensor ports:
.. data:: S1
.. data:: S2
.. data:: S3
.. data:: S4
.. tab-container:: movehub
:title: Move Hub
Input/Output ports:
.. data:: A
.. data:: B
.. data:: C
.. data:: D
.. tab-container:: cityhub
:title: City Hub
Input/Output ports:
.. data:: A
.. data:: B
.. data:: S1
.. data:: S2
.. data:: S3
.. data:: S4
.. autoclass:: pybricks.parameters.Direction
:no-members:
@@ -53,8 +30,6 @@
Some motors have two shafts. If in doubt, refer to the following diagrams:
- Clockwise direction for :ref:`EV3/NXT motors <fig_ev3motors>`
- Clockwise direction for :ref:`Powered Up Motors <fig_pupmotors>`
- Clockwise direction for :ref:`Move Hub Motors <fig_hubs>`
.. autoclass:: pybricks.parameters.Stop
:no-members:
@@ -89,9 +64,3 @@
.. autoclass:: pybricks.parameters.Button
:no-members:
.. .. autoclass:: pybricks.parameters.Axis
.. :no-members:
.. .. autoclass:: pybricks.parameters.Side
.. :no-members:
-144
View File
@@ -1,144 +0,0 @@
:mod:`pupdevices <pybricks.pupdevices>` -- Powered Up Devices
=============================================================
.. automodule:: pybricks.pupdevices
:no-members:
Motors without Rotation Sensors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _fig_pupdcmotors:
.. figure:: ../api/images/pupdcmotors_label.png
:width: 70 %
:alt: pupmotors
:align: center
Powered Up motors without rotation sensors. The arrows indicate the default
positive direction.
.. autoclass:: pybricks._common.DCMotor
:noindex:
:no-members:
.. automethod:: pybricks._common.DCMotor.dc
:noindex:
.. automethod:: pybricks._common.DCMotor.stop
:noindex:
.. automethod:: pybricks._common.DCMotor.brake
:noindex:
Motors with Rotation Sensors
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. _fig_pupmotors:
.. figure:: ../api/images/pupmotors_label.png
:width: 100 %
:alt: pupmotors
:align: left
Powered Up motors with rotation sensors. The arrows indicate the default
positive direction. See the :mod:`hubs <pybricks.hubs>` module for default
directions of built-in motors.
.. autoclass:: pybricks.pupdevices.Motor
:noindex:
:no-members:
.. rubric:: Measuring
.. automethod:: pybricks.pupdevices.Motor.speed
.. automethod:: pybricks.pupdevices.Motor.angle
.. automethod:: pybricks.pupdevices.Motor.reset_angle
.. rubric:: Stopping
.. automethod:: pybricks.pupdevices.Motor.stop
.. automethod:: pybricks.pupdevices.Motor.brake
.. automethod:: pybricks.pupdevices.Motor.hold
.. rubric:: Action
.. automethod:: pybricks.pupdevices.Motor.run
.. automethod:: pybricks.pupdevices.Motor.run_time
.. automethod:: pybricks.pupdevices.Motor.run_angle
.. automethod:: pybricks.pupdevices.Motor.run_target
.. automethod:: pybricks.pupdevices.Motor.run_until_stalled
.. automethod:: pybricks.pupdevices.Motor.dc
.. rubric:: Advanced motion control
.. automethod:: pybricks.pupdevices.Motor.track_target
.. autoattribute:: pybricks.pupdevices.Motor.control
:annotation:
Color and Distance Sensor
^^^^^^^^^^^^^^^^^^^^^^^^^
.. figure:: ../api/images/sensor_colordistance.png
:width: 35 %
.. autoclass:: pybricks.pupdevices.ColorDistanceSensor
:no-members:
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.color
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.ambient
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.reflection
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.distance
.. automethod:: pybricks.pupdevices.ColorDistanceSensor.remote
.. rubric:: Built-in light
This sensor has a built-in light. You can make it red, green, blue, or turn
it off. If you use the sensor to measure something afterwards, the light
automatically turns back on at the default color for that sensing method.
.. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.on
.. automethod:: pybricks.pupdevices::ColorDistanceSensor.light.off
.. Tilt Sensor
.. ^^^^^^^^^^^^^^^^^^^^^^^^^
.. .. autoclass:: pybricks.pupdevices.TiltSensor
:no-members:
.. automethod:: neutral
.. automethod:: acceleration
.. automethod:: tilt
.. automethod:: up
.. Remote Control
.. ^^^^^^^^^^^^^^^^^^^^^^^^^
.. .. autoclass:: pybricks.pupdevices.RemoteControl
:no-members:
.. automethod:: pybricks.pupdevices::RemoteControl.light.on
.. automethod:: pybricks.pupdevices::RemoteControl.light.off
.. automethod:: pybricks.pupdevices::RemoteControl.buttons.pressed
-4
View File
@@ -1,4 +0,0 @@
Powered Up Quick Start
########################
Coming soon!
Generated
+303 -136
View File
@@ -1,54 +1,91 @@
[[package]]
category = "dev"
description = "A configurable sidebar-enabled Sphinx theme"
name = "alabaster"
version = "0.7.12"
description = "A configurable sidebar-enabled Sphinx theme"
category = "dev"
optional = false
python-versions = "*"
version = "0.7.12"
[[package]]
name = "appdirs"
version = "1.4.4"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
description = "Internationalization utilities"
optional = false
python-versions = "*"
[[package]]
name = "babel"
version = "2.8.0"
description = "Internationalization utilities"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.8.0"
[package.dependencies]
pytz = ">=2015.7"
[[package]]
name = "black"
version = "20.8b1"
description = "The uncompromising code formatter."
category = "dev"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.6"
[package.dependencies]
appdirs = "*"
click = ">=7.1.2"
mypy-extensions = ">=0.4.3"
pathspec = ">=0.6,<1"
regex = ">=2020.1.8"
toml = ">=0.10.1"
typed-ast = ">=1.4.0"
typing-extensions = ">=3.7.4"
[package.extras]
colorama = ["colorama (>=0.4.3)"]
d = ["aiohttp (>=3.3.2)", "aiohttp-cors"]
[[package]]
name = "certifi"
optional = false
python-versions = "*"
version = "2019.11.28"
[[package]]
description = "Python package for providing Mozilla's CA Bundle."
category = "dev"
description = "Universal encoding detector for Python 2 and 3"
name = "chardet"
optional = false
python-versions = "*"
version = "3.0.4"
[[package]]
name = "chardet"
version = "3.0.4"
description = "Universal encoding detector for Python 2 and 3"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "click"
version = "7.1.2"
description = "Composable command line interface toolkit"
category = "dev"
description = "Cross-platform colored terminal text."
marker = "sys_platform == \"win32\""
name = "colorama"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "0.4.3"
[[package]]
name = "colorama"
version = "0.4.3"
description = "Cross-platform colored terminal text."
category = "dev"
description = "Style checker for Sphinx (or other) RST documentation"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "doc8"
version = "0.8.0"
description = "Style checker for Sphinx (or other) RST documentation"
category = "dev"
optional = false
python-versions = "*"
version = "0.8.0"
[package.dependencies]
chardet = "*"
@@ -58,28 +95,28 @@ six = "*"
stevedore = "*"
[[package]]
category = "dev"
description = "Docutils -- Python Documentation Utilities"
name = "docutils"
version = "0.16"
description = "Docutils -- Python Documentation Utilities"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "0.16"
[[package]]
category = "dev"
description = "Discover and load entry points from installed packages."
name = "entrypoints"
version = "0.3"
description = "Discover and load entry points from installed packages."
category = "dev"
optional = false
python-versions = ">=2.7"
version = "0.3"
[[package]]
category = "dev"
description = "the modular source code checker: pep8, pyflakes and co"
name = "flake8"
version = "3.7.9"
description = "the modular source code checker: pep8, pyflakes and co"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "3.7.9"
[package.dependencies]
entrypoints = ">=0.3.0,<0.4.0"
@@ -88,28 +125,28 @@ pycodestyle = ">=2.5.0,<2.6.0"
pyflakes = ">=2.1.0,<2.2.0"
[[package]]
category = "dev"
description = "Internationalized Domain Names in Applications (IDNA)"
name = "idna"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.9"
[[package]]
description = "Internationalized Domain Names in Applications (IDNA)"
category = "dev"
description = "Getting image size from png/jpeg/jpeg2000/gif file"
name = "imagesize"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.2.0"
[[package]]
name = "imagesize"
version = "1.2.0"
description = "Getting image size from png/jpeg/jpeg2000/gif file"
category = "dev"
description = "A very fast and expressive template engine."
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "jinja2"
version = "2.11.1"
description = "A very fast and expressive template engine."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "2.11.1"
[package.dependencies]
MarkupSafe = ">=0.23"
@@ -118,88 +155,112 @@ MarkupSafe = ">=0.23"
i18n = ["Babel (>=0.8)"]
[[package]]
category = "dev"
description = "Safely add untrusted strings to HTML/XML markup."
name = "markupsafe"
version = "1.1.1"
description = "Safely add untrusted strings to HTML/XML markup."
category = "dev"
optional = false
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
version = "1.1.1"
[[package]]
category = "dev"
description = "McCabe checker, plugin for flake8"
name = "mccabe"
version = "0.6.1"
description = "McCabe checker, plugin for flake8"
category = "dev"
optional = false
python-versions = "*"
version = "0.6.1"
[[package]]
name = "mypy-extensions"
version = "0.4.3"
description = "Experimental type system extensions for programs checked with the mypy typechecker."
category = "dev"
description = "Core utilities for Python packages"
optional = false
python-versions = "*"
[[package]]
name = "packaging"
version = "20.3"
description = "Core utilities for Python packages"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "20.3"
[package.dependencies]
pyparsing = ">=2.0.2"
six = "*"
[[package]]
name = "pathspec"
version = "0.8.1"
description = "Utility library for gitignore style pattern matching of file paths."
category = "dev"
description = "Python Build Reasonableness"
name = "pbr"
optional = false
python-versions = "*"
version = "5.4.4"
[[package]]
category = "dev"
description = "Python style guide checker"
name = "pycodestyle"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.5.0"
[[package]]
category = "dev"
description = "passive checker of Python programs"
name = "pyflakes"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.1.1"
[[package]]
category = "dev"
description = "Pygments is a syntax highlighting package written in Python."
name = "pygments"
optional = false
python-versions = ">=3.5"
version = "2.6.1"
[[package]]
category = "dev"
description = "Python parsing module"
name = "pyparsing"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
version = "2.4.6"
[[package]]
category = "dev"
description = "World timezone definitions, modern and historical"
name = "pytz"
optional = false
python-versions = "*"
version = "2019.3"
[[package]]
category = "dev"
description = "Python HTTP for Humans."
name = "requests"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "pbr"
version = "5.4.4"
description = "Python Build Reasonableness"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "pycodestyle"
version = "2.5.0"
description = "Python style guide checker"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "pyflakes"
version = "2.1.1"
description = "passive checker of Python programs"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]]
name = "pygments"
version = "2.6.1"
description = "Pygments is a syntax highlighting package written in Python."
category = "dev"
optional = false
python-versions = ">=3.5"
[[package]]
name = "pyparsing"
version = "2.4.6"
description = "Python parsing module"
category = "dev"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "pytz"
version = "2019.3"
description = "World timezone definitions, modern and historical"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "regex"
version = "2020.11.13"
description = "Alternative regular expression module, to replace re."
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "requests"
version = "2.23.0"
description = "Python HTTP for Humans."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[package.dependencies]
certifi = ">=2017.4.17"
@@ -212,51 +273,50 @@ security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
[[package]]
category = "dev"
description = "reStructuredText linter"
name = "restructuredtext-lint"
version = "1.3.0"
description = "reStructuredText linter"
category = "dev"
optional = false
python-versions = "*"
version = "1.3.0"
[package.dependencies]
docutils = ">=0.11,<1.0"
[[package]]
category = "dev"
description = "Python 2 and 3 compatibility utilities"
name = "six"
version = "1.14.0"
description = "Python 2 and 3 compatibility utilities"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
version = "1.14.0"
[[package]]
category = "dev"
description = "This package provides 26 stemmers for 25 languages generated from Snowball algorithms."
name = "snowballstemmer"
version = "2.0.0"
description = "This package provides 26 stemmers for 25 languages generated from Snowball algorithms."
category = "dev"
optional = false
python-versions = "*"
version = "2.0.0"
[[package]]
category = "dev"
description = "Python documentation generator"
name = "sphinx"
version = "1.7.9"
description = "Python documentation generator"
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "1.7.9"
[package.dependencies]
Jinja2 = ">=2.3"
Pygments = ">=2.0"
alabaster = ">=0.7,<0.8"
babel = ">=1.3,<2.0 || >2.0"
colorama = ">=0.3.5"
colorama = {version = ">=0.3.5", markers = "sys_platform == \"win32\""}
docutils = ">=0.11"
imagesize = "*"
Jinja2 = ">=2.3"
packaging = "*"
Pygments = ">=2.0"
requests = ">=2.0.0"
setuptools = "*"
six = ">=1.5"
snowballstemmer = ">=1.1"
sphinxcontrib-websupport = "*"
@@ -266,66 +326,82 @@ test = ["mock", "pytest", "pytest-cov", "html5lib", "flake8 (>=3.5.0)", "flake8-
websupport = ["sqlalchemy (>=0.9)", "whoosh (>=2.0)"]
[[package]]
category = "dev"
description = "Read the Docs theme for Sphinx"
name = "sphinx-rtd-theme"
version = "0.4.3"
description = "Read the Docs theme for Sphinx"
category = "dev"
optional = false
python-versions = "*"
version = "0.4.3"
[package.dependencies]
sphinx = "*"
[[package]]
category = "dev"
description = "Sphinx \"contentui\" extension"
name = "sphinxcontrib-contentui"
version = "0.2.2"
description = "Sphinx \"contentui\" extension"
category = "dev"
optional = false
python-versions = "*"
version = "0.2.2"
[package.dependencies]
Sphinx = ">=1.0"
[[package]]
category = "dev"
description = "Sphinx API for Web Apps"
name = "sphinxcontrib-websupport"
version = "1.2.0"
description = "Sphinx API for Web Apps"
category = "dev"
optional = false
python-versions = ">=3.5"
version = "1.2.0"
[package.extras]
lint = ["flake8"]
test = ["pytest", "sqlalchemy", "whoosh", "sphinx"]
[[package]]
category = "dev"
description = "Manage dynamic plugins for Python applications"
name = "stevedore"
version = "1.32.0"
description = "Manage dynamic plugins for Python applications"
category = "dev"
optional = false
python-versions = "*"
version = "1.32.0"
[package.dependencies]
pbr = ">=2.0.0,<2.1.0 || >2.1.0"
six = ">=1.10.0"
[[package]]
category = "dev"
description = "Python Library for Tom's Obvious, Minimal Language"
name = "toml"
version = "0.10.2"
description = "Python Library for Tom's Obvious, Minimal Language"
category = "dev"
optional = false
python-versions = "*"
version = "0.10.0"
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "typed-ast"
version = "1.4.1"
description = "a fork of Python 2 and 3 ast modules with type comment support"
category = "dev"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
python-versions = "*"
[[package]]
name = "typing-extensions"
version = "3.7.4.3"
description = "Backported and Experimental Type Hints for Python 3.5+"
category = "dev"
optional = false
python-versions = "*"
[[package]]
name = "urllib3"
version = "1.25.8"
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.*, <4"
version = "1.25.8"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
@@ -333,18 +409,27 @@ secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "cer
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
[metadata]
content-hash = "4bb3b4633264fced6ec76a562fef02081becb8d883b5f81f63d5e125a33eaa12"
python-versions = "^3.5"
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "8f38e4f82e091b428f68f7b905366d3a0cccbff71f12c10026e2eec7eb8a4774"
[metadata.files]
alabaster = [
{file = "alabaster-0.7.12-py2.py3-none-any.whl", hash = "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359"},
{file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"},
]
appdirs = [
{file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
{file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
]
babel = [
{file = "Babel-2.8.0-py2.py3-none-any.whl", hash = "sha256:d670ea0b10f8b723672d3a6abeb87b565b244da220d76b4dba1b66269ec152d4"},
{file = "Babel-2.8.0.tar.gz", hash = "sha256:1aac2ae2d0d8ea368fa90906567f5c08463d98ade155c0c4bfedd6a0f7160e38"},
]
black = [
{file = "black-20.8b1-py3-none-any.whl", hash = "sha256:70b62ef1527c950db59062cda342ea224d772abdf6adc58b86a45421bab20a6b"},
{file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"},
]
certifi = [
{file = "certifi-2019.11.28-py2.py3-none-any.whl", hash = "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3"},
{file = "certifi-2019.11.28.tar.gz", hash = "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"},
@@ -353,6 +438,10 @@ chardet = [
{file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"},
{file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"},
]
click = [
{file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"},
{file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"},
]
colorama = [
{file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"},
{file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"},
@@ -424,10 +513,18 @@ mccabe = [
{file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"},
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
]
mypy-extensions = [
{file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"},
{file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"},
]
packaging = [
{file = "packaging-20.3-py2.py3-none-any.whl", hash = "sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752"},
{file = "packaging-20.3.tar.gz", hash = "sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3"},
]
pathspec = [
{file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"},
{file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"},
]
pbr = [
{file = "pbr-5.4.4-py2.py3-none-any.whl", hash = "sha256:61aa52a0f18b71c5cc58232d2cf8f8d09cd67fcad60b742a60124cb8d6951488"},
{file = "pbr-5.4.4.tar.gz", hash = "sha256:139d2625547dbfa5fb0b81daebb39601c478c21956dc57e2e07b74450a8c506b"},
@@ -452,6 +549,49 @@ pytz = [
{file = "pytz-2019.3-py2.py3-none-any.whl", hash = "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d"},
{file = "pytz-2019.3.tar.gz", hash = "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"},
]
regex = [
{file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"},
{file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"},
{file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"},
{file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"},
{file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"},
{file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"},
{file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"},
{file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"},
{file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"},
{file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"},
{file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"},
{file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"},
{file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"},
{file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"},
{file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"},
{file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"},
{file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"},
{file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"},
{file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"},
{file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"},
{file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"},
]
requests = [
{file = "requests-2.23.0-py2.py3-none-any.whl", hash = "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee"},
{file = "requests-2.23.0.tar.gz", hash = "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"},
@@ -487,9 +627,36 @@ stevedore = [
{file = "stevedore-1.32.0.tar.gz", hash = "sha256:18afaf1d623af5950cc0f7e75e70f917784c73b652a34a12d90b309451b5500b"},
]
toml = [
{file = "toml-0.10.0-py2.7.egg", hash = "sha256:f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3"},
{file = "toml-0.10.0-py2.py3-none-any.whl", hash = "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"},
{file = "toml-0.10.0.tar.gz", hash = "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c"},
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
]
typed-ast = [
{file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"},
{file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"},
{file = "typed_ast-1.4.1-cp35-cp35m-win32.whl", hash = "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919"},
{file = "typed_ast-1.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01"},
{file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"},
{file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"},
{file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"},
{file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"},
{file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"},
{file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"},
{file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"},
{file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"},
{file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"},
{file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"},
{file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"},
{file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"},
{file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"},
{file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"},
{file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"},
{file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"},
{file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"},
]
typing-extensions = [
{file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"},
{file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"},
{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},
]
urllib3 = [
{file = "urllib3-1.25.8-py2.py3-none-any.whl", hash = "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc"},
+1 -262
View File
@@ -4,7 +4,7 @@
"""Generic cross-platform module for typical devices like lights, displays,
speakers, and batteries."""
from .parameters import Direction, Stop, Axis
from .parameters import Direction, Stop
class DCMotor:
@@ -389,22 +389,6 @@ class Speaker:
pass
class Light:
"""Control a single-color light."""
def on(self, brightness=100):
"""Turn on the light at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Brightness of the light.
"""
def off(self):
"""Turns off the light."""
pass
class ColorLight:
"""Control a multi-color light."""
@@ -432,119 +416,6 @@ class ColorLight:
pass
class LightArray:
"""Control an array of single-color lights."""
def __init__(self, lights):
"""Initializes the light array.
Arguments:
lights (int): Number of lights
"""
pass
def on(self, brightness=100):
"""Turns on all the lights at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Brightness of the lights.
"""
pass
def off(self):
"""Turns off all the lights."""
pass
def array(self, *brightnesses):
"""array(first_light, ..., last_light)
Sets the brightness of each light individually.
Arguments:
brightness (:ref:`brightness`, ..., :ref:`brightness`):
Brightness of each light.
"""
pass
class LightGrid:
"""Control a rectangular grid of single-color lights."""
def __init__(self, rows, columns):
"""Initializes the light grid.
Arguments:
rows (int): Number of rows in the grid
columns (int): Number of columns in the grid
"""
pass
def image(self, matrix, clear=True):
"""Shows an image made up of pixels of a given brightness.
Arguments:
matrix (2D Array): Matrix of intensities (:ref:`brightness`).
clear (bool): Whether to turn off all the lights before showing
the new image. If you choose ``False``,
the given matrix is added to one already shown.
"""
pass
def pixel(self, row, column, brightness):
"""Turns on a pixel at the specified brightness.
Arguments:
row (int): Vertical grid index, starting at 0 from the top.
column (int): Horizontal grid index, starting at 0 from the left.
brightness (:ref:`brightness`): Brightness of the pixel.
"""
pass
def on(self, brightness=100):
"""Turns on all the pixels at the specified brightness.
Arguments:
brightness (:ref:`brightness`):
Brightness of the lights.
"""
pass
def off(self):
"""Turns off all the pixels."""
pass
def number(self, number):
"""Displays a number on the light grid.
Arguments:
number (int): The number to be displayed.
"""
pass
def char(self, character):
"""Displays a character or symbol on the light grid. This may
be any letter (``a``--``z``), capital letter (``A``--``Z``) or one of
the following symbols: ``!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}``.
Arguments:
character (str): The character or symbol to be displayed.
"""
pass
def text(self, text, pause=500):
"""Displays a text string, one character at a time, with a pause
between each character. After the last character is shown, the light
grid turns off.
Arguments:
character (str): The character or symbol to be displayed.
time (:ref:`time`): How long to show a character before showing
the next one.
"""
pass
class KeyPad:
"""Get status of buttons on a keypad layout."""
@@ -577,135 +448,3 @@ class Battery:
"""
pass
class Accelerometer:
"""Get measurements from an accelerometer."""
def neutral(self, top, front):
"""Configures the neutral orientation of the device or hub. You do this
by specifying how it is mounted on your design, in terms of the
:ref:`robot reference frame <robotframe>`.
In this given neutral orientation, the tilt and heading will then be
zero.
Arguments:
top (Axis): Which direction the top of the device faces in the
neutral orientation. For example, you can
choose ``top=-Axis.Z`` if you mounted it such that the
neutral orientation is upside down.
front (Axis): Which direction the front of the device faces in the
neutral orientation.
"""
pass
def acceleration(self, axis=Axis.ALL):
"""acceleration(axis=Axis.ALL)
Gets the acceleration of the device along a given axis in the
:ref:`robot reference frame <robotframe>`.
Arguments:
axis (Axis): Axis along which the acceleration is
measured.
Returns:
:ref:`linacceleration`. Returns a :ref:`scalar` of the acceleration
along the specified axis.
If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the
accelerations along all three axes (x, y, z).
"""
pass
def tilt(self):
"""Gets the pitch and roll angles relative to the neutral, horizontal
orientation.
The order of rotation is pitch-then-roll. This is equivalent to a
positive rotation along the x-axis and then a positive rotation
along the y-axis.
Returns:
(:ref:`angle`, :ref:`angle`): Pitch and roll angles.
"""
pass
def tapped(self):
"""Checks if the device or hub was tapped.
Returns:
bool:
``True`` if tapped since this method was last called. ``False``
otherwise.
"""
# def tapped(self, axis=Axis.ALL, bidirectional=True, tolerance=45):
pass
def shaken(self):
"""Checks if the device or hub was shaken.
Returns:
bool:
``True`` if shaken since this method was last called. ``False``
otherwise.
"""
# def shaken(self, axis=Axis.ALL, bidirectional=True, tolerance=45):
pass
def up(self):
"""Checks which side of the device or hub currently faces upward.
:returns:
``Side.TOP``, ``Side.BOTTOM``, ``Side.LEFT``, ``Side.RIGHT``,
``Side.FRONT`` or ``Side.BACK``.
:rtype: :class:`Side <.parameters.Side>`
"""
pass
class IMU(Accelerometer):
def heading(self):
"""Gets the heading angle relative to the starting orientation. It is a
a positive rotation around the :ref:`z-axis in the robot
frame <robotframe>`, prior to applying any tilt rotation.
For a vehicle viewed from the top, this means that
a positive heading value corresponds to a counterclockwise rotation.
Returns:
:ref:`angle`: Heading angle relative to starting orientation.
"""
pass
def reset_heading(self, angle):
"""Resets the accumulated heading angle of the robot.
Arguments:
angle (:ref:`angle`): Value to which the heading should be reset.
"""
pass
def gyro(self, axis=Axis.ALL):
"""gyro(axis=Axis.ALL)
Measures the angular velocity of the device along a given axis in the
:ref:`robot reference frame <robotframe>`.
Arguments:
axis (Axis): Axis along which the angular velocity is
measured.
Returns:
:ref:`speed`. Returns a :ref:`scalar` of the angular velocity
along the specified axis.
If you choose ``axis=Axis.ALL``, you get a :ref:`vector` with the
angular velocities along all three axes (x, y, z).
"""
pass
+111
View File
@@ -0,0 +1,111 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Iterable, List, Optional, Tuple, Union, overload
from .parameters import Button, Color, Direction, Stop, Port
from .media.ev3dev import SoundFile
class DCMotor:
def __init__(
self, port: Port, positive_direction: Direction = Direction.CLOCKWISE
): ...
def dc(self, duty: int) -> None: ...
def stop(self) -> None: ...
def brake(self) -> None: ...
class Control:
@overload
def limits(self) -> Tuple[int, int, int]: ...
@overload
def limits(
self,
speed: Optional[int] = None,
acceleration: Optional[int] = None,
actuation: Optional[int] = None,
) -> None: ...
def pid(self) -> Tuple[int, int, int, int, int, int]: ...
@overload
def pid(
self,
kp: Optional[int] = None,
ki: Optional[int] = None,
kd: Optional[int] = None,
integral_range: Optional[int] = None,
integral_rate: Optional[int] = None,
feed_forward: Optional[int] = None,
) -> None: ...
@overload
def target_tolerances(self) -> Tuple[int, int]: ...
@overload
def target_tolerances(
self, speed: Optional[int] = None, position: Optional[int] = None
) -> None: ...
@overload
def stall_tolerances(self) -> Tuple[int, int]: ...
@overload
def stall_tolerances(
self, speed: Optional[int] = None, time: Optional[int] = None
) -> None: ...
def trajectory(
self,
) -> Tuple[int, int, int, int, int, int, int, int, int, int, int, int]: ...
def stalled(self) -> bool: ...
def done(self) -> bool: ...
class Motor(DCMotor):
control: Control
def __init__(
self,
port: Port,
positive_direction: Direction = Direction.CLOCKWISE,
gears: Optional[Union[List[int], List[List[int]]]] = None,
): ...
def angle(self) -> int: ...
def speed(self) -> int: ...
def reset_angle(self, angle: int) -> None: ...
def hold(self) -> None: ...
def run(self, speed: int) -> None: ...
def run_time(
self, speed: int, time: int, then: Stop = Stop.HOLD, wait: bool = True
) -> None: ...
def run_angle(
self, speed: int, rotation_angle: int, then: Stop = Stop.HOLD, wait: bool = True
) -> None: ...
def run_target(
self, speed: int, target_angle: int, then: Stop = Stop.HOLD, wait: bool = True
) -> None: ...
def run_until_stalled(
self, speed: int, then: Stop = Stop.COAST, duty_limit: Optional[int] = None
) -> int: ...
def track_target(self, target_angle: int) -> None: ...
class Speaker:
def beep(self, frequency: int = 500, duration: int = 100) -> None: ...
def play_notes(self, notes: Iterable[str], tempo: int = 120) -> None: ...
def play_file(self, file_name: Union[SoundFile, str]) -> None: ...
def say(self, text: str) -> None: ...
def set_speech_options(
self,
language: Optional[str] = None,
voice: Optional[str] = None,
speed: Optional[int] = None,
pitch: Optional[int] = None,
): ...
def set_volume(self, volume: int, which: str = "_all_") -> None: ...
class Light:
def on(self, brightness: int = 100) -> None: ...
def off(self) -> None: ...
class ColorLight:
def on(self, color: Optional[Color]) -> None: ...
def off(self) -> None: ...
def rgb(self, red: int, green: int, blue: int) -> None: ...
class KeyPad:
def pressed(self) -> List[Button]:...
class Battery:
def voltage(self) -> int: ...
def current(self) -> int: ...
+10 -2
View File
@@ -1,10 +1,18 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
# Copyright (c) 2018-2022 The Pybricks Authors
"""LEGO® MINDSTORMS® EV3 motors and sensors."""
from .parameters import Direction as _Direction
from ._common import Motor # noqa E402
from ._common import DCMotor as _DCMotor, Motor as _Motor
class DCMotor(_DCMotor):
pass
class Motor(_Motor):
pass
class TouchSensor:
+41
View File
@@ -0,0 +1,41 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020-2022 The Pybricks Authors
from typing import List, Optional, Tuple
from .parameters import Color, Direction, Port, Button
from ._common import DCMotor as _DCMotor, Motor as _Motor
class DCMotor(_DCMotor): ...
class Motor(_Motor): ...
class TouchSensor:
def __init__(self, port: Port): ...
def pressed(self) -> bool: ...
class ColorSensor:
def __init__(self, port: Port): ...
def color(self) -> Optional[Color]: ...
def ambient(self) -> int: ...
def reflection(self) -> int: ...
def rgb(self) -> Tuple[int, int, int]: ...
class InfraredSensor:
def __init__(self, port: Port): ...
def distance(self) -> int: ...
def beacon(self, channel: int) -> Tuple[Optional[int], Optional[int]]: ...
def buttons(self, channel: int) -> List[Button]: ...
def keypad(self) -> List[Button]: ...
class GyroSensor:
def __init__(
self, port: Port, positive_direction: Direction = Direction.CLOCKWISE
): ...
def speed(self) -> int: ...
def angle(self) -> int: ...
def reset_angle(self, angle: int) -> None: ...
class UltrasonicSensor:
def __init__(self, port: Port): ...
def distance(self, silent: bool = False) -> int: ...
def presence(self) -> bool: ...
-12
View File
@@ -14,15 +14,3 @@ class EV3Brick:
battery = _Battery()
light = _ColorLight()
buttons = _KeyPad()
class MoveHub:
"""LEGO® Powered Up Move Hub."""
battery = _Battery()
light = _ColorLight()
class CityHub:
"""LEGO® Powered Up City Hub."""
battery = _Battery()
light = _ColorLight()
+12
View File
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from ._common import Speaker, Battery, ColorLight, KeyPad
from .media.ev3dev import Image
class EV3Brick:
screen: Image
speaker: Speaker
battery: Battery
light: ColorLight
buttons = KeyPad
+37
View File
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Optional, Tuple
from .parameters import Port
class LUMPDevice:
def __init__(self, port: Port): ...
def read(self, mode: int) -> Tuple: ...
def write(self, mode: int, values: Tuple): ...
class Ev3devSensor:
sensor_index: int
port_index: int
def __init__(self, port: Port): ...
def read(self, mode: int) -> Tuple: ...
class AnalogSensor:
def __init__(self, port: Port): ...
def voltage(self) -> int: ...
def resistance(self) -> int: ...
def active(self) -> None: ...
def passive(self) -> None: ...
class I2CDevice:
def __init__(self, port: Port, address: int): ...
def read(self, reg: Optional[int], length: Optional[int] = 1) -> bytes: ...
def write(self, reg: Optional[int], data: Optional[bytes] = None) -> None: ...
class UARTDevice:
def __init__(self, port: Port, baudrate: int, timeout: Optional[int] = None): ...
def read(self, length: int = 1) -> bytes: ...
def read_all(self) -> bytes: ...
def write(self, data: bytes) -> None: ...
def waiting(self) -> int: ...
def clear(self) -> None: ...
+232
View File
@@ -0,0 +1,232 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Any, Literal, Optional, Union, overload
from ..parameters import Color
class Image:
@overload
def __init__(self, /, source: Union[Image, ImageFile, str]): ...
@overload
def __init__(
self, /, source: Image, sub: Literal[True], x1: int, y1: int, x2: int, y2: int
): ...
@property
def width(self) -> int: ...
@property
def height(self) -> int: ...
def clear(self) -> None: ...
def draw_pixel(self, x: int, y: int, color: Color = Color.BLACK) -> None: ...
def draw_line(
self,
x1: int,
y1: int,
x2: int,
y2: int,
width: int = 1,
color: Color = Color.BLACK,
) -> None: ...
def draw_box(
self,
x1: int,
y1: int,
x2: int,
y2: int,
r: int = 0,
fill: bool = False,
color: Color = Color.BLACK,
) -> None: ...
def draw_circle(
self, x: int, y: int, r: int, fill: bool = False, color: Color = Color.BLACK
) -> None: ...
def draw_image(
self,
x: int,
y: int,
source: Union[Image, ImageFile, str],
transparent: Optional[Color] = None,
) -> None: ...
def load_image(self, source: Union[Image, ImageFile, str]) -> None: ...
def draw_text(
self,
x: int,
y: int,
text: str,
text_color: Color = Color.BLACK,
background_color: Optional[Color] = None,
) -> None: ...
def print(self, *args: Any, sep: str = " ", end: str = "\n") -> None: ...
def set_font(self, font: Font) -> None: ...
@staticmethod
def empty(width: int = 178, height: int = 128) -> Image: ...
def save(self, filename: str) -> None: ...
class Font:
DEFAULT: Font
def __init__(
self,
family: Optional[str] = None,
size: int = 12,
bold: bool = False,
monospace: bool = False,
lang: Optional[str] = None,
script: Optional[str] = None,
): ...
@property
def family(self) -> str: ...
@property
def style(self) -> str: ...
@property
def width(self) -> int: ...
@property
def height(self) -> int: ...
def text_width(self, text: str) -> int: ...
def text_height(self, text: str) -> int: ...
class SoundFile:
SHOUTING: SoundFile
CHEERING: SoundFile
CRYING: SoundFile
OUCH: SoundFile
LAUGHING_2: SoundFile
SNEEZING: SoundFile
SMACK: SoundFile
BOING: SoundFile
BOO: SoundFile
UH_OH: SoundFile
SNORING: SoundFile
KUNG_FU: SoundFile
FANFARE: SoundFile
CRUNCHING: SoundFile
MAGIC_WAND: SoundFile
LAUGHING_1: SoundFile
LEFT: SoundFile
BACKWARDS: SoundFile
RIGHT: SoundFile
OBJECT: SoundFile
COLOR: SoundFile
FLASHING: SoundFile
ERROR: SoundFile
ERROR_ALARM: SoundFile
DOWN: SoundFile
FORWARD: SoundFile
ACTIVATE: SoundFile
SEARCHING: SoundFile
TOUCH: SoundFile
UP: SoundFile
ANALYZE: SoundFile
STOP: SoundFile
DETECTED: SoundFile
TURN: SoundFile
START: SoundFile
MORNING: SoundFile
EV3: SoundFile
GO: SoundFile
GOOD_JOB: SoundFile
OKEY_DOKEY: SoundFile
GOOD: SoundFile
NO: SoundFile
THANK_YOU: SoundFile
YES: SoundFile
GAME_OVER: SoundFile
OKAY: SoundFile
SORRY: SoundFile
BRAVO: SoundFile
GOODBYE: SoundFile
HI: SoundFile
HELLO: SoundFile
MINDSTORMS: SoundFile
LEGO: SoundFile
FANTASTIC: SoundFile
SPEED_IDLE: SoundFile
SPEED_DOWN: SoundFile
SPEED_UP: SoundFile
BROWN: SoundFile
GREEN: SoundFile
BLACK: SoundFile
WHITE: SoundFile
RED: SoundFile
BLUE: SoundFile
YELLOW: SoundFile
TICK_TACK: SoundFile
HORN_1: SoundFile
BACKING_ALERT: SoundFile
MOTOR_IDLE: SoundFile
AIR_RELEASE: SoundFile
AIRBRAKE: SoundFile
RATCHET: SoundFile
MOTOR_STOP: SoundFile
HORN_2: SoundFile
LASER: SoundFile
SONAR: SoundFile
MOTOR_START: SoundFile
INSECT_BUZZ_2: SoundFile
ELEPHANT_CALL: SoundFile
SNAKE_HISS: SoundFile
DOG_BARK_2: SoundFile
DOG_WHINE: SoundFile
INSECT_BUZZ_1: SoundFile
DOG_SNIFF: SoundFile
T_REX_ROAR: SoundFile
INSECT_CHIRP: SoundFile
DOG_GROWL: SoundFile
SNAKE_RATTLE: SoundFile
DOG_BARK_1: SoundFile
CAT_PURR: SoundFile
EIGHT: SoundFile
SEVEN: SoundFile
SIX: SoundFile
FOUR: SoundFile
TEN: SoundFile
ONE: SoundFile
TWO: SoundFile
THREE: SoundFile
ZERO: SoundFile
FIVE: SoundFile
NINE: SoundFile
READY: SoundFile
CONFIRM: SoundFile
GENERAL_ALERT: SoundFile
CLICK: SoundFile
OVERPOWER: SoundFile
class ImageFile:
RIGHT: ImageFile
FORWARD: ImageFile
ACCEPT: ImageFile
QUESTION_MARK: ImageFile
STOP_1: ImageFile
LEFT: ImageFile
DECLINE: ImageFile
THUMBS_DOWN: ImageFile
BACKWARD: ImageFile
NO_GO: ImageFile
WARNING: ImageFile
STOP_2: ImageFile
THUMBS_UP: ImageFile
EV3: ImageFile
EV3_ICON: ImageFile
TARGET: ImageFile
BOTTOM_RIGHT: ImageFile
BOTTOM_LEFT: ImageFile
EVIL: ImageFile
CRAZY_2: ImageFile
KNOCKED_OUT: ImageFile
PINCHED_RIGHT: ImageFile
WINKING: ImageFile
DIZZY: ImageFile
DOWN: ImageFile
TIRED_MIDDLE: ImageFile
MIDDLE_RIGHT: ImageFile
SLEEPING: ImageFile
MIDDLE_LEFT: ImageFile
TIRED_RIGHT: ImageFile
PINCHED_LEFT: ImageFile
PINCHED_MIDDLE: ImageFile
CRAZY_1: ImageFile
NEUTRAL: ImageFile
AWAKE: ImageFile
UP: ImageFile
TIRED_LEFT: ImageFile
ANGRY: ImageFile
View File
+1 -1
View File
@@ -180,5 +180,5 @@ class BluetoothMailboxClient:
There was a problem establishing the connection.
"""
def close(self):
def server_close(self):
"""Closes all connections."""
+49
View File
@@ -0,0 +1,49 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from abc import abstractmethod
from typing import Callable, Generic, Optional, TypeVar
T = TypeVar("T")
class Connection:
@abstractmethod
def read_from_mailbox(self, name: str) -> bytes: ...
@abstractmethod
def send_to_mailbox(self, name: str, data: bytes) -> None: ...
@abstractmethod
def wait_for_mailbox_update(self, name: str) -> None: ...
class Mailbox(Generic[T]):
def __init__(
self,
name: str,
connection: Connection,
encode: Optional[Callable[[T], bytes]] = None,
decode: Optional[Callable[[bytes], T]] = None,
): ...
def read(self) -> T: ...
def send(self, value: T, brick: Optional[str] = None) -> None: ...
def wait(self) -> None: ...
def wait_new(self) -> T: ...
class LogicMailbox(Mailbox[bool]):
def __init__(self, name, connection: Connection): ...
class NumericMailbox(Mailbox[float]):
def __init__(self, name, connection: Connection): ...
class TextMailbox(Mailbox[str]):
def __init__(self, name, connection: Connection): ...
class BluetoothMailboxServer(Connection):
def __enter__(self) -> BluetoothMailboxServer: ...
def __exit__(self, type, value, traceback) -> None: ...
def wait_for_connection(self, count: int = 1) -> None: ...
def server_close(self) -> None: ...
class BluetoothMailboxClient(Connection):
def __enter__(self) -> BluetoothMailboxClient: ...
def __exit__(self, type, value, traceback) -> None: ...
def connect(self, brick: str) -> None: ...
def close(self) -> None: ...
+51
View File
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Callable, Optional, Tuple
from ._common import ColorLight
from .iodevices import AnalogSensor
from .parameters import Color, Port
class TouchSensor:
def __init__(self, port: Port): ...
def pressed(self) -> bool: ...
class LightSensor:
def __init__(self, port: Port): ...
def ambient(self) -> int: ...
def reflection(self) -> int: ...
class ColorSensor:
light: ColorLight
def __init__(self, port: Port): ...
def color(self) -> Optional[Color]: ...
def ambient(self) -> int: ...
def reflection(self) -> int: ...
def rgb(self) -> Tuple[int, int, int]: ...
class UltrasonicSensor:
def __init__(self, port: Port): ...
def distance(self) -> int: ...
class SoundSensor:
def __init__(self, port: Port): ...
def intensity(self, audible_only: bool = True) -> int: ...
class TemperatureSensor:
def __init__(self, port: Port): ...
def temperature(self) -> int: ...
class EnergyMeter:
def __init__(self, port: Port): ...
def storage(self) -> int: ...
def input(self) -> Tuple[int, int, int]: ...
def output(self) -> Tuple[int, int, int]: ...
class VernierAdapter(AnalogSensor):
def __init__(
self, port: Port, conversion: Optional[Callable[[int], float]] = None
): ...
def voltage(self) -> int: ...
def conversion(self, voltage: int) -> float: ...
def value(self) -> float: ...
-37
View File
@@ -155,40 +155,3 @@ class Button(_PybricksEnum):
UP = 8
BEACON = 8
RIGHT_UP = 9
class Axis(_PybricksEnum):
"""Unit axes of a coordinate system.
.. data:: X
.. data:: Y
.. data:: Z
Some methods let you measure along all axes at once:
.. data:: ALL
"""
X = (1, 0, 0)
Y = (0, 1, 0)
Z = (0, 0, 1)
ALL = None
class Side(_PybricksEnum):
"""Sides or face of a device such as a hub or a sensor. Such devices are
usually shaped like a rectangular box with six of the following sides:
.. data:: TOP
.. data:: BOTTOM
.. data:: FRONT
.. data:: BACK
.. data:: LEFT
.. data:: RIGHT
"""
RIGHT = 6
FRONT = 0
TOP = 8
LEFT = 4
BACK = 5
BOTTOM = 2
+44
View File
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
class Color:
BLACK: Color
BLUE: Color
GREEN: Color
YELLOW: Color
RED: Color
WHITE: Color
BROWN: Color
ORANGE: Color
PURPLE: Color
class Port:
A: Port
B: Port
C: Port
D: Port
S1: Port
S2: Port
S3: Port
S4: Port
class Stop:
COAST: Stop
BRAKE: Stop
HOLD: Stop
class Direction:
CLOCKWISE: Direction
COUNTERCLOCKWISE: Direction
class Button:
LEFT_DOWN: Button
DOWN: Button
RIGHT_DOWN: Button
LEFT: Button
CENTER: Button
RIGHT: Button
LEFT_UP: Button
UP: Button
BEACON: Button
RIGHT_UP: Button
-137
View File
@@ -1,137 +0,0 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
"""LEGO® Powered Up motor, sensors, and lights."""
from ._common import (KeyPad as _KeyPad, Accelerometer as _Accelerometer,
ColorLight as _ColorLight, Motor as _Motor)
class Motor(_Motor):
"""Generic class to control motors with built-in rotation sensors."""
def reset_angle(self, angle=None):
"""Sets the accumulated rotation angle of the motor to a desired value.
If you don't specify an angle, the absolute angle
will be used if your motor supports it.
Arguments:
angle (:ref:`angle`): Value to which the angle should be reset.
"""
pass
class RemoteControl:
"""LEGO® Powered Up Bluetooth Remote Control/Handset."""
light = _ColorLight()
buttons = _KeyPad()
def __init__(self, device=None, timeout=10000):
"""Connect the handset to the hub.
Arguments:
device (str): Bluetooth address of the handset (? TODO ?).
If you do not specify a device identifier, the hub will
attempt to pair with any handset that is currently in
advertising mode.
timeout (:ref:`time`): The amount of time before giving up
searching.
"""
pass
class TiltSensor(_Accelerometer):
"""LEGO® Powered Up Tilt Sensor."""
def __init__(self, port):
"""TiltSensor(port)
Arguments:
port (Port): Port to which the sensor is connected.
"""
pass
class ColorDistanceSensor:
"""LEGO® Powered Up Color and Distance Sensor."""
light = _ColorLight()
def __init__(self, port):
"""ColorDistanceSensor(port)
Arguments:
port (Port): Port to which the sensor is connected.
"""
pass
def color(self):
"""Measures the color of a surface.
:returns:
``Color.BLACK``, ``Color.BLUE``, ``Color.GREEN``, ``Color.YELLOW``,
``Color.RED``, ``Color.WHITE``, or ``None``.
:rtype: :class:`Color <.parameters.Color>`, or ``None`` if no color is
detected.
"""
pass
def ambient(self):
"""Measures the ambient light intensity.
Returns:
:ref:`percentage`: Ambient light intensity, ranging from 0 (dark)
to 100 (bright).
"""
pass
def reflection(self):
"""Measures the reflection of a surface using a red light.
Returns:
:ref:`percentage`: Reflection, ranging from 0.0 (no reflection) to
100.0 (high reflection).
"""
pass
def rgb(self):
"""Measures the reflection of a surface using a red, green, and then a
blue light.
:returns: Tuple of reflections for red, green, and blue light, each
ranging from 0.0 (no reflection) to 100.0 (high reflection).
:rtype: (:ref:`percentage`, :ref:`percentage`, :ref:`percentage`)
"""
pass
def distance(self):
"""Measures the relative distance between the sensor and an object
using infrared light.
Returns:
:ref:`relativedistance`: Relative distance ranging from 0 (closest)
to 100 (farthest).
"""
pass
def remote(self, channel, button_1=None, button_2=None):
"""Makes the sensor act like a Power Functions 1.0 IR remote.
Choose a channel and up to two buttons to "press". The infrared
receiver behaves just as if responding to the real remote.
The sensor keeps sending the signal (as if you keep pressing the
buttons). It keeps going until you call this method again with
different buttons or no buttons at all.
Arguments:
channel (int): Channel number of the remote.
button_1 (Button): Button of the Power Functions 1.0 IR remote.
Choose ``None`` if you don't want to press
any button.
button_2 (Button): Button of the Power Functions 1.0 IR remote.
Choose ``None`` if you don't want to press
any button.
"""
View File
+34
View File
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Optional, Tuple, overload
from ._common import Control, Motor
class DriveBase:
distance_control: Control
heading_control: Control
def __init__(
self,
left_motor: Motor,
right_motor: Motor,
wheel_diameter: int,
axle_track: int,
): ...
def drive(self, drive_speed: int, turn_rate: int) -> None: ...
def stop(self) -> None: ...
def distance(self) -> int: ...
def angle(self) -> int: ...
def state(self) -> Tuple[int, int, int, int]: ...
def reset(self) -> None: ...
@overload
def settings(self) -> Tuple[int, int, int, int]: ...
@overload
def settings(
self,
straight_speed: Optional[int],
straight_acceleration: Optional[int],
turn_rate: Optional[int],
turn_acceleration: Optional[int],
) -> None: ...
def straight(self, distance: int) -> None: ...
def turn(self, angle: int) -> None: ...
+23
View File
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Any
def wait(time: int) -> None: ...
class StopWatch:
def time(self) -> int: ...
def pause(self) -> None: ...
def resume(self) -> None: ...
def reset(self) -> None: ...
class DataLog:
def __init__(
self,
*headers: str,
name: str = "log",
timestamp: bool = True,
extension: str = "csv",
append: bool = False
): ...
def log(self, *values: Any) -> None: ...
+8 -7
View File
@@ -1,23 +1,24 @@
[tool.poetry]
name = "pybricks"
version = "2.0.0"
version = "2.0.0.post2"
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>" ]
license = "MIT"
readme = "README.rst"
homepage = "https://pybricks.com"
repository = "https://github.com/pybricks/pybricks-api"
documentation = "https://docs.pybricks.com"
repository = "https://github.com/pybricks/pybricks-api/tree/v2"
documentation = "https://pybricks.github.io/ev3-micropython/"
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: Implementation :: MicroPython",
]
include = ["CHANGELOG.md", "pybricks/py.typed"]
[tool.poetry.dependencies]
python = "^3.5"
python = "^3.8"
[tool.poetry.dev-dependencies]
black = {version = "^20.8b1", allow-prereleases = true}
doc8 = "*"
flake8 = "*"
sphinx = "==1.7.9"
@@ -26,5 +27,5 @@ sphinxcontrib-contentui = "==0.2.2"
toml = "^0.10.0"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
+1 -1
View File
@@ -1,6 +1,6 @@
[flake8]
exclude = .venv/
exclude = .venv/,*.pyi
max-line-length = 88
[doc8]