Skip to content

Commit 951eea7

Browse files
authored
Merge pull request #6391 from tekktrik/doc/add-additional-builtins-docs
Add additional documentation for modules, builtin exceptions
2 parents 395b550 + fca1a9b commit 951eea7

File tree

16 files changed

+116
-40
lines changed

16 files changed

+116
-40
lines changed

docs/library/builtins.rst

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
All builtin functions and exceptions are described here. They are also
55
available via ``builtins`` module.
66

7+
For more information about built-ins, see the following CPython documentation:
8+
9+
* `Builtin CPython Functions <https://docs.python.org/3/library/functions.html>`_
10+
* `Builtin CPython Exceptions <https://docs.python.org/3/library/exceptions.html>`_
11+
* `Builtin CPython Constants <https://docs.python.org/3/library/constants.html>`_
12+
13+
.. note:: Not all of these functions, types, exceptions, and constants are turned
14+
on in all CircuitPython ports, for space reasons.
15+
716
Functions and types
817
-------------------
918

10-
Not all of these functions and types are turned on in all CircuitPython ports, for space reasons.
11-
1219
.. function:: abs()
1320

1421
.. function:: all()
@@ -160,46 +167,77 @@ Not all of these functions and types are turned on in all CircuitPython ports, f
160167
Exceptions
161168
----------
162169

170+
.. exception:: ArithmeticError
171+
163172
.. exception:: AssertionError
164173

165174
.. exception:: AttributeError
166175

176+
.. exception:: BaseException
177+
178+
.. exception:: BrokenPipeError
179+
180+
.. exception:: ConnectionError
181+
182+
.. exception:: EOFError
183+
167184
.. exception:: Exception
168185

169186
.. exception:: ImportError
170187

188+
.. exception:: IndentationError
189+
171190
.. exception:: IndexError
172191

173192
.. exception:: KeyboardInterrupt
174193

175194
.. exception:: KeyError
176195

196+
.. exception:: LookupError
197+
177198
.. exception:: MemoryError
178199

200+
.. exception:: MpyError
201+
202+
Not a part of the CPython standard library
203+
179204
.. exception:: NameError
180205

181206
.. exception:: NotImplementedError
182207

183208
.. exception:: OSError
184209

210+
.. exception:: OverflowError
211+
185212
.. exception:: RuntimeError
186213

187214
.. exception:: ReloadException
188215

189216
`ReloadException` is used internally to deal with soft restarts.
190217

218+
Not a part of the CPython standard library
219+
220+
.. exception:: StopAsyncIteration
221+
191222
.. exception:: StopIteration
192223

193224
.. exception:: SyntaxError
194225

195226
.. exception:: SystemExit
196227

197-
|see_cpython| :py:class:`cpython:SystemExit`.
228+
.. exception:: TimeoutError
198229

199230
.. exception:: TypeError
200231

201-
|see_cpython| :py:class:`cpython:TypeError`.
232+
.. exception:: UnicodeError
202233

203234
.. exception:: ValueError
204235

205236
.. exception:: ZeroDivisionError
237+
238+
Constants
239+
---------
240+
241+
.. data:: Ellipsis
242+
243+
.. data:: NotImplemented

ports/raspberrypi/bindings/rp2pio/__init__.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
#include "bindings/rp2pio/StateMachine.h"
3131
#include "bindings/rp2pio/__init__.h"
3232

33-
//| """Hardware interface to RP2 series' programmable IO (PIO) peripheral."""
33+
//| """Hardware interface to RP2 series' programmable IO (PIO) peripheral.
34+
//|
35+
//| .. note:: This module is intended to be used with the `adafruit_pioasm library
36+
//| <https://github.com/adafruit/Adafruit_CircuitPython_PIOASM>`_. For an
37+
//| introduction and guide to working with PIO in CircuitPython, see `this
38+
//| Learn guide <https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython>`_.
39+
//|
40+
//| """
3441
//|
3542

3643
//| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool:

shared-bindings/alarm/__init__.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
//|
5656
//| For both light sleep and deep sleep, if CircuitPython is connected to a host computer,
5757
//| maintaining the connection takes priority and power consumption may not be reduced.
58+
//|
59+
//| For more information about working with alarms and light/deep sleep in CircuitPython,
60+
//| see `this Learn guide <https://learn.adafruit.com/deep-sleep-with-circuitpython>`_.
5861
//| """
5962

6063
//| sleep_memory: SleepMemory

shared-bindings/analogio/__init__.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@
5959
//| :py:meth:`~analogio.AnalogIn.deinit` the hardware. The last step is optional
6060
//| because CircuitPython will do it automatically after the program finishes.
6161
//|
62-
//| For the essentials of `analogio`, see the CircuitPython Essentials
63-
//| Learn guide:
64-
//| https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-in
62+
//| For the essentials of `analogio`, see the `CircuitPython Essentials
63+
//| Learn guide <https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-in>`_
6564
//|
66-
//| For more information on using `analogio`, see this additional Learn guide:
67-
//| https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs
65+
//| For more information on using `analogio`, see `this additional Learn guide
66+
//| <https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs>`_
6867
//| """
6968
//|
7069

shared-bindings/audiomp3/__init__.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131

3232
#include "shared-bindings/audiomp3/MP3Decoder.h"
3333

34-
//| """Support for MP3-compressed audio files"""
34+
//| """Support for MP3-compressed audio files
35+
//|
36+
//| For more infomration about working with MP3 files in CircuitPython,
37+
//| see `this CircuitPython Essentials Learn guide page
38+
//| <https://learn.adafruit.com/circuitpython-essentials/circuitpython-mp3-audio>`_.
39+
//| """
3540
//|
3641

3742
STATIC const mp_rom_map_elem_t audiomp3_module_globals_table[] = {

shared-bindings/bitmaptools/__init__.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@
4343
#include "extmod/vfs_posix.h"
4444
#endif
4545

46-
//| """Collection of bitmap manipulation tools"""
46+
//| """Collection of bitmap manipulation tools
47+
//|
48+
//| .. note:: If you're looking for information about displaying bitmaps on
49+
//| screens in CircuitPython, see `this Learn guide
50+
//| <https://learn.adafruit.com/circuitpython-display-support-using-displayio>`_
51+
//| for information about using the :py:mod:`displayio` module.
52+
//| """
4753
//|
4854

4955
STATIC int16_t validate_point(mp_obj_t point, int16_t default_value) {

shared-bindings/board/__init__.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
//| the default pins and settings. For more information about serial communcication
4848
//| in CircuitPython, see the :mod:`busio`.
4949
//|
50-
//| For more information regarding the typical usage of :py:mod:`board`, refer to the CircuitPython
51-
//| Essentials Learn guide:
52-
//| https://learn.adafruit.com/circuitpython-essentials/circuitpython-pins-and-modules
50+
//| For more information regarding the typical usage of :py:mod:`board`, refer to the `CircuitPython
51+
//| Essentials Learn guide
52+
//| <https://learn.adafruit.com/circuitpython-essentials/circuitpython-pins-and-modules>`_
5353
//|
5454
//| .. warning:: The board module varies by board. The APIs documented here may or may not be
5555
//| available on a specific board."""

shared-bindings/digitalio/__init__.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,11 @@
7373
//| led.value = False
7474
//| time.sleep(0.1)
7575
//|
76-
//| For the essentials of `digitalio`, see the CircuitPython Essentials
77-
//| Learn guide:
78-
//| https://learn.adafruit.com/circuitpython-essentials/circuitpython-digital-in-out
76+
//| For the essentials of `digitalio`, see the `CircuitPython Essentials
77+
//| Learn guide <https://learn.adafruit.com/circuitpython-essentials/circuitpython-digital-in-out>`_
7978
//|
80-
//| For more information on using `digitalio`, see this additional Learn guide:
81-
//| https://learn.adafruit.com/circuitpython-digital-inputs-and-outputs
79+
//| For more information on using `digitalio`, see `this additional Learn guide
80+
//| <https://learn.adafruit.com/circuitpython-digital-inputs-and-outputs>`_
8281
//| """
8382

8483
STATIC const mp_rom_map_elem_t digitalio_module_globals_table[] = {

shared-bindings/displayio/__init__.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
//| The `displayio` module contains classes to manage display output
5252
//| including synchronizing with refresh rates and partial updating.
5353
//|
54-
//| For more a more thorugh explanation and guide for using `displayio`, please
55-
//| refer to this Learn guide:
56-
//| https://learn.adafruit.com/circuitpython-display-support-using-displayio
54+
//| For more a more thorough explanation and guide for using `displayio`, please
55+
//| refer to `this Learn guide
56+
//| <https://learn.adafruit.com/circuitpython-display-support-using-displayio>`_.
5757
//| """
5858
//|
5959

shared-bindings/fontio/__init__.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@
3333
#include "shared-bindings/fontio/BuiltinFont.h"
3434
#include "shared-bindings/fontio/Glyph.h"
3535

36-
//| """Core font related data structures"""
36+
//| """Core font related data structures
37+
//|
38+
//| .. note:: This module is intended only for low-level usage. For working with
39+
//| fonts in CircuitPython see the `adafruit_bitmap_font library
40+
//| <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_.
41+
//| For information on creating custom fonts for use in CircuitPython, see
42+
//| `this Learn guide <https://learn.adafruit.com/custom-fonts-for-pyportal-circuitpython-display>`_
43+
//|
44+
//| """
3745
//|
3846

3947
STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = {

0 commit comments

Comments
 (0)