# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR , YEAR.
#
# Translators:
# Alireza Shabani (Revisto) , 2025
# Rafael Fontenelle , 2025
# Sepehr Rasouli , 2026
# arman mohebali , 2026
#
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-10-01 14:41+0330\n"
"PO-Revision-Date: 2026-09-14 16:12+0330\n"
"Last-Translator: Sepehr Rasouli , 2026\n"
"Language-Team: Persian (https://github.com/python/python-docs-fa/)\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.6\n"
msgid ":mod:`!difflib` --- Helpers for computing deltas"
msgstr ":mod:`!difflib` --- "
msgid "**Source code:** :source:`Lib/difflib.py`"
msgstr "** :** :source:`Lib/difflib.py`"
msgid "This module provides classes and functions for comparing sequences. Most of them compare sequences of text lines (for example lists of strings, or :term:`file objects `) and produce :dfn:`diffs` -- reports on the differences. Diffs can be produced in various formats, including HTML and context and unified diffs -- formats produced by tools like :manpage:`diff ` and :manpage:`git diff `."
msgstr " . ( :term:` `) :dfn:` (diffs)` -- . HTML -- :manpage:`diff ` :manpage:`git diff ` ."
msgid "Comparisons are done using a matching algorithm implemented in :class:`SequenceMatcher` -- a flexible class for comparing pairs of sequences of any type, not just text, so long as the sequence elements are :term:`hashable`."
msgstr " :class:`SequenceMatcher` :term:`hashable` ."
msgid "Junk heuristic"
msgstr " (Junk heuristic)"
msgid ":mod:`!difflib` uses a :dfn:`junk` heuristic: some items are deemed to be :dfn:`junk`, and ignored when searching for similarities. Ideally, these are uninteresting or common items, such as blank lines or whitespace."
msgstr ":mod:`!difflib` :dfn:`junk` : :dfn:`junk` . ."
msgid "This heuristic can speed the algorithm up (because it reduces the number of possible combinations) and it can produce results that are more understandable for humans (typically breaking on whitespace). But it can also cause pathological cases:"
msgstr " ( ) ( ). :"
msgid "Inappropriately chosen junk items can cause an unexpectedly **large** (but still correct) result."
msgstr " **** ( ) ."
msgid "The default heuristic is **asymmetric**: only the second sequence is inspected when determining what is considered junk, so comparing A to B can give different results than comparing B to A and reversing the result."
msgstr " **** : A B B A ."
msgid "By default, if the second input sequence is at least 200 items long, items that account for more than 1% it are considered *junk*."
msgstr " ** ."
msgid "Depending on your data, you should consider turning this heuristic off (setting :class:`~difflib.SequenceMatcher`'s *autojunk* argument to ``False``) or tuning it (using the *isjunk* argument, perhaps to one of the :ref:`predefined functions `)."
msgstr " ( *autojunk* :class:`~difflib.SequenceMatcher` ``False``) ( *isjunk* :ref:` `)."
msgid "The :mod:`!difflib` algorithm"
msgstr " :mod:`!difflib`"
msgid "The algorithm used in :class:`SequenceMatcher` predates, and is a little fancier than, an algorithm published in the late 1980s by Ratcliff and Obershelp under the hyperbolic name \"gestalt pattern matching.\" The idea is to find the longest contiguous subsequence common to both inputs, then recursively handle the pieces of the sequences to the left and to the right of the matching subsequence."
msgstr " :class:`SequenceMatcher` (gestalt pattern matching) . ."
msgid "`Pattern Matching: The Gestalt Approach `_"
msgstr "` : `_"
msgid "Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This was published in Dr. Dobb's Journal in July, 1988."
msgstr " John W. Ratcliff D. E. Metzener. Dr. Dobb's Journal ."
msgid "As an extension to the Ratcliff and Obershelp algorithm, :mod:`!difflib` searches for the longest *junk-free* contiguous subsequence. See the :ref:`difflib-junk` section for details."
msgstr " Ratcliff Obershelp :mod:`!difflib` * * . :ref:`difflib-junk` ."
msgid "Timing"
msgstr ""
msgid "The basic Ratcliff-Obershelp algorithm is cubic time in the worst case and quadratic time in the expected case. :mod:`difflib`'s algorithm is quadratic time for the worst case and has expected-case behavior dependent in a complicated way on how many elements the sequences have in common; best case time is linear."
msgstr " Ratcliff-Obershelp . :mod:`difflib` ."
msgid "Diff generation"
msgstr " (diff)"
msgid "This is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses :class:`SequenceMatcher` both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines."
msgstr " . Differ :class:`SequenceMatcher` ( ) ."
msgid "Each line of a :class:`Differ` delta begins with a two-letter code:"
msgstr " :class:`Differ` :"
msgid "Code"
msgstr ""
msgid "Meaning"
msgstr ""
msgid "``'- '``"
msgstr "``'- '``"
msgid "line unique to sequence 1"
msgstr " "
msgid "``'+ '``"
msgstr "``'+ '``"
msgid "line unique to sequence 2"
msgstr " "
msgid "``' '``"
msgstr "``' '``"
msgid "line common to both sequences"
msgstr " "
msgid "``'? '``"
msgstr "``'? '``"
msgid "line not present in either input sequence"
msgstr " "
msgid "Lines beginning with '``?``' attempt to guide the eye to intraline differences, and were not present in either input sequence. These lines can be confusing if the sequences contain whitespace characters, such as spaces, tabs or line breaks."
msgstr " '``?``' . ."
msgid "Note that :class:`Differ`\\ -generated deltas make no claim to be **minimal** diffs. To the contrary, minimal diffs are often counter-intuitive for humans, because they synch up anywhere possible, sometimes at accidental matches 100 pages apart. Restricting synch points to contiguous matches preserves some notion of locality, at the occasional cost of producing a longer diff."
msgstr " :class:`Differ` **** . . ."
msgid "The :class:`Differ` class has this constructor:"
msgstr " :class:`Differ` :"
msgid "Optional keyword parameters *linejunk* and *charjunk* are for filter functions (or ``None``):"
msgstr " *linejunk* *charjunk* ( ``None``) :"
msgid "*linejunk*: A function that accepts a single string argument, and returns true if the string is junk. The default is ``None``, meaning that no line is considered junk."
msgstr "*linejunk*: true . ``None`` ."
msgid "*charjunk*: A function that accepts a single character argument (a string of length 1), and returns true if the character is junk. The default is ``None``, meaning that no character is considered junk."
msgstr "*charjunk*: ( ) . ``None`` ."
msgid "These junk-filtering functions speed up matching to find differences and do not cause any differing lines or characters to be ignored. Read the description of the :meth:`~SequenceMatcher.find_longest_match` method's *isjunk* parameter for an explanation."
msgstr " (junk-filtering) . *isjunk* :meth:`~SequenceMatcher.find_longest_match` ."
msgid ":class:`Differ` objects are used (deltas generated) via a single method:"
msgstr " :class:`Differ` ( ):"
msgid "Compare two sequences of lines, and generate the delta (a sequence of lines)."
msgstr " ( ) ."
msgid "Each sequence must contain individual single-line strings ending with newlines. Such sequences can be obtained from the :meth:`~io.IOBase.readlines` method of file-like objects. The generated delta also consists of newline-terminated strings, ready to be printed as-is via the :meth:`~io.IOBase.writelines` method of a file-like object."
msgstr " . :meth:`~io.IOBase.readlines` . :meth:`~io.IOBase.writelines` ."
msgid "This class can be used to create an HTML table (or a complete HTML file containing the table) showing a side by side, line by line comparison of text with inter-line and intra-line change highlights. The table can be generated in either full or contextual difference mode."
msgstr " HTML ( HTML ) . ."
msgid "The trailing newlines get stripped before the diff, so the result can be incomplete. See :gh:`71896` for details."
msgstr " diff . :gh:`71896` ."
msgid "The constructor for this class is:"
msgstr " :"
msgid "Initializes instance of :class:`HtmlDiff`."
msgstr " :class:`HtmlDiff` ."
msgid "*tabsize* is an optional keyword argument to specify tab stop spacing and defaults to ``8``."
msgstr "*tabsize* ``8`` ."
msgid "*wrapcolumn* is an optional keyword to specify column number where lines are broken and wrapped, defaults to ``None`` where lines are not wrapped."
msgstr "*wrapcolumn* ``None`` ."
msgid "*linejunk* and *charjunk* are optional keyword arguments passed into :func:`ndiff` (used by :class:`HtmlDiff` to generate the side by side HTML differences). See :func:`ndiff` documentation for argument default values and descriptions."
msgstr "*linejunk* *charjunk* :func:`ndiff` ( :class:`HtmlDiff` HTML ). :func:`ndiff` ."
msgid "The following methods are public:"
msgstr " :"
msgid "Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML file containing a table showing line by line differences with inter-line and intra-line changes highlighted."
msgstr "*fromlines* *tolines* ( ) HTML ."
msgid "*fromdesc* and *todesc* are optional keyword arguments to specify from/to file column header strings (both default to an empty string)."
msgstr "*fromdesc* *todesc* / ( )."
msgid "*context* and *numlines* are both optional keyword arguments. Set *context* to ``True`` when contextual differences are to be shown, else the default is ``False`` to show the full files. *numlines* defaults to ``5``. When *context* is ``True`` *numlines* controls the number of context lines which surround the difference highlights. When *context* is ``False`` *numlines* controls the number of lines which are shown before a difference highlight when using the \"next\" hyperlinks (setting to zero would cause the \"next\" hyperlinks to place the next difference highlight at the top of the browser without any leading context)."
msgstr "*context* *numlines* . *context* ``True`` ``False`` . *numlines* ``5`` . *context* ``True`` *numlines* . *context* ``False`` *numlines* next ( next )."
msgid "*fromdesc* and *todesc* are interpreted as unescaped HTML and should be properly escaped while receiving input from untrusted sources."
msgstr "*fromdesc* *todesc* HTML ."
msgid "*charset* keyword-only argument was added. The default charset of HTML document changed from ``'ISO-8859-1'`` to ``'utf-8'``."
msgstr " *charset* . HTML ``'ISO-8859-1'`` ``'utf-8'`` ."
msgid "Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML table showing line by line differences with inter-line and intra-line changes highlighted."
msgstr "*fromlines* *tolines* ( ) HTML ."
msgid "The arguments for this method are the same as those for the :meth:`make_file` method."
msgstr " :meth:`make_file` ."
msgid "Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in context diff format."
msgstr "*a* *b* ( ) ( :term:` ` ) context diff ."
msgid "Context diffs are a compact way of showing just the lines that have changed plus a few lines of context. The changes are shown in a before/after style. The number of context lines is set by *n* which defaults to three."
msgstr " (context diffs) . / . *n* ."
msgid "By default, the diff control lines (those with ``***`` or ``---``) are created with a trailing newline. This is helpful so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines."
msgstr " (diff) ( ``***`` ``---`` ) . :func:`io.IOBase.readlines` :func:`io.IOBase.writelines` ."
msgid "For inputs that do not have trailing newlines, set the *lineterm* argument to ``\"\"`` so that the output will be uniformly newline free."
msgstr " *lineterm* ``\"\"`` ."
msgid "The context diff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks."
msgstr " diff (context diff) . *fromfile* *tofile* *fromfiledate* *tofiledate* . ISO 8601 . ."
msgid "See :ref:`difflib-interface` for a more detailed example."
msgstr " :ref:`difflib-interface` ."
msgid "Return a list of the best \"good enough\" matches. *word* is a sequence for which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings)."
msgstr " . *word* ( ) *possibilities* *word* ( )."
msgid "Optional argument *n* (default ``3``) is the maximum number of close matches to return; *n* must be greater than ``0``."
msgstr " *n* ( ``3``) *n* ``0`` ."
msgid "Optional argument *cutoff* (default ``0.6``) is a float in the range [0, 1]. Possibilities that don't score at least that similar to *word* are ignored."
msgstr " *cutoff* ( ``0.6``) [ ] . *word* ."
msgid "The best (no more than *n*) matches among the possibilities are returned in a list, sorted by similarity score, most similar first."
msgstr " ( *n* ) ."
msgid "Compare *a* and *b* (lists of strings); return a :class:`Differ`\\ -style delta (a :term:`generator` generating the delta lines)."
msgstr "*a* *b* ( ) :class:`Differ` ( :term:` ` )."
msgid "Optional keyword parameters *linejunk* and *charjunk* are filtering functions (or ``None``):"
msgstr " *linejunk* *charjunk* ( ``None``) :"
msgid "*linejunk*: A function that accepts a single string argument, and returns true if the string is junk, or false if not. The default is ``None``. There is also a module-level function :func:`IS_LINE_JUNK`, which filters out lines without visible characters, except for at most one hash character (``'#'``) -- however the underlying :class:`SequenceMatcher` class does a dynamic analysis of which lines are so frequent as to constitute noise, and this usually works better than using this function."
msgstr "*linejunk*: . ``None`` . :func:`IS_LINE_JUNK` (``'#'``) -- :class:`SequenceMatcher` ."
msgid "*charjunk*: A function that accepts a character (a string of length 1), and returns if the character is junk, or false if not. The default is module-level function :func:`IS_CHARACTER_JUNK`, which filters out whitespace characters (a blank or tab; it's a bad idea to include newline in this!)."
msgstr "*charjunk*: ( ) (junk) false . :func:`IS_CHARACTER_JUNK` ( !) ."
msgid "Return one of the two sequences that generated a delta."
msgstr " (delta) ."
msgid "Given a *sequence* produced by :meth:`Differ.compare` or :func:`ndiff`, extract lines originating from file 1 or 2 (parameter *which*), stripping off line prefixes."
msgstr " ** :meth:`Differ.compare` :func:`ndiff` ( *which*) ."
msgid "Example:"
msgstr ":"
msgid "Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format."
msgstr "*a* *b* ( ) ( :term:` ` ) unified diff ."
msgid "Unified diffs are a compact way of showing just the lines that have changed plus a few lines of context. The changes are shown in an inline style (instead of separate before/after blocks). The number of context lines is set by *n* which defaults to three."
msgstr " (unified diffs) . ( /). *n* ."
msgid "By default, the diff control lines (those with ``---``, ``+++``, or ``@@``) are created with a trailing newline. This is helpful so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines."
msgstr " diff ( ``---`` ``+++`` ``@@`` ) . :func:`io.IOBase.readlines` diff :func:`io.IOBase.writelines` ."
msgid "Set *color* to ``True`` to enable output in color, similar to :program:`git diff --color`. Even if enabled, it can be :ref:`controlled using environment variables `."
msgstr " :program:`git diff --color` *color* ``True`` . :ref:` `."
msgid "The unified diff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks."
msgstr " unified diff . *fromfile* *tofile* *fromfiledate* *tofiledate* . ISO 8601 . ."
msgid "Added the *color* parameter."
msgstr " *color* ."
msgid "Compare *a* and *b* (lists of bytes objects) using *dfunc*; yield a sequence of delta lines (also bytes) in the format returned by *dfunc*. *dfunc* must be a callable, typically either :func:`unified_diff` or :func:`context_diff`."
msgstr "*a* *b* ( bytes) *dfunc* ( bytes ) *dfunc* . *dfunc* :func:`unified_diff` :func:`context_diff`."
msgid "Allows you to compare data with unknown or inconsistent encoding. All inputs except *n* must be bytes objects, not str. Works by losslessly converting all inputs (except *n*) to str, and calling ``dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)``. The output of *dfunc* is then converted back to bytes, so the delta lines that you receive have the same unknown/inconsistent encodings as *a* and *b*."
msgstr " . *n* bytes str. ( *n*) str ``dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)`` . *dfunc* bytes / *a* *b* ."
msgid "Junk definition functions"
msgstr " "
msgid "Return ``True`` for ignorable lines. The line *line* is ignorable if *line* is blank or contains a single ``'#'``, otherwise it is not ignorable. Used as a default for parameter *linejunk* in :func:`ndiff` in older versions."
msgstr " ``True`` . *line* *line* ``'#'`` . *linejunk* :func:`ndiff` ."
msgid "Return ``True`` for ignorable characters. The character *ch* is ignorable if *ch* is a space or tab, otherwise it is not ignorable. Used as a default for parameter *charjunk* in :func:`ndiff`."
msgstr "``True`` . *ch* *ch* . *charjunk* :func:`ndiff` ."
msgid "SequenceMatcher objects"
msgstr " SequenceMatcher"
msgid "Optional argument *isjunk* must be ``None`` (the default) or a one-argument function that takes a sequence element and returns true if and only if the element is \"junk\" and should be ignored. Passing ``None`` for *isjunk* is equivalent to passing ``lambda x: False``; in other words, no elements are ignored. For example, pass::"
msgstr " *isjunk* ``None`` () . ``None`` *isjunk* ``lambda x: False`` . ::"
msgid "lambda x: x in \" \\t\""
msgstr "lambda x: x in \" \\t\""
msgid "if you're comparing lines as sequences of characters, and don't want to synch up on blanks or hard tabs."
msgstr " ."
msgid "The optional arguments *a* and *b* are sequences to be compared; both default to empty strings. The elements of both sequences must be :term:`hashable`."
msgstr " *a* *b* . :term:`hashable` ."
msgid "The optional argument *autojunk* can be used to disable the automatic junk heuristic."
msgstr " *autojunk* ."
msgid "Added the *autojunk* parameter."
msgstr " *autojunk* ."
msgid "SequenceMatcher objects get three data attributes: *bjunk* is the set of elements of *b* for which *isjunk* is ``True``; *bpopular* is the set of non-junk elements considered popular by the heuristic (if it is not disabled); *b2j* is a dict mapping the remaining elements of *b* to a list of positions where they occur. All three are reset whenever *b* is reset with :meth:`set_seqs` or :meth:`set_seq2`."
msgstr " SequenceMatcher : *bjunk* *b* *isjunk* ``True`` *bpopular* ( ) *b2j* *b* . *b* :meth:`set_seqs` :meth:`set_seq2` ."
msgid "The *bjunk* and *bpopular* attributes."
msgstr " *bjunk* *bpopular*."
msgid ":class:`SequenceMatcher` objects have the following methods:"
msgstr " :class:`SequenceMatcher` :"
msgid "Set the two sequences to be compared."
msgstr " ."
msgid ":class:`SequenceMatcher` computes and caches detailed information about the second sequence, so if you want to compare one sequence against many sequences, use :meth:`set_seq2` to set the commonly used sequence once and call :meth:`set_seq1` repeatedly, once for each of the other sequences."
msgstr ":class:`SequenceMatcher` :meth:`set_seq2` :meth:`set_seq1` ."
msgid "Set the first sequence to be compared. The second sequence to be compared is not changed."
msgstr " . ."
msgid "Set the second sequence to be compared. The first sequence to be compared is not changed."
msgstr " . ."
msgid "Find longest matching block in ``a[alo:ahi]`` and ``b[blo:bhi]``."
msgstr " ``a[alo:ahi]`` ``b[blo:bhi]`` ."
msgid "If *isjunk* was omitted or ``None``, :meth:`find_longest_match` returns ``(i, j, k)`` such that ``a[i:i+k]`` is equal to ``b[j:j+k]``, where ``alo b[{}:{}] {!r:>8} --> {!r}'.format(\n"
"... tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))\n"
"delete a[0:1] --> b[0:0] 'q' --> ''\n"
"equal a[1:3] --> b[0:2] 'ab' --> 'ab'\n"
"replace a[3:4] --> b[2:3] 'x' --> 'y'\n"
"equal a[4:6] --> b[3:5] 'cd' --> 'cd'\n"
"insert a[6:6] --> b[5:6] '' --> 'f'"
msgstr ""
">>> a = \"qabxcd\"\n"
">>> b = \"abycdf\"\n"
">>> s = SequenceMatcher(None, a, b)\n"
">>> for tag, i1, i2, j1, j2 in s.get_opcodes():\n"
"... print('{:7} a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(\n"
"... tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))\n"
"delete a[0:1] --> b[0:0] 'q' --> ''\n"
"equal a[1:3] --> b[0:2] 'ab' --> 'ab'\n"
"replace a[3:4] --> b[2:3] 'x' --> 'y'\n"
"equal a[4:6] --> b[3:5] 'cd' --> 'cd'\n"
"insert a[6:6] --> b[5:6] '' --> 'f'"
msgid "Return a :term:`generator` of groups with up to *n* lines of context."
msgstr " :term:` ` *n* ."
msgid "Starting with the groups returned by :meth:`get_opcodes`, this method splits out smaller change clusters and eliminates intervening ranges which have no changes."
msgstr " :meth:`get_opcodes` ."
msgid "The groups are returned in the same format as :meth:`get_opcodes`."
msgstr " :meth:`get_opcodes` ."
msgid "Return a measure of the sequences' similarity as a float in the range [0, 1]."
msgstr " [ ] ."
msgid "Where T is the total number of elements in both sequences, and M is the number of matches, this is 2.0\\*M / T. Note that this is ``1.0`` if the sequences are identical, and ``0.0`` if they have nothing in common."
msgstr " T M 2.0\\*M / T . ``1.0`` ``0.0`` ."
msgid "This is expensive to compute if :meth:`get_matching_blocks` or :meth:`get_opcodes` hasn't already been called, in which case you may want to try :meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an upper bound."
msgstr " :meth:`get_matching_blocks` :meth:`get_opcodes` :meth:`quick_ratio` :meth:`real_quick_ratio` ."
msgid "Return an upper bound on :meth:`ratio` relatively quickly."
msgstr " :meth:`ratio` ."
msgid "Return an upper bound on :meth:`ratio` very quickly."
msgstr " :meth:`ratio` ."
msgid "The three methods that return the ratio of matching to total characters can give different results due to differing levels of approximation, although :meth:`~SequenceMatcher.quick_ratio` and :meth:`~SequenceMatcher.real_quick_ratio` are always at least as large as :meth:`~SequenceMatcher.ratio`:"
msgstr " :meth:`~SequenceMatcher.quick_ratio` :meth:`~SequenceMatcher.real_quick_ratio` :meth:`~SequenceMatcher.ratio` :"
msgid "Examples"
msgstr ""
msgid "SequenceMatcher examples"
msgstr " SequenceMatcher"
msgid "This example compares two strings, considering blanks to be \"junk\":"
msgstr " :"
msgid ":meth:`~SequenceMatcher.ratio` returns a float in [0, 1], measuring the similarity of the sequences. As a rule of thumb, a :meth:`~SequenceMatcher.ratio` value over 0.6 means the sequences are close matches:"
msgstr ":meth:`~SequenceMatcher.ratio` [ ] . :meth:`~SequenceMatcher.ratio` :"
msgid "If you're only interested in where the sequences match, :meth:`~SequenceMatcher.get_matching_blocks` is handy:"
msgstr " :meth:`~SequenceMatcher.get_matching_blocks` :"
msgid "Note that the last tuple returned by :meth:`~SequenceMatcher.get_matching_blocks` is always a dummy, ``(len(a), len(b), 0)``, and this is the only case in which the last tuple element (number of elements matched) is ``0``."
msgstr " :meth:`~SequenceMatcher.get_matching_blocks` ``(len(a), len(b), 0)`` ( ) ``0`` ."
msgid "If you want to know how to change the first sequence into the second, use :meth:`~SequenceMatcher.get_opcodes`:"
msgstr " :meth:`~SequenceMatcher.get_opcodes` :"
msgid "The :func:`get_close_matches` function in this module which shows how simple code building on :class:`SequenceMatcher` can be used to do useful work."
msgstr " :func:`get_close_matches` :class:`SequenceMatcher` ."
msgid "`Simple version control recipe `_ for a small application built with :class:`SequenceMatcher`."
msgstr "` `_ :class:`SequenceMatcher`."
msgid "Differ example"
msgstr " Differ"
msgid "This example compares two texts. First we set up the texts, sequences of individual single-line strings ending with newlines (such sequences can also be obtained from the :meth:`~io.IOBase.readlines` method of file-like objects):"
msgstr " . ( :meth:`~io.IOBase.readlines` ):"
msgid "Next we instantiate a Differ object:"
msgstr " Differ :"
msgid "Note that when instantiating a :class:`Differ` object we may pass functions to filter out line and character \"junk.\" See the :meth:`Differ` constructor for details."
msgstr " :class:`Differ` . :meth:`Differ` ."
msgid "Finally, we compare the two:"
msgstr " :"
msgid "``result`` is a list of strings, so let's pretty-print it:"
msgstr "``result`` (pretty-print):"
msgid "As a single multi-line string it looks like this:"
msgstr " :"
msgid "A command-line interface to difflib"
msgstr " difflib"
msgid "This example shows how to use difflib to create a ``diff``-like utility."
msgstr " difflib ``diff`` ."
msgid ""
"\"\"\" Command-line interface to difflib.py providing diffs in four formats:\n"
"\n"
"* ndiff: lists every line and highlights interline changes.\n"
"* context: highlights clusters of changes in a before/after format.\n"
"* unified: highlights clusters of changes in an inline format.\n"
"* html: generates side by side comparison with change highlights.\n"
"\n"
"\"\"\"\n"
"\n"
"import sys, os, difflib, argparse\n"
"import datetime as dt\n"
"\n"
"def file_mtime(path):\n"
" t = dt.datetime.fromtimestamp(os.stat(path).st_mtime,\n"
" dt.timezone.utc)\n"
" return t.astimezone().isoformat()\n"
"\n"
"def main():\n"
"\n"
" parser = argparse.ArgumentParser()\n"
" parser.add_argument('-c', action='store_true', default=False,\n"
" help='Produce a context format diff (default)')\n"
" parser.add_argument('-u', action='store_true', default=False,\n"
" help='Produce a unified format diff')\n"
" parser.add_argument('-m', action='store_true', default=False,\n"
" help='Produce HTML side by side diff '\n"
" '(can use -c and -l in conjunction)')\n"
" parser.add_argument('-n', action='store_true', default=False,\n"
" help='Produce a ndiff format diff')\n"
" parser.add_argument('-l', '--lines', type=int, default=3,\n"
" help='Set number of context lines (default 3)')\n"
" parser.add_argument('fromfile')\n"
" parser.add_argument('tofile')\n"
" options = parser.parse_args()\n"
"\n"
" n = options.lines\n"
" fromfile = options.fromfile\n"
" tofile = options.tofile\n"
"\n"
" fromdate = file_mtime(fromfile)\n"
" todate = file_mtime(tofile)\n"
" with open(fromfile) as ff:\n"
" fromlines = ff.readlines()\n"
" with open(tofile) as tf:\n"
" tolines = tf.readlines()\n"
"\n"
" if options.u:\n"
" diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n"
" elif options.n:\n"
" diff = difflib.ndiff(fromlines, tolines)\n"
" elif options.m:\n"
" diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)\n"
" else:\n"
" diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n"
"\n"
" sys.stdout.writelines(diff)\n"
"\n"
"if __name__ == '__main__':\n"
" main()\n"
msgstr ""
"\"\"\" Command-line interface to difflib.py providing diffs in four formats:\n"
"\n"
"* ndiff: lists every line and highlights interline changes.\n"
"* context: highlights clusters of changes in a before/after format.\n"
"* unified: highlights clusters of changes in an inline format.\n"
"* html: generates side by side comparison with change highlights.\n"
"\n"
"\"\"\"\n"
"\n"
"import sys, os, difflib, argparse\n"
"import datetime as dt\n"
"\n"
"def file_mtime(path):\n"
" t = dt.datetime.fromtimestamp(os.stat(path).st_mtime,\n"
" dt.timezone.utc)\n"
" return t.astimezone().isoformat()\n"
"\n"
"def main():\n"
"\n"
" parser = argparse.ArgumentParser()\n"
" parser.add_argument('-c', action='store_true', default=False,\n"
" help='Produce a context format diff (default)')\n"
" parser.add_argument('-u', action='store_true', default=False,\n"
" help='Produce a unified format diff')\n"
" parser.add_argument('-m', action='store_true', default=False,\n"
" help='Produce HTML side by side diff '\n"
" '(can use -c and -l in conjunction)')\n"
" parser.add_argument('-n', action='store_true', default=False,\n"
" help='Produce a ndiff format diff')\n"
" parser.add_argument('-l', '--lines', type=int, default=3,\n"
" help='Set number of context lines (default 3)')\n"
" parser.add_argument('fromfile')\n"
" parser.add_argument('tofile')\n"
" options = parser.parse_args()\n"
"\n"
" n = options.lines\n"
" fromfile = options.fromfile\n"
" tofile = options.tofile\n"
"\n"
" fromdate = file_mtime(fromfile)\n"
" todate = file_mtime(tofile)\n"
" with open(fromfile) as ff:\n"
" fromlines = ff.readlines()\n"
" with open(tofile) as tf:\n"
" tolines = tf.readlines()\n"
"\n"
" if options.u:\n"
" diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n"
" elif options.n:\n"
" diff = difflib.ndiff(fromlines, tolines)\n"
" elif options.m:\n"
" diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)\n"
" else:\n"
" diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n"
"\n"
" sys.stdout.writelines(diff)\n"
"\n"
"if __name__ == '__main__':\n"
" main()\n"
msgid "ndiff example"
msgstr " ndiff"
msgid "This example shows how to use :func:`difflib.ndiff`."
msgstr " :func:`difflib.ndiff` ."
msgid ""
"\"\"\"ndiff [-q] file1 file2\n"
" or\n"
"ndiff (-r1 | -r2) < ndiff_output > file1_or_file2\n"
"\n"
"Print a human-friendly file difference report to stdout. Both inter-\n"
"and intra-line differences are noted. In the second form, recreate file1\n"
"(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.\n"
"\n"
"In the first form, if -q (\"quiet\") is not specified, the first two lines\n"
"of output are\n"
"\n"
"-: file1\n"
"+: file2\n"
"\n"
"Each remaining line begins with a two-letter code:\n"
"\n"
" \"- \" line unique to file1\n"
" \"+ \" line unique to file2\n"
" \" \" line common to both files\n"
" \"? \" line not present in either input file\n"
"\n"
"Lines beginning with \"? \" attempt to guide the eye to intraline\n"
"differences, and were not present in either input file. These lines can be\n"
"confusing if the source files contain tab characters.\n"
"\n"
"The first file can be recovered by retaining only lines that begin with\n"
"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with -r1.\n"
"\n"
"The second file can be recovered similarly, but by retaining only \" \" and\n"
"\"+ \" lines; use ndiff with -r2; or, on Unix, the second file can be\n"
"recovered by piping the output through\n"
"\n"
" sed -n '/^[+ ] /s/^..//p'\n"
"\"\"\"\n"
"\n"
"__version__ = 1, 7, 0\n"
"\n"
"import difflib, sys\n"
"\n"
"def fail(msg):\n"
" out = sys.stderr.write\n"
" out(msg + \"\\n\\n\")\n"
" out(__doc__)\n"
" return 0\n"
"\n"
"# open a file & return the file object; gripe and return 0 if it\n"
"# couldn't be opened\n"
"def fopen(fname):\n"
" try:\n"
" return open(fname)\n"
" except IOError as detail:\n"
" return fail(\"couldn't open \" + fname + \": \" + str(detail))\n"
"\n"
"# open two files & spray the diff to stdout; return false iff a problem\n"
"def fcompare(f1name, f2name):\n"
" f1 = fopen(f1name)\n"
" f2 = fopen(f2name)\n"
" if not f1 or not f2:\n"
" return 0\n"
"\n"
" a = f1.readlines(); f1.close()\n"
" b = f2.readlines(); f2.close()\n"
" for line in difflib.ndiff(a, b):\n"
" print(line, end=' ')\n"
"\n"
" return 1\n"
"\n"
"# crack args (sys.argv[1:] is normal) & compare;\n"
"# return false iff a problem\n"
"\n"
"def main(args):\n"
" import getopt\n"
" try:\n"
" opts, args = getopt.getopt(args, \"qr:\")\n"
" except getopt.error as detail:\n"
" return fail(str(detail))\n"
" noisy = 1\n"
" qseen = rseen = 0\n"
" for opt, val in opts:\n"
" if opt == \"-q\":\n"
" qseen = 1\n"
" noisy = 0\n"
" elif opt == \"-r\":\n"
" rseen = 1\n"
" whichfile = val\n"
" if qseen and rseen:\n"
" return fail(\"can't specify both -q and -r\")\n"
" if rseen:\n"
" if args:\n"
" return fail(\"no args allowed with -r option\")\n"
" if whichfile in (\"1\", \"2\"):\n"
" restore(whichfile)\n"
" return 1\n"
" return fail(\"-r value must be 1 or 2\")\n"
" if len(args) != 2:\n"
" return fail(\"need 2 filename args\")\n"
" f1name, f2name = args\n"
" if noisy:\n"
" print('-:', f1name)\n"
" print('+:', f2name)\n"
" return fcompare(f1name, f2name)\n"
"\n"
"# read ndiff output from stdin, and print file1 (which=='1') or\n"
"# file2 (which=='2') to stdout\n"
"\n"
"def restore(which):\n"
" restored = difflib.restore(sys.stdin.readlines(), which)\n"
" sys.stdout.writelines(restored)\n"
"\n"
"if __name__ == '__main__':\n"
" main(sys.argv[1:])\n"
msgstr ""
"\"\"\"ndiff [-q] file1 file2\n"
" or\n"
"ndiff (-r1 | -r2) < ndiff_output > file1_or_file2\n"
"\n"
"Print a human-friendly file difference report to stdout. Both inter-\n"
"and intra-line differences are noted. In the second form, recreate file1\n"
"(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.\n"
"\n"
"In the first form, if -q (\"quiet\") is not specified, the first two lines\n"
"of output are\n"
"\n"
"-: file1\n"
"+: file2\n"
"\n"
"Each remaining line begins with a two-letter code:\n"
"\n"
" \"- \" line unique to file1\n"
" \"+ \" line unique to file2\n"
" \" \" line common to both files\n"
" \"? \" line not present in either input file\n"
"\n"
"Lines beginning with \"? \" attempt to guide the eye to intraline\n"
"differences, and were not present in either input file. These lines can be\n"
"confusing if the source files contain tab characters.\n"
"\n"
"The first file can be recovered by retaining only lines that begin with\n"
"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with -r1.\n"
"\n"
"The second file can be recovered similarly, but by retaining only \" \" and\n"
"\"+ \" lines; use ndiff with -r2; or, on Unix, the second file can be\n"
"recovered by piping the output through\n"
"\n"
" sed -n '/^[+ ] /s/^..//p'\n"
"\"\"\"\n"
"\n"
"__version__ = 1, 7, 0\n"
"\n"
"import difflib, sys\n"
"\n"
"def fail(msg):\n"
" out = sys.stderr.write\n"
" out(msg + \"\\n\\n\")\n"
" out(__doc__)\n"
" return 0\n"
"\n"
"# open a file & return the file object; gripe and return 0 if it\n"
"# couldn't be opened\n"
"def fopen(fname):\n"
" try:\n"
" return open(fname)\n"
" except IOError as detail:\n"
" return fail(\"couldn't open \" + fname + \": \" + str(detail))\n"
"\n"
"# open two files & spray the diff to stdout; return false iff a problem\n"
"def fcompare(f1name, f2name):\n"
" f1 = fopen(f1name)\n"
" f2 = fopen(f2name)\n"
" if not f1 or not f2:\n"
" return 0\n"
"\n"
" a = f1.readlines(); f1.close()\n"
" b = f2.readlines(); f2.close()\n"
" for line in difflib.ndiff(a, b):\n"
" print(line, end=' ')\n"
"\n"
" return 1\n"
"\n"
"# crack args (sys.argv[1:] is normal) & compare;\n"
"# return false iff a problem\n"
"\n"
"def main(args):\n"
" import getopt\n"
" try:\n"
" opts, args = getopt.getopt(args, \"qr:\")\n"
" except getopt.error as detail:\n"
" return fail(str(detail))\n"
" noisy = 1\n"
" qseen = rseen = 0\n"
" for opt, val in opts:\n"
" if opt == \"-q\":\n"
" qseen = 1\n"
" noisy = 0\n"
" elif opt == \"-r\":\n"
" rseen = 1\n"
" whichfile = val\n"
" if qseen and rseen:\n"
" return fail(\"can't specify both -q and -r\")\n"
" if rseen:\n"
" if args:\n"
" return fail(\"no args allowed with -r option\")\n"
" if whichfile in (\"1\", \"2\"):\n"
" restore(whichfile)\n"
" return 1\n"
" return fail(\"-r value must be 1 or 2\")\n"
" if len(args) != 2:\n"
" return fail(\"need 2 filename args\")\n"
" f1name, f2name = args\n"
" if noisy:\n"
" print('-:', f1name)\n"
" print('+:', f2name)\n"
" return fcompare(f1name, f2name)\n"
"\n"
"# read ndiff output from stdin, and print file1 (which=='1') or\n"
"# file2 (which=='2') to stdout\n"
"\n"
"def restore(which):\n"
" restored = difflib.restore(sys.stdin.readlines(), which)\n"
" sys.stdout.writelines(restored)\n"
"\n"
"if __name__ == '__main__':\n"
" main(sys.argv[1:])\n"