Kaydet (Commit) aa069003 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 68750,68776-68777,68811,68842,68859 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68750 | benjamin.peterson | 2009-01-18 16:47:04 -0600 (Sun, 18 Jan 2009) | 1 line

  fix encoding cookie case
........
  r68776 | benjamin.peterson | 2009-01-19 10:17:54 -0600 (Mon, 19 Jan 2009) | 1 line

  move BufferedIOBase into the base class section
........
  r68777 | benjamin.peterson | 2009-01-19 10:18:27 -0600 (Mon, 19 Jan 2009) | 1 line

  add email address
........
  r68811 | benjamin.peterson | 2009-01-20 12:58:27 -0600 (Tue, 20 Jan 2009) | 1 line

  fix url
........
  r68842 | andrew.kuchling | 2009-01-20 20:16:26 -0600 (Tue, 20 Jan 2009) | 1 line

  Markup fixes
........
  r68859 | georg.brandl | 2009-01-22 12:29:28 -0600 (Thu, 22 Jan 2009) | 2 lines

  Clarify wording.
........
üst 83b97306
...@@ -285,7 +285,8 @@ Inline markup ...@@ -285,7 +285,8 @@ Inline markup
As said before, Sphinx uses interpreted text roles to insert semantic markup in As said before, Sphinx uses interpreted text roles to insert semantic markup in
documents. documents.
Variable names are an exception, they should be marked simply with ``*var*``. Names of local variables, such as function/method arguments, are an exception,
they should be marked simply with ``*var*``.
For all other roles, you have to write ``:rolename:`content```. For all other roles, you have to write ``:rolename:`content```.
...@@ -310,7 +311,7 @@ a matching identifier is found: ...@@ -310,7 +311,7 @@ a matching identifier is found:
.. describe:: data .. describe:: data
The name of a module-level variable. The name of a module-level variable or constant.
.. describe:: const .. describe:: const
......
...@@ -328,59 +328,6 @@ I/O Base Classes ...@@ -328,59 +328,6 @@ I/O Base Classes
``len(b)``, since if the write fails, an :exc:`IOError` will be raised). ``len(b)``, since if the write fails, an :exc:`IOError` will be raised).
Raw File I/O
------------
.. class:: FileIO(name[, mode])
:class:`FileIO` represents a file containing bytes data. It implements
the :class:`RawIOBase` interface (and therefore the :class:`IOBase`
interface, too).
The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing,
or appending. The file will be created if it doesn't exist when opened for
writing or appending; it will be truncated when opened for writing. Add a
``'+'`` to the mode to allow simultaneous reading and writing.
In addition to the attributes and methods from :class:`IOBase` and
:class:`RawIOBase`, :class:`FileIO` provides the following data
attributes and methods:
.. attribute:: mode
The mode as given in the constructor.
.. attribute:: name
The file name. This is the file descriptor of the file when no name is
given in the constructor.
.. method:: read([n])
Read and return at most *n* bytes. Only one system call is made, so it is
possible that less data than was requested is returned. Use :func:`len`
on the returned bytes object to see how many bytes were actually returned.
(In non-blocking mode, ``None`` is returned when no data is available.)
.. method:: readall()
Read and return the entire file's contents in a single bytes object. As
much as immediately available is returned in non-blocking mode. If the
EOF has been reached, ``b''`` is returned.
.. method:: write(b)
Write the bytes or bytearray object, *b*, to the file, and return
the number actually written. Only one system call is made, so it
is possible that only some of the data is written.
Note that the inherited ``readinto()`` method should not be used on
:class:`FileIO` objects.
Buffered Streams
----------------
.. class:: BufferedIOBase .. class:: BufferedIOBase
Base class for streams that support buffering. It inherits :class:`IOBase`. Base class for streams that support buffering. It inherits :class:`IOBase`.
...@@ -438,6 +385,59 @@ Buffered Streams ...@@ -438,6 +385,59 @@ Buffered Streams
underlying raw stream cannot accept more data at the moment. underlying raw stream cannot accept more data at the moment.
Raw File I/O
------------
.. class:: FileIO(name[, mode])
:class:`FileIO` represents a file containing bytes data. It implements
the :class:`RawIOBase` interface (and therefore the :class:`IOBase`
interface, too).
The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing,
or appending. The file will be created if it doesn't exist when opened for
writing or appending; it will be truncated when opened for writing. Add a
``'+'`` to the mode to allow simultaneous reading and writing.
In addition to the attributes and methods from :class:`IOBase` and
:class:`RawIOBase`, :class:`FileIO` provides the following data
attributes and methods:
.. attribute:: mode
The mode as given in the constructor.
.. attribute:: name
The file name. This is the file descriptor of the file when no name is
given in the constructor.
.. method:: read([n])
Read and return at most *n* bytes. Only one system call is made, so it is
possible that less data than was requested is returned. Use :func:`len`
on the returned bytes object to see how many bytes were actually returned.
(In non-blocking mode, ``None`` is returned when no data is available.)
.. method:: readall()
Read and return the entire file's contents in a single bytes object. As
much as immediately available is returned in non-blocking mode. If the
EOF has been reached, ``b''`` is returned.
.. method:: write(b)
Write the bytes or bytearray object, *b*, to the file, and return
the number actually written. Only one system call is made, so it
is possible that only some of the data is written.
Note that the inherited ``readinto()`` method should not be used on
:class:`FileIO` objects.
Buffered Streams
----------------
.. class:: BytesIO([initial_bytes]) .. class:: BytesIO([initial_bytes])
A stream implementation using an in-memory bytes buffer. It inherits A stream implementation using an in-memory bytes buffer. It inherits
......
...@@ -160,11 +160,12 @@ This module also defines four shortcut functions: ...@@ -160,11 +160,12 @@ This module also defines four shortcut functions:
Run command with arguments and return its output as a byte string. Run command with arguments and return its output as a byte string.
If the exit code was non-zero it raises a CalledProcessError. The If the exit code was non-zero it raises a :exc:`CalledProcessError`. The
CalledProcessError object will have the return code in the returncode :exc:`CalledProcessError` object will have the return code in the
attribute and output in the output attribute. :attr:`returncode`
attribute and output in the :attr:`output` attribute.
The arguments are the same as for the Popen constructor. Example: The arguments are the same as for the :class:`Popen` constructor. Example:
>>> subprocess.check_output(["ls", "-l", "/dev/null"]) >>> subprocess.check_output(["ls", "-l", "/dev/null"])
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
:synopsis: Interface to the compiler's internal symbol tables. :synopsis: Interface to the compiler's internal symbol tables.
.. moduleauthor:: Jeremy Hylton <jeremy@alum.mit.edu> .. moduleauthor:: Jeremy Hylton <jeremy@alum.mit.edu>
.. sectionauthor:: Benjamin Peterson .. sectionauthor:: Benjamin Peterson <benjamin@python.org>
Symbol tables are generated by the compiler from AST just before bytecode is Symbol tables are generated by the compiler from AST just before bytecode is
......
# -*- coding: Latin-1 -*- # -*- coding: latin-1 -*-
"""Heap queue algorithm (a.k.a. priority queue). """Heap queue algorithm (a.k.a. priority queue).
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* fast search/count implementation, based on a mix between boyer- /* fast search/count implementation, based on a mix between boyer-
moore and horspool, with a few more bells and whistles on the top. moore and horspool, with a few more bells and whistles on the top.
for some more background, see: http://effbot.org/stringlib */ for some more background, see: http://effbot.org/stringlib.htm */
/* note: fastsearch may access s[n], which isn't a problem when using /* note: fastsearch may access s[n], which isn't a problem when using
Python's ordinary string types, but may cause problems if you're Python's ordinary string types, but may cause problems if you're
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment