Skip to content

Commit 9469697

Browse files
committed
docs/select: Rename to uselect, to match the actual module name.
Also, add ipoll() documentation and markup changes to comply with CPython usage.
1 parent 396d6f6 commit 9469697

2 files changed

Lines changed: 30 additions & 20 deletions

File tree

docs/library/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ it will fallback to loading the built-in ``ujson`` module.
7272
cmath.rst
7373
gc.rst
7474
math.rst
75-
select.rst
7675
sys.rst
7776
ubinascii.rst
7877
ucollections.rst
@@ -82,6 +81,7 @@ it will fallback to loading the built-in ``ujson`` module.
8281
ujson.rst
8382
uos.rst
8483
ure.rst
84+
uselect.rst
8585
usocket.rst
8686
ustruct.rst
8787
utime.rst
@@ -97,7 +97,6 @@ it will fallback to loading the built-in ``ujson`` module.
9797
cmath.rst
9898
gc.rst
9999
math.rst
100-
select.rst
101100
sys.rst
102101
ubinascii.rst
103102
ucollections.rst
@@ -107,6 +106,7 @@ it will fallback to loading the built-in ``ujson`` module.
107106
ujson.rst
108107
uos.rst
109108
ure.rst
109+
uselect.rst
110110
usocket.rst
111111
ustruct.rst
112112
utime.rst
@@ -120,12 +120,12 @@ it will fallback to loading the built-in ``ujson`` module.
120120
builtins.rst
121121
array.rst
122122
gc.rst
123-
select.rst
124123
sys.rst
125124
ubinascii.rst
126125
ujson.rst
127126
uos.rst
128127
ure.rst
128+
uselect.rst
129129
usocket.rst
130130
ussl.rst
131131
utime.rst
@@ -148,6 +148,7 @@ it will fallback to loading the built-in ``ujson`` module.
148148
ujson.rst
149149
uos.rst
150150
ure.rst
151+
uselect.rst
151152
usocket.rst
152153
ussl.rst
153154
ustruct.rst
Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
:mod:`select` -- wait for events on a set of streams
1+
:mod:`uselect` -- wait for events on a set of streams
22
========================================================================
33

4-
.. module:: select
4+
.. module:: uselect
55
:synopsis: wait for events on a set of streams
66

7-
This module provides functions to wait for events on streams (select streams
8-
which are ready for operations).
9-
10-
Pyboard specifics
11-
-----------------
12-
13-
Polling is an efficient way of waiting for read/write activity on multiple
14-
objects. Current objects that support polling are: :class:`pyb.UART`,
15-
:class:`pyb.USB_VCP`.
7+
This module provides functions to efficiently wait for events on multiple
8+
streams (select streams which are ready for operations).
169

1710
Functions
1811
---------
@@ -25,8 +18,8 @@ Functions
2518

2619
Wait for activity on a set of objects.
2720

28-
This function is provided for compatibility and is not efficient. Usage
29-
of :class:`Poll` is recommended instead.
21+
This function is provided by some MicroPython ports for compatibility
22+
and is not efficient. Usage of :class:`Poll` is recommended instead.
3023

3124
.. _class: Poll
3225

@@ -38,22 +31,22 @@ Methods
3831

3932
.. method:: poll.register(obj[, eventmask])
4033

41-
Register ``obj`` for polling. ``eventmask`` is logical OR of:
34+
Register *obj* for polling. *eventmask* is logical OR of:
4235

4336
* ``select.POLLIN`` - data available for reading
4437
* ``select.POLLOUT`` - more data can be written
4538
* ``select.POLLERR`` - error occurred
4639
* ``select.POLLHUP`` - end of stream/connection termination detected
4740

48-
``eventmask`` defaults to ``select.POLLIN | select.POLLOUT``.
41+
*eventmask* defaults to ``select.POLLIN | select.POLLOUT``.
4942

5043
.. method:: poll.unregister(obj)
5144

52-
Unregister ``obj`` from polling.
45+
Unregister *obj* from polling.
5346

5447
.. method:: poll.modify(obj, eventmask)
5548

56-
Modify the ``eventmask`` for ``obj``.
49+
Modify the *eventmask* for *obj*.
5750

5851
.. method:: poll.poll([timeout])
5952

@@ -65,3 +58,19 @@ Methods
6558
timeout, an empty list is returned.
6659

6760
Timeout is in milliseconds.
61+
62+
.. admonition:: Difference to CPython
63+
:class: attention
64+
65+
Tuples returned may contain more than 2 elements as described above.
66+
67+
.. method:: poll.ipoll([timeout])
68+
69+
Like :meth:`poll.poll`, but instead returns an iterator which yields
70+
callee-owned tuples. This function provides efficient, allocation-free
71+
way to poll on streams.
72+
73+
.. admonition:: Difference to CPython
74+
:class: attention
75+
76+
This function is a MicroPython extension.

0 commit comments

Comments
 (0)