From 2457b2bdf44d5219c89a9541bfa67cf97b9d7d5a Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 3 May 2022 13:49:00 -0400 Subject: [PATCH 1/7] Link to CPython docs for time module --- shared-bindings/time/__init__.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 4b090fc34e..980d012c5c 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -40,7 +40,11 @@ //| //| The `time` module is a strict subset of the CPython `cpython:time` module. So, code //| using `time` written in CircuitPython will work in CPython but not necessarily the other -//| way around.""" +//| way around. +//| +//| For more information about the `time` module, see the CPython documentation: +//| https://docs.python.org/3/library/time.html +//| """ //| //| def monotonic() -> float: //| """Returns an always increasing value of time with an unknown reference From 664a92c2dfc1136ea07286b0a9d47df56305c71a Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 3 May 2022 13:57:22 -0400 Subject: [PATCH 2/7] Add link to CPython math module --- shared-bindings/math/__init__.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 4146112d20..9df8e68169 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -41,7 +41,15 @@ //| """mathematical functions //| //| The `math` module provides some basic mathematical functions for -//| working with floating-point numbers.""" +//| working with floating-point numbers. +//| +//| This library is a subset of the CPython library. All code using this +//| library should function in CPython, but not necessarily the other way +//| around. For more information about the `math` module, see the +//| CPython documentation: +//| +//| https://docs.python.org/3/library/math.html +//| """ //| STATIC NORETURN void math_error(void) { From 5bd8fa684200f1d3214857566564b0367e46ff8d Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 3 May 2022 13:59:13 -0400 Subject: [PATCH 3/7] Add link to CPython random module --- shared-bindings/random/__init__.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 838e1e72ca..87f0bdc6bc 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -44,7 +44,11 @@ //| Once seeded, it will be deterministic, which is why its bad for cryptography. //| //| .. warning:: Numbers from this module are not cryptographically strong! Use -//| bytes from `os.urandom` directly for true randomness.""" +//| bytes from `os.urandom` directly for true randomness. +//| +//| For more information about the `random` module, see the CPython documentation: +//| https://docs.python.org/3/library/random.html +//| """ //| //| from typing import TypeVar //| _T = TypeVar('_T') From de7a90ab00c67b86a9c5b6b46a703665b08f53ab Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 3 May 2022 14:00:52 -0400 Subject: [PATCH 4/7] Add link to CPython os module --- shared-bindings/os/__init__.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 02efd41988..3d468eb70f 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -41,7 +41,11 @@ //| //| The `os` module is a strict subset of the CPython `cpython:os` module. So, //| code written in CircuitPython will work in CPython but not necessarily the -//| other way around.""" +//| other way around. +//| +//| For more information about the `os` module, see the CPython documentation: +//| https://docs.python.org/3/library/os.html +//| """ //| //| import typing From bbc29e84a7aeb5610143004e86e1079b7588d009 Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Tue, 3 May 2022 12:31:20 -0600 Subject: [PATCH 5/7] Add os, "socket", atexit, ssl, struct, traceback, math links --- shared-bindings/atexit/__init__.c | 1 + shared-bindings/math/__init__.c | 7 +------ shared-bindings/os/__init__.c | 7 +------ shared-bindings/socketpool/__init__.c | 3 +++ shared-bindings/ssl/__init__.c | 7 +++++++ shared-bindings/struct/__init__.c | 4 +--- shared-bindings/traceback/__init__.c | 1 + 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index e6d1372ccf..dd27adaa98 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -34,6 +34,7 @@ //| These functions are run in the reverse order in which they were registered; //| if you register ``A``, ``B``, and ``C``, they will be run in the order ``C``, ``B``, ``A``. //| +//| |see_cpython_module| :mod:`cpython:atexit`. //| """ //| ... //| diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 9df8e68169..54dbf004ad 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -43,12 +43,7 @@ //| The `math` module provides some basic mathematical functions for //| working with floating-point numbers. //| -//| This library is a subset of the CPython library. All code using this -//| library should function in CPython, but not necessarily the other way -//| around. For more information about the `math` module, see the -//| CPython documentation: -//| -//| https://docs.python.org/3/library/math.html +//| |see_cpython_module| :mod:`cpython:math`. //| """ //| diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 3d468eb70f..2daca52b85 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -39,12 +39,7 @@ //| """functions that an OS normally provides //| -//| The `os` module is a strict subset of the CPython `cpython:os` module. So, -//| code written in CircuitPython will work in CPython but not necessarily the -//| other way around. -//| -//| For more information about the `os` module, see the CPython documentation: -//| https://docs.python.org/3/library/os.html +//| |see_cpython_module| :mod:`cpython:os`. //| """ //| //| import typing diff --git a/shared-bindings/socketpool/__init__.c b/shared-bindings/socketpool/__init__.c index f10196ab0d..b81aa238c8 100644 --- a/shared-bindings/socketpool/__init__.c +++ b/shared-bindings/socketpool/__init__.c @@ -35,6 +35,9 @@ //| """ //| The `socketpool` module provides sockets through a pool. The pools themselves //| act like CPython's `socket` module. +//| +//| For more infomration about the `socket` module, see the CPython documentation: +//| https://docs.python.org/3/library/socket.html //| """ //| diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 578c51dfbe..8f32582635 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -33,6 +33,13 @@ //| """ //| The `ssl` module provides SSL contexts to wrap sockets in. +//| +//| This module is a strict subset of the CPython `ssl` module. +//| So, code written in CircuitPython will work in CPython but not +//| necessarily the other way around. +//| +//| For more information about the `ssl` module see the CPython documentation +//| https://docs.python.org/3/library/ssl.html //| """ //| diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 84654a3afe..c29c33c1c0 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -40,9 +40,7 @@ //| """Manipulation of c-style data //| -//| This module implements a subset of the corresponding CPython module, -//| as described below. For more information, refer to the original CPython -//| documentation: struct. +//| |see_cpython_module| :mod:`cpython:struct`. //| //| Supported size/byte order prefixes: *@*, *<*, *>*, *!*. //| diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index aa21210494..880fe08e85 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -34,6 +34,7 @@ //| This module provides a standard interface to print stack traces of programs. //| This is useful when you want to print stack traces under program control. //| +//| |see_cpython_module| :mod:`cpython:traceback`. //| """ //| ... //| From 24fb138311f7866ba3bd864aa558e1ebc7cdfaf2 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 3 May 2022 14:56:12 -0400 Subject: [PATCH 6/7] Use shortcut "directive" for subset note --- shared-bindings/random/__init__.c | 10 ++-------- shared-bindings/ssl/__init__.c | 7 +------ shared-bindings/time/__init__.c | 7 +------ 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 87f0bdc6bc..63570fe7e7 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -35,20 +35,14 @@ //| """pseudo-random numbers and choices //| -//| The `random` module is a strict subset of the CPython `cpython:random` -//| module. So, code written in CircuitPython will work in CPython but not -//| necessarily the other way around. +//| |see_cpython_module| :mod:`cpython:random`. //| //| Like its CPython cousin, CircuitPython's random seeds itself on first use //| with a true random from os.urandom() when available or the uptime otherwise. //| Once seeded, it will be deterministic, which is why its bad for cryptography. //| //| .. warning:: Numbers from this module are not cryptographically strong! Use -//| bytes from `os.urandom` directly for true randomness. -//| -//| For more information about the `random` module, see the CPython documentation: -//| https://docs.python.org/3/library/random.html -//| """ +//| bytes from `os.urandom` directly for true randomness.""" //| //| from typing import TypeVar //| _T = TypeVar('_T') diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 8f32582635..6967860054 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -34,12 +34,7 @@ //| """ //| The `ssl` module provides SSL contexts to wrap sockets in. //| -//| This module is a strict subset of the CPython `ssl` module. -//| So, code written in CircuitPython will work in CPython but not -//| necessarily the other way around. -//| -//| For more information about the `ssl` module see the CPython documentation -//| https://docs.python.org/3/library/ssl.html +//| |see_cpython_module| :mod:`cpython:ssl`. //| """ //| diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 980d012c5c..5b16ded0e4 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -38,12 +38,7 @@ //| """time and timing related functions //| -//| The `time` module is a strict subset of the CPython `cpython:time` module. So, code -//| using `time` written in CircuitPython will work in CPython but not necessarily the other -//| way around. -//| -//| For more information about the `time` module, see the CPython documentation: -//| https://docs.python.org/3/library/time.html +//| |see_cpython_module| :mod:`cpython:time`. //| """ //| //| def monotonic() -> float: From 024ab1974b18d9f154cc7f8237827234e4bdd1e9 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Tue, 3 May 2022 16:42:40 -0400 Subject: [PATCH 7/7] Fix typo --- shared-bindings/socketpool/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/socketpool/__init__.c b/shared-bindings/socketpool/__init__.c index b81aa238c8..fee81f2820 100644 --- a/shared-bindings/socketpool/__init__.c +++ b/shared-bindings/socketpool/__init__.c @@ -36,7 +36,7 @@ //| The `socketpool` module provides sockets through a pool. The pools themselves //| act like CPython's `socket` module. //| -//| For more infomration about the `socket` module, see the CPython documentation: +//| For more information about the `socket` module, see the CPython documentation: //| https://docs.python.org/3/library/socket.html //| """ //|