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
5c456e6f
Kaydet (Commit)
5c456e6f
authored
Kas 23, 2009
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix for issue1488943 - difflib.Differ() doesn't always add hints for tab
characters.
üst
f058d2dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
difflib.py
Lib/difflib.py
+5
-4
test_difflib.py
Lib/test/test_difflib.py
+8
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/difflib.py
Dosyayı görüntüle @
5c456e6f
...
...
@@ -1061,20 +1061,21 @@ class Differ:
Example:
>>> d = Differ()
>>> results = d._qformat('\tabcDefghiJkl\n', '\t
\t
abcdefGhijkl\n',
... ' ^ ^ ^ ', '
+
^ ^ ^ ')
>>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
... ' ^ ^ ^ ', ' ^ ^ ^ ')
>>> for line in results: print repr(line)
...
'- \tabcDefghiJkl\n'
'? \t ^ ^ ^\n'
'+ \t
\t
abcdefGhijkl\n'
'? \t
^ ^ ^\n'
'+ \tabcdefGhijkl\n'
'? \t ^ ^ ^\n'
"""
# Can hurt, but will probably help most of the time.
common
=
min
(
_count_leading
(
aline
,
"
\t
"
),
_count_leading
(
bline
,
"
\t
"
))
common
=
min
(
common
,
_count_leading
(
atags
[:
common
],
" "
))
common
=
min
(
common
,
_count_leading
(
btags
[:
common
],
" "
))
atags
=
atags
[
common
:]
.
rstrip
()
btags
=
btags
[
common
:]
.
rstrip
()
...
...
Lib/test/test_difflib.py
Dosyayı görüntüle @
5c456e6f
...
...
@@ -20,6 +20,14 @@ class TestSFbugs(unittest.TestCase):
diff_gen
=
difflib
.
unified_diff
([],
[])
self
.
assertRaises
(
StopIteration
,
diff_gen
.
next
)
def
test_added_tab_hint
(
self
):
# Check fix for bug #1488943
diff
=
list
(
difflib
.
Differ
()
.
compare
([
"
\t
I am a buggy"
],[
"
\t\t
I am a bug"
]))
self
.
assertEqual
(
"-
\t
I am a buggy"
,
diff
[
0
])
self
.
assertEqual
(
"? --
\n
"
,
diff
[
1
])
self
.
assertEqual
(
"+
\t\t
I am a bug"
,
diff
[
2
])
self
.
assertEqual
(
"? +
\n
"
,
diff
[
3
])
patch914575_from1
=
"""
1. Beautiful is beTTer than ugly.
2. Explicit is better than implicit.
...
...
Misc/NEWS
Dosyayı görüntüle @
5c456e6f
...
...
@@ -476,6 +476,8 @@ Core and Builtins
Library
-------
- Issue #1488943: difflib.Differ() doesn't always add hints for tab characters
- Issue #6123: tarfile now opens empty archives correctly and consistently
raises ReadError on empty files.
...
...
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