diff options
Diffstat (limited to 'docs/library')
29 files changed, 136 insertions, 136 deletions
diff --git a/docs/library/array.rst b/docs/library/array.rst index 9fa82ff31b..88d6d2263c 100644 --- a/docs/library/array.rst +++ b/docs/library/array.rst @@ -1,7 +1,7 @@ -:mod:`uarray` -- arrays of numeric data -======================================= +:mod:`array` -- arrays of numeric data +====================================== -.. module:: uarray +.. module:: array :synopsis: efficient arrays of numeric data |see_cpython_module| :mod:`python:array`. diff --git a/docs/library/binascii.rst b/docs/library/binascii.rst index 721b80508e..fc621a8abe 100644 --- a/docs/library/binascii.rst +++ b/docs/library/binascii.rst @@ -1,7 +1,7 @@ -:mod:`ubinascii` -- binary/ASCII conversions -============================================ +:mod:`binascii` -- binary/ASCII conversions +=========================================== -.. module:: ubinascii +.. module:: binascii :synopsis: binary/ASCII conversions |see_cpython_module| :mod:`python:binascii`. diff --git a/docs/library/bluetooth.rst b/docs/library/bluetooth.rst index 3d435a7bed..f110bfb195 100644 --- a/docs/library/bluetooth.rst +++ b/docs/library/bluetooth.rst @@ -1,7 +1,7 @@ -:mod:`ubluetooth` --- low-level Bluetooth -========================================= +:mod:`bluetooth` --- low-level Bluetooth +======================================== -.. module:: ubluetooth +.. module:: bluetooth :synopsis: Low-level Bluetooth radio functionality This module provides an interface to a Bluetooth controller on a board. @@ -110,7 +110,7 @@ Event Handling **Note:** As an optimisation to prevent unnecessary allocations, the ``addr``, ``adv_data``, ``char_data``, ``notify_data``, and ``uuid`` entries in the - tuples are read-only memoryview instances pointing to ubluetooth's internal + tuples are read-only memoryview instances pointing to :mod:`bluetooth`'s internal ringbuffer, and are only valid during the invocation of the IRQ handler function. If your program needs to save one of these values to access after 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:: _PASSKEY_ACTION_NUMERIC_COMPARISON = const(4) In order to save space in the firmware, these constants are not included on the -:mod:`ubluetooth` module. Add the ones that you need from the list above to your +:mod:`bluetooth` module. Add the ones that you need from the list above to your program. diff --git a/docs/library/btree.rst b/docs/library/btree.rst index ba91085210..c093f970fa 100644 --- a/docs/library/btree.rst +++ b/docs/library/btree.rst @@ -22,7 +22,7 @@ Example:: # First, we need to open a stream which holds a database # This is usually a file, but can be in-memory database - # using uio.BytesIO, a raw flash partition, etc. + # using io.BytesIO, a raw flash partition, etc. # Oftentimes, you want to create a database file if it doesn't # exist and open if it exists. Idiom below takes care of this. # DO NOT open database with "a+b" access mode. diff --git a/docs/library/collections.rst b/docs/library/collections.rst index b833842c13..21f06fded7 100644 --- a/docs/library/collections.rst +++ b/docs/library/collections.rst @@ -1,7 +1,7 @@ -:mod:`ucollections` -- collection and container types -===================================================== +:mod:`collections` -- collection and container types +==================================================== -.. module:: ucollections +.. module:: collections :synopsis: collection and container types |see_cpython_module| :mod:`python:collections`. @@ -49,7 +49,7 @@ Classes a string with space-separated field named (but this is less efficient). Example of use:: - from ucollections import namedtuple + from collections import namedtuple MyTuple = namedtuple("MyTuple", ("id", "name")) t1 = MyTuple(1, "foo") @@ -63,7 +63,7 @@ Classes added. When ordered dict is iterated over, keys/items are returned in the order they were added:: - from ucollections import OrderedDict + from collections import OrderedDict # To make benefit of ordered keys, OrderedDict should be initialized # from sequence of (key, value) pairs. diff --git a/docs/library/cryptolib.rst b/docs/library/cryptolib.rst index 79471c2e90..e02fb0d226 100644 --- a/docs/library/cryptolib.rst +++ b/docs/library/cryptolib.rst @@ -1,7 +1,7 @@ -:mod:`ucryptolib` -- cryptographic ciphers -========================================== +:mod:`cryptolib` -- cryptographic ciphers +========================================= -.. module:: ucryptolib +.. module:: cryptolib :synopsis: cryptographic ciphers Classes @@ -21,9 +21,9 @@ Classes * *key* is an encryption/decryption key (bytes-like). * *mode* is: - * ``1`` (or ``ucryptolib.MODE_ECB`` if it exists) for Electronic Code Book (ECB). - * ``2`` (or ``ucryptolib.MODE_CBC`` if it exists) for Cipher Block Chaining (CBC). - * ``6`` (or ``ucryptolib.MODE_CTR`` if it exists) for Counter mode (CTR). + * ``1`` (or ``cryptolib.MODE_ECB`` if it exists) for Electronic Code Book (ECB). + * ``2`` (or ``cryptolib.MODE_CBC`` if it exists) for Cipher Block Chaining (CBC). + * ``6`` (or ``cryptolib.MODE_CTR`` if it exists) for Counter mode (CTR). * *IV* is an initialization vector for CBC mode. * For Counter mode, *IV* is the initial value for the counter. diff --git a/docs/library/errno.rst b/docs/library/errno.rst index 1d60c80e11..82303bfcb4 100644 --- a/docs/library/errno.rst +++ b/docs/library/errno.rst @@ -1,7 +1,7 @@ -:mod:`uerrno` -- system error codes -=================================== +:mod:`errno` -- system error codes +================================== -.. module:: uerrno +.. module:: errno :synopsis: system error codes |see_cpython_module| :mod:`python:errno`. @@ -20,9 +20,9 @@ Constants where ``exc`` is an instance of `OSError`. Usage example:: try: - uos.mkdir("my_dir") + os.mkdir("my_dir") except OSError as exc: - if exc.errno == uerrno.EEXIST: + if exc.errno == errno.EEXIST: print("Directory already exists") .. data:: errorcode @@ -30,5 +30,5 @@ Constants Dictionary mapping numeric error codes to strings with symbolic error code (see above):: - >>> print(uerrno.errorcode[uerrno.EEXIST]) + >>> print(errno.errorcode[errno.EEXIST]) EEXIST diff --git a/docs/library/esp32.rst b/docs/library/esp32.rst index fc90968037..e3c25d2653 100644 --- a/docs/library/esp32.rst +++ b/docs/library/esp32.rst @@ -91,7 +91,7 @@ methods to enable over-the-air (OTA) updates. These methods implement the simple and :ref:`extended <block-device-interface>` block protocol defined by - :class:`uos.AbstractBlockDev`. + :class:`os.AbstractBlockDev`. .. method:: Partition.set_boot() diff --git a/docs/library/hashlib.rst b/docs/library/hashlib.rst index e1eddd2b71..e5d8dd880b 100644 --- a/docs/library/hashlib.rst +++ b/docs/library/hashlib.rst @@ -1,7 +1,7 @@ -:mod:`uhashlib` -- hashing algorithms -===================================== +:mod:`hashlib` -- hashing algorithms +==================================== -.. module:: uhashlib +.. module:: hashlib :synopsis: hashing algorithms |see_cpython_module| :mod:`python:hashlib`. @@ -27,15 +27,15 @@ be implemented: Constructors ------------ -.. class:: uhashlib.sha256([data]) +.. class:: hashlib.sha256([data]) Create an SHA256 hasher object and optionally feed ``data`` into it. -.. class:: uhashlib.sha1([data]) +.. class:: hashlib.sha1([data]) Create an SHA1 hasher object and optionally feed ``data`` into it. -.. class:: uhashlib.md5([data]) +.. class:: hashlib.md5([data]) Create an MD5 hasher object and optionally feed ``data`` into it. @@ -53,5 +53,5 @@ Methods .. method:: hash.hexdigest() - This method is NOT implemented. Use ``ubinascii.hexlify(hash.digest())`` + This method is NOT implemented. Use ``binascii.hexlify(hash.digest())`` to achieve a similar effect. diff --git a/docs/library/heapq.rst b/docs/library/heapq.rst index 9ae1f61a17..5e808d544a 100644 --- a/docs/library/heapq.rst +++ b/docs/library/heapq.rst @@ -1,7 +1,7 @@ -:mod:`uheapq` -- heap queue algorithm -===================================== +:mod:`heapq` -- heap queue algorithm +==================================== -.. module:: uheapq +.. module:: heapq :synopsis: heap queue algorithm |see_cpython_module| :mod:`python:heapq`. diff --git a/docs/library/index.rst b/docs/library/index.rst index 638941fa5e..9af4fec056 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -56,7 +56,7 @@ The following standard Python libraries have been "micro-ified" to fit in with the philosophy of MicroPython. They provide the core functionality of that module and are intended to be a drop-in replacement for the standard Python library. Some modules below use a standard Python name, but prefixed with "u", -e.g. ``ujson`` instead of ``json``. This is to signify that such a module is +e.g. ``json`` instead of ``json``. This is to signify that such a module is micro-library, i.e. implements only a subset of CPython module functionality. By naming them differently, a user has a choice to write a Python-level module 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 non-u-name can be overridden by a file of that name in your library path (``sys.path``). For example, ``import json`` will first search for a file ``json.py`` (or package directory ``json``) and load that module if it is found. If nothing is found, -it will fallback to loading the built-in ``ujson`` module. +it will fallback to loading the built-in ``json`` module. .. toctree:: :maxdepth: 1 diff --git a/docs/library/io.rst b/docs/library/io.rst index adbeef08b7..6b4b9f1a47 100644 --- a/docs/library/io.rst +++ b/docs/library/io.rst @@ -1,7 +1,7 @@ -:mod:`uio` -- input/output streams -================================== +:mod:`io` -- input/output streams +================================= -.. module:: uio +.. module:: io :synopsis: input/output streams |see_cpython_module| :mod:`python:io`. diff --git a/docs/library/json.rst b/docs/library/json.rst index 65ed1867e6..f1d6364f4f 100644 --- a/docs/library/json.rst +++ b/docs/library/json.rst @@ -1,7 +1,7 @@ -:mod:`ujson` -- JSON encoding and decoding -========================================== +:mod:`json` -- JSON encoding and decoding +========================================= -.. module:: ujson +.. module:: json :synopsis: JSON encoding and decoding |see_cpython_module| :mod:`python:json`. diff --git a/docs/library/machine.SDCard.rst b/docs/library/machine.SDCard.rst index b1cf42ec02..96fb5b01c8 100644 --- a/docs/library/machine.SDCard.rst +++ b/docs/library/machine.SDCard.rst @@ -27,10 +27,10 @@ vary from platform to platform. This class provides access to SD or MMC storage cards using either a dedicated SD/MMC interface hardware or through an SPI channel. - The class implements the block protocol defined by :class:`uos.AbstractBlockDev`. + The class implements the block protocol defined by :class:`os.AbstractBlockDev`. This allows the mounting of an SD card to be as simple as:: - uos.mount(machine.SDCard(), "/sd") + os.mount(machine.SDCard(), "/sd") The constructor takes the following parameters: diff --git a/docs/library/network.WLAN.rst b/docs/library/network.WLAN.rst index 35e4b798ae..72091d0ea5 100644 --- a/docs/library/network.WLAN.rst +++ b/docs/library/network.WLAN.rst @@ -55,7 +55,7 @@ Methods (ssid, bssid, channel, RSSI, authmode, hidden) *bssid* is hardware address of an access point, in binary form, returned as - bytes object. You can use `ubinascii.hexlify()` to convert it to ASCII form. + bytes object. You can use `binascii.hexlify()` to convert it to ASCII form. There are five values for authmode: diff --git a/docs/library/network.rst b/docs/library/network.rst index a20eb2ebf5..c188bb3135 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -9,7 +9,7 @@ This module provides network drivers and routing configuration. To use this module, a MicroPython variant/build with network capabilities must be installed. Network drivers for specific hardware are available within this module and are used to configure hardware network interface(s). Network services provided -by configured interfaces are then available for use via the :mod:`usocket` +by configured interfaces are then available for use via the :mod:`socket` module. For example:: @@ -17,17 +17,17 @@ For example:: # connect/ show IP config a specific network interface # see below for examples of specific drivers import network - import utime + import time nic = network.Driver(...) if not nic.isconnected(): nic.connect() print("Waiting for connection...") while not nic.isconnected(): - utime.sleep(1) + time.sleep(1) print(nic.ifconfig()) - # now use usocket as usual - import usocket as socket + # now use socket as usual + import socket as socket addr = socket.getaddrinfo('micropython.org', 80)[0][-1] s = socket.socket() s.connect(addr) diff --git a/docs/library/os.rst b/docs/library/os.rst index edc94556b1..a1eae4f245 100644 --- a/docs/library/os.rst +++ b/docs/library/os.rst @@ -1,12 +1,12 @@ -:mod:`uos` -- basic "operating system" services -=============================================== +:mod:`os` -- basic "operating system" services +============================================== -.. module:: uos +.. module:: os :synopsis: basic "operating system" services |see_cpython_module| :mod:`python:os`. -The ``uos`` module contains functions for filesystem access and mounting, +The ``os`` module contains functions for filesystem access and mounting, terminal redirection and duplication, and the ``uname`` and ``urandom`` functions. @@ -116,7 +116,7 @@ Terminal redirection and duplication Duplicate or switch the MicroPython terminal (the REPL) on the given `stream`-like object. The *stream_object* argument must be a native stream object, or derive - from ``uio.IOBase`` and implement the ``readinto()`` and + from ``io.IOBase`` and implement the ``readinto()`` and ``write()`` methods. The stream should be in non-blocking mode and ``readinto()`` should return ``None`` if there is no data available for reading. @@ -207,7 +207,7 @@ represented by VFS classes. otherwise the timestamps will remain untouched. Littlefs v2 filesystems without timestamps will work without reformatting and timestamps will be added transparently to existing files once they are opened for writing. When *mtime* - is enabled `uos.stat` on files without timestamps will return 0 for the timestamp. + is enabled `os.stat` on files without timestamps will return 0 for the timestamp. See :ref:`filesystem` for more information. @@ -234,7 +234,7 @@ but an actual block device class must implement the methods described below. A concrete implementation of this class will usually allow access to the memory-like functionality of a piece of hardware (like flash memory). A block -device can be formatted to any supported filesystem and mounted using ``uos`` +device can be formatted to any supported filesystem and mounted using ``os`` methods. See :ref:`filesystem` for example implementations of block devices using the diff --git a/docs/library/pyb.Flash.rst b/docs/library/pyb.Flash.rst index 4b0c2ce2aa..01b3a0ac9e 100644 --- a/docs/library/pyb.Flash.rst +++ b/docs/library/pyb.Flash.rst @@ -43,7 +43,7 @@ Methods These methods implement the simple and :ref:`extended <block-device-interface>` block protocol defined by - :class:`uos.AbstractBlockDev`. + :class:`os.AbstractBlockDev`. Hardware Note ------------- diff --git a/docs/library/pyb.rst b/docs/library/pyb.rst index 321be3c52f..880d68c531 100644 --- a/docs/library/pyb.rst +++ b/docs/library/pyb.rst @@ -213,11 +213,11 @@ Miscellaneous functions .. function:: mount(device, mountpoint, *, readonly=False, mkfs=False) .. note:: This function is deprecated. Mounting and unmounting devices should - be performed by :meth:`uos.mount` and :meth:`uos.umount` instead. + be performed by :meth:`os.mount` and :meth:`os.umount` instead. Mount a block device and make it available as part of the filesystem. ``device`` must be an object that provides the block protocol. (The - following is also deprecated. See :class:`uos.AbstractBlockDev` for the + following is also deprecated. See :class:`os.AbstractBlockDev` for the correct way to create a block device.) - ``readblocks(self, blocknum, buf)`` diff --git a/docs/library/re.rst b/docs/library/re.rst index e94d286175..19b15d2d2c 100644 --- a/docs/library/re.rst +++ b/docs/library/re.rst @@ -1,7 +1,7 @@ -:mod:`ure` -- simple regular expressions -======================================== +:mod:`re` -- simple regular expressions +======================================= -.. module:: ure +.. module:: re :synopsis: regular expressions |see_cpython_module| :mod:`python:re`. @@ -95,11 +95,11 @@ Supported operators and special sequences are: Example:: - import ure + import re - # As ure doesn't support escapes itself, use of r"" strings is not + # As re doesn't support escapes itself, use of r"" strings is not # recommended. - regex = ure.compile("[\r\n]") + regex = re.compile("[\r\n]") regex.split("line1\rline2\nline3\r\n") @@ -152,7 +152,7 @@ Regex objects ------------- Compiled regular expression. Instances of this class are created using -`ure.compile()`. +`re.compile()`. .. method:: regex.match(string) regex.search(string) diff --git a/docs/library/rp2.Flash.rst b/docs/library/rp2.Flash.rst index 3b423adfdd..1e94cf519c 100644 --- a/docs/library/rp2.Flash.rst +++ b/docs/library/rp2.Flash.rst @@ -32,5 +32,5 @@ Methods These methods implement the simple and extended :ref:`block protocol <block-device-interface>` defined by - :class:`uos.AbstractBlockDev`. + :class:`os.AbstractBlockDev`. diff --git a/docs/library/select.rst b/docs/library/select.rst index 76202739c8..57adbb49af 100644 --- a/docs/library/select.rst +++ b/docs/library/select.rst @@ -1,7 +1,7 @@ -:mod:`uselect` -- wait for events on a set of streams -======================================================================== +:mod:`select` -- wait for events on a set of streams +==================================================== -.. module:: uselect +.. module:: select :synopsis: wait for events on a set of streams |see_cpython_module| :mod:`python:select`. @@ -35,15 +35,15 @@ Methods Register `stream` *obj* for polling. *eventmask* is logical OR of: - * ``uselect.POLLIN`` - data available for reading - * ``uselect.POLLOUT`` - more data can be written + * ``select.POLLIN`` - data available for reading + * ``select.POLLOUT`` - more data can be written - Note that flags like ``uselect.POLLHUP`` and ``uselect.POLLERR`` are + Note that flags like ``select.POLLHUP`` and ``select.POLLERR`` are *not* valid as input eventmask (these are unsolicited events which will be returned from `poll()` regardless of whether they are asked for). This semantics is per POSIX. - *eventmask* defaults to ``uselect.POLLIN | uselect.POLLOUT``. + *eventmask* defaults to ``select.POLLIN | select.POLLOUT``. It is OK to call this function multiple times for the same *obj*. Successive calls will update *obj*'s eventmask to the value of @@ -67,8 +67,8 @@ Methods Returns list of (``obj``, ``event``, ...) tuples. There may be other elements in tuple, depending on a platform and version, so don't assume that its size is 2. The ``event`` element specifies which events happened with a stream and - is a combination of ``uselect.POLL*`` constants described above. Note that - flags ``uselect.POLLHUP`` and ``uselect.POLLERR`` can be returned at any time + is a combination of ``select.POLL*`` constants described above. Note that + flags ``select.POLLHUP`` and ``select.POLLERR`` can be returned at any time (even if were not asked for), and must be acted on accordingly (the corresponding stream unregistered from poll and likely closed), because otherwise all further invocations of `poll()` may return immediately with diff --git a/docs/library/socket.rst b/docs/library/socket.rst index 39b848e593..704b614ab1 100644 --- a/docs/library/socket.rst +++ b/docs/library/socket.rst @@ -1,8 +1,8 @@ -******************************* -:mod:`usocket` -- socket module -******************************* +****************************** +:mod:`socket` -- socket module +****************************** -.. module:: usocket +.. module:: socket :synopsis: socket module |see_cpython_module| :mod:`python:socket`. @@ -21,13 +21,13 @@ This module provides access to the BSD socket interface. Socket address format(s) ------------------------ -The native socket address format of the ``usocket`` module is an opaque data type +The native socket address format of the ``socket`` module is an opaque data type returned by `getaddrinfo` function, which must be used to resolve textual address (including numeric addresses):: - sockaddr = usocket.getaddrinfo('www.micropython.org', 80)[0][-1] + sockaddr = socket.getaddrinfo('www.micropython.org', 80)[0][-1] # You must use getaddrinfo() even for numeric addresses - sockaddr = usocket.getaddrinfo('127.0.0.1', 80)[0][-1] + sockaddr = socket.getaddrinfo('127.0.0.1', 80)[0][-1] # Now you can use that address sock.connect(addr) @@ -35,7 +35,7 @@ Using `getaddrinfo` is the most efficient (both in terms of memory and processin power) and portable way to work with addresses. However, ``socket`` module (note the difference with native MicroPython -``usocket`` module described here) provides CPython-compatible way to specify +``socket`` module described here) provides CPython-compatible way to specify addresses using tuples, as described below. Note that depending on a :term:`MicroPython port`, ``socket`` module can be builtin or need to be installed from `micropython-lib` (as in the case of :term:`MicroPython Unix port`), @@ -54,13 +54,13 @@ Tuple address format for ``socket`` module: dot-notation numeric IPv4 address, e.g. ``"8.8.8.8"``, and *port* is and integer port number in the range 1-65535. Note the domain names are not accepted as *ipv4_address*, they should be resolved first using - `usocket.getaddrinfo()`. + `socket.getaddrinfo()`. * IPv6: *(ipv6_address, port, flowinfo, scopeid)*, where *ipv6_address* is a string with colon-notation numeric IPv6 address, e.g. ``"2001:db8::1"``, and *port* is an integer port number in the range 1-65535. *flowinfo* must be 0. *scopeid* is the interface scope identifier for link-local addresses. Note the domain names are not accepted as *ipv6_address*, - they should be resolved first using `usocket.getaddrinfo()`. Availability + they should be resolved first using `socket.getaddrinfo()`. Availability of IPv6 support depends on a :term:`MicroPython port`. Functions @@ -94,17 +94,17 @@ Functions The following example shows how to connect to a given url:: - s = usocket.socket() + s = socket.socket() # This assumes that if "type" is not specified, an address for # SOCK_STREAM will be returned, which may be not true - s.connect(usocket.getaddrinfo('www.micropython.org', 80)[0][-1]) + s.connect(socket.getaddrinfo('www.micropython.org', 80)[0][-1]) Recommended use of filtering params:: - s = usocket.socket() + s = socket.socket() # Guaranteed to return an address which can be connect'ed to for # stream operation. - s.connect(usocket.getaddrinfo('www.micropython.org', 80, 0, SOCK_STREAM)[0][-1]) + s.connect(socket.getaddrinfo('www.micropython.org', 80, 0, SOCK_STREAM)[0][-1]) .. admonition:: Difference to CPython :class: attention @@ -113,7 +113,7 @@ Functions of error in this function. MicroPython doesn't have ``socket.gaierror`` and raises OSError directly. Note that error numbers of `getaddrinfo()` form a separate namespace and may not match error numbers from - the :mod:`uerrno` module. To distinguish `getaddrinfo()` errors, they are + the :mod:`errno` module. To distinguish `getaddrinfo()` errors, they are represented by negative numbers, whereas standard system errors are positive numbers (error numbers are accessible using ``e.args[0]`` property from an exception object). The use of negative values is a provisional @@ -124,7 +124,7 @@ Functions Convert a binary network address *bin_addr* of the given address family *af* to a textual representation:: - >>> usocket.inet_ntop(usocket.AF_INET, b"\x7f\0\0\1") + >>> socket.inet_ntop(socket.AF_INET, b"\x7f\0\0\1") '127.0.0.1' .. function:: inet_pton(af, txt_addr) @@ -132,7 +132,7 @@ Functions Convert a textual network address *txt_addr* of the given address family *af* to a binary representation:: - >>> usocket.inet_pton(usocket.AF_INET, "1.2.3.4") + >>> socket.inet_pton(socket.AF_INET, "1.2.3.4") b'\x01\x02\x03\x04' Constants @@ -152,17 +152,17 @@ Constants IPPROTO_TCP IP protocol numbers. Availability depends on a particular :term:`MicroPython port`. - Note that you don't need to specify these in a call to `usocket.socket()`, + Note that you don't need to specify these in a call to `socket.socket()`, because `SOCK_STREAM` socket type automatically selects `IPPROTO_TCP`, and `SOCK_DGRAM` - `IPPROTO_UDP`. Thus, the only real use of these constants is as an argument to `setsockopt()`. -.. data:: usocket.SOL_* +.. data:: socket.SOL_* Socket option levels (an argument to `setsockopt()`). The exact inventory depends on a :term:`MicroPython port`. -.. data:: usocket.SO_* +.. data:: socket.SO_* Socket options (an argument to `setsockopt()`). The exact inventory depends on a :term:`MicroPython port`. @@ -260,7 +260,7 @@ Methods is put in blocking mode. Not every :term:`MicroPython port` supports this method. A more portable and - generic solution is to use `uselect.poll` object. This allows to wait on + generic solution is to use `select.poll` object. This allows to wait on multiple objects at the same time (and not just on sockets, but on generic `stream` objects which support polling). Example:: @@ -269,8 +269,8 @@ Methods s.read(10) # may timeout # Use: - poller = uselect.poll() - poller.register(s, uselect.POLLIN) + poller = select.poll() + poller.register(s, select.POLLIN) res = poller.poll(1000) # time in milliseconds if not res: # s is still not ready for input, i.e. operation timed out @@ -342,7 +342,7 @@ Methods Return value: number of bytes written. -.. exception:: usocket.error +.. exception:: socket.error MicroPython does NOT have this exception. diff --git a/docs/library/ssl.rst b/docs/library/ssl.rst index 77d278d41d..4726daa59b 100644 --- a/docs/library/ssl.rst +++ b/docs/library/ssl.rst @@ -1,7 +1,7 @@ -:mod:`ussl` -- SSL/TLS module -============================= +:mod:`ssl` -- SSL/TLS module +============================ -.. module:: ussl +.. module:: ssl :synopsis: TLS/SSL wrapper for socket objects |see_cpython_module| :mod:`python:ssl`. @@ -13,14 +13,14 @@ facilities for network sockets, both client-side and server-side. Functions --------- -.. function:: ussl.wrap_socket(sock, server_side=False, keyfile=None, certfile=None, cert_reqs=CERT_NONE, ca_certs=None, do_handshake=True) +.. function:: ssl.wrap_socket(sock, server_side=False, keyfile=None, certfile=None, cert_reqs=CERT_NONE, ca_certs=None, do_handshake=True) - Takes a `stream` *sock* (usually usocket.socket instance of ``SOCK_STREAM`` type), + Takes a `stream` *sock* (usually socket.socket instance of ``SOCK_STREAM`` type), and returns an instance of ssl.SSLSocket, which wraps the underlying stream in an SSL context. Returned object has the usual `stream` interface methods like ``read()``, ``write()``, etc. A server-side SSL socket should be created from a normal socket returned from - :meth:`~usocket.socket.accept()` on a non-SSL listening server socket. + :meth:`~socket.socket.accept()` on a non-SSL listening server socket. - *do_handshake* determines whether the handshake is done as part of the ``wrap_socket`` or whether it is deferred to be done as part of the initial reads or writes @@ -36,7 +36,7 @@ Functions .. warning:: - Some implementations of ``ussl`` module do NOT validate server certificates, + Some implementations of ``ssl`` module do NOT validate server certificates, which makes an SSL connection established prone to man-in-the-middle attacks. CPython's ``wrap_socket`` returns an ``SSLSocket`` object which has methods typical @@ -54,8 +54,8 @@ Exceptions Constants --------- -.. data:: ussl.CERT_NONE - ussl.CERT_OPTIONAL - ussl.CERT_REQUIRED +.. data:: ssl.CERT_NONE + ssl.CERT_OPTIONAL + ssl.CERT_REQUIRED Supported values for *cert_reqs* parameter. diff --git a/docs/library/struct.rst b/docs/library/struct.rst index bfcd84e2d8..92757aba8d 100644 --- a/docs/library/struct.rst +++ b/docs/library/struct.rst @@ -1,7 +1,7 @@ -:mod:`ustruct` -- pack and unpack primitive data types -====================================================== +:mod:`struct` -- pack and unpack primitive data types +===================================================== -.. module:: ustruct +.. module:: struct :synopsis: pack and unpack primitive data types |see_cpython_module| :mod:`python:struct`. diff --git a/docs/library/sys.rst b/docs/library/sys.rst index 9601643850..24f9e353bb 100644 --- a/docs/library/sys.rst +++ b/docs/library/sys.rst @@ -1,7 +1,7 @@ -:mod:`usys` -- system specific functions -======================================== +:mod:`sys` -- system specific functions +======================================= -.. module:: usys +.. module:: sys :synopsis: system specific functions |see_cpython_module| :mod:`python:sys`. @@ -28,10 +28,10 @@ Functions This function is a MicroPython extension intended to provide similar functionality to the :mod:`atexit` module in CPython. -.. function:: print_exception(exc, file=usys.stdout, /) +.. function:: print_exception(exc, file=sys.stdout, /) Print exception with a traceback to a file-like object *file* (or - `usys.stdout` by default). + `sys.stdout` by default). .. admonition:: Difference to CPython :class: attention @@ -84,7 +84,7 @@ Constants value directly, but instead count number of bits in it:: bits = 0 - v = usys.maxsize + v = sys.maxsize while v: bits += 1 v >>= 1 @@ -113,7 +113,7 @@ Constants is an identifier of a board, e.g. ``"pyboard"`` for the original MicroPython reference board. It thus can be used to distinguish one board from another. If you need to check whether your program runs on MicroPython (vs other - Python implementation), use `usys.implementation` instead. + Python implementation), use `sys.implementation` instead. .. data:: stderr diff --git a/docs/library/time.rst b/docs/library/time.rst index ef2a572aa4..6ca172f221 100644 --- a/docs/library/time.rst +++ b/docs/library/time.rst @@ -1,12 +1,12 @@ -:mod:`utime` -- time related functions -====================================== +:mod:`time` -- time related functions +===================================== -.. module:: utime +.. module:: time :synopsis: time related functions |see_cpython_module| :mod:`python:time`. -The ``utime`` module provides functions for getting the current time and date, +The ``time`` module provides functions for getting the current time and date, measuring time intervals, and for delays. **Time Epoch**: Unix port uses standard for POSIX systems epoch of @@ -119,7 +119,7 @@ Functions in the system. This is usually CPU clocks, and that's why the function is named that way. But it doesn't have to be a CPU clock, some other timing source available in a system (e.g. high-resolution timer) can be used instead. The exact timing unit - (resolution) of this function is not specified on ``utime`` module level, but + (resolution) of this function is not specified on ``time`` module level, but documentation for a specific port may provide more specific information. This function is intended for very fine benchmarking or very tight real-time loops. Avoid using it in portable code. diff --git a/docs/library/uctypes.rst b/docs/library/uctypes.rst index b3343beb7e..803ddacdce 100644 --- a/docs/library/uctypes.rst +++ b/docs/library/uctypes.rst @@ -19,7 +19,7 @@ sub-fields. .. seealso:: - Module :mod:`ustruct` + Module :mod:`struct` Standard Python way to access binary data structures (doesn't scale well to large and complex structures). diff --git a/docs/library/zlib.rst b/docs/library/zlib.rst index d40c46145a..96d6c24523 100644 --- a/docs/library/zlib.rst +++ b/docs/library/zlib.rst @@ -1,7 +1,7 @@ -:mod:`uzlib` -- zlib decompression -================================== +:mod:`zlib` -- zlib decompression +================================= -.. module:: uzlib +.. module:: zlib :synopsis: zlib decompression |see_cpython_module| :mod:`python:zlib`. |