FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add cross-references to the glossary entry for file objects. · python-emscripten/cpython@11cb961 · GitHub

Repository navigation

Commit 11cb961

Browse files
committed
Add cross-references to the glossary entry for file objects.
1 parent 6a11a98 commit 11cb961

33 files changed

Lines changed: 165 additions & 166 deletions

‎Doc/faq/design.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ have to remember to change two places in your program -- the second occurrence
210210
is hidden at the bottom of the loop.
211211

212212
The best approach is to use iterators, making it possible to loop through
213-
objects using the ``for`` statement. For example, in the current version of
214-
Python file objects support the iterator protocol, so you can now write simply::
213+
objects using the ``for`` statement. For example, :term:`file objects
214+
<file object>` support the iterator protocol, so you can write simply::
215215

216216
for line in f:
217217
... # do something with line...

‎Doc/library/aifc.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ Module :mod:`aifc` defines the following function:
4040
.. function:: open(file, mode=None)
4141

4242
Open an AIFF or AIFF-C file and return an object instance with methods that are
43-
described below. The argument *file* is either a string naming a file or a file
44-
object. *mode* must be ``'r'`` or ``'rb'`` when the file must be opened for
45-
reading, or ``'w'`` or ``'wb'`` when the file must be opened for writing. If
46-
omitted, ``file.mode`` is used if it exists, otherwise ``'rb'`` is used. When
43+
described below. The argument *file* is either a string naming a file or a
44+
:term:`file object`. *mode* must be ``'r'`` or ``'rb'`` when the file must be
45+
opened for reading, or ``'w'`` or ``'wb'`` when the file must be opened for writing.
46+
If omitted, ``file.mode`` is used if it exists, otherwise ``'rb'`` is used. When
4747
used for writing, the file object should be seekable, unless you know ahead of
4848
time how many samples you are going to write in total and use
4949
:meth:`writeframesraw` and :meth:`setnframes`.

‎Doc/library/array.rst‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ The following data items and methods are also supported:
147147

148148
.. method:: array.fromfile(f, n)
149149

150-
Read *n* items (as machine values) from the file object *f* and append them to
151-
the end of the array. If less than *n* items are available, :exc:`EOFError` is
152-
raised, but the items that were available are still inserted into the array.
153-
*f* must be a real built-in file object; something else with a :meth:`read`
154-
method won't do.
150+
Read *n* items (as machine values) from the :term:`file object` *f* and append
151+
them to the end of the array. If less than *n* items are available,
152+
:exc:`EOFError` is raised, but the items that were available are still
153+
inserted into the array. *f* must be a real built-in file object; something
154+
else with a :meth:`read` method won't do.
155155

156156

157157
.. method:: array.fromlist(list)
@@ -214,7 +214,7 @@ The following data items and methods are also supported:
214214

215215
.. method:: array.tofile(f)
216216

217-
Write all items (as machine values) to the file object *f*.
217+
Write all items (as machine values) to the :term:`file object` *f*.
218218

219219

220220
.. method:: array.tolist()

‎Doc/library/asyncore.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ any that have been added to the map during asynchronous service) is closed.
225225

226226
.. class:: file_dispatcher()
227227

228-
A file_dispatcher takes a file descriptor or file object along with an
229-
optional map argument and wraps it for use with the :cfunc:`poll` or
230-
:cfunc:`loop` functions. If provided a file object or anything with a
228+
A file_dispatcher takes a file descriptor or :term:`file object` along
229+
with an optional map argument and wraps it for use with the :cfunc:`poll`
230+
or :cfunc:`loop` functions. If provided a file object or anything with a
231231
:cfunc:`fileno` method, that method will be called and passed to the
232232
:class:`file_wrapper` constructor. Availability: UNIX.
233233

‎Doc/library/base64.rst‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ The legacy interface:
122122
.. function:: decode(input, output)
123123

124124
Decode the contents of the binary *input* file and write the resulting binary
125-
data to the *output* file. *input* and *output* must either be file objects
126-
or objects that mimic the file object interface working with bytes
127-
objects. *input* will be read until ``input.read()`` returns an empty string.
125+
data to the *output* file. *input* and *output* must be :term:`file objects
126+
<file object>`. *input* will be read until ``input.read()`` returns an empty
127+
bytes object.
128128

129129

130130
.. function:: decodebytes(s)
@@ -138,11 +138,10 @@ The legacy interface:
138138
.. function:: encode(input, output)
139139

140140
Encode the contents of the binary *input* file and write the resulting base64
141-
encoded data to the *output* file. *input* and *output* must either be file
142-
objects or objects that mimic the file object interface working with bytes
143-
objects. *input* will be read until ``input.read()`` returns an empty string.
144-
:func:`encode` returns the encoded data plus a trailing newline character
145-
(``b'\n'``).
141+
encoded data to the *output* file. *input* and *output* must be :term:`file
142+
objects <file object>`. *input* will be read until ``input.read()`` returns
143+
an empty bytes object. :func:`encode` returns the encoded data plus a trailing
144+
newline character (``b'\n'``).
146145

147146

148147
.. function:: encodebytes(s)

‎Doc/library/bz2.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Here is a summary of the features offered by the bz2 module:
2525

2626
* :class:`BZ2File` class implements universal newline support;
2727

28-
* :class:`BZ2File` class offers an optimized line iteration using the readahead
29-
algorithm borrowed from file objects;
28+
* :class:`BZ2File` class offers an optimized line iteration using a readahead
29+
algorithm;
3030

3131
* Sequential (de)compression supported by :class:`BZ2Compressor` and
3232
:class:`BZ2Decompressor` classes;

‎Doc/library/configparser.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ RawConfigParser Objects
422422

423423
.. method:: RawConfigParser.write(fileobject, space_around_delimiters=True)
424424

425-
Write a representation of the configuration to the specified file object,
425+
Write a representation of the configuration to the specified :term:`file object`,
426426
which must be opened in text mode (accepting strings). This representation
427427
can be parsed by a future :meth:`read` call. If ``space_around_delimiters``
428428
is ``True`` (the default), delimiters between keys and values are surrounded

‎Doc/library/csv.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ The :mod:`csv` module defines the following functions:
5050

5151
Return a reader object which will iterate over lines in the given *csvfile*.
5252
*csvfile* can be any object which supports the :term:`iterator` protocol and returns a
53-
string each time its :meth:`!next` method is called --- file objects and list
54-
objects are both suitable. If *csvfile* is a file object, it should be opened
55-
with ``newline=''``. [#]_ An optional
53+
string each time its :meth:`!next` method is called --- :term:`file objects
54+
<file object>` and list objects are both suitable. If *csvfile* is a file object,
55+
it should be opened with ``newline=''``. [#]_ An optional
5656
*dialect* parameter can be given which is used to define a set of parameters
5757
specific to a particular CSV dialect. It may be an instance of a subclass of
5858
the :class:`Dialect` class or one of the strings returned by the

‎Doc/library/email.generator.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Here are the public methods of the :class:`Generator` class, imported from the
2828

2929
.. class:: Generator(outfp, mangle_from_=True, maxheaderlen=78)
3030

31-
The constructor for the :class:`Generator` class takes a file-like object called
32-
*outfp* for an argument. *outfp* must support the :meth:`write` method and be
33-
usable as the output file for the :func:`print` function.
31+
The constructor for the :class:`Generator` class takes a :term:`file-like object`
32+
called *outfp* for an argument. *outfp* must support the :meth:`write` method
33+
and be usable as the output file for the :func:`print` function.
3434

3535
Optional *mangle_from_* is a flag that, when ``True``, puts a ``>`` character in
3636
front of any line in the body that starts exactly as ``From``, i.e. ``From``

‎Doc/library/email.parser.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ in the top-level :mod:`email` package namespace.
154154

155155
.. function:: message_from_file(fp[, _class][, strict])
156156

157-
Return a message object structure tree from an open file object. This is
158-
exactly equivalent to ``Parser().parse(fp)``. Optional *_class* and *strict*
159-
are interpreted as with the :class:`Parser` class constructor.
157+
Return a message object structure tree from an open :term:`file object`.
158+
This is exactly equivalent to ``Parser().parse(fp)``. Optional *_class*
159+
and *strict* are interpreted as with the :class:`Parser` class constructor.
160160

161161
Here's an example of how you might use this at an interactive Python prompt::
162162

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL