mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-97669: Move difflib examples to Doc/includes/ (#97964)
Remove diff.py and ndiff.py scripts of Tools/scripts/: move them to Doc/includes/. * diff.py and ndiff.py files are no longer executable. Remove also their shebang ("#!/usr/bin/env python3"). * Remove the -profile command from ndiff.py to simply the code. * Remove ndiff.py copyright and history command. The Python documentation examples are distributed under the "Zero Clause BSD License".
This commit is contained in:
parent
24a4b34158
commit
002252c4ad
3 changed files with 9 additions and 31 deletions
|
@ -145,8 +145,6 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
|
|||
The arguments for this method are the same as those for the :meth:`make_file`
|
||||
method.
|
||||
|
||||
:file:`Tools/scripts/diff.py` is a command-line front-end to this class and
|
||||
contains a good example of its use.
|
||||
|
||||
|
||||
.. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n')
|
||||
|
@ -240,8 +238,6 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
|
|||
function :func:`IS_CHARACTER_JUNK`, which filters out whitespace characters (a
|
||||
blank or tab; it's a bad idea to include newline in this!).
|
||||
|
||||
:file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
|
||||
|
||||
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
|
||||
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
|
||||
>>> print(''.join(diff), end="")
|
||||
|
@ -759,7 +755,12 @@ A command-line interface to difflib
|
|||
-----------------------------------
|
||||
|
||||
This example shows how to use difflib to create a ``diff``-like utility.
|
||||
It is also contained in the Python source distribution, as
|
||||
:file:`Tools/scripts/diff.py`.
|
||||
|
||||
.. literalinclude:: ../../Tools/scripts/diff.py
|
||||
.. literalinclude:: ../includes/diff.py
|
||||
|
||||
ndiff example
|
||||
-------------
|
||||
|
||||
This example shows how to use :func:`difflib.ndiff`.
|
||||
|
||||
.. literalinclude:: ../includes/ndiff.py
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue