Skip to content

Commit 2992784

Browse files
Josverldpgeorge
authored andcommitted
all: Fix formatting errors in docstrings.
No changes to versions as only comments and docstrings changed Signed-off-by: Jos Verlinde <[email protected]>
1 parent 886f136 commit 2992784

File tree

11 files changed

+123
-109
lines changed

11 files changed

+123
-109
lines changed

micropython/drivers/imu/bmi270/bmi270.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,31 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
THE SOFTWARE.
2323
24-
Basic example usage:
24+
Basic example usage::
25+
26+
import time
27+
from bmi270 import BMI270
28+
from machine import Pin, SPI, I2C
29+
30+
# Init in I2C mode.
31+
imu = BMI270(I2C(1, scl=Pin(15), sda=Pin(14)))
32+
33+
# Or init in SPI mode.
34+
# TODO: Not supported yet.
35+
# imu = BMI270(SPI(5), cs=Pin(10))
36+
37+
while (True):
38+
print('Accelerometer: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.accel()))
39+
print('Gyroscope: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.gyro()))
40+
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
41+
print("")
42+
time.sleep_ms(100)
2543
26-
import time
27-
from bmi270 import BMI270
28-
from machine import Pin, SPI, I2C
29-
30-
# Init in I2C mode.
31-
imu = BMI270(I2C(1, scl=Pin(15), sda=Pin(14)))
32-
33-
# Or init in SPI mode.
34-
# TODO: Not supported yet.
35-
# imu = BMI270(SPI(5), cs=Pin(10))
36-
37-
while (True):
38-
print('Accelerometer: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.accel()))
39-
print('Gyroscope: x:{:>6.3f} y:{:>6.3f} z:{:>6.3f}'.format(*imu.gyro()))
40-
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
41-
print("")
42-
time.sleep_ms(100)
4344
"""
4445

4546
import array
4647
import time
48+
4749
from micropython import const
4850

4951
_DEFAULT_ADDR = const(0x68)

micropython/drivers/imu/bmm150/bmm150.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
THE SOFTWARE.
2323
24-
Basic example usage:
24+
Basic example usage::
2525
26-
import time
27-
from bmm150 import BMM150
28-
from machine import Pin, SPI, I2C
26+
import time
27+
from bmm150 import BMM150
28+
from machine import Pin, SPI, I2C
2929
30-
# Init in I2C mode.
31-
imu = BMM150(I2C(1, scl=Pin(15), sda=Pin(14)))
30+
# Init in I2C mode.
31+
imu = BMM150(I2C(1, scl=Pin(15), sda=Pin(14)))
3232
33-
# Or init in SPI mode.
34-
# TODO: Not supported yet.
35-
# imu = BMM150(SPI(5), cs=Pin(10))
33+
# Or init in SPI mode.
34+
# TODO: Not supported yet.
35+
# imu = BMM150(SPI(5), cs=Pin(10))
3636
37-
while (True):
38-
print('magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
39-
time.sleep_ms(100)
37+
while (True):
38+
print('magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
39+
time.sleep_ms(100)
4040
"""
4141

4242
import array

micropython/drivers/imu/lsm6dsox/lsm6dsox.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,24 @@
2525
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2626
THE SOFTWARE.
2727
28-
Basic example usage:
28+
Basic example usage::
2929
30-
import time
31-
from lsm6dsox import LSM6DSOX
30+
import time
31+
from lsm6dsox import LSM6DSOX
32+
33+
from machine import Pin, SPI, I2C
34+
# Init in I2C mode.
35+
lsm = LSM6DSOX(I2C(0, scl=Pin(13), sda=Pin(12)))
3236
33-
from machine import Pin, SPI, I2C
34-
# Init in I2C mode.
35-
lsm = LSM6DSOX(I2C(0, scl=Pin(13), sda=Pin(12)))
37+
# Or init in SPI mode.
38+
#lsm = LSM6DSOX(SPI(5), cs=Pin(10))
3639
37-
# Or init in SPI mode.
38-
#lsm = LSM6DSOX(SPI(5), cs=Pin(10))
40+
while (True):
41+
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.accel()))
42+
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.gyro()))
43+
print("")
44+
time.sleep_ms(100)
3945
40-
while (True):
41-
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.accel()))
42-
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.gyro()))
43-
print("")
44-
time.sleep_ms(100)
4546
"""
4647

4748
import array

micropython/drivers/imu/lsm9ds1/lsm9ds1.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@
2727
The sensor contains an accelerometer / gyroscope / magnetometer
2828
Uses the internal FIFO to store up to 16 gyro/accel data, use the iter_accel_gyro generator to access it.
2929
30-
Example usage:
30+
Example usage::
3131
32-
import time
33-
from lsm9ds1 import LSM9DS1
34-
from machine import Pin, I2C
32+
import time
33+
from lsm9ds1 import LSM9DS1
34+
from machine import Pin, I2C
3535
36-
imu = LSM9DS1(I2C(1, scl=Pin(15), sda=Pin(14)))
36+
imu = LSM9DS1(I2C(1, scl=Pin(15), sda=Pin(14)))
3737
38-
while (True):
39-
#for g,a in imu.iter_accel_gyro(): print(g,a) # using fifo
40-
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.accel()))
41-
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
42-
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.gyro()))
43-
print("")
44-
time.sleep_ms(100)
38+
while (True):
39+
#for g,a in imu.iter_accel_gyro(): print(g,a) # using fifo
40+
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.accel()))
41+
print('Magnetometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.magnet()))
42+
print('Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*imu.gyro()))
43+
print("")
44+
time.sleep_ms(100)
4545
"""
4646

4747
import array

micropython/drivers/sensor/ds18x20/ds18x20.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# DS18x20 temperature sensor driver for MicroPython.
2-
# MIT license; Copyright (c) 2016 Damien P. George
1+
"""
2+
DS18x20 temperature sensor driver for MicroPython.
3+
4+
MIT license; Copyright (c) 2016 Damien P. George
5+
"""
36

47
from micropython import const
58

micropython/drivers/sensor/hs3003/hs3003.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,23 @@
2222
THE SOFTWARE.
2323
2424
HS3003 driver for MicroPython.
25+
------------------------------
2526
2627
Example usage:
2728
28-
import time
29-
from hs3003 import HS3003
30-
from machine import Pin, I2C
29+
import time
30+
from hs3003 import HS3003
31+
from machine import Pin, I2C
3132
32-
bus = I2C(1, scl=Pin(15), sda=Pin(14))
33-
hts = HS3003(bus)
33+
bus = I2C(1, scl=Pin(15), sda=Pin(14))
34+
hts = HS3003(bus)
35+
36+
while True:
37+
rH = hts.humidity()
38+
temp = hts.temperature()
39+
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
40+
time.sleep_ms(100)
3441
35-
while True:
36-
rH = hts.humidity()
37-
temp = hts.temperature()
38-
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
39-
time.sleep_ms(100)
4042
"""
4143

4244
import struct

micropython/drivers/sensor/hts221/hts221.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@
2323
THE SOFTWARE.
2424
2525
HTS221 driver driver for MicroPython.
26+
-------------------------------------
27+
2628
Original source: https://github.com/ControlEverythingCommunity/HTS221/blob/master/Python/HTS221.py
2729
2830
Example usage:
2931
30-
import time
31-
import hts221
32-
from machine import Pin, I2C
32+
import time
33+
import hts221
34+
from machine import Pin, I2C
3335
34-
bus = I2C(1, scl=Pin(15), sda=Pin(14))
35-
hts = hts221.HTS221(bus)
36+
bus = I2C(1, scl=Pin(15), sda=Pin(14))
37+
hts = hts221.HTS221(bus)
3638
37-
while (True):
38-
rH = hts.humidity()
39-
temp = hts.temperature()
40-
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
41-
time.sleep_ms(100)
39+
while (True):
40+
rH = hts.humidity()
41+
temp = hts.temperature()
42+
print ("rH: %.2f%% T: %.2fC" %(rH, temp))
43+
time.sleep_ms(100)
4244
"""
4345

4446
import struct

python-stdlib/cmd/cmd.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
"""A generic class to build line-oriented command interpreters.
1+
"""
2+
A generic class to build line-oriented command interpreters.
23
34
Interpreters constructed with this class obey the following conventions:
45
56
1. End of file on input is processed as the command 'EOF'.
67
2. A command is parsed out of each line by collecting the prefix composed
78
of characters in the identchars member.
8-
3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
9+
3. A command 'foo' is dispatched to a method 'do_foo()'; the do_ method
910
is passed a single argument consisting of the remainder of the line.
1011
4. Typing an empty line repeats the last command. (Actually, it calls the
11-
method `emptyline', which may be overridden in a subclass.)
12-
5. There is a predefined `help' method. Given an argument `topic', it
13-
calls the command `help_topic'. With no arguments, it lists all topics
12+
method 'emptyline', which may be overridden in a subclass.)
13+
5. There is a predefined 'help' method. Given an argument 'topic', it
14+
calls the command 'help_topic'. With no arguments, it lists all topics
1415
with defined help_ functions, broken into up to three topics; documented
1516
commands, miscellaneous help topics, and undocumented commands.
16-
6. The command '?' is a synonym for `help'. The command '!' is a synonym
17-
for `shell', if a do_shell method exists.
17+
6. The command '?' is a synonym for 'help'. The command '!' is a synonym
18+
for 'shell', if a do_shell method exists.
1819
7. If completion is enabled, completing commands will be done automatically,
1920
and completing of commands args is done by calling complete_foo() with
2021
arguments text, line, begidx, endidx. text is string we are matching
@@ -23,21 +24,21 @@
2324
indexes of the text being matched, which could be used to provide
2425
different completion depending upon which position the argument is in.
2526
26-
The `default' method may be overridden to intercept commands for which there
27+
The 'default' method may be overridden to intercept commands for which there
2728
is no do_ method.
2829
29-
The `completedefault' method may be overridden to intercept completions for
30+
The 'completedefault' method may be overridden to intercept completions for
3031
commands that have no complete_ method.
3132
32-
The data member `self.ruler' sets the character used to draw separator lines
33+
The data member 'self.ruler' sets the character used to draw separator lines
3334
in the help messages. If empty, no ruler line is drawn. It defaults to "=".
3435
35-
If the value of `self.intro' is nonempty when the cmdloop method is called,
36+
If the value of 'self.intro' is nonempty when the cmdloop method is called,
3637
it is printed out on interpreter startup. This value may be overridden
3738
via an optional argument to the cmdloop() method.
3839
39-
The data members `self.doc_header', `self.misc_header', and
40-
`self.undoc_header' set the headers used for the help function's
40+
The data members 'self.doc_header', 'self.misc_header', and
41+
'self.undoc_header' set the headers used for the help function's
4142
listings of documented functions, miscellaneous topics, and undocumented
4243
functions respectively.
4344
@@ -48,7 +49,7 @@
4849
One of the notable deviations is that since MicroPython strips doc strings,
4950
this means that that help by doc string feature doesn't work.
5051
51-
completions have also been stripped out.
52+
Completions have also been stripped out.
5253
"""
5354

5455
import sys

python-stdlib/contextlib/contextlib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"""Utilities for with-statement contexts. See PEP 343.
1+
"""
2+
Utilities for with-statement contexts. See PEP 343.
23
34
Original source code: https://hg.python.org/cpython/file/3.4/Lib/contextlib.py
45
56
Not implemented:
67
- redirect_stdout;
7-
88
"""
99

1010
import sys
@@ -15,12 +15,12 @@
1515
class closing(object):
1616
"""Context to automatically close something at the end of a block.
1717
18-
Code like this:
18+
Code like this::
1919
2020
with closing(<module>.open(<arguments>)) as f:
2121
<block>
2222
23-
is equivalent to this:
23+
is equivalent to this::
2424
2525
f = <module>.open(<arguments>)
2626
try:

python-stdlib/heapq/heapq.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""Heap queue algorithm (a.k.a. priority queue).
1+
"""
2+
Heap queue algorithm (a.k.a. priority queue).
23
34
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
45
all k, counting elements from 0. For the sake of comparison,
@@ -7,13 +8,13 @@
78
89
Usage:
910
10-
heap = [] # creates an empty heap
11-
heappush(heap, item) # pushes a new item on the heap
12-
item = heappop(heap) # pops the smallest item from the heap
13-
item = heap[0] # smallest item on the heap without popping it
14-
heapify(x) # transforms list into a heap, in-place, in linear time
15-
item = heapreplace(heap, item) # pops and returns smallest item, and adds
16-
# new item; the heap size is unchanged
11+
heap = [] # creates an empty heap
12+
heappush(heap, item) # pushes a new item on the heap
13+
item = heappop(heap) # pops the smallest item from the heap
14+
item = heap[0] # smallest item on the heap without popping it
15+
heapify(x) # transforms list into a heap, in-place, in linear time
16+
item = heapreplace(heap, item) # pops and returns smallest item, and adds
17+
# new item; the heap size is unchanged
1718
1819
Our API differs from textbook heap algorithms as follows:
1920
@@ -40,7 +41,7 @@
4041
property of a heap is that a[0] is always its smallest element.
4142
4243
The strange invariant above is meant to be an efficient memory
43-
representation for a tournament. The numbers below are `k', not a[k]:
44+
representation for a tournament. The numbers below are 'k', not a[k]::
4445
4546
0
4647
@@ -53,7 +54,7 @@
5354
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
5455
5556
56-
In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In
57+
In the tree above, each cell 'k' is topping '2*k+1' and '2*k+2'. In
5758
an usual binary tournament we see in sports, each cell is the winner
5859
over the two cells it tops, and we can trace the winner down the tree
5960
to see all opponents s/he had. However, in many computer applications
@@ -108,7 +109,7 @@
108109
effective!
109110
110111
In a word, heaps are useful memory structures to know. I use them in
111-
a few applications, and I think it is good to keep a `heap' module
112+
a few applications, and I think it is good to keep a `heap` module
112113
around. :-)
113114
114115
--------------------
@@ -377,7 +378,7 @@ def _siftup_max(heap, pos):
377378
def merge(*iterables):
378379
"""Merge multiple sorted inputs into a single sorted output.
379380
380-
Similar to sorted(itertools.chain(*iterables)) but returns a generator,
381+
Similar to `sorted(itertools.chain(*iterables))` but returns a generator,
381382
does not pull the data into memory all at once, and assumes that each of
382383
the input streams is already sorted (smallest to largest).
383384

0 commit comments

Comments
 (0)