Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
74a7c67d
Kaydet (Commit)
74a7c67d
authored
Ara 03, 2010
tarafından
Terry Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
--no commit message
--no commit message
üst
f3b68b3f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
difflib.rst
Doc/library/difflib.rst
+11
-1
difflib.py
Lib/difflib.py
+6
-2
No files found.
Doc/library/difflib.rst
Dosyayı görüntüle @
74a7c67d
...
...
@@ -358,6 +358,16 @@ The :class:`SequenceMatcher` class has this constructor:
.. versionadded:: 3.2
The *autojunk* parameter.
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`.
.. versionadded:: 3.2
The *bjunk* and *bpopular* attributes.
:class:`SequenceMatcher` objects have the following methods:
...
...
@@ -538,7 +548,7 @@ different results due to differing levels of approximation, although
SequenceMatcher Examples
------------------------
This example compares two strings, considering blanks to be "junk
:"
This example compares two strings, considering blanks to be "junk
":
>>> s = SequenceMatcher(lambda x: x == " ",
... "private Thread currentThread;",
...
...
Lib/difflib.py
Dosyayı görüntüle @
74a7c67d
...
...
@@ -213,6 +213,10 @@ class SequenceMatcher:
# (at least 200 elements) and x accounts for more than 1 + 1% of
# its elements (when autojunk is enabled).
# DOES NOT WORK for x in a!
# bjunk
# the items in b for which isjunk is True.
# bpopular
# nonjunk items in b treated as junk by the heuristic (if used).
self
.
isjunk
=
isjunk
self
.
a
=
self
.
b
=
None
...
...
@@ -321,7 +325,7 @@ class SequenceMatcher:
indices
.
append
(
i
)
# Purge junk elements
junk
=
set
()
self
.
bjunk
=
junk
=
set
()
isjunk
=
self
.
isjunk
if
isjunk
:
for
elt
in
list
(
b2j
.
keys
()):
# using list() since b2j is modified
...
...
@@ -330,7 +334,7 @@ class SequenceMatcher:
del
b2j
[
elt
]
# Purge popular elements that are not junk
popular
=
set
()
self
.
bpopular
=
popular
=
set
()
n
=
len
(
b
)
if
self
.
autojunk
and
n
>=
200
:
ntest
=
n
//
100
+
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment