Skip to content

Commit c737cde

Browse files
jimmodpgeorge
authored andcommitted
docs: Replace ufoo with foo in all docs.
Anywhere a module is mentioned, use its "non-u" name for consistency. The "import module" vs "import umodule" is something of a FAQ, and this commit intends to help clear that up. As a first approximation MicroPython is Python, and so imports should work the same as Python and use the same name, to a first approximation. The u-version of a module is a detail that can be learned later on, when the user wants to understand more and have finer control over importing. Existing Python code should just work, as much as it is possible to do that within the constraints of embedded systems, and the MicroPython documentation should match the idiomatic way to write Python code. With universal weak links for modules (via MICROPY_MODULE_WEAK_LINKS) users can consistently use "import foo" across all ports (with the exception of the minimal ports). And the ability to override/extend via "foo.py" continues to work well. Signed-off-by: Jim Mussared <[email protected]>
1 parent 2186063 commit c737cde

Some content is hidden

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

42 files changed

+175
-175
lines changed

docs/develop/library.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ An example is the ``gc`` module discussed in :ref:`memorymanagement`.
3434
>>> gc.enable()
3535
>>>
3636
37-
MicroPython has several other builtin standard/core modules like ``io``, ``uarray`` etc.
37+
MicroPython has several other builtin standard/core modules like ``io``, ``array`` etc.
3838
Adding a new core module involves several modifications.
3939

4040
First, create the ``C`` file in the ``py/`` directory. In this example we are adding a

docs/develop/porting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ That should give a MicroPython REPL. You can then run commands like:
245245
.. code-block:: bash
246246
247247
MicroPython v1.13 on 2021-01-01; example-board with unknown-cpu
248-
>>> import usys
249-
>>> usys.implementation
248+
>>> import sys
249+
>>> sys.implementation
250250
('micropython', (1, 13, 0))
251251
>>>
252252

docs/esp32/quickref.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ A useful function for connecting to your local WiFi network is::
9898
pass
9999
print('network config:', wlan.ifconfig())
100100

101-
Once the network is established the :mod:`socket <usocket>` module can be used
101+
Once the network is established the :mod:`socket <socket>` module can be used
102102
to create and use TCP/UDP sockets as usual, and the ``urequests`` module for
103103
convenient HTTP requests.
104104

@@ -113,7 +113,7 @@ to reconnect forever).
113113
Delay and timing
114114
----------------
115115

116-
Use the :mod:`time <utime>` module::
116+
Use the :mod:`time <time>` module::
117117

118118
import time
119119

@@ -459,15 +459,15 @@ SD card
459459

460460
See :ref:`machine.SDCard <machine.SDCard>`. ::
461461

462-
import machine, uos
462+
import machine, os
463463

464464
# Slot 2 uses pins sck=18, cs=5, miso=19, mosi=23
465465
sd = machine.SDCard(slot=2)
466-
uos.mount(sd, "/sd") # mount
466+
os.mount(sd, "/sd") # mount
467467

468-
uos.listdir('/sd') # list directory contents
468+
os.listdir('/sd') # list directory contents
469469

470-
uos.umount('/sd') # eject
470+
os.umount('/sd') # eject
471471

472472
RMT
473473
---

docs/esp8266/general.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Real-time clock
117117

118118
RTC in ESP8266 has very bad accuracy, drift may be seconds per minute. As
119119
a workaround, to measure short enough intervals you can use
120-
``utime.time()``, etc. functions, and for wall clock time, synchronize from
120+
``time.time()``, etc. functions, and for wall clock time, synchronize from
121121
the net using included ``ntptime.py`` module.
122122

123123
Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
@@ -203,7 +203,7 @@ limitation with usage of TLS on the low-memory devices:
203203
communication with other devices.
204204

205205
There are also some not implemented features specifically in MicroPython's
206-
``ussl`` module based on axTLS:
206+
``ssl`` module based on axTLS:
207207

208208
6. Certificates are not validated (this makes connections susceptible
209209
to man-in-the-middle attacks).

docs/esp8266/quickref.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ A useful function for connecting to your local WiFi network is::
7878
pass
7979
print('network config:', wlan.ifconfig())
8080

81-
Once the network is established the :mod:`socket <usocket>` module can be used
81+
Once the network is established the :mod:`socket <socket>` module can be used
8282
to create and use TCP/UDP sockets as usual.
8383

8484
Delay and timing
8585
----------------
8686

87-
Use the :mod:`time <utime>` module::
87+
Use the :mod:`time <time>` module::
8888

8989
import time
9090

@@ -171,15 +171,15 @@ attaches the REPL).
171171

172172
To detach the REPL from UART0, use::
173173

174-
import uos
175-
uos.dupterm(None, 1)
174+
import os
175+
os.dupterm(None, 1)
176176

177177
The REPL is attached by default. If you have detached it, to reattach
178178
it use::
179179

180-
import uos, machine
180+
import os, machine
181181
uart = machine.UART(0, 115200)
182-
uos.dupterm(uart, 1)
182+
os.dupterm(uart, 1)
183183

184184
PWM (pulse width modulation)
185185
----------------------------

docs/library/array.rst

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

4-
.. module:: uarray
4+
.. module:: array
55
:synopsis: efficient arrays of numeric data
66

77
|see_cpython_module| :mod:`python:array`.

docs/library/binascii.rst

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

4-
.. module:: ubinascii
4+
.. module:: binascii
55
:synopsis: binary/ASCII conversions
66

77
|see_cpython_module| :mod:`python:binascii`.

docs/library/bluetooth.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:mod:`ubluetooth` --- low-level Bluetooth
2-
=========================================
1+
:mod:`bluetooth` --- low-level Bluetooth
2+
========================================
33

4-
.. module:: ubluetooth
4+
.. module:: bluetooth
55
:synopsis: Low-level Bluetooth radio functionality
66

77
This module provides an interface to a Bluetooth controller on a board.
@@ -110,7 +110,7 @@ Event Handling
110110

111111
**Note:** As an optimisation to prevent unnecessary allocations, the ``addr``,
112112
``adv_data``, ``char_data``, ``notify_data``, and ``uuid`` entries in the
113-
tuples are read-only memoryview instances pointing to ubluetooth's internal
113+
tuples are read-only memoryview instances pointing to :mod:`bluetooth`'s internal
114114
ringbuffer, and are only valid during the invocation of the IRQ handler
115115
function. If your program needs to save one of these values to access after
116116
the IRQ handler has returned (e.g. by saving it in a class instance or global
@@ -293,7 +293,7 @@ For the ``_IRQ_PASSKEY_ACTION`` event, the available actions are::
293293
_PASSKEY_ACTION_NUMERIC_COMPARISON = const(4)
294294

295295
In order to save space in the firmware, these constants are not included on the
296-
:mod:`ubluetooth` module. Add the ones that you need from the list above to your
296+
:mod:`bluetooth` module. Add the ones that you need from the list above to your
297297
program.
298298

299299

docs/library/btree.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Example::
2222

2323
# First, we need to open a stream which holds a database
2424
# This is usually a file, but can be in-memory database
25-
# using uio.BytesIO, a raw flash partition, etc.
25+
# using io.BytesIO, a raw flash partition, etc.
2626
# Oftentimes, you want to create a database file if it doesn't
2727
# exist and open if it exists. Idiom below takes care of this.
2828
# DO NOT open database with "a+b" access mode.

docs/library/collections.rst

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

4-
.. module:: ucollections
4+
.. module:: collections
55
:synopsis: collection and container types
66

77
|see_cpython_module| :mod:`python:collections`.
@@ -49,7 +49,7 @@ Classes
4949
a string with space-separated field named (but this is less efficient).
5050
Example of use::
5151

52-
from ucollections import namedtuple
52+
from collections import namedtuple
5353

5454
MyTuple = namedtuple("MyTuple", ("id", "name"))
5555
t1 = MyTuple(1, "foo")
@@ -63,7 +63,7 @@ Classes
6363
added. When ordered dict is iterated over, keys/items are returned in
6464
the order they were added::
6565

66-
from ucollections import OrderedDict
66+
from collections import OrderedDict
6767

6868
# To make benefit of ordered keys, OrderedDict should be initialized
6969
# from sequence of (key, value) pairs.

docs/library/cryptolib.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:mod:`ucryptolib` -- cryptographic ciphers
2-
==========================================
1+
:mod:`cryptolib` -- cryptographic ciphers
2+
=========================================
33

4-
.. module:: ucryptolib
4+
.. module:: cryptolib
55
:synopsis: cryptographic ciphers
66

77
Classes
@@ -21,9 +21,9 @@ Classes
2121
* *key* is an encryption/decryption key (bytes-like).
2222
* *mode* is:
2323

24-
* ``1`` (or ``ucryptolib.MODE_ECB`` if it exists) for Electronic Code Book (ECB).
25-
* ``2`` (or ``ucryptolib.MODE_CBC`` if it exists) for Cipher Block Chaining (CBC).
26-
* ``6`` (or ``ucryptolib.MODE_CTR`` if it exists) for Counter mode (CTR).
24+
* ``1`` (or ``cryptolib.MODE_ECB`` if it exists) for Electronic Code Book (ECB).
25+
* ``2`` (or ``cryptolib.MODE_CBC`` if it exists) for Cipher Block Chaining (CBC).
26+
* ``6`` (or ``cryptolib.MODE_CTR`` if it exists) for Counter mode (CTR).
2727

2828
* *IV* is an initialization vector for CBC mode.
2929
* For Counter mode, *IV* is the initial value for the counter.

docs/library/errno.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:mod:`uerrno` -- system error codes
2-
===================================
1+
:mod:`errno` -- system error codes
2+
==================================
33

4-
.. module:: uerrno
4+
.. module:: errno
55
:synopsis: system error codes
66

77
|see_cpython_module| :mod:`python:errno`.
@@ -20,15 +20,15 @@ Constants
2020
where ``exc`` is an instance of `OSError`. Usage example::
2121

2222
try:
23-
uos.mkdir("my_dir")
23+
os.mkdir("my_dir")
2424
except OSError as exc:
25-
if exc.errno == uerrno.EEXIST:
25+
if exc.errno == errno.EEXIST:
2626
print("Directory already exists")
2727

2828
.. data:: errorcode
2929

3030
Dictionary mapping numeric error codes to strings with symbolic error
3131
code (see above)::
3232

33-
>>> print(uerrno.errorcode[uerrno.EEXIST])
33+
>>> print(errno.errorcode[errno.EEXIST])
3434
EEXIST

docs/library/esp32.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ methods to enable over-the-air (OTA) updates.
9191

9292
These methods implement the simple and :ref:`extended
9393
<block-device-interface>` block protocol defined by
94-
:class:`uos.AbstractBlockDev`.
94+
:class:`os.AbstractBlockDev`.
9595

9696
.. method:: Partition.set_boot()
9797

docs/library/hashlib.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:mod:`uhashlib` -- hashing algorithms
2-
=====================================
1+
:mod:`hashlib` -- hashing algorithms
2+
====================================
33

4-
.. module:: uhashlib
4+
.. module:: hashlib
55
:synopsis: hashing algorithms
66

77
|see_cpython_module| :mod:`python:hashlib`.
@@ -27,15 +27,15 @@ be implemented:
2727
Constructors
2828
------------
2929

30-
.. class:: uhashlib.sha256([data])
30+
.. class:: hashlib.sha256([data])
3131

3232
Create an SHA256 hasher object and optionally feed ``data`` into it.
3333

34-
.. class:: uhashlib.sha1([data])
34+
.. class:: hashlib.sha1([data])
3535

3636
Create an SHA1 hasher object and optionally feed ``data`` into it.
3737

38-
.. class:: uhashlib.md5([data])
38+
.. class:: hashlib.md5([data])
3939

4040
Create an MD5 hasher object and optionally feed ``data`` into it.
4141

@@ -53,5 +53,5 @@ Methods
5353

5454
.. method:: hash.hexdigest()
5555

56-
This method is NOT implemented. Use ``ubinascii.hexlify(hash.digest())``
56+
This method is NOT implemented. Use ``binascii.hexlify(hash.digest())``
5757
to achieve a similar effect.

docs/library/heapq.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:mod:`uheapq` -- heap queue algorithm
2-
=====================================
1+
:mod:`heapq` -- heap queue algorithm
2+
====================================
33

4-
.. module:: uheapq
4+
.. module:: heapq
55
:synopsis: heap queue algorithm
66

77
|see_cpython_module| :mod:`python:heapq`.

docs/library/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The following standard Python libraries have been "micro-ified" to fit in with
5656
the philosophy of MicroPython. They provide the core functionality of that
5757
module and are intended to be a drop-in replacement for the standard Python
5858
library. Some modules below use a standard Python name, but prefixed with "u",
59-
e.g. ``ujson`` instead of ``json``. This is to signify that such a module is
59+
e.g. ``json`` instead of ``json``. This is to signify that such a module is
6060
micro-library, i.e. implements only a subset of CPython module functionality.
6161
By naming them differently, a user has a choice to write a Python-level module
6262
to extend functionality for better compatibility with CPython (indeed, this is
@@ -68,7 +68,7 @@ are available both by their u-name, and also by their non-u-name. The
6868
non-u-name can be overridden by a file of that name in your library path (``sys.path``).
6969
For example, ``import json`` will first search for a file ``json.py`` (or package
7070
directory ``json``) and load that module if it is found. If nothing is found,
71-
it will fallback to loading the built-in ``ujson`` module.
71+
it will fallback to loading the built-in ``json`` module.
7272

7373
.. toctree::
7474
:maxdepth: 1

docs/library/io.rst

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

4-
.. module:: uio
4+
.. module:: io
55
:synopsis: input/output streams
66

77
|see_cpython_module| :mod:`python:io`.

docs/library/json.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
:mod:`ujson` -- JSON encoding and decoding
2-
==========================================
1+
:mod:`json` -- JSON encoding and decoding
2+
=========================================
33

4-
.. module:: ujson
4+
.. module:: json
55
:synopsis: JSON encoding and decoding
66

77
|see_cpython_module| :mod:`python:json`.

docs/library/machine.SDCard.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ vary from platform to platform.
2727

2828
This class provides access to SD or MMC storage cards using either
2929
a dedicated SD/MMC interface hardware or through an SPI channel.
30-
The class implements the block protocol defined by :class:`uos.AbstractBlockDev`.
30+
The class implements the block protocol defined by :class:`os.AbstractBlockDev`.
3131
This allows the mounting of an SD card to be as simple as::
3232

33-
uos.mount(machine.SDCard(), "/sd")
33+
os.mount(machine.SDCard(), "/sd")
3434

3535
The constructor takes the following parameters:
3636

docs/library/network.WLAN.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Methods
5555
(ssid, bssid, channel, RSSI, authmode, hidden)
5656

5757
*bssid* is hardware address of an access point, in binary form, returned as
58-
bytes object. You can use `ubinascii.hexlify()` to convert it to ASCII form.
58+
bytes object. You can use `binascii.hexlify()` to convert it to ASCII form.
5959

6060
There are five values for authmode:
6161

0 commit comments

Comments
 (0)