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
ae39fbdd
Kaydet (Commit)
ae39fbdd
authored
Agu 04, 2014
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make the import private to keep the global namespace clean.
üst
f25a38e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
difflib.py
Lib/difflib.py
+2
-2
No files found.
Lib/difflib.py
Dosyayı görüntüle @
ae39fbdd
...
...
@@ -30,7 +30,7 @@ __all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher',
'Differ'
,
'IS_CHARACTER_JUNK'
,
'IS_LINE_JUNK'
,
'context_diff'
,
'unified_diff'
,
'HtmlDiff'
,
'Match'
]
import
heapq
from
heapq
import
nlargest
as
_nlargest
from
collections
import
namedtuple
as
_namedtuple
Match
=
_namedtuple
(
'Match'
,
'a b size'
)
...
...
@@ -729,7 +729,7 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
result
.
append
((
s
.
ratio
(),
x
))
# Move the best scorers to head of list
result
=
heapq
.
nlargest
(
n
,
result
)
result
=
_
nlargest
(
n
,
result
)
# Strip scores for the best n matches
return
[
x
for
score
,
x
in
result
]
...
...
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