docs/{micropython,sys,uos}: Use markup adhering to the latest docs conventions.

pull/3173/merge
Paul Sokolovsky 2017-06-28 00:37:47 +03:00
rodzic 3e82bedf46
commit f8ac28964d
3 zmienionych plików z 26 dodań i 26 usunięć

Wyświetl plik

@ -23,30 +23,30 @@ Functions
variable, and does not take up any memory during execution. variable, and does not take up any memory during execution.
This `const` function is recognised directly by the MicroPython parser and is This `const` function is recognised directly by the MicroPython parser and is
provided as part of the `micropython` module mainly so that scripts can be provided as part of the :mod:`micropython` module mainly so that scripts can be
written which run under both CPython and MicroPython, by following the above written which run under both CPython and MicroPython, by following the above
pattern. pattern.
.. function:: opt_level([level]) .. function:: opt_level([level])
If `level` is given then this function sets the optimisation level for subsequent If *level* is given then this function sets the optimisation level for subsequent
compilation of scripts, and returns `None`. Otherwise it returns the current compilation of scripts, and returns ``None``. Otherwise it returns the current
optimisation level. optimisation level.
.. function:: alloc_emergency_exception_buf(size) .. function:: alloc_emergency_exception_buf(size)
Allocate ``size`` bytes of RAM for the emergency exception buffer (a good Allocate *size* bytes of RAM for the emergency exception buffer (a good
size is around 100 bytes). The buffer is used to create exceptions in cases size is around 100 bytes). The buffer is used to create exceptions in cases
when normal RAM allocation would fail (eg within an interrupt handler) and when normal RAM allocation would fail (eg within an interrupt handler) and
therefore give useful traceback information in these situations. therefore give useful traceback information in these situations.
A good way to use this function is to put it at the start of your main script A good way to use this function is to put it at the start of your main script
(eg boot.py or main.py) and then the emergency exception buffer will be active (eg ``boot.py`` or ``main.py``) and then the emergency exception buffer will be active
for all the code following it. for all the code following it.
.. function:: mem_info([verbose]) .. function:: mem_info([verbose])
Print information about currently used memory. If the ``verbose`` argument Print information about currently used memory. If the *verbose`* argument
is given then extra information is printed. is given then extra information is printed.
The information that is printed is implementation dependent, but currently The information that is printed is implementation dependent, but currently
@ -55,7 +55,7 @@ Functions
.. function:: qstr_info([verbose]) .. function:: qstr_info([verbose])
Print information about currently interned strings. If the ``verbose`` Print information about currently interned strings. If the *verbose*
argument is given then extra information is printed. argument is given then extra information is printed.
The information that is printed is implementation dependent, but currently The information that is printed is implementation dependent, but currently
@ -89,10 +89,10 @@ Functions
incoming stream of characters that is usually used for the REPL, in case incoming stream of characters that is usually used for the REPL, in case
that stream is used for other purposes. that stream is used for other purposes.
.. function:: schedule(fun, arg) .. function:: schedule(func, arg)
Schedule the function `fun` to be executed "very soon". The function Schedule the function *func* to be executed "very soon". The function
is passed the value `arg` as its single argument. "very soon" means that is passed the value *arg* as its single argument. "Very soon" means that
the MicroPython runtime will do its best to execute the function at the the MicroPython runtime will do its best to execute the function at the
earliest possible time, given that it is also trying to be efficient, and earliest possible time, given that it is also trying to be efficient, and
that the following conditions hold: that the following conditions hold:

Wyświetl plik

@ -10,13 +10,13 @@ Functions
.. function:: exit(retval=0) .. function:: exit(retval=0)
Terminate current program with a given exit code. Underlyingly, this Terminate current program with a given exit code. Underlyingly, this
function raise as ``SystemExit`` exception. If an argument is given, its function raise as `SystemExit` exception. If an argument is given, its
value given as an argument to ``SystemExit``. value given as an argument to `SystemExit`.
.. function:: print_exception(exc, file=sys.stdout) .. function:: print_exception(exc, file=sys.stdout)
Print exception with a traceback to a file-like object `file` (or Print exception with a traceback to a file-like object *file* (or
``sys.stdout`` by default). `sys.stdout` by default).
.. admonition:: Difference to CPython .. admonition:: Difference to CPython
:class: attention :class: attention
@ -24,7 +24,7 @@ Functions
This is simplified version of a function which appears in the This is simplified version of a function which appears in the
``traceback`` module in CPython. Unlike ``traceback.print_exception()``, ``traceback`` module in CPython. Unlike ``traceback.print_exception()``,
this function takes just exception value instead of exception type, this function takes just exception value instead of exception type,
exception value, and traceback object; `file` argument should be exception value, and traceback object; *file* argument should be
positional; further arguments are not supported. CPython-compatible positional; further arguments are not supported. CPython-compatible
``traceback`` module can be found in micropython-lib. ``traceback`` module can be found in micropython-lib.
@ -37,15 +37,15 @@ Constants
.. data:: byteorder .. data:: byteorder
The byte order of the system ("little" or "big"). The byte order of the system (``"little"`` or ``"big"``).
.. data:: implementation .. data:: implementation
Object with information about the current Python implementation. For Object with information about the current Python implementation. For
MicroPython, it has following attributes: MicroPython, it has following attributes:
* `name` - string "micropython" * *name* - string "micropython"
* `version` - tuple (major, minor, micro), e.g. (1, 7, 0) * *version* - tuple (major, minor, micro), e.g. (1, 7, 0)
This object is the recommended way to distinguish MicroPython from other This object is the recommended way to distinguish MicroPython from other
Python implementations (note that it still may not exist in the very Python implementations (note that it still may not exist in the very
@ -95,10 +95,10 @@ Constants
The platform that MicroPython is running on. For OS/RTOS ports, this is The platform that MicroPython is running on. For OS/RTOS ports, this is
usually an identifier of the OS, e.g. ``"linux"``. For baremetal ports it usually an identifier of the OS, e.g. ``"linux"``. For baremetal ports it
is an identifier of a board, e.g. "pyboard" for the original MicroPython 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. 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 If you need to check whether your program runs on MicroPython (vs other
Python implementation), use ``sys.implementation`` instead. Python implementation), use `sys.implementation` instead.
.. data:: stderr .. data:: stderr

Wyświetl plik

@ -22,15 +22,15 @@ Functions
This function returns an iterator which then yields 3-tuples corresponding to This function returns an iterator which then yields 3-tuples corresponding to
the entries in the directory that it is listing. With no argument it lists the the entries in the directory that it is listing. With no argument it lists the
current directory, otherwise it lists the directory given by `dir`. current directory, otherwise it lists the directory given by *dir*.
The 3-tuples have the form `(name, type, inode)`: The 3-tuples have the form *(name, type, inode)*:
- `name` is a string (or bytes if `dir` is a bytes object) and is the name of - *name* is a string (or bytes if *dir* is a bytes object) and is the name of
the entry; the entry;
- `type` is an integer that specifies the type of the entry, with 0x4000 for - *type* is an integer that specifies the type of the entry, with 0x4000 for
directories and 0x8000 for regular files; directories and 0x8000 for regular files;
- `inode` is an integer corresponding to the inode of the file, and may be 0 - *inode* is an integer corresponding to the inode of the file, and may be 0
for filesystems that don't have such a notion. for filesystems that don't have such a notion.
.. function:: listdir([dir]) .. function:: listdir([dir])
@ -90,5 +90,5 @@ Functions
.. function:: dupterm(stream_object) .. function:: dupterm(stream_object)
Duplicate or switch MicroPython terminal (the REPL) on the passed stream-like Duplicate or switch MicroPython terminal (the REPL) on the passed stream-like
object. The given object must implement the `.readinto()` and `.write()` object. The given object must implement the ``readinto()`` and ``write()``
methods. If ``None`` is passed, previously set redirection is cancelled. methods. If ``None`` is passed, previously set redirection is cancelled.