Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion micropython/bluetooth/aioble/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async with aioble.scan(duration_ms=5000, interval_us=30000, window_us=30000, act
# Either from scan result
device = result.device
# Or with known address
device = aioble.Device(aioble.PUBLIC, "aa:bb:cc:dd:ee:ff")
device = aioble.Device(aioble.ADDR_PUBLIC, "aa:bb:cc:dd:ee:ff")

try:
connection = await device.connect(timeout_ms=2000)
Expand Down
4 changes: 2 additions & 2 deletions micropython/bluetooth/aioble/examples/temp_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
_ADV_APPEARANCE_GENERIC_THERMOMETER = const(768)

# How frequently to send advertising beacons.
_ADV_INTERVAL_MS = 250_000
_ADV_INTERVAL_US = 250_000


# Register GATT server.
Expand Down Expand Up @@ -50,7 +50,7 @@ async def sensor_task():
async def peripheral_task():
while True:
async with await aioble.advertise(
_ADV_INTERVAL_MS,
_ADV_INTERVAL_US,
name="mpy-temp",
services=[_ENV_SENSE_UUID],
appearance=_ADV_APPEARANCE_GENERIC_THERMOMETER,
Expand Down
36 changes: 18 additions & 18 deletions micropython/drivers/imu/bmi270/bmi270.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Basic example usage:
Basic example usage::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against this indenting change, but doe we need to make it RST compatible with the double colon?

I'm curious why you made the change / how you found these problems? It's not really supposed to be RST format.

import time
from bmi270 import BMI270
from machine import Pin, SPI, I2C
# Init in I2C mode.
imu = BMI270(I2C(1, scl=Pin(15), sda=Pin(14)))
# Or init in SPI mode.
# TODO: Not supported yet.
# imu = BMI270(SPI(5), cs=Pin(10))
while (True):
print('Accelerometer: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.accel()))
print('Gyroscope: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.gyro()))
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
print("")
time.sleep_ms(100)
import time
from bmi270 import BMI270
from machine import Pin, SPI, I2C
# Init in I2C mode.
imu = BMI270(I2C(1, scl=Pin(15), sda=Pin(14)))
# Or init in SPI mode.
# TODO: Not supported yet.
# imu = BMI270(SPI(5), cs=Pin(10))
while (True):
print('Accelerometer: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.accel()))
print('Gyroscope: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.gyro()))
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
print("")
time.sleep_ms(100)
"""

import array
Expand Down
24 changes: 12 additions & 12 deletions micropython/drivers/imu/bmm150/bmm150.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Basic example usage:
Basic example usage::

import time
from bmm150 import BMM150
from machine import Pin, SPI, I2C
import time
from bmm150 import BMM150
from machine import Pin, SPI, I2C

# Init in I2C mode.
imu = BMM150(I2C(1, scl=Pin(15), sda=Pin(14)))
# Init in I2C mode.
imu = BMM150(I2C(1, scl=Pin(15), sda=Pin(14)))

# Or init in SPI mode.
# TODO: Not supported yet.
# imu = BMM150(SPI(5), cs=Pin(10))
# Or init in SPI mode.
# TODO: Not supported yet.
# imu = BMM150(SPI(5), cs=Pin(10))

while (True):
print('magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
time.sleep_ms(100)
while (True):
print('magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
time.sleep_ms(100)
"""

import array
Expand Down
26 changes: 13 additions & 13 deletions micropython/drivers/imu/lsm6dsox/lsm6dsox.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Basic example usage:
Basic example usage::

import time
from lsm6dsox import LSM6DSOX
import time
from lsm6dsox import LSM6DSOX

from machine import Pin, SPI, I2C
# Init in I2C mode.
lsm = LSM6DSOX(I2C(0, scl=Pin(13), sda=Pin(12)))
from machine import Pin, SPI, I2C
# Init in I2C mode.
lsm = LSM6DSOX(I2C(0, scl=Pin(13), sda=Pin(12)))

# Or init in SPI mode.
#lsm = LSM6DSOX(SPI(5), cs=Pin(10))
# Or init in SPI mode.
#lsm = LSM6DSOX(SPI(5), cs=Pin(10))

while (True):
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.accel()))
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.gyro()))
print("")
time.sleep_ms(100)
while (True):
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.accel()))
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.gyro()))
print("")
time.sleep_ms(100)
"""

import array
Expand Down
24 changes: 12 additions & 12 deletions micropython/drivers/imu/lsm9ds1/lsm9ds1.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
The sensor contains an accelerometer / gyroscope / magnetometer
Uses the internal FIFO to store up to 16 gyro/accel data, use the iter_accel_gyro generator to access it.

Example usage:
Example usage::

import time
from lsm9ds1 import LSM9DS1
from machine import Pin, I2C
import time
from lsm9ds1 import LSM9DS1
from machine import Pin, I2C

imu = LSM9DS1(I2C(1, scl=Pin(15), sda=Pin(14)))
imu = LSM9DS1(I2C(1, scl=Pin(15), sda=Pin(14)))

while (True):
#for g,a in imu.iter_accel_gyro(): print(g,a) # using fifo
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.accel()))
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.gyro()))
print("")
time.sleep_ms(100)
while (True):
#for g,a in imu.iter_accel_gyro(): print(g,a) # using fifo
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.accel()))
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.gyro()))
print("")
time.sleep_ms(100)
"""

import array
Expand Down
3 changes: 2 additions & 1 deletion micropython/drivers/sensor/ds18x20/ds18x20.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# DS18x20 temperature sensor driver for MicroPython.
"""DS18x20 temperature sensor driver for MicroPython."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? If it should be a docstring, then why not also include the below license/copyright line as well?


# MIT license; Copyright (c) 2016 Damien P. George

from micropython import const
Expand Down
24 changes: 13 additions & 11 deletions micropython/drivers/sensor/hs3003/hs3003.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@
THE SOFTWARE.

HS3003 driver for MicroPython.
------------------------------

Example usage:
Example usage::

import time
from hs3003 import HS3003
from machine import Pin, I2C
import time
from hs3003 import HS3003
from machine import Pin, I2C

bus = I2C(1, scl=Pin(15), sda=Pin(14))
hts = HS3003(bus)
bus = I2C(1, scl=Pin(15), sda=Pin(14))
hts = HS3003(bus)

while True:
rH = hts.humidity()
temp = hts.temperature()
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
time.sleep_ms(100)

while True:
rH = hts.humidity()
temp = hts.temperature()
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
time.sleep_ms(100)
"""

import struct
Expand Down
24 changes: 13 additions & 11 deletions micropython/drivers/sensor/hts221/hts221.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@
THE SOFTWARE.

HTS221 driver driver for MicroPython.
-------------------------------------

Original source: https://github.com/ControlEverythingCommunity/HTS221/blob/master/Python/HTS221.py

Example usage:
Example usage::

import time
import hts221
from machine import Pin, I2C
import time
import hts221
from machine import Pin, I2C

bus = I2C(1, scl=Pin(15), sda=Pin(14))
hts = hts221.HTS221(bus)
bus = I2C(1, scl=Pin(15), sda=Pin(14))
hts = hts221.HTS221(bus)

while (True):
rH = hts.humidity()
temp = hts.temperature()
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
time.sleep_ms(100)
while (True):
rH = hts.humidity()
temp = hts.temperature()
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
time.sleep_ms(100)
"""

import struct
Expand Down
6 changes: 3 additions & 3 deletions micropython/ucontextlib/ucontextlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __exit__(self, type, value, traceback):
def contextmanager(func):
"""@contextmanager decorator.

Typical usage:
Typical usage::

@contextmanager
def some_generator(<arguments>):
Expand All @@ -88,12 +88,12 @@ def some_generator(<arguments>):
finally:
<cleanup>

This makes this:
This makes this::

with some_generator(<arguments>) as <variable>:
<body>

equivalent to this:
equivalent to this::

<setup>
try:
Expand Down
3 changes: 2 additions & 1 deletion python-ecosys/iperf3/iperf3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

Supported modes: server & client, TCP & UDP, normal & reverse

Usage:
Usage::

import iperf3
iperf3.server()
iperf3.client('192.168.1.5')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import requests

r = requests.get("http://api.xively.com/")
r = requests.get("https://dummyjson.com/quotes/1")
print(r)
print(r.content)
print(r.text)
Expand Down
39 changes: 20 additions & 19 deletions python-stdlib/cmd/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
Interpreters constructed with this class obey the following conventions:
1. End of file on input is processed as the command 'EOF'.
2. A command is parsed out of each line by collecting the prefix composed
2. A command is parsed out of each line by collecting the prefix composed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it should add a space at the end of the line.

of characters in the identchars member.
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
3. A command 'foo' is dispatched to a method 'do_foo()'; the do_ method
is passed a single argument consisting of the remainder of the line.
4. Typing an empty line repeats the last command. (Actually, it calls the
method `emptyline', which may be overridden in a subclass.)
5. There is a predefined `help' method. Given an argument `topic', it
calls the command `help_topic'. With no arguments, it lists all topics
method ``emptyline``, which may be overridden in a subclass.)
5. There is a predefined ``help`` method. Given an argument 'topic', it
calls the command 'help_topic'. With no arguments, it lists all topics
with defined help_ functions, broken into up to three topics; documented
commands, miscellaneous help topics, and undocumented commands.
6. The command '?' is a synonym for `help'. The command '!' is a synonym
for `shell', if a do_shell method exists.
6. The command '?' is a synonym for 'help'. The command '!' is a synonym
for 'shell', if a do_shell method exists.
7. If completion is enabled, completing commands will be done automatically,
and completing of commands args is done by calling complete_foo() with
arguments text, line, begidx, endidx. text is string we are matching
Expand All @@ -23,32 +23,33 @@
indexes of the text being matched, which could be used to provide
different completion depending upon which position the argument is in.
The `default' method may be overridden to intercept commands for which there
The 'default' method may be overridden to intercept commands for which there
is no do_ method.
The `completedefault' method may be overridden to intercept completions for
The ``completedefault`` method may be overridden to intercept completions for
commands that have no complete_ method.
The data member `self.ruler' sets the character used to draw separator lines
The data member ``self.ruler`` sets the character used to draw separator lines
in the help messages. If empty, no ruler line is drawn. It defaults to "=".
If the value of `self.intro' is nonempty when the cmdloop method is called,
If the value of ``self.intro`` is nonempty when the cmdloop method is called,
it is printed out on interpreter startup. This value may be overridden
via an optional argument to the cmdloop() method.
The data members `self.doc_header', `self.misc_header', and
`self.undoc_header' set the headers used for the help function's
The data members ``self.doc_header``, ``self.misc_header``, and
``self.undoc_header`` set the headers used for the help function's
listings of documented functions, miscellaneous topics, and undocumented
functions respectively.
----------------------------------------------------------------------------
This is a copy of python's Cmd, but leaves out features that aren't relevant
or can't currently be implemented for MicroPython.
.. caution::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't think we should be using RST formatting here.

This is a copy of python's Cmd, but leaves out features that aren't relevant
or can't currently be implemented for MicroPython.
One of the notable deviations is that since MicroPython strips doc strings,
this means that that help by doc string feature doesn't work.
One of the notable deviations is that since MicroPython strips doc strings,
this means that that help by doc string feature doesn't work.
completions have also been stripped out.
completions have also been stripped out.
"""

import sys
Expand Down
4 changes: 2 additions & 2 deletions python-stdlib/contextlib/contextlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
class closing(object):
"""Context to automatically close something at the end of a block.

Code like this:
Code like this::

with closing(<module>.open(<arguments>)) as f:
<block>

is equivalent to this:
is equivalent to this::

f = <module>.open(<arguments>)
try:
Expand Down
2 changes: 1 addition & 1 deletion python-stdlib/copy/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def deepcopy(x, memo=None, _nil=[]):
if copier:
y = copier(memo)
else:
reductor = dispatch_table.get(cls)
reductor = _deepcopy_dispatch.get(cls)
if reductor:
rv = reductor(x)
else:
Expand Down
Loading
Loading