Skip to content

Commit 6bc722d

Browse files
hugovksobolevn
andauthored
[3.11] gh-101100: Fix sphinx warnings in library/difflib.rst (GH-110074) (#110082)
Co-authored-by: Nikita Sobolev <[email protected]>
1 parent c534637 commit 6bc722d

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Doc/library/difflib.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ The :class:`SequenceMatcher` class has this constructor:
574574

575575
The three methods that return the ratio of matching to total characters can give
576576
different results due to differing levels of approximation, although
577-
:meth:`quick_ratio` and :meth:`real_quick_ratio` are always at least as large as
578-
:meth:`ratio`:
577+
:meth:`~SequenceMatcher.quick_ratio` and :meth:`~SequenceMatcher.real_quick_ratio`
578+
are always at least as large as :meth:`~SequenceMatcher.ratio`:
579579

580580
>>> s = SequenceMatcher(None, "abcd", "bcde")
581581
>>> s.ratio()
@@ -597,28 +597,28 @@ This example compares two strings, considering blanks to be "junk":
597597
... "private Thread currentThread;",
598598
... "private volatile Thread currentThread;")
599599

600-
:meth:`ratio` returns a float in [0, 1], measuring the similarity of the
601-
sequences. As a rule of thumb, a :meth:`ratio` value over 0.6 means the
600+
:meth:`~SequenceMatcher.ratio` returns a float in [0, 1], measuring the similarity of the
601+
sequences. As a rule of thumb, a :meth:`~SequenceMatcher.ratio` value over 0.6 means the
602602
sequences are close matches:
603603

604604
>>> print(round(s.ratio(), 3))
605605
0.866
606606

607607
If you're only interested in where the sequences match,
608-
:meth:`get_matching_blocks` is handy:
608+
:meth:`~SequenceMatcher.get_matching_blocks` is handy:
609609

610610
>>> for block in s.get_matching_blocks():
611611
... print("a[%d] and b[%d] match for %d elements" % block)
612612
a[0] and b[0] match for 8 elements
613613
a[8] and b[17] match for 21 elements
614614
a[29] and b[38] match for 0 elements
615615

616-
Note that the last tuple returned by :meth:`get_matching_blocks` is always a
617-
dummy, ``(len(a), len(b), 0)``, and this is the only case in which the last
616+
Note that the last tuple returned by :meth:`~SequenceMatcher.get_matching_blocks`
617+
is always a dummy, ``(len(a), len(b), 0)``, and this is the only case in which the last
618618
tuple element (number of elements matched) is ``0``.
619619

620620
If you want to know how to change the first sequence into the second, use
621-
:meth:`get_opcodes`:
621+
:meth:`~SequenceMatcher.get_opcodes`:
622622

623623
>>> for opcode in s.get_opcodes():
624624
... print("%6s a[%d:%d] b[%d:%d]" % opcode)
@@ -693,7 +693,7 @@ Differ Example
693693

694694
This example compares two texts. First we set up the texts, sequences of
695695
individual single-line strings ending with newlines (such sequences can also be
696-
obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
696+
obtained from the :meth:`~io.IOBase.readlines` method of file-like objects):
697697

698698
>>> text1 = ''' 1. Beautiful is better than ugly.
699699
... 2. Explicit is better than implicit.

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ Doc/library/ctypes.rst
5555
Doc/library/datetime.rst
5656
Doc/library/dbm.rst
5757
Doc/library/decimal.rst
58-
Doc/library/difflib.rst
5958
Doc/library/dis.rst
6059
Doc/library/doctest.rst
6160
Doc/library/email.charset.rst

0 commit comments

Comments
 (0)