usys: add stubs and docs for usys module

Issue: https://github.com/pybricks/support/issues/236
This commit is contained in:
David Lechner
2021-07-14 09:41:30 +02:00
committed by laurensvalk
parent 9dd131142e
commit 818409f675
6 changed files with 53 additions and 0 deletions
+1
View File
@@ -82,6 +82,7 @@ findings on our `support page`_ so we can make Pybricks even better.
uio
urandom
uselect
usys
.. toctree::
:maxdepth: 1
+4
View File
@@ -0,0 +1,4 @@
:mod:`usys` -- System specific functions
========================================
.. automodule:: usys
+1
View File
@@ -20,6 +20,7 @@ packages = [
{ include = "uio", from = "src" },
{ include = "urandom", from = "src" },
{ include = "uselect", from = "src" },
{ include = "usys", from = "src" },
]
[tool.poetry.dependencies]
+7
View File
@@ -63,3 +63,10 @@ class StringIO:
initial_value: Optional string object that contains initial data.
alloc_size: Optional number of preallocated bytes.
"""
class FileIO:
"""
This is type of a file open in binary mode, e.g. using ``open(name, 'rb')``.
You should not instantiate this class directly.
"""
+40
View File
@@ -0,0 +1,40 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 The Pybricks Authors
#
# Portions of documentation copied from:
# https://raw.githubusercontent.com/micropython/micropython/1e6d18c915ccea0b6a19ffec9710d33dd7e5f866/docs/library/sys.rst
# Copyright (c) 2014-2021, Damien P. George, Paul Sokolovsky, and contributors
"""
This module provides a subset of the standard Python ``sys`` module.
.. note:: This module is not available on the BOOST Move hub.
"""
from uio import FileIO
# REVIST: most functions are excluded since they aren't useful for Pybricks
stdin: FileIO
"""
Stream object that receives input from a connected terminal, if any.
Writing may modify newline characters. Use ``usys.stdin.buffer`` instead if
this is undesirable.
Also see :meth:`micropython.kbd_intr` to disable ``KeyboardInterrupt`` if you
are passing binary data via ``stdin``.
"""
stdout: FileIO
"""
Stream object that sends output to a connected terminal, if any.
Reading may modify newline characters. Use ``usys.stdout.buffer`` instead if
this is undesirable.
"""
stderr: FileIO
"""
Alias for :data:`stdout`.
"""
View File