From 621c644205384103ac781bbe8cd952f0df289c41 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 2 May 2016 14:02:54 +0300 Subject: docs: _io and _collections were renamed to have standard "u" prefix. --- docs/library/_collections.rst | 53 ------------------------------------------- docs/library/_io.rst | 46 ------------------------------------- docs/library/index.rst | 12 +++++----- docs/library/ucollections.rst | 53 +++++++++++++++++++++++++++++++++++++++++++ docs/library/uio.rst | 46 +++++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 105 deletions(-) delete mode 100644 docs/library/_collections.rst delete mode 100644 docs/library/_io.rst create mode 100644 docs/library/ucollections.rst create mode 100644 docs/library/uio.rst (limited to 'docs') diff --git a/docs/library/_collections.rst b/docs/library/_collections.rst deleted file mode 100644 index 2554c4d0a..000000000 --- a/docs/library/_collections.rst +++ /dev/null @@ -1,53 +0,0 @@ -:mod:`_collections` -- collection and container types -===================================================== - -.. module:: _collections - :synopsis: collection and container types - -This module implements advanced collection and container types to -hold/accumulate various objects. - -Classes -------- - -.. function:: namedtuple(name, fields) - - This is factory function to create a new namedtuple type with a specific - name and set of fields. A namedtyple is a subclass of tuple which allows - to access its fields not just by numeric index, but also with an attribute - access syntax using symbolic field names. Fields is a sequence of strings - specifying field names. For compatibily with CPython it can also be a - a string with space-separated field named (but this is less efficient). - Example of use:: - - from _collections import namedtuple - - MyTuple = namedtuple("MyTuple", ("id", "name")) - t1 = MyTuple(1, "foo") - t2 = MyTuple(2, "bar") - print(t1.name) - assert t2.name == t2[1] - -.. function:: OrderedDict(...) - - ``dict`` type subclass which remembers and preserves the order of keys - added. When ordered dict is iterated over, keys/items are returned in - the order they were added:: - - from _collections import OrderedDict - - # To make benefit of ordered keys, OrderedDict should be initialized - # from sequence of (key, value) pairs. - d = OrderedDict([("z", 1), ("a", 2)]) - # More items can be added as usual - d["w"] = 5 - d["b"] = 3 - for k, v in d.items(): - print(k, v) - - Output:: - - z 1 - a 2 - w 5 - b 3 diff --git a/docs/library/_io.rst b/docs/library/_io.rst deleted file mode 100644 index 5a5669700..000000000 --- a/docs/library/_io.rst +++ /dev/null @@ -1,46 +0,0 @@ -:mod:`_io` -- input/output streams -================================== - -.. module:: _io - :synopsis: input/output streams - -This module contains additional types of stream (file-like) objects -and helper functions. - -Functions ---------- - -.. function:: open(name, mode='r', **kwargs) - - Open a file. Builtin ``open()`` function is alised to this function. - All ports (which provide access to file system) are required to support - `mode` parameter, but support for other arguments vary by port. - -Classes -------- - -.. 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. - -.. class:: TextIOWrapper(...) - - This is type of a file open in text mode, e.g. using ``open(name, "rt")``. - You should not instantiate this class directly. - -.. class:: StringIO([string]) -.. class:: BytesIO([string]) - - In-memory file-like objects for input/output. `StringIO` is used for - text-mode I/O (similar to a normal file opened with "t" modifier). - `BytesIO` is used for binary-mode I/O (similar to a normal file - opened with "b" modifier). Initial contents of file-like objects - can be specified with `string` parameter (should be normal string - for `StringIO` or bytes object for `BytesIO`). All the usual file - methods like ``read()``, ``write()``, ``close()`` are available on - these objects, and additionally, following method: - - .. method:: getvalue() - - Get the current contents of the underlying buffer which holds data. diff --git a/docs/library/index.rst b/docs/library/index.rst index 8b153f0ac..03e6502d9 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -28,15 +28,15 @@ library. :maxdepth: 1 cmath.rst - _collections.rst gc.rst - _io.rst math.rst select.rst sys.rst ubinascii.rst + ucollections.rst uhashlib.rst uheapq.rst + uio.rst ujson.rst uos.rst ure.rst @@ -51,15 +51,15 @@ library. :maxdepth: 1 cmath.rst - _collections.rst gc.rst - _io.rst math.rst select.rst sys.rst ubinascii.rst + ucollections.rst uhashlib.rst uheapq.rst + uio.rst ujson.rst uos.rst ure.rst @@ -89,14 +89,14 @@ library. .. toctree:: :maxdepth: 1 - _collections.rst gc.rst - _io.rst math.rst sys.rst ubinascii.rst + ucollections.rst uhashlib.rst uheapq.rst + uio.rst ujson.rst uos.rst ure.rst diff --git a/docs/library/ucollections.rst b/docs/library/ucollections.rst new file mode 100644 index 000000000..c7ed068c7 --- /dev/null +++ b/docs/library/ucollections.rst @@ -0,0 +1,53 @@ +:mod:`ucollections` -- collection and container types +===================================================== + +.. module:: ucollections + :synopsis: collection and container types + +This module implements advanced collection and container types to +hold/accumulate various objects. + +Classes +------- + +.. function:: namedtuple(name, fields) + + This is factory function to create a new namedtuple type with a specific + name and set of fields. A namedtyple is a subclass of tuple which allows + to access its fields not just by numeric index, but also with an attribute + access syntax using symbolic field names. Fields is a sequence of strings + specifying field names. For compatibily with CPython it can also be a + a string with space-separated field named (but this is less efficient). + Example of use:: + + from ucollections import namedtuple + + MyTuple = namedtuple("MyTuple", ("id", "name")) + t1 = MyTuple(1, "foo") + t2 = MyTuple(2, "bar") + print(t1.name) + assert t2.name == t2[1] + +.. function:: OrderedDict(...) + + ``dict`` type subclass which remembers and preserves the order of keys + added. When ordered dict is iterated over, keys/items are returned in + the order they were added:: + + from ucollections import OrderedDict + + # To make benefit of ordered keys, OrderedDict should be initialized + # from sequence of (key, value) pairs. + d = OrderedDict([("z", 1), ("a", 2)]) + # More items can be added as usual + d["w"] = 5 + d["b"] = 3 + for k, v in d.items(): + print(k, v) + + Output:: + + z 1 + a 2 + w 5 + b 3 diff --git a/docs/library/uio.rst b/docs/library/uio.rst new file mode 100644 index 000000000..1b3e2a082 --- /dev/null +++ b/docs/library/uio.rst @@ -0,0 +1,46 @@ +:mod:`uio` -- input/output streams +================================== + +.. module:: uio + :synopsis: input/output streams + +This module contains additional types of stream (file-like) objects +and helper functions. + +Functions +--------- + +.. function:: open(name, mode='r', **kwargs) + + Open a file. Builtin ``open()`` function is alised to this function. + All ports (which provide access to file system) are required to support + `mode` parameter, but support for other arguments vary by port. + +Classes +------- + +.. 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. + +.. class:: TextIOWrapper(...) + + This is type of a file open in text mode, e.g. using ``open(name, "rt")``. + You should not instantiate this class directly. + +.. class:: StringIO([string]) +.. class:: BytesIO([string]) + + In-memory file-like objects for input/output. `StringIO` is used for + text-mode I/O (similar to a normal file opened with "t" modifier). + `BytesIO` is used for binary-mode I/O (similar to a normal file + opened with "b" modifier). Initial contents of file-like objects + can be specified with `string` parameter (should be normal string + for `StringIO` or bytes object for `BytesIO`). All the usual file + methods like ``read()``, ``write()``, ``close()`` are available on + these objects, and additionally, following method: + + .. method:: getvalue() + + Get the current contents of the underlying buffer which holds data. -- cgit v1.2.3