Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/difflib.rst

    r2 r391  
    3838   time is linear.
    3939
     40   **Automatic junk heuristic:** :class:`SequenceMatcher` supports a heuristic that
     41   automatically treats certain sequence items as junk. The heuristic counts how many
     42   times each individual item appears in the sequence. If an item's duplicates (after
     43   the first one) account for more than 1% of the sequence and the sequence is at least
     44   200 items long, this item is marked as "popular" and is treated as junk for
     45   the purpose of sequence matching. This heuristic can be turned off by setting
     46   the ``autojunk`` argument to ``False`` when creating the :class:`SequenceMatcher`.
     47
     48   .. versionadded:: 2.7.1
     49      The *autojunk* parameter.
    4050
    4151.. class:: Differ
     
    7585
    7686
    77    .. function:: __init__([tabsize][, wrapcolumn][, linejunk][, charjunk])
     87   .. function:: __init__(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=IS_CHARACTER_JUNK)
    7888
    7989      Initializes instance of :class:`HtmlDiff`.
     
    147157   The context diff format normally has a header for filenames and modification
    148158   times.  Any or all of these may be specified using strings for *fromfile*,
    149    *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
    150    expressed in the format returned by :func:`time.ctime`. If not specified, the
     159   *tofile*, *fromfiledate*, and *tofiledate*.  The modification times are normally
     160   expressed in the ISO 8601 format. If not specified, the
    151161   strings default to blanks.
    152162
     
    282292   The context diff format normally has a header for filenames and modification
    283293   times.  Any or all of these may be specified using strings for *fromfile*,
    284    *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally
    285    expressed in the format returned by :func:`time.ctime`. If not specified, the
     294   *tofile*, *fromfiledate*, and *tofiledate*.  The modification times are normally
     295   expressed in the ISO 8601 format. If not specified, the
    286296   strings default to blanks.
    287297
     
    335345
    336346
    337 .. class:: SequenceMatcher([isjunk[, a[, b]]])
     347.. class:: SequenceMatcher(isjunk=None, a='', b='', autojunk=True)
    338348
    339349   Optional argument *isjunk* must be ``None`` (the default) or a one-argument
     
    351361   empty strings.  The elements of both sequences must be :term:`hashable`.
    352362
     363   The optional argument *autojunk* can be used to disable the automatic junk
     364   heuristic.
     365
     366   .. versionadded:: 2.7.1
     367      The *autojunk* parameter.
     368
    353369   :class:`SequenceMatcher` objects have the following methods:
    354 
    355370
    356371   .. method:: set_seqs(a, b)
     
    513528      Return an upper bound on :meth:`ratio` relatively quickly.
    514529
    515       This isn't defined beyond that it is an upper bound on :meth:`ratio`, and
    516       is faster to compute.
    517 
    518530
    519531   .. method:: real_quick_ratio()
     
    521533      Return an upper bound on :meth:`ratio` very quickly.
    522534
    523       This isn't defined beyond that it is an upper bound on :meth:`ratio`, and
    524       is faster to compute than either :meth:`ratio` or :meth:`quick_ratio`.
    525535
    526536The three methods that return the ratio of matching to total characters can give
     
    623633      Compare two sequences of lines, and generate the delta (a sequence of lines).
    624634
    625       Each sequence must contain individual single-line strings ending with newlines.
    626       Such sequences can be obtained from the :meth:`readlines` method of file-like
    627       objects.  The delta generated also consists of newline-terminated strings, ready
    628       to be printed as-is via the :meth:`writelines` method of a file-like object.
     635      Each sequence must contain individual single-line strings ending with
     636      newlines.  Such sequences can be obtained from the
     637      :meth:`~file.readlines` method of file-like objects.  The delta
     638      generated also consists of newline-terminated strings, ready to be
     639      printed as-is via the :meth:`~file.writelines` method of a
     640      file-like object.
    629641
    630642
     
    636648This example compares two texts. First we set up the texts, sequences of
    637649individual single-line strings ending with newlines (such sequences can also be
    638 obtained from the :meth:`readlines` method of file-like objects):
     650obtained from the :meth:`~file.readlines` method of file-like objects):
    639651
    640652   >>> text1 = '''  1. Beautiful is better than ugly.
Note: See TracChangeset for help on using the changeset viewer.