Branch merge
This commit is contained in:
commit
9a42793761
|
@ -511,13 +511,12 @@ interpreter can only be used after the interpreter has been initialized.
|
|||
module: builtins
|
||||
module: __main__
|
||||
module: sys
|
||||
module: exceptions
|
||||
triple: module; search; path
|
||||
single: path (in module sys)
|
||||
|
||||
The basic initialization function is :cfunc:`Py_Initialize`. This initializes
|
||||
the table of loaded modules, and creates the fundamental modules
|
||||
:mod:`builtins`, :mod:`__main__`, :mod:`sys`, and :mod:`exceptions`. It also
|
||||
:mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also
|
||||
initializes the module search path (``sys.path``).
|
||||
|
||||
.. index:: single: PySys_SetArgv()
|
||||
|
|
|
@ -280,7 +280,7 @@ For example, if the :file:`setup.py` script is changed like this::
|
|||
Where the long description is broken, ``check`` will be able to detect it
|
||||
by using the :mod:`docutils` parser::
|
||||
|
||||
$ pythontrunk setup.py check --restructuredtext
|
||||
$ python setup.py check --restructuredtext
|
||||
running check
|
||||
warning: check: Title underline too short. (line 2)
|
||||
warning: check: Could not finish the parsing.
|
||||
|
|
|
@ -152,7 +152,7 @@ The directives are:
|
|||
|
||||
Describes global data in a module, including both variables and values used
|
||||
as "defined constants." Class and object attributes are not documented
|
||||
using this environment.
|
||||
using this directive.
|
||||
|
||||
.. describe:: exception
|
||||
|
||||
|
@ -165,7 +165,7 @@ The directives are:
|
|||
parameters, enclosing optional parameters in brackets. Default values can be
|
||||
given if it enhances clarity. For example::
|
||||
|
||||
.. function:: Timer.repeat([repeat=3[, number=1000000]])
|
||||
.. function:: repeat([repeat=3[, number=1000000]])
|
||||
|
||||
Object methods are not documented using this directive. Bound object methods
|
||||
placed in the module namespace as part of the public interface of the module
|
||||
|
@ -186,13 +186,30 @@ The directives are:
|
|||
|
||||
Describes an object data attribute. The description should include
|
||||
information about the type of the data to be expected and whether it may be
|
||||
changed directly.
|
||||
changed directly. This directive should be nested in a class directive,
|
||||
like in this example::
|
||||
|
||||
.. class:: Spam
|
||||
|
||||
Description of the class.
|
||||
|
||||
.. data:: ham
|
||||
|
||||
Description of the attribute.
|
||||
|
||||
If is also possible to document an attribute outside of a class directive,
|
||||
for example if the documentation for different attributes and methods is
|
||||
split in multiple sections. The class name should then be included
|
||||
explicitly::
|
||||
|
||||
.. data:: Spam.eggs
|
||||
|
||||
.. describe:: method
|
||||
|
||||
Describes an object method. The parameters should not include the ``self``
|
||||
parameter. The description should include similar information to that
|
||||
described for ``function``.
|
||||
described for ``function``. This method should be nested in a class
|
||||
method, like in the example above.
|
||||
|
||||
.. describe:: opcode
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Each statement in :file:`__future__.py` is of the form::
|
|||
|
||||
|
||||
where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both are
|
||||
5-tuples of the same form as ``sys.version_info``::
|
||||
5-tuples of the same form as :data:`sys.version_info`::
|
||||
|
||||
(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int
|
||||
PY_MINOR_VERSION, # the 1; an int
|
||||
|
|
|
@ -30,9 +30,9 @@ the Oracle Berkeley DB.
|
|||
name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``.
|
||||
|
||||
|
||||
.. function:: open(filename, flag='r', mode=0o666)
|
||||
.. function:: open(file, flag='r', mode=0o666)
|
||||
|
||||
Open the database file *filename* and return a corresponding object.
|
||||
Open the database file *file* and return a corresponding object.
|
||||
|
||||
If the database file already exists, the :func:`whichdb` function is used to
|
||||
determine its type and the appropriate module is used; if it does not exist,
|
||||
|
|
|
@ -34,7 +34,7 @@ Encoding basic Python object hierarchies::
|
|||
Compact encoding::
|
||||
|
||||
>>> import json
|
||||
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
|
||||
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':'))
|
||||
'[1,2,3,{"4":5,"6":7}]'
|
||||
|
||||
Pretty printing::
|
||||
|
|
|
@ -447,8 +447,8 @@ always available.
|
|||
|
||||
This is called ``hexversion`` since it only really looks meaningful when viewed
|
||||
as the result of passing it to the built-in :func:`hex` function. The
|
||||
``version_info`` value may be used for a more human-friendly encoding of the
|
||||
same information.
|
||||
struct sequence :data:`sys.version_info` may be used for a more human-friendly
|
||||
encoding of the same information.
|
||||
|
||||
The ``hexversion`` is a 32-bit number with the following layout
|
||||
|
||||
|
|
|
@ -664,7 +664,7 @@ input, output, and error streams.
|
|||
.. attribute:: BaseHandler.wsgi_file_wrapper
|
||||
|
||||
A ``wsgi.file_wrapper`` factory, or ``None``. The default value of this
|
||||
attribute is the :class:`FileWrapper` class from :mod:`wsgiref.util`.
|
||||
attribute is the :class:`wsgiref.util.FileWrapper` class.
|
||||
|
||||
|
||||
.. method:: BaseHandler.sendfile()
|
||||
|
|
|
@ -24,16 +24,8 @@ It has the following interface (key and data are strings):
|
|||
list = d.keys() # return a list of all existing keys (slow!)
|
||||
|
||||
Future versions may change the order in which implementations are
|
||||
tested for existence, add interfaces to other dbm-like
|
||||
tested for existence, and add interfaces to other dbm-like
|
||||
implementations.
|
||||
|
||||
The open function has an optional second argument. This can be 'r',
|
||||
for read-only access, 'w', for read-write access of an existing
|
||||
database, 'c' for read-write access to a new or existing database, and
|
||||
'n' for read-write access to a new database. The default is 'r'.
|
||||
|
||||
Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
|
||||
only if it doesn't exist; and 'n' always creates a new database.
|
||||
"""
|
||||
|
||||
__all__ = ['open', 'whichdb', 'error', 'error']
|
||||
|
@ -54,7 +46,17 @@ _modules = {}
|
|||
error = (error, IOError)
|
||||
|
||||
|
||||
def open(file, flag = 'r', mode = 0o666):
|
||||
def open(file, flag='r', mode=0o666):
|
||||
"""Open or create database at path given by *file*.
|
||||
|
||||
Optional argument *flag* can be 'r' (default) for read-only access, 'w'
|
||||
for read-write access of an existing database, 'c' for read-write access
|
||||
to a new or existing database, and 'n' for read-write access to a new
|
||||
database.
|
||||
|
||||
Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it
|
||||
only if it doesn't exist; and 'n' always creates a new database.
|
||||
"""
|
||||
global _defaultmod
|
||||
if _defaultmod is None:
|
||||
for name in _names:
|
||||
|
|
|
@ -294,17 +294,20 @@ class sdist(Command):
|
|||
join_lines=1, lstrip_ws=1, rstrip_ws=1,
|
||||
collapse_join=1)
|
||||
|
||||
while True:
|
||||
line = template.readline()
|
||||
if line is None: # end of file
|
||||
break
|
||||
try:
|
||||
while True:
|
||||
line = template.readline()
|
||||
if line is None: # end of file
|
||||
break
|
||||
|
||||
try:
|
||||
self.filelist.process_template_line(line)
|
||||
except DistutilsTemplateError as msg:
|
||||
self.warn("%s, line %d: %s" % (template.filename,
|
||||
template.current_line,
|
||||
msg))
|
||||
try:
|
||||
self.filelist.process_template_line(line)
|
||||
except DistutilsTemplateError as msg:
|
||||
self.warn("%s, line %d: %s" % (template.filename,
|
||||
template.current_line,
|
||||
msg))
|
||||
finally:
|
||||
template.close()
|
||||
|
||||
def prune_file_list(self):
|
||||
"""Prune off branches that might slip into the file list as created
|
||||
|
|
|
@ -137,7 +137,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
|||
|
||||
# let's see what the server received : we should
|
||||
# have 2 similar requests
|
||||
self.assertTrue(self.conn.reqs, 2)
|
||||
self.assertEqual(len(self.conn.reqs), 2)
|
||||
req1 = dict(self.conn.reqs[0].headers)
|
||||
req2 = dict(self.conn.reqs[1].headers)
|
||||
|
||||
|
@ -169,7 +169,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
|||
del register_module.input
|
||||
|
||||
# we should have send a request
|
||||
self.assertTrue(self.conn.reqs, 1)
|
||||
self.assertEqual(len(self.conn.reqs), 1)
|
||||
req = self.conn.reqs[0]
|
||||
headers = dict(req.headers)
|
||||
self.assertEqual(headers['Content-length'], '608')
|
||||
|
@ -187,7 +187,7 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
|||
del register_module.input
|
||||
|
||||
# we should have send a request
|
||||
self.assertTrue(self.conn.reqs, 1)
|
||||
self.assertEqual(len(self.conn.reqs), 1)
|
||||
req = self.conn.reqs[0]
|
||||
headers = dict(req.headers)
|
||||
self.assertEqual(headers['Content-length'], '290')
|
||||
|
|
|
@ -172,7 +172,7 @@ def heappushpop(heap, item):
|
|||
return item
|
||||
|
||||
def heapify(x):
|
||||
"""Transform list into a heap, in-place, in O(len(heap)) time."""
|
||||
"""Transform list into a heap, in-place, in O(len(x)) time."""
|
||||
n = len(x)
|
||||
# Transform bottom-up. The largest index there's any point to looking at
|
||||
# is the largest with a child index in-range, so must have 2*i + 1 < n,
|
||||
|
@ -363,7 +363,7 @@ def nsmallest(n, iterable, key=None):
|
|||
return [min(chain(head, it))]
|
||||
return [min(chain(head, it), key=key)]
|
||||
|
||||
# When n>=size, it's faster to use sort()
|
||||
# When n>=size, it's faster to use sorted()
|
||||
try:
|
||||
size = len(iterable)
|
||||
except (TypeError, AttributeError):
|
||||
|
@ -401,7 +401,7 @@ def nlargest(n, iterable, key=None):
|
|||
return [max(chain(head, it))]
|
||||
return [max(chain(head, it), key=key)]
|
||||
|
||||
# When n>=size, it's faster to use sort()
|
||||
# When n>=size, it's faster to use sorted()
|
||||
try:
|
||||
size = len(iterable)
|
||||
except (TypeError, AttributeError):
|
||||
|
|
|
@ -31,7 +31,7 @@ Encoding basic Python object hierarchies::
|
|||
Compact encoding::
|
||||
|
||||
>>> import json
|
||||
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
|
||||
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':'))
|
||||
'[1,2,3,{"4":5,"6":7}]'
|
||||
|
||||
Pretty printing::
|
||||
|
|
|
@ -2,8 +2,3 @@
|
|||
that the exact location of functions in these modules is important, as trace.py
|
||||
takes the real line numbers into account.
|
||||
"""
|
||||
"""This directory contains modules that help testing the trace.py module. Note
|
||||
that the exact location of functions in these modules is important, as trace.py
|
||||
takes the real line numbers into account.
|
||||
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue