Skip to content

Commit 0d4bc8c

Browse files
committed
initial v1.19.1 merge; not compiled yet
2 parents b71f394 + 9b48634 commit 0d4bc8c

File tree

423 files changed

+11270
-9126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+11270
-9126
lines changed

.git-blame-ignore-revs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
#all: Reformat remaining C code that doesn't have a space after a comma.
2+
5b700b0af90591d6b1a2c087bb8de6b7f1bfdd2d
3+
4+
# ports: Reformat more C and Python source code.
5+
5c32111fa0e31e451b0f1666bdf926be2fdfd82c
6+
7+
# all: Update Python formatting to latest Black version 22.1.0.
8+
ab2923dfa1174dc177f0a90cb00a7e4ff87958d2
9+
10+
# all: Update Python formatting to latest Black version 21.12b0.
11+
3770fab33449a5dadf8eb06edfae0767e75320a6
12+
113
# tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
214
0f78c36c5aa458a954eed39a46942209107a553e
315

docs/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
:mod:`array` -- arrays of numeric data
2-
=======================================
2+
======================================
33

44
.. module:: array
55
:synopsis: efficient arrays of numeric data
66

7-
|see_cpython_module| :mod:`cpython:array`.
7+
|see_cpython_module| :mod:`python:array`.
88

99
Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
1010
``L``, ``q``, ``Q``, ``f``, ``d`` (the latter 2 depending on the

docs/library/binascii.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
:mod:`binascii` -- binary/ASCII conversions
2-
============================================
2+
===========================================
33

44
.. module:: binascii
55
:synopsis: binary/ASCII conversions
66

7-
|see_cpython_module| :mod:`cpython:binascii`.
7+
|see_cpython_module| :mod:`python:binascii`.
88

99
This module implements conversions between binary data and various
1010
encodings of it in ASCII form (in both directions).
@@ -31,11 +31,11 @@ Functions
3131
Conforms to `RFC 2045 s.6.8 <https://tools.ietf.org/html/rfc2045#section-6.8>`_.
3232
Returns a bytes object.
3333

34-
.. function:: b2a_base64(data)
34+
.. function:: b2a_base64(data, *, newline=True)
3535

3636
Encode binary data in base64 format, as in `RFC 3548
3737
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
38-
followed by a newline character, as a bytes object.
38+
followed by a newline character if ``newline``is true, as a bytes object.
3939
4040
.. function:: crc32(data, value=0, /)
4141

docs/library/btree.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:synopsis: simple BTree database
88

99
The ``btree`` module implements a simple key-value database using external
10-
storage (disk files, or in general case, a random-access ``stream``). Keys are
10+
storage (disk files, or in general case, a random-access `stream`). Keys are
1111
stored sorted in the database, and besides efficient retrieval by a key
1212
value, a database also supports efficient ordered range scans (retrieval
1313
of values with the keys in a given range). On the application interface
@@ -80,7 +80,7 @@ Functions
8080

8181
.. function:: open(stream, *, flags=0, pagesize=0, cachesize=0, minkeypage=0)
8282

83-
Open a database from a random-access ``stream`` (like an open file). All
83+
Open a database from a random-access `stream` (like an open file). All
8484
other parameters are optional and keyword-only, and allow to tweak advanced
8585
parameters of the database operation (most users will not need them):
8686

docs/library/builtins.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Functions and types
3333

3434
.. class:: bytes()
3535

36-
|see_cpython| `bytes`.
36+
|see_cpython| `python:bytes`.
3737

3838
.. function:: callable()
3939

@@ -68,7 +68,7 @@ Functions and types
6868

6969
.. class:: frozenset()
7070

71-
`frozenset()` is not enabled on non-Express CircuitPython boards.
71+
`frozenset()` is not enabled on the smallest CircuitPython boards for space reasons.
7272

7373
.. function:: getattr()
7474

@@ -88,12 +88,12 @@ Functions and types
8888

8989
.. classmethod:: from_bytes(bytes, byteorder)
9090

91-
In CircuitPython, ``byteorder`` parameter must be positional (this is
91+
In CircuitPython, the ``byteorder`` parameter must be positional (this is
9292
compatible with CPython).
9393

9494
.. method:: to_bytes(size, byteorder)
9595

96-
In CircuitPython, ``byteorder`` parameter must be positional (this is
96+
In CircuitPython, the ``byteorder`` parameter must be positional (this is
9797
compatible with CPython).
9898

9999
.. function:: isinstance()
@@ -138,7 +138,7 @@ Functions and types
138138

139139
.. function:: reversed()
140140

141-
`reversed()` is not enabled on non-Express CircuitPython boards.
141+
`reversed()` is not enabled on the smallest CircuitPython boards for space reasons.
142142

143143
.. function:: round()
144144

@@ -224,10 +224,14 @@ Exceptions
224224

225225
.. exception:: SystemExit
226226

227+
|see_cpython| `python:SystemExit`.
228+
227229
.. exception:: TimeoutError
228230

229231
.. exception:: TypeError
230232

233+
|see_cpython| `python:TypeError`.
234+
231235
.. exception:: UnicodeError
232236

233237
.. exception:: ValueError

docs/library/collections.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
:mod:`collections` -- collection and container types
2-
=====================================================
2+
====================================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
4+
**Limitations:** Not implemented on the smallest CircuitPython boards for space reasons.
55

66
.. module:: collections
77
:synopsis: collection and container types
88

9-
|see_cpython_module| :mod:`cpython:collections`.
9+
|see_cpython_module| :mod:`python:collections`.
1010

1111
This module implements advanced collection and container types to
1212
hold/accumulate various objects.
1313

1414
Classes
1515
-------
1616

17-
.. function:: deque(iterable, maxlen[, flags])
17+
.. class:: deque(iterable, maxlen[, flags])
1818

1919
Deques (double-ended queues) are a list-like container that support O(1)
2020
appends and pops from either side of the deque. New deques are created
@@ -59,7 +59,7 @@ Classes
5959
print(t1.name)
6060
assert t2.name == t2[1]
6161

62-
.. function:: OrderedDict(...)
62+
.. class:: OrderedDict(...)
6363

6464
``dict`` type subclass which remembers and preserves the order of keys
6565
added. When ordered dict is iterated over, keys/items are returned in

docs/library/errno.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44
.. module:: errno
55
:synopsis: system error codes
66

7-
|see_cpython_module| :mod:`cpython:errno`.
7+
|see_cpython_module| :mod:`python:errno`.
88

99
This module provides access to symbolic error codes for `OSError` exception.
10-
A particular inventory of codes depends on :term:`MicroPython port`.
10+
The codes available may vary per CircuitPython build.
1111

1212
Constants
1313
---------
1414

1515
.. data:: EEXIST, EAGAIN, etc.
1616

1717
Error codes, based on ANSI C/POSIX standard. All error codes start with
18-
"E". As mentioned above, inventory of the codes depends on
19-
:term:`MicroPython port`. Errors are usually accessible as ``exc.args[0]``
18+
"E". Errors are usually accessible as ``exc.errno``
2019
where ``exc`` is an instance of `OSError`. Usage example::
2120

2221
try:
2322
os.mkdir("my_dir")
2423
except OSError as exc:
25-
if exc.args[0] == errno.EEXIST:
24+
if exc.errno == errno.EEXIST:
2625
print("Directory already exists")
2726

2827
.. data:: errorcode

docs/library/gc.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
:mod:`gc` -- control the garbage collector
22
==========================================
33

4-
.. include:: ../templates/unsupported_in_circuitpython.inc
5-
64
.. module:: gc
75
:synopsis: control the garbage collector
86

9-
|see_cpython_module| :mod:`cpython:gc`.
7+
|see_cpython_module| :mod:`python:gc`.
108

119
Functions
1210
---------
@@ -63,6 +61,6 @@ Functions
6361
.. admonition:: Difference to CPython
6462
:class: attention
6563

66-
This function is a a MicroPython extension. CPython has a similar
64+
This function is a MicroPython extension. CPython has a similar
6765
function - ``set_threshold()``, but due to different GC
6866
implementations, its signature and semantics are different.

docs/library/heapq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
.. module:: heapq
77
:synopsis: heap queue algorithm
88

9-
|see_cpython_module| :mod:`cpython:heapq`.
9+
|see_cpython_module| :mod:`python:heapq`.
1010

1111
This module implements the
1212
`min heap queue algorithm <https://en.wikipedia.org/wiki/Heap_%28data_structure%29>`_.

docs/library/index.rst

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CircuitPython's long-term goal is that code written in CircuitPython
1515
using Python standard libraries will be runnable on CPython without changes.
1616

1717
These libraries are not enabled on CircuitPython builds with
18-
limited flash memory, usually on non-Express builds:
18+
limited flash memory:
1919
``binascii``, ``errno``, ``json``, ``re``.
2020

2121
These libraries are not currently enabled in any CircuitPython build, but may be in the future:
@@ -42,21 +42,6 @@ Omitted functions in the ``string`` library
4242
-------------------------------------------
4343

4444
A few string operations are not enabled on small builds
45-
(usually non-Express), due to limited flash memory:
45+
due to limited flash memory:
4646
``string.center()``, ``string.partition()``, ``string.splitlines()``,
4747
``string.reversed()``.
48-
49-
50-
CircuitPython/MicroPython-specific libraries
51-
--------------------------------------------
52-
53-
Functionality specific to the CircuitPython/MicroPython implementation is available in
54-
the following libraries. These libraries may change significantly or be removed in future
55-
versions of CircuitPython.
56-
57-
.. toctree::
58-
:maxdepth: 1
59-
60-
btree.rst
61-
framebuf.rst
62-
micropython.rst

docs/library/io.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
:mod:`io` -- input/output streams
2-
==================================
2+
=================================
33

44
.. module:: io
55
:synopsis: input/output streams
66

7-
|see_cpython_module| :mod:`cpython:io`.
7+
|see_cpython_module| :mod:`python:io`.
88

99
This module contains additional types of ``stream`` (file-like) objects
1010
and helper functions.
@@ -112,3 +112,20 @@ Classes
112112
.. method:: getvalue()
113113

114114
Get the current contents of the underlying buffer which holds data.
115+
116+
.. class:: StringIO(alloc_size)
117+
:noindex:
118+
.. class:: BytesIO(alloc_size)
119+
:noindex:
120+
121+
Create an empty `StringIO`/`BytesIO` object, preallocated to hold up
122+
to *alloc_size* number of bytes. That means that writing that amount
123+
of bytes won't lead to reallocation of the buffer, and thus won't hit
124+
out-of-memory situation or lead to memory fragmentation. These constructors
125+
are a MicroPython extension and are recommended for usage only in special
126+
cases and in system-level libraries, not for end-user applications.
127+
128+
.. admonition:: Difference to CPython
129+
:class: attention
130+
131+
These constructors are a MicroPython extension.

docs/library/json.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
:mod:`json` -- JSON encoding and decoding
2-
==========================================
2+
=========================================
33

44
.. module:: json
55
:synopsis: JSON encoding and decoding
66

7-
|see_cpython_module| :mod:`cpython:json`.
7+
|see_cpython_module| :mod:`python:json`.
88

99
This modules allows to convert between Python objects and the JSON
1010
data format.
1111

1212
Functions
1313
---------
1414

15-
.. function:: dump(obj, stream)
15+
.. function:: dump(obj, stream, separators=None)
1616

1717
Serialise ``obj`` to a JSON string, writing it to the given *stream*.
1818

19-
.. function:: dumps(obj)
19+
If specified, separators should be an ``(item_separator, key_separator)``
20+
tuple. The default is ``(', ', ': ')``. To get the most compact JSON
21+
representation, you should specify ``(',', ':')`` to eliminate whitespace.
22+
23+
.. function:: dumps(obj, separators=None)
2024

2125
Return ``obj`` represented as a JSON string.
2226

27+
The arguments have the same meaning as in `dump`.
28+
2329
.. function:: load(stream)
2430

2531
Parse the given ``stream``, interpreting it as a JSON string and

0 commit comments

Comments
 (0)